blob: 9525ed8c545f83f8c30fea2433dc150ae0707986 [file] [log] [blame]
Brad Bishop96ff1982019-08-19 13:50:42 -04001From 97668ae0bce776a36ea2001dea63d376be8274ac Mon Sep 17 00:00:00 2001
2From: Peter Jones <pjones@redhat.com>
3Date: Wed, 6 Mar 2019 13:08:33 -0500
4Subject: [PATCH] Make sure PKGS= is propogated into the submake for "make
5 deps"
6
7When we're doing make deps with "$(CC) -MF", gcc and clang have different
8behavior, both broken in different ways, which we're hitting because of a
9missing -I argument for libefivar's includes. On clang, when a header can't
10be found, it emits a rule with the header as a prerequisite without a path,
11such as efivar.h here:
12
13efibootmgr.o: efibootmgr.c fix_coverity.h efivar.h efiboot.h \
14 /home/pjones/devel/github.com/efibootmgr/master/src/include/list.h \
15 /home/pjones/devel/github.com/efibootmgr/master/src/include/efi.h \
16 /home/pjones/devel/github.com/efibootmgr/master/src/include/unparse_path.h \
17 /home/pjones/devel/github.com/efibootmgr/master/src/include/efibootmgr.h \
18 error.h
19
20Then the build that utilizes that rule will fail to find the
21prerequisite and tell you something like:
22
23make[1]: *** No rule to make target 'efivar.h', needed by 'efibootmgr.o'. Stop.
24make[1]: Leaving directory '/home/pjones/devel/github.com/efibootmgr/master/src'
25
26With gcc, when a header can't be found, it emits a rule without that header
27as a prerequisite, as such (again with efivar.h):
28
29efibootmgr.o: efibootmgr.c fix_coverity.h \
30 /home/pjones/devel/github.com/efibootmgr/master/src/include/list.h \
31 /home/pjones/devel/github.com/efibootmgr/master/src/include/efi.h \
32 /home/pjones/devel/github.com/efibootmgr/master/src/include/unparse_path.h \
33 /home/pjones/devel/github.com/efibootmgr/master/src/include/efi.h \
34 /home/pjones/devel/github.com/efibootmgr/master/src/include/efibootmgr.h \
35 error.h
36
37And then your build will fail if you haven't adjusted CFLAGS to tell it
38where to find the header.
39
40Both of these would be better just erroring, but at least gcc's doesn't
41insert a *wrong* dependency.
42
43This patch adds "PKGS=efivar efibootmgr popt" for all deps under src/.
44Technically that's overkill, as efibootmgr itself doesn't need popt, but it
45doesn't hurt anything to have the extra part there. The resulting
46.efibootmgr.d file has the prerequisites expressed correctly:
47
48efibootmgr.o: efibootmgr.c fix_coverity.h /usr/include/efivar/efivar.h \
49 /usr/include/efivar/efiboot.h \
50 /home/pjones/devel/github.com/efibootmgr/master/src/include/list.h \
51 /home/pjones/devel/github.com/efibootmgr/master/src/include/efi.h \
52 /home/pjones/devel/github.com/efibootmgr/master/src/include/unparse_path.h \
53 /home/pjones/devel/github.com/efibootmgr/master/src/include/efi.h \
54 /home/pjones/devel/github.com/efibootmgr/master/src/include/efibootmgr.h \
55 error.h
56
57This fixes the issue described in github PR #96
58
59Signed-off-by: Peter Jones <pjones@redhat.com>
60Upstream-Status: Backport [https://github.com/rhboot/efibootmgr/commit/97668ae0bce776a36ea2001dea63d376be8274ac]
61---
62 src/Makefile | 7 ++++++-
63 1 file changed, 6 insertions(+), 1 deletion(-)
64
65diff --git a/src/Makefile b/src/Makefile
66index 258bac1..32fa188 100644
67--- a/src/Makefile
68+++ b/src/Makefile
69@@ -31,8 +31,13 @@ efibootdump : PKGS=efivar efiboot popt
70 efibootnext : $(call objects-of,$(EFIBOOTNEXT_SOURCES))
71 efibootnext : PKGS=efivar efiboot popt
72
73+deps : PKGS=efivar efiboot popt
74 deps : $(ALL_SOURCES)
75- $(MAKE) -f $(TOPDIR)/Make.deps deps SOURCES="$(ALL_SOURCES)" SUBDIR_CFLAGS="$(SUBDIR_CFLAGS)"
76+ $(MAKE) -f $(TOPDIR)/Make.deps \
77+ SOURCES="$(ALL_SOURCES)" \
78+ SUBDIR_CFLAGS="$(SUBDIR_CFLAGS)" \
79+ PKGS="$(PKGS)" \
80+ deps
81
82 clean :
83 @rm -rfv *.o *.a *.so $(TARGETS)