fall back to SimpleTextInputProtocol if we can't read a key
[platform/upstream/gummiboot.git] / Makefile.am
1 #
2 #  This file is part of gummiboot
3 #
4 #  Copyright (C) 2013 Karel Zak <kzak@redhat.com>
5 #
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.
10 #
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.
15 #
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/>.
18
19 ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
20 AM_MAKEFLAGS = --no-print-directory
21
22 gummibootlibdir = $(prefix)/lib/gummiboot
23
24 AM_CPPFLAGS = -include config.h
25 AM_CFLAGS = \
26         -D_GNU_SOURCE \
27         -Wall \
28         -Wextra \
29         -Wmissing-prototypes \
30         -Wno-unused-parameter
31 AM_LDFLAGS =
32
33 EXTRA_DIST = autogen.sh README LICENSE
34 CLEANFILES =
35
36 # ------------------------------------------------------------------------------
37 bin_PROGRAMS = gummiboot
38
39 gummiboot_SOURCES = \
40         src/setup/setup.c \
41         src/setup/efivars.c \
42         src/setup/efivars.h
43
44 gummiboot_CFLAGS = \
45         $(AM_CFLAGS) \
46         -DMACHINE_TYPE_NAME=\"$(MACHINE_TYPE_NAME)\" \
47         -DGUMMIBOOTLIBDIR=\"$(gummibootlibdir)\" \
48         $(BLKID_CFLAGS)
49
50 gummiboot_LDADD = \
51         $(BLKID_LIBS)
52
53 if ENABLE_MANPAGES
54 %.8: %.xml
55         $(AM_V_GEN)$(XSLTPROC) -o $@ --nonet \
56           --stringparam man.output.quietly 1 \
57           --stringparam man.th.extra1.suppress 1 \
58           --stringparam man.authors.section.enabled 0 \
59           --stringparam man.copyright.section.enabled 0 \
60           http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
61
62 dist_man_MANS = man/gummiboot.8
63 endif
64
65 EXTRA_DIST += man/gummiboot.xml
66 CLEANFILES += man/gummiboot.8
67
68 # ------------------------------------------------------------------------------
69 # EFI compilation -- this part of the build system uses custom make rules and
70 # bypasses regular automake to provide absolute control on compiler and linker
71 # flags.
72 efi_loadername = gummiboot$(MACHINE_TYPE_NAME).efi
73 efi_sources = src/efi/gummiboot.c
74
75 efi_cppflags = \
76         -I$(top_builddir) -include config.h \
77         -I/usr/include/efi \
78         -I/usr/include/efi/$(ARCH)
79
80 efi_cflags = \
81         -Wall \
82         -Wextra \
83         -nostdinc \
84         -ggdb -O0 \
85         -fpic \
86         -fshort-wchar \
87         -nostdinc \
88         -ffreestanding \
89         -fno-strict-aliasing \
90         -fno-stack-protector \
91         -Wsign-compare \
92         -mno-sse \
93         -mno-mmx
94
95 if ARCH_X86_64
96 efi_cflags += \
97         -mno-red-zone \
98         -DEFI_FUNCTION_WRAPPER \
99         -DGNU_EFI_USE_MS_ABI
100 endif
101
102 efi_ldflags = \
103         -T $(GNUEFI_LDS_DIR)/elf_$(ARCH)_efi.lds \
104         -shared \
105         -Bsymbolic \
106         -nostdlib \
107         -znocombreloc \
108         $(GNUEFI_LIBS) \
109         $(GNUEFI_LDS_DIR)/crt0-efi-$(ARCH).o
110
111 efi_objects = $(addprefix $(top_builddir)/,$(efi_sources:.c=.o))
112 efi_solib = $(top_builddir)/src/efi/gummiboot.so
113
114 # ------------------------------------------------------------------------------
115 gummibootlib_DATA = $(efi_loadername)
116 CLEANFILES += $(efi_objects) $(efi_solib) $(efi_loadername)
117 EXTRA_DIST += $(efi_sources)
118
119 $(top_builddir)/src/efi/%.o: $(top_srcdir)/src/efi/%.c
120         @$(MKDIR_P) $(top_builddir)/src/efi/
121         $(AM_V_CC)$(GNUEFI_CC) $(efi_cppflags) $(efi_cflags) -c $< -o $@
122
123 $(efi_solib): $(efi_objects)
124         $(AM_V_CCLD)$(LD) $(efi_ldflags) $(efi_objects) \
125                 -o $@ -lefi -lgnuefi $(shell $(CC) -print-libgcc-file-name); \
126         nm -D -u $@ | grep ' U ' && exit 1 || :
127 .DELETE_ON_ERROR: $(efi_solib)
128
129 $(efi_loadername): $(efi_solib)
130         $(AM_V_GEN) objcopy -j .text -j .sdata -j .data -j .dynamic \
131           -j .dynsym -j .rel -j .rela -j .reloc -j .eh_frame \
132           --target=efi-app-$(ARCH) $< $@
133
134 # ------------------------------------------------------------------------------
135 CLEANFILES += test-disk
136 EXTRA_DIST += test/test-create-disk.sh
137
138 test-disk: gummiboot$(MACHINE_TYPE_NAME).efi test/test-create-disk.sh
139         $(AM_V_GEN)test/test-create-disk.sh
140
141 qemu: test-disk
142         $(QEMU_KVM) -m 256 -L $(BIOS) -snapshot test-disk
143
144 install-tree: all
145         rm -rf $(abs_srcdir)/install-tree
146         $(MAKE) install DESTDIR=$(abs_srcdir)/install-tree
147         tree $(abs_srcdir)/install-tree