packaging: disable ubsan
[platform/upstream/gnu-efi.git] / Make.defaults
1 #
2 # Copyright (c) 1999-2007 Hewlett-Packard Development Company, L.P.
3 #       Contributed by David Mosberger <davidm@hpl.hp.com>
4 #       Contributed by Stephane Eranian <eranian@hpl.hp.com>
5 #
6 #    All rights reserved.
7 #
8 #    Redistribution and use in source and binary forms, with or without
9 #    modification, are permitted provided that the following conditions
10 #    are met:
11 #
12 #    * Redistributions of source code must retain the above copyright
13 #      notice, this list of conditions and the following disclaimer.
14 #    * Redistributions in binary form must reproduce the above
15 #      copyright notice, this list of conditions and the following
16 #      disclaimer in the documentation and/or other materials
17 #      provided with the distribution.
18 #    * Neither the name of Hewlett-Packard Co. nor the names of its
19 #      contributors may be used to endorse or promote products derived
20 #      from this software without specific prior written permission.
21 #
22 #    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
23 #    CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
24 #    INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
25 #    MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 #    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
27 #    BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
28 #    OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
29 #    PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30 #    PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31 #    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
32 #    TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
33 #    THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 #    SUCH DAMAGE.
35 #                                                                                                                            #
36
37 #
38 # Where to install the package. GNU-EFI will create and access
39 # lib and include under the root
40 #
41 INSTALLROOT := /
42 PREFIX := /usr/local
43 LIBDIR := ${PREFIX}/lib
44
45 TOPDIR    := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
46
47 HOSTARCH   = $(shell uname -m | sed s,i[3456789]86,ia32,)
48 ARCH       := $(shell uname -m | sed s,i[3456789]86,ia32,)
49 OS         = $(shell uname -s)
50 INCDIR     = -I$(SRCDIR) -I$(TOPDIR)/inc -I$(TOPDIR)/inc/$(ARCH) -I$(TOPDIR)/inc/protocol 
51 GCCVERSION := $(shell gcc -dumpversion | cut -f1 -d.)
52 GCCMINOR := $(shell gcc -dumpversion | cut -f2 -d.)
53 GCCNEWENOUGH := $(shell ([ $(GCCVERSION) -gt "4" ] || ([ $(GCCVERSION) -eq "4" ] && [ $(GCCMINOR) -ge "7" ])) && echo 1)
54
55 CPPFLAGS   += -DCONFIG_$(ARCH)
56 ifeq ($(GCCNEWENOUGH),1)
57 CPPFLAGS   += -maccumulate-outgoing-args --std=c11
58 endif
59 CFLAGS     += $(ARCH3264) -O2 -fpic -Wall -fshort-wchar -fno-strict-aliasing -fno-merge-constants
60 ASFLAGS    = $(ARCH3264)
61 LDFLAGS    += -nostdlib
62 INSTALL    = install
63 prefix     = /usr/bin/
64
65 CC            := $(prefix)gcc
66 AS            := $(prefix)as
67 LD            := $(prefix)ld
68 AR            := $(prefix)ar
69 RANLIB        := $(prefix)ranlib
70 OBJCOPY       := $(prefix)objcopy
71
72 ifeq ($(ARCH),ia64)
73   CFLAGS += -mfixed-range=f32-f127
74 endif
75
76 ifeq ($(ARCH), ia32)
77   ifeq ($(HOSTARCH), x86_64)
78     ARCH3264 = -m32
79   endif
80 endif
81
82 ifeq ($(ARCH), x86_64)
83   CFLAGS += -mno-red-zone
84   ifeq ($(HOSTARCH), ia32)
85     ARCH3264 = -m64
86   endif
87 endif