12 ARCH=$(shell $(CC) -dumpmachine | sed "s/\(-\).*$$//")
13 LIBDIR=$(shell echo $$(cd /usr/lib/$$(gcc -print-multi-os-directory); pwd))
14 LIBEFIDIR=$(or $(wildcard $(LIBDIR)/gnuefi), $(LIBDIR))
18 MACHINE_TYPE_NAME=ia32
24 -DEFI_FUNCTION_WRAPPER \
28 all: gummiboot$(MACHINE_TYPE_NAME).efi gummiboot
30 # ------------------------------------------------------------------------------
34 -I/usr/include/efi/$(ARCH)
37 -DVERSION=$(VERSION) \
46 -fno-strict-aliasing \
47 -fno-stack-protector \
51 LDFLAGS = -T $(LIBEFIDIR)/elf_$(ARCH)_efi.lds \
57 $(LIBEFIDIR)/crt0-efi-$(ARCH).o
61 $(Q) $(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
63 src/efi/gummiboot.o: src/efi/gummiboot.c Makefile
65 src/efi/gummiboot.so: src/efi/gummiboot.o
67 $(Q) $(LD) $(LDFLAGS) src/efi/gummiboot.o -o $@ -lefi -lgnuefi \
68 $(shell $(CC) -print-libgcc-file-name)
69 $(Q) nm -D -u $@ | grep ' U ' && exit 1 || :
71 gummiboot$(MACHINE_TYPE_NAME).efi: src/efi/gummiboot.so
73 $(Q) objcopy -j .text -j .sdata -j .data -j .dynamic \
74 -j .dynsym -j .rel -j .rela -j .reloc -j .eh_frame \
75 --target=efi-app-$(ARCH) $< $@
77 # ------------------------------------------------------------------------------
78 gummiboot: src/setup/setup.c src/setup/efivars.h src/setup/efivars.c Makefile
80 $(Q) $(CC) -O0 -g -Wall -Wextra \
81 -Wno-unused-parameter -D_GNU_SOURCE \
82 -DMACHINE_TYPE_NAME=\"$(MACHINE_TYPE_NAME)\" \
85 `pkg-config --cflags --libs blkid` \
88 # ------------------------------------------------------------------------------
91 gummiboot.1: src/setup/gummiboot.xml
93 $(Q) xsltproc -o @ --nonet \
94 --stringparam man.output.quietly 1 \
95 --stringparam man.th.extra1.suppress 1 \
96 --stringparam man.authors.section.enabled 0 \
97 --stringparam man.copyright.section.enabled 0 \
98 http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
100 # ------------------------------------------------------------------------------
102 rm -f src/efi/gummiboot.o src/efi/gummiboot.so gummiboot gummiboot$(MACHINE_TYPE_NAME).efi
105 mkdir -p $(DESTDIR)/usr/bin/
106 cp gummiboot $(DESTDIR)/usr/bin
107 mkdir -p $(DESTDIR)/usr/lib/gummiboot/
108 cp gummiboot$(MACHINE_TYPE_NAME).efi $(DESTDIR)/usr/lib/gummiboot/
109 [ -e gummiboot.1 ] && mkdir -p $(DESTDIR)/usr/share/man/man1/ && cp gummiboot.1 $(DESTDIR)/usr/share/man/man1/ || :
112 git archive --format=tar --prefix=gummiboot-$(VERSION)/ $(VERSION) | xz > gummiboot-$(VERSION).tar.xz
114 test-disk: gummiboot$(MACHINE_TYPE_NAME).efi test/test-create-disk.sh
115 test/test-create-disk.sh
118 qemu-kvm -m 256 -L /usr/lib/qemu-bios -snapshot test-disk