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