Releasing debian version 6.03~pre1+dfsg-1.
[syslinux-debian/hramrach.git] / mk / efi.mk
blob82bd51f0394cc7afbbe4e04414ff45b4f8128df8
1 include $(MAKEDIR)/syslinux.mk
3 com32 = $(topdir)/com32
4 core = $(topdir)/core
6 # Support IA32 and x86_64 platforms with one build
7 # Set up architecture specifics; for cross compilation, set ARCH as apt
8 # gnuefi sets up architecture specifics in ia32 or x86_64 sub directories
9 # set up the LIBDIR and EFIINC for building for the appropriate architecture
10 EFIINC = $(objdir)/include/efi
11 LIBDIR = $(objdir)/lib
13 ifeq ($(ARCH),i386)
14 SARCHOPT = -march=i386
15 CARCHOPT = -m32 -march=i386
16 EFI_SUBARCH = ia32
17 endif
18 ifeq ($(ARCH),x86_64)
19 SARCHOPT = -march=x86-64
20 CARCHOPT = -m64 -march=x86-64
21 EFI_SUBARCH = $(ARCH)
22 endif
24 output = $(shell $(topdir)/efi/check-gnu-efi.sh $(EFI_SUBARCH) \
25 $(topdir) $(objdir))
26 ifneq ($(output),)
27 $(error Failed to build gnu-efi for $(EFI_SUBARCH))
28 endif
30 #LIBDIR=/usr/lib
31 FORMAT=efi-app-$(EFI_SUBARCH)
33 CFLAGS = -I$(EFIINC) -I$(EFIINC)/$(EFI_SUBARCH) \
34 -DEFI_FUNCTION_WRAPPER -fPIC -fshort-wchar -ffreestanding \
35 -Wall -I$(com32)/include -I$(com32)/include/sys \
36 -I$(core)/include -I$(core)/ $(CARCHOPT) \
37 -I$(com32)/lib/ -I$(com32)/libutil/include -std=gnu99 \
38 -DELF_DEBUG -DSYSLINUX_EFI -I$(objdir) \
39 $(GCCWARN) -D__COM32__ -mno-red-zone \
40 -DLDLINUX=\"$(LDLINUX)\" -fvisibility=hidden \
41 -Wno-unused-parameter
43 CRT0 := $(LIBDIR)/crt0-efi-$(EFI_SUBARCH).o
44 LDSCRIPT := $(LIBDIR)/elf_$(EFI_SUBARCH)_efi.lds
46 LDFLAGS = -T $(SRC)/$(ARCH)/syslinux.ld -Bsymbolic -pie -nostdlib -znocombreloc \
47 -L$(LIBDIR) --hash-style=gnu -m elf_$(ARCH) $(CRT0) -E
49 SFLAGS = $(GCCOPT) $(GCCWARN) $(SARCHOPT) \
50 -fomit-frame-pointer -D__COM32__ \
51 -nostdinc -iwithprefix include \
52 -I$(com32)/libutil/include -I$(com32)/include -I$(com32)/include/sys $(GPLINCLUDE)
54 .PRECIOUS: %.o
55 %.o: %.S
56 $(CC) $(SFLAGS) -c -o $@ $<
58 .PRECIOUS: %.o
59 %.o: %.c
60 $(CC) $(CFLAGS) -c -o $@ $<
62 #%.efi: %.so
63 # $(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel \
64 # -j .rela -j .reloc --target=$(FORMAT) $*.so $@