From 2d9f9e3d574b3f0785fb6063c2e91b2d9ca7cdd8 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Mon, 6 Mar 2017 16:24:10 -0500 Subject: [PATCH] Make conditional default loader path use EFIDIR like fwupdate does. Signed-off-by: Peter Jones --- Make.defaults | 10 ++++++++-- Makefile | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Make.defaults b/Make.defaults index 2870f60..aa6a690 100644 --- a/Make.defaults +++ b/Make.defaults @@ -9,7 +9,10 @@ localedir ?= $(datadir)/locale/ PCDIR ?= $(libdir)/pkgconfig DESTDIR ?= -OS_VENDOR := redhat +EFIDIR ?= $(shell x=$$(which --skip-alias --skip-functions git 2>/dev/null) ; [ -n "$$x" ] && git config --get efibootmgr.efidir) +ifeq ($(EFIDIR),) + EFIDIR_ERROR = $(error EFIDIR or .gitconfig efibootmgr.efidir must be set to this distro's reserved EFI System Partition subdirectory name) +endif EFI_LOADER := grub.efi INSTALL ?= install @@ -32,7 +35,7 @@ cflags = $(CFLAGS) $(SUBDIR_CFLAGS) \ -std=gnu11 -fPIC \ -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -DLOCALEDIR=\"$(localedir)\" \ -DEFIBOOTMGR_VERSION="\"$(VERSION)\"" \ - -DDEFAULT_LOADER=\"\\\\EFI\\\\$(OS_VENDOR)\\\\$(EFI_LOADER)\" \ + -DDEFAULT_LOADER=\"\\\\EFI\\\\$(EFIDIR)\\\\$(EFI_LOADER)\" \ $(if $(findstring clang,$(CC)),$(clang_cflags),) \ $(if $(findstring gcc,$(CC)),$(gcc_cflags),) \ $(call pkg-config-cflags) @@ -47,3 +50,6 @@ ccldflags = $(cflags) $(CCLDFLAGS) $(LDFLAGS) \ CPPFLAGS?= SOFLAGS=-shared LDLIBS=$(foreach lib,$(LIBS),-l$(lib)) $(call pkg-config-ldlibs) + +.PHONY: check_efidir_error +check_efidir_error : ; $(EFIDIR_ERROR) $(info Building with EFIDIR as $(EFIDIR)) diff --git a/Makefile b/Makefile index 35b7611..c308543 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ include $(TOPDIR)/Make.defaults SUBDIRS := src -all clean install deps : | Make.version +all clean install deps : | check_efidir_error Make.version @set -e ; for x in $(SUBDIRS) ; do \ $(MAKE) -C $$x $@ ; \ done