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)
70 gummiboot$(MACHINE_TYPE_NAME).efi: src/efi/gummiboot.so
72 $(Q) objcopy -j .text -j .sdata -j .data -j .dynamic \
73 -j .dynsym -j .rel -j .rela -j .reloc -j .eh_frame \
74 --target=efi-app-$(ARCH) $< $@
76 # ------------------------------------------------------------------------------
77 gummiboot: src/setup/setup.c src/setup/efivars.h src/setup/efivars.c Makefile
79 $(Q) $(CC) -O0 -g -Wall -Wextra \
80 -Wno-unused-parameter -D_GNU_SOURCE \
81 -DMACHINE_TYPE_NAME=\"$(MACHINE_TYPE_NAME)\" \
82 `pkg-config --cflags --libs blkid` \
87 # ------------------------------------------------------------------------------
90 gummiboot.1: src/setup/gummiboot.xml
92 $(Q) xsltproc -o @ --nonet \
93 --stringparam man.output.quietly 1 \
94 --stringparam man.th.extra1.suppress 1 \
95 --stringparam man.authors.section.enabled 0 \
96 --stringparam man.copyright.section.enabled 0 \
97 http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
99 # ------------------------------------------------------------------------------
101 rm -f src/efi/gummiboot.o src/efi/gummiboot.so gummiboot gummiboot$(MACHINE_TYPE_NAME).efi
104 mkdir -p $(DESTDIR)/usr/bin/
105 cp gummiboot $(DESTDIR)/usr/bin
106 mkdir -p $(DESTDIR)/usr/lib/gummiboot/
107 cp gummiboot$(MACHINE_TYPE_NAME).efi $(DESTDIR)/usr/lib/gummiboot/
108 [ -e gummiboot.1 ] && mkdir -p $(DESTDIR)/usr/share/man/man1/ && cp gummiboot.1 $(DESTDIR)/usr/share/man/man1/ || :
111 git archive --format=tar --prefix=gummiboot-$(VERSION)/ $(VERSION) | xz > gummiboot-$(VERSION).tar.xz
113 test-disk: gummiboot$(MACHINE_TYPE_NAME).efi test/test-create-disk.sh
114 test/test-create-disk.sh
117 qemu-kvm -m 256 -L /usr/lib/qemu-bios -snapshot test-disk