2 # This file is part of gummiboot
4 # Copyright (C) 2013 Karel Zak <kzak@redhat.com>
6 # gummiboot is free software; you can redistribute it and/or modify it
7 # under the terms of the GNU Lesser General Public License as published by
8 # the Free Software Foundation; either version 2.1 of the License, or
9 # (at your option) any later version.
11 # gummiboot is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # Lesser General Public License for more details.
16 # You should have received a copy of the GNU Lesser General Public License
17 # along with systemd; If not, see <http://www.gnu.org/licenses/>.
19 ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
20 AM_MAKEFLAGS = --no-print-directory
22 gummibootlibdir = $(prefix)/lib/gummiboot
24 AM_CPPFLAGS = -include config.h
29 -Wmissing-prototypes \
33 EXTRA_DIST = autogen.sh README LICENSE
36 # ------------------------------------------------------------------------------
37 bin_PROGRAMS = gummiboot
44 gummiboot_CPPFLAGS = \
46 -DMACHINE_TYPE_NAME=\"$(MACHINE_TYPE_NAME)\" \
47 -DGUMMIBOOTLIBDIR=\"$(gummibootlibdir)\"
58 $(AM_V_GEN)$(XSLTPROC) -o $@ --nonet \
59 --stringparam man.output.quietly 1 \
60 --stringparam man.th.extra1.suppress 1 \
61 --stringparam man.authors.section.enabled 0 \
62 --stringparam man.copyright.section.enabled 0 \
63 http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
65 dist_man_MANS = man/gummiboot.8
68 EXTRA_DIST += man/gummiboot.xml
69 CLEANFILES += man/gummiboot.8
71 # ------------------------------------------------------------------------------
72 # EFI compilation -- this part of the build system uses custom make rules and
73 # bypasses regular automake to provide absolute control on compiler and linker
75 efi_loadername = gummiboot$(MACHINE_TYPE_NAME).efi
76 efi_sources = src/efi/gummiboot.c
80 -I$(top_builddir) -include config.h \
81 -I$(EFI_INC_DIR)/efi \
82 -I$(EFI_INC_DIR)/efi/$(ARCH) \
83 -DMACHINE_TYPE_NAME=\"$(MACHINE_TYPE_NAME)\"
95 -fno-strict-aliasing \
96 -fno-stack-protector \
104 -DEFI_FUNCTION_WRAPPER \
110 -T $(EFI_LDS_DIR)/elf_$(ARCH)_efi.lds \
116 $(EFI_LDS_DIR)/crt0-efi-$(ARCH).o
118 efi_objects = $(addprefix $(top_builddir)/,$(efi_sources:.c=.o))
119 efi_solib = $(top_builddir)/src/efi/gummiboot.so
121 # ------------------------------------------------------------------------------
122 gummibootlib_DATA = $(efi_loadername)
123 CLEANFILES += $(efi_objects) $(efi_solib) $(efi_loadername)
124 EXTRA_DIST += $(efi_sources)
126 $(top_builddir)/src/efi/%.o: $(top_srcdir)/src/efi/%.c
127 @$(MKDIR_P) $(top_builddir)/src/efi/
128 $(AM_V_CC)$(EFI_CC) $(efi_cppflags) $(efi_cflags) -c $< -o $@
130 $(efi_solib): $(efi_objects)
131 $(AM_V_CCLD)$(LD) $(efi_ldflags) $(efi_objects) \
132 -o $@ -lefi -lgnuefi $(shell $(CC) -print-libgcc-file-name); \
133 nm -D -u $@ | grep ' U ' && exit 1 || :
134 .DELETE_ON_ERROR: $(efi_solib)
136 $(efi_loadername): $(efi_solib)
137 $(AM_V_GEN) objcopy -j .text -j .sdata -j .data -j .dynamic \
138 -j .dynsym -j .rel -j .rela -j .reloc -j .eh_frame \
139 --target=efi-app-$(ARCH) $< $@
141 # ------------------------------------------------------------------------------
142 CLEANFILES += test-disk.img
143 EXTRA_DIST += test/test-create-disk.sh
145 test-disk.img: gummiboot$(MACHINE_TYPE_NAME).efi test/test-create-disk.sh
146 $(AM_V_GEN)test/test-create-disk.sh
149 $(QEMU) -m 256 -bios $(QEMU_BIOS) -snapshot test-disk.img
152 rm -rf $(abs_srcdir)/install-tree
153 $(MAKE) install DESTDIR=$(abs_srcdir)/install-tree
154 tree $(abs_srcdir)/install-tree