]> code.delx.au - refind/blob - Make.tiano
BIOS-mode boot support now works when compiled with GNU-EFI
[refind] / Make.tiano
1 #
2 # Make.tiano
3 # Common Makefile options for rEFInd using TianoCore EDK2
4 #
5
6 HOSTARCH = $(shell uname -m | sed s,i[3456789]86,ia32,)
7 ARCH ?= $(HOSTARCH)
8
9 # Note: IA64 options are untested; taken from Debian's rEFIt package.
10 ifeq ($(ARCH),ia64)
11 # EFI specs allows only lower floating point partition to be used
12 ARCH_C_CFLAGS = -frename-registers -mfixed-range=f32-f127
13 # TODO: Add ARCHDIR and FILENAME_CODE as appropriate
14 endif
15
16 ifeq ($(ARCH),ia32)
17 ARCH_C_FLAGS = -m32 -DEFI32 -malign-double
18 ARCHDIR = Ia32
19 UC_ARCH = IA32
20 FILENAME_CODE = ia32
21 LD_CODE = elf_i386
22 endif
23
24 ifeq ($(ARCH),x86_64)
25 ARCH_C_FLAGS = "-DEFIAPI=__attribute__((ms_abi))" -DEFIX64 -mcmodel=large -m64
26 ARCHDIR = X64
27 UC_ARCH = X64
28 FILENAME_CODE = x64
29 LD_CODE = elf_x86_64
30 endif
31
32 EDK2BASE = /usr/local/UDK2010/MyWorkSpace
33 #EDK2BASE = /usr/local/EDK2/tianocore-edk2
34
35 # Below file defines TARGET (RELEASE or DEBUG) and TOOL_CHAIN_TAG (GCC44, GCC45, GCC46, or GCC47)
36 include $(EDK2BASE)/Conf/target.txt
37
38 INCLUDE_DIRS = -I $(EDK2BASE)/MdePkg \
39 -I $(EDK2BASE)/MdePkg/Include \
40 -I $(EDK2BASE)/MdeModulePkg/ \
41 -I $(EDK2BASE)/MdeModulePkg/Include \
42 -I $(EDK2BASE)/IntelFrameworkPkg/Include \
43 -I $(EDK2BASE)/MdePkg/Include/$(ARCHDIR) \
44 -I .. \
45 -I ../refind \
46 -I ../libeg \
47 -I ../include \
48 -I ../mok
49
50 OPTIMFLAGS = -fno-strict-aliasing -mno-red-zone -Wno-address -Os
51 DEBUGFLAGS = -Wall -Wno-missing-braces -Wno-array-bounds -ffunction-sections -fdata-sections
52 CFLAGS = $(OPTIMFLAGS) -g -fshort-wchar -fno-stack-protector $(DEBUGFLAGS) -c
53
54 prefix = /usr/bin/
55 CC = $(prefix)gcc
56 AS = $(prefix)as
57 LD = $(prefix)ld
58 AR = $(prefix)ar
59 RANLIB = $(prefix)ranlib
60 OBJCOPY = $(prefix)objcopy
61 GENFW = $(EDK2BASE)/BaseTools/Source/C/bin/GenFw
62
63
64 LDSCRIPT = $(EDK2BASE)/BaseTools/Scripts/gcc4.4-ld-script
65
66 LDFLAGS = -nostdlib -n -q --gc-sections --script=$(EDK2BASE)/BaseTools/Scripts/gcc4.4-ld-script \
67 --entry efi_main -u efi_main -m $(LD_CODE)
68
69 %.obj: %.c
70 $(CC) $(ARCH_C_FLAGS) $(CFLAGS) $(INCLUDE_DIRS) -DNO_BUILTIN_VA_FUNCS -D__MAKEWITH_TIANO -c $< -o $@
71
72