]> code.delx.au - refind/blob - Make.tiano
More documentation of copyrights and licenses.
[refind] / Make.tiano
1 #
2 # Make.tiano
3 # Common Makefile options for rEFInd using TianoCore EDK2
4 #
5
6 # This program is licensed under the terms of the GNU GPL, version 3,
7 # or (at your option) any later version.
8 # You should have received a copy of the GNU General Public License
9 # along with this program. If not, see <http://www.gnu.org/licenses/>.
10
11 HOSTARCH = $(shell uname -m | sed s,i[3456789]86,ia32,)
12 ARCH ?= $(HOSTARCH)
13
14 # Note: IA64 options are untested; taken from Debian's rEFIt package.
15 ifeq ($(ARCH),ia64)
16 # EFI specs allows only lower floating point partition to be used
17 ARCH_C_CFLAGS = -frename-registers -mfixed-range=f32-f127
18 # TODO: Add ARCHDIR and FILENAME_CODE as appropriate
19 endif
20
21 ifeq ($(ARCH),ia32)
22 ARCH_C_FLAGS = -m32 -DEFI32 -malign-double
23 ARCHDIR = Ia32
24 UC_ARCH = IA32
25 FILENAME_CODE = ia32
26 LD_CODE = elf_i386
27 endif
28
29 ifeq ($(ARCH),x86_64)
30 ARCH_C_FLAGS = "-DEFIAPI=__attribute__((ms_abi))" -DEFIX64 -mcmodel=large -m64 -mno-red-zone
31 ARCHDIR = X64
32 UC_ARCH = X64
33 FILENAME_CODE = x64
34 LD_CODE = elf_x86_64
35 endif
36
37 ifeq ($(ARCH),aarch64)
38 ARCH_C_FLAGS = -DEFIAARCH64 -mcmodel=large
39 ARCHDIR = AArch64
40 UC_ARCH = AARCH64
41 FILENAME_CODE = aa64
42 LD_CODE = aarch64elf
43 endif
44
45 EDK2BASE = /usr/local/UDK2014/MyWorkSpace
46 #EDK2BASE = /usr/local/EDK2/tianocore-edk2
47 #ENTRYPOINT=_ModuleEntryPoint
48 ENTRYPOINT=efi_main
49
50 # Below file defines TARGET (RELEASE or DEBUG) and TOOL_CHAIN_TAG (GCC44, GCC45, GCC46, or GCC47)
51 include $(EDK2BASE)/Conf/target.txt
52
53 INCLUDE_DIRS = -I $(EDK2BASE)/MdePkg \
54 -I $(EDK2BASE)/MdePkg/Include \
55 -I $(EDK2BASE)/MdeModulePkg/ \
56 -I $(EDK2BASE)/MdeModulePkg/Include \
57 -I $(EDK2BASE)/IntelFrameworkPkg/Include \
58 -I $(EDK2BASE)/MdePkg/Include/$(ARCHDIR) \
59 -I .. \
60 -I ../refind \
61 -I ../libeg \
62 -I ../include \
63 -I ../mok
64
65 OPTIMFLAGS += -fno-strict-aliasing -Wno-address -Os
66 DEBUGFLAGS = -Wall -Wno-missing-braces -Wno-array-bounds -ffunction-sections -fdata-sections
67 CFLAGS = $(OPTIMFLAGS) -g -fshort-wchar -fno-stack-protector $(DEBUGFLAGS) -c
68
69 prefix = /usr/bin/
70 CC = $(prefix)gcc
71 AS = $(prefix)as
72 LD = $(prefix)ld
73 AR = $(prefix)ar
74 RANLIB = $(prefix)ranlib
75 OBJCOPY = $(prefix)objcopy
76 GENFW = $(EDK2BASE)/BaseTools/Source/C/bin/GenFw
77
78
79 LDSCRIPT = $(EDK2BASE)/BaseTools/Scripts/gcc4.4-ld-script
80
81 LDFLAGS = -nostdlib -n -q --gc-sections --script=$(EDK2BASE)/BaseTools/Scripts/gcc4.4-ld-script \
82 --entry $(ENTRYPOINT) -u $(ENTRYPOINT) -m $(LD_CODE)
83
84 %.obj: %.c
85 $(CC) $(ARCH_C_FLAGS) $(CFLAGS) $(INCLUDE_DIRS) -DNO_BUILTIN_VA_FUNCS -D__MAKEWITH_TIANO -c $< -o $@
86
87