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 # ------------------------------------------------------------------------------
38 bin_PROGRAMS = gummiboot
45 gummiboot_CPPFLAGS = \
47 -DMACHINE_TYPE_NAME=\"$(MACHINE_TYPE_NAME)\" \
48 -DGUMMIBOOTLIBDIR=\"$(gummibootlibdir)\"
60 $(AM_V_GEN)$(XSLTPROC) -o $@ --nonet \
61 --stringparam man.output.quietly 1 \
62 --stringparam man.th.extra1.suppress 1 \
63 --stringparam man.authors.section.enabled 0 \
64 --stringparam man.copyright.section.enabled 0 \
65 http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
67 dist_man_MANS = man/gummiboot.8
70 EXTRA_DIST += man/gummiboot.xml
71 CLEANFILES += man/gummiboot.8
73 # ------------------------------------------------------------------------------
74 # EFI compilation -- this part of the build system uses custom make rules and
75 # bypasses regular automake to provide absolute control on compiler and linker
79 -I$(top_builddir) -include config.h \
80 -I$(EFI_INC_DIR)/efi \
81 -I$(EFI_INC_DIR)/efi/$(ARCH) \
82 -DMACHINE_TYPE_NAME=\"$(MACHINE_TYPE_NAME)\"
94 -fno-strict-aliasing \
95 -fno-stack-protector \
103 -DEFI_FUNCTION_WRAPPER \
109 -T $(EFI_LDS_DIR)/elf_$(ARCH)_efi.lds \
115 $(EFI_LDS_DIR)/crt0-efi-$(ARCH).o
117 # ------------------------------------------------------------------------------
118 gummiboot_headers = \
124 gummiboot_sources = \
131 gummiboot_objects = $(addprefix $(top_builddir)/,$(gummiboot_sources:.c=.o))
132 gummiboot_solib = $(top_builddir)/src/efi/gummiboot.so
133 gummiboot = gummiboot$(MACHINE_TYPE_NAME).efi
135 gummibootlib_DATA = $(gummiboot)
136 CLEANFILES += $(gummiboot_objects) $(gummiboot_solib) $(gummiboot)
137 EXTRA_DIST += $(gummiboot_sources) $(gummiboot_headers)
139 $(top_builddir)/src/efi/%.o: $(top_srcdir)/src/efi/%.c $(addprefix $(top_srcdir)/,$(gummiboot_headers))
140 @$(MKDIR_P) $(top_builddir)/src/efi/
141 $(AM_V_CC)$(EFI_CC) $(efi_cppflags) $(efi_cflags) -c $< -o $@
143 $(gummiboot_solib): $(gummiboot_objects)
144 $(AM_V_CCLD)$(LD) $(efi_ldflags) $(gummiboot_objects) \
145 -o $@ -lefi -lgnuefi $(shell $(CC) -print-libgcc-file-name); \
146 nm -D -u $@ | grep ' U ' && exit 1 || :
147 .DELETE_ON_ERROR: $(gummboot_solib)
149 $(gummiboot): $(gummiboot_solib)
150 $(AM_V_GEN) objcopy -j .text -j .sdata -j .data -j .dynamic \
151 -j .dynsym -j .rel -j .rela -j .reloc \
152 --target=efi-app-$(ARCH) $< $@
154 # ------------------------------------------------------------------------------
166 stub_objects = $(addprefix $(top_builddir)/,$(stub_sources:.c=.o))
167 stub_solib = $(top_builddir)/src/efi/stub.so
168 stub = linux$(MACHINE_TYPE_NAME).efi.stub
170 gummibootlib_DATA += $(stub)
171 CLEANFILES += $(stub_objects) $(stub_solib) $(stub)
172 EXTRA_DIST += $(stub_sources) $(stub_headers)
174 $(top_builddir)/src/efi/%.o: $(top_srcdir)/src/efi/%.c $(addprefix $(top_srcdir)/,$(stub_headers))
175 @$(MKDIR_P) $(top_builddir)/src/efi/
176 $(AM_V_CC)$(EFI_CC) $(efi_cppflags) $(efi_cflags) -c $< -o $@
178 $(stub_solib): $(stub_objects)
179 $(AM_V_CCLD)$(LD) $(efi_ldflags) $(stub_objects) \
180 -o $@ -lefi -lgnuefi $(shell $(CC) -print-libgcc-file-name); \
181 nm -D -u $@ | grep ' U ' && exit 1 || :
182 .DELETE_ON_ERROR: $(gummboot_solib)
184 $(stub): $(stub_solib)
185 $(AM_V_GEN) objcopy -j .text -j .sdata -j .data -j .dynamic \
186 -j .dynsym -j .rel -j .rela -j .reloc \
187 --target=efi-app-$(ARCH) $< $@
189 # ------------------------------------------------------------------------------
190 CLEANFILES += test-disk.img
191 EXTRA_DIST += test/test-create-disk.sh
193 test-disk.img: gummiboot$(MACHINE_TYPE_NAME).efi test/test-create-disk.sh
194 $(AM_V_GEN)test/test-create-disk.sh
197 $(QEMU) -machine accel=kvm -m 256 -bios $(QEMU_BIOS) -snapshot test-disk.img
200 rm -rf $(abs_srcdir)/install-tree
201 $(MAKE) install DESTDIR=$(abs_srcdir)/install-tree
202 tree $(abs_srcdir)/install-tree