Lines 1-11
Link Here
|
1 |
EFISIGNED = $(patsubst %.efi,%-signed.efi,$(EFIFILES)) |
1 |
EFISIGNED = $(patsubst %.efi,%-signed.efi,$(EFIFILES)) |
2 |
MANPAGES = $(patsubst doc/%.1.in,doc/%.1,$(wildcard doc/*.1.in)) |
2 |
MANPAGES = $(patsubst doc/%.1.in,doc/%.1,$(wildcard doc/*.1.in)) |
3 |
HELP2MAN = help2man |
3 |
HELP2MAN = help2man |
4 |
ARCH = $(shell uname -m) |
4 |
ARCH = $(shell uname -m) |
5 |
INCDIR = -I$(TOPDIR)include/ -I/usr/include/efi -I/usr/include/efi/$(ARCH) -I/usr/include/efi/protocol |
5 |
INCDIR = -I$(TOPDIR)include/ -I/usr/include/efi -I/usr/include/efi/$(ARCH) -I/usr/include/efi/protocol |
6 |
CPPFLAGS = -DCONFIG_$(ARCH) |
6 |
CPPFLAGS_EFI = -DCONFIG_$(ARCH) |
7 |
CFLAGS = -O2 -fpic -Wall -fshort-wchar -fno-strict-aliasing -fno-merge-constants -mno-red-zone -fno-stack-protector -g |
7 |
CFLAGS ?= -O2 -g |
8 |
LDFLAGS = -nostdlib |
8 |
LDFLAGS ?= -Wl,-O1 -Wl,--as-needed |
|
|
9 |
CFLAGS_EFI = -O2 -fpic -Wall -fshort-wchar -fno-strict-aliasing -fno-merge-constants -mno-red-zone -fno-stack-protector -g |
10 |
LDFLAGS_EFI = -nostdlib |
9 |
CRTOBJ = crt0-efi-$(ARCH).o |
11 |
CRTOBJ = crt0-efi-$(ARCH).o |
10 |
CRTPATHS = /lib /lib64 /lib/efi /lib64/efi /usr/lib /usr/lib64 /usr/lib/efi /usr/lib64/efi |
12 |
CRTPATHS = /lib /lib64 /lib/efi /lib64/efi /usr/lib /usr/lib64 /usr/lib/efi /usr/lib64/efi |
11 |
CRTPATH = $(shell for f in $(CRTPATHS); do if [ -e $$f/$(CRTOBJ) ]; then echo $$f; break; fi; done) |
13 |
CRTPATH = $(shell for f in $(CRTPATHS); do if [ -e $$f/$(CRTOBJ) ]; then echo $$f; break; fi; done) |
Lines 13-19
CRTOBJS = $(CRTPATH)/$(CRTOBJ)
Link Here
|
13 |
# there's a bug in the gnu tools ... the .reloc section has to be |
15 |
# there's a bug in the gnu tools ... the .reloc section has to be |
14 |
# aligned otherwise the file alignment gets screwed up |
16 |
# aligned otherwise the file alignment gets screwed up |
15 |
LDSCRIPT = $(TOPDIR)/elf_$(ARCH)_efi.lds |
17 |
LDSCRIPT = $(TOPDIR)/elf_$(ARCH)_efi.lds |
16 |
LDFLAGS += -T $(LDSCRIPT) -shared -Bsymbolic $(CRTOBJS) -L $(CRTPATH) |
18 |
LDFLAGS_EFI += -T $(LDSCRIPT) -shared -Bsymbolic $(CRTOBJS) -L $(CRTPATH) |
17 |
LOADLIBES = -lefi -lgnuefi $(shell $(CC) -print-libgcc-file-name) |
19 |
LOADLIBES = -lefi -lgnuefi $(shell $(CC) -print-libgcc-file-name) |
18 |
FORMAT = efi-app-$(ARCH) |
20 |
FORMAT = efi-app-$(ARCH) |
19 |
OBJCOPY = objcopy |
21 |
OBJCOPY = objcopy |
Lines 25-31
EFIDIR = $(DESTDIR)/usr/share/efitools/efi
Link Here
|
25 |
DOCDIR = $(DESTDIR)/usr/share/efitools |
27 |
DOCDIR = $(DESTDIR)/usr/share/efitools |
26 |
|
28 |
|
27 |
ifeq ($(ARCH),x86_64) |
29 |
ifeq ($(ARCH),x86_64) |
28 |
CFLAGS += -DEFI_FUNCTION_WRAPPER |
30 |
CFLAGS_EFI += -DEFI_FUNCTION_WRAPPER |
29 |
endif |
31 |
endif |
30 |
|
32 |
|
31 |
%.efi: %.so |
33 |
%.efi: %.so |
Lines 33-39
endif
Link Here
|
33 |
-j .rela -j .reloc --target=$(FORMAT) $*.so $@ |
35 |
-j .rela -j .reloc --target=$(FORMAT) $*.so $@ |
34 |
|
36 |
|
35 |
%.so: %.o |
37 |
%.so: %.o |
36 |
$(LD) $(LDFLAGS) $^ -o $@ $(LOADLIBES) |
38 |
$(LD) $(LDFLAGS_EFI) $^ -o $@ $(LOADLIBES) |
37 |
# check we have no undefined symbols |
39 |
# check we have no undefined symbols |
38 |
nm -D $@ | grep ' U ' && exit 1 || exit 0 |
40 |
nm -D $@ | grep ' U ' && exit 1 || exit 0 |
39 |
|
41 |
|
Lines 47-59
endif
Link Here
|
47 |
./cert-to-efi-sig-list -g $(MYGUID) $< $@ |
49 |
./cert-to-efi-sig-list -g $(MYGUID) $< $@ |
48 |
|
50 |
|
49 |
%.o: %.c |
51 |
%.o: %.c |
50 |
$(CC) $(INCDIR) $(CFLAGS) $(CPPFLAGS) -c $< -o $@ |
52 |
$(CC) $(INCDIR) $(CFLAGS_EFI) $(CPPFLAGS_EFI) -c $< -o $@ |
51 |
|
53 |
|
52 |
%.efi.o: %.c |
54 |
%.efi.o: %.c |
53 |
$(CC) $(INCDIR) $(CFLAGS) $(CPPFLAGS) -fno-toplevel-reorder -DBUILD_EFI -c $< -o $@ |
55 |
$(CC) $(INCDIR) $(CFLAGS_EFI) $(CPPFLAGS_EFI) -fno-toplevel-reorder -DBUILD_EFI -c $< -o $@ |
54 |
|
56 |
|
55 |
%.efi.s: %.c |
57 |
%.efi.s: %.c |
56 |
$(CC) -S $(INCDIR) $(CFLAGS) $(CPPFLAGS) -fno-toplevel-reorder -DBUILD_EFI -c $< -o $@ |
58 |
$(CC) -S $(INCDIR) $(CFLAGS_EFI) $(CPPFLAGS_EFI) -fno-toplevel-reorder -DBUILD_EFI -c $< -o $@ |
57 |
|
59 |
|
58 |
|
60 |
|
59 |
%.cer: %.crt |
61 |
%.cer: %.crt |