diff options
-rw-r--r-- | build-aux/Makefile.each.tail/20-systemd.mk | 2 | ||||
-rw-r--r-- | config.mk.in | 4 | ||||
-rw-r--r-- | src/Makefile | 1 | ||||
-rw-r--r-- | src/grp-boot/Makefile | 28 | ||||
-rw-r--r-- | src/grp-boot/bootctl/Makefile | 7 | ||||
-rw-r--r-- | src/grp-boot/systemd-boot/Makefile | 106 | ||||
-rwxr-xr-x | src/grp-boot/systemd-boot/test-efi-create-disk.sh (renamed from test/test-efi-create-disk.sh) | 0 |
7 files changed, 65 insertions, 83 deletions
diff --git a/build-aux/Makefile.each.tail/20-systemd.mk b/build-aux/Makefile.each.tail/20-systemd.mk index 5047f895ab..9d08fd5c23 100644 --- a/build-aux/Makefile.each.tail/20-systemd.mk +++ b/build-aux/Makefile.each.tail/20-systemd.mk @@ -23,7 +23,7 @@ -include $(outdir)/$(DEPDIR)/*.P* -std.clean_files += *.o *.lo .deps/ .libs/ +std.clean_files += *.o *.lo *.so .deps/ .libs/ std.clean_files += *-list.txt std.clean_files += *-from-name.gperf std.clean_files += *-from-name.h diff --git a/config.mk.in b/config.mk.in index 10862f89b2..498745c9d0 100644 --- a/config.mk.in +++ b/config.mk.in @@ -41,6 +41,10 @@ OUR_CFLAGS = @OUR_CFLAGS@ OUR_LDFLAGS = @OUR_LDFLAGS@ OUR_LIBTOOLFLAGS = +EFI_CPPFLAGS = +EFI_CFLAGS = +EFI_LDFLAGS = + # Dirs of external packages dbuspolicydir=@dbuspolicydir@ dbussessionservicedir=@dbussessionservicedir@ diff --git a/src/Makefile b/src/Makefile index 5d4e7de7de..9aa98640dd 100644 --- a/src/Makefile +++ b/src/Makefile @@ -24,6 +24,7 @@ include $(dir $(lastword $(MAKEFILE_LIST)))/../config.mk include $(topsrcdir)/build-aux/Makefile.head.mk at.subdirs += busctl +at.subdirs += grp-boot at.subdirs += systemd-nspawn include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/grp-boot/Makefile b/src/grp-boot/Makefile new file mode 100644 index 0000000000..922d8a32d3 --- /dev/null +++ b/src/grp-boot/Makefile @@ -0,0 +1,28 @@ +# -*- Mode: makefile; indent-tabs-mode: t -*- +# +# This file is part of systemd. +# +# Copyright 2010-2012 Lennart Poettering +# Copyright 2010-2012 Kay Sievers +# Copyright 2013 Zbigniew Jędrzejewski-Szmek +# Copyright 2013 David Strauss +# Copyright 2016 Luke Shumaker +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or +# (at your option) any later version. +# +# systemd is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with systemd; If not, see <http://www.gnu.org/licenses/>. +include $(dir $(lastword $(MAKEFILE_LIST)))/../../config.mk +include $(topsrcdir)/build-aux/Makefile.head.mk + +at.subdirs += bootctl systemd-boot + +include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/grp-boot/bootctl/Makefile b/src/grp-boot/bootctl/Makefile index 2fcdc44799..39a4af1442 100644 --- a/src/grp-boot/bootctl/Makefile +++ b/src/grp-boot/bootctl/Makefile @@ -38,7 +38,7 @@ bootctl_CFLAGS = \ $(BLKID_CFLAGS) bootctl_LDADD = \ - libshared.la \ + $(topoutdir)/src/libshared/libshared.la \ $(BLKID_LIBS) bin_PROGRAMS += \ @@ -51,5 +51,10 @@ dist_zshcompletion_data += \ shell-completion/zsh/_bootctl endif # HAVE_BLKID endif # ENABLE_EFI + $(eval $(value automake2autothing)) +at.depdirs += $(topoutdir)/src/libshared +AM_CPPFLAGS += $(libshared.CPPFLAGS) +AM_CPPFLAGS += $(libbasic.CPPFLAGS) + include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/src/grp-boot/systemd-boot/Makefile b/src/grp-boot/systemd-boot/Makefile index 074438908e..a1e4b6088a 100644 --- a/src/grp-boot/systemd-boot/Makefile +++ b/src/grp-boot/systemd-boot/Makefile @@ -20,11 +20,12 @@ # # You should have received a copy of the GNU Lesser General Public License # along with systemd; If not, see <http://www.gnu.org/licenses/>. -include $(dir $(lastword $(MAKEFILE_LIST)))/../../config.mk +include $(dir $(lastword $(MAKEFILE_LIST)))/../../../config.mk include $(topsrcdir)/build-aux/Makefile.head.mk ifneq ($(ENABLE_EFI),) ifneq ($(HAVE_GNUEFI),) +# ------------------------------------------------------------------------------ efi_cppflags = \ $(EFI_CPPFLAGS) \ -I$(top_builddir) -include config.h \ @@ -81,17 +82,19 @@ EFI_FORMAT = -O binary else EFI_FORMAT = --target=efi-app-$(EFI_ARCH) endif # ARCH_AARCH64 -endif # HAVE_GNUEFI -endif # ENABLE_EFI -# ------------------------------------------------------------------------------ -systemd_boot_headers = \ - src/boot/efi/util.h \ - src/boot/efi/console.h \ - src/boot/efi/graphics.h \ - src/boot/efi/pefile.h \ - src/boot/efi/disk.h +$(outdir)/%.o: $(srcdir)/%.c + $(AM_V_CC)$(EFI_CC) $(efi_cppflags) $(efi_cflags) -c $< -o $@ +$(outdir)/%.so: + @if test $(words $^) = 0; then echo 'Cannot link EFI library with no dependencies: $@' >&2; exit 1; fi + $(AM_V_CCLD)$(LD) $(efi_ldflags) $^ -o $@ -lefi -lgnuefi $(shell $(CC) -print-libgcc-file-name) + $(AM_V_at)! { nm -D -u $@ | grep ' U '; } + +# These next 2 are the same rule +$(outdir)/%$(EFI_MACHINE_TYPE_NAME).efi : $(outdir)/%.so; $(AM_V_GEN)$(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel -j .rela -j .reloc $(EFI_FORMAT) $< $@ +$(outdir)/%$(EFI_MACHINE_TYPE_NAME).efi.stub: $(outdir)/%.so; $(AM_V_GEN)$(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel -j .rela -j .reloc $(EFI_FORMAT) $< $@ +# ------------------------------------------------------------------------------ systemd_boot_sources = \ src/boot/efi/util.c \ src/boot/efi/console.c \ @@ -100,42 +103,11 @@ systemd_boot_sources = \ src/boot/efi/disk.c \ src/boot/efi/boot.c -EXTRA_DIST += $(systemd_boot_sources) $(systemd_boot_headers) - -systemd_boot_objects = $(addprefix $(top_builddir)/,$(systemd_boot_sources:.c=.o)) -systemd_boot_solib = $(top_builddir)/src/boot/efi/systemd_boot.so systemd_boot = systemd-boot$(EFI_MACHINE_TYPE_NAME).efi - -ifneq ($(ENABLE_EFI),) -ifneq ($(HAVE_GNUEFI),) -bootlib_DATA = $(systemd_boot) - -$(outdir)/%.o: $(top_srcdir)/src/boot/efi/%.c $(addprefix $(top_srcdir)/,$(systemd_boot_headers)) - @$(MKDIR_P) $(top_builddir)/src/boot/efi/ - $(AM_V_CC)$(EFI_CC) $(efi_cppflags) $(efi_cflags) -c $< -o $@ - -$(systemd_boot_solib): $(systemd_boot_objects) - $(AM_V_CCLD)$(LD) $(efi_ldflags) $(systemd_boot_objects) \ - -o $@ -lefi -lgnuefi $(shell $(CC) -print-libgcc-file-name); \ - nm -D -u $@ | grep ' U ' && exit 1 || : - -$(systemd_boot): $(systemd_boot_solib) - $(AM_V_GEN)$(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic \ - -j .dynsym -j .rel -j .rela -j .reloc $(EFI_FORMAT) $< $@ -endif # HAVE_GNUEFI -endif # ENABLE_EFI - -CLEANFILES += $(systemd_boot_objects) $(systemd_boot_solib) $(systemd_boot) - +std.out_files += $(systemd_boot) +std.sys_files += $(bootlibdir)/$(systemd_boot) +$(outdir)/systemd-boot.so: $(addprefix $(outdir)/,$(notdir $(systemd_boot_sources:.c=.o))) # ------------------------------------------------------------------------------ -stub_headers = \ - src/boot/efi/util.h \ - src/boot/efi/pefile.h \ - src/boot/efi/disk.h \ - src/boot/efi/graphics.h \ - src/boot/efi/splash.h \ - src/boot/efi/linux.h - stub_sources = \ src/boot/efi/util.c \ src/boot/efi/pefile.c \ @@ -145,47 +117,19 @@ stub_sources = \ src/boot/efi/linux.c \ src/boot/efi/stub.c -EXTRA_DIST += \ - $(stub_sources) \ - $(stub_headers) \ - test/splash.bmp - -stub_objects = $(addprefix $(top_builddir)/,$(stub_sources:.c=.o)) -stub_solib = $(top_builddir)/src/boot/efi/stub.so stub = linux$(EFI_MACHINE_TYPE_NAME).efi.stub - -ifneq ($(ENABLE_EFI),) -ifneq ($(HAVE_GNUEFI),) -bootlib_DATA += $(stub) - -$(outdir)/%.o: $(top_srcdir)/src/boot/efi/%.c $(addprefix $(top_srcdir)/,$(stub_headers)) - @$(MKDIR_P) $(top_builddir)/src/boot/efi/ - $(AM_V_CC)$(EFI_CC) $(efi_cppflags) $(efi_cflags) -c $< -o $@ - -$(stub_solib): $(stub_objects) - $(AM_V_CCLD)$(LD) $(efi_ldflags) $(stub_objects) \ - -o $@ -lefi -lgnuefi $(shell $(CC) -print-libgcc-file-name); \ - nm -D -u $@ | grep ' U ' && exit 1 || : - -$(stub): $(stub_solib) - $(AM_V_GEN)$(OBJCOPY) -j .text -j .sdata -j .data -j .dynamic \ - -j .dynsym -j .rel -j .rela -j .reloc $(EFI_FORMAT) $< $@ -endif # HAVE_GNUEFI -endif # ENABLE_EFI - -CLEANFILES += $(stub_objects) $(stub_solib) $(stub) - - +std.out_files += $(stub) +std.sys_files += $(bootlibdir)/$(stub) +$(outdir)/linux.so: $(addprefix $(outdir)/,$(notdir $(stub_sources:.c=.o))) # ------------------------------------------------------------------------------ -CLEANFILES += test-efi-disk.img +$(outdir)/test-efi-disk.img: $(outdir)/$(systemd_boot) $(outdir)/$(stub) $(srcdir)/test-efi-create-disk.sh + $(AM_V_GEN)$(@D)/test-efi-create-disk.sh -test-efi-disk.img: $(systemd_boot) $(stub) test/test-efi-create-disk.sh - $(AM_V_GEN)test/test-efi-create-disk.sh - -test-efi: test-efi-disk.img +test-efi: $(outdir)/test-efi-disk.img $(QEMU) -machine accel=kvm -m 1024 -bios $(QEMU_BIOS) -snapshot test-efi-disk.img -EXTRA_DIST += test/test-efi-create-disk.sh - +std.clean_files += test-efi-disk.img # ------------------------------------------------------------------------------ +endif # HAVE_GNUEFI +endif # ENABLE_EFI include $(topsrcdir)/build-aux/Makefile.tail.mk diff --git a/test/test-efi-create-disk.sh b/src/grp-boot/systemd-boot/test-efi-create-disk.sh index 56dd09abd7..56dd09abd7 100755 --- a/test/test-efi-create-disk.sh +++ b/src/grp-boot/systemd-boot/test-efi-create-disk.sh |