tools/libs: fix build rules to correctly deal with multiple public headers
cover tools/libs: fix build rules to correctly deal with multiple public headers
1: fix header symlinking rule
2: fix uninstall rule for header files
Jan
PATCH 1/2 tools/libs: fix header symlinking rule
Unlike pattern rules, ordinary rules with multiple targets have their commands executed once per target. Hence when $(LIBHEADERS) expands to more than just one item, multiple identical commands would have been issued, which have been observed to cause build failures relatively frequently after libx{c,l} code was moved to tools/libs/{ctrl,light}/. Use a static pattern rule instead.
---
I'm aware Jürgen has a series pending to entirely remove the rule in question, but this being an isolated fix which ought to be easier to review, I thought I'd still post it. Re-basing his series over this change should be straightforward.
However, for the above reason I'm not bothering getting right the theoretical case of headers in subdirs of the respective include/ being mentioned in $(LIBHEADER).
tools/libs/libs.mk +2 -2
@@ -79,8 +79,8 @@ headers.chk: $(LIBHEADERSGLOB) $(AUTOINC libxen$(LIBNAME).map: echo 'VERS_$(MAJOR).$(MINOR) { global: *; };' >$@ -$(LIBHEADERSGLOB): $(LIBHEADERS) - for i in $(realpath $(LIBHEADERS)); do ln -sf $$i $(XEN_ROOT)/tools/include; done +$(LIBHEADERSGLOB): $(XEN_ROOT)/tools/include/%.h: include/%.h + ln -sf $(CURDIR)/$< $(XEN_ROOT)/tools/include/ lib$(LIB_FILE_NAME).a: $(LIB_OBJS) $(AR) rc $@ $^
PATCH 2/2 tools/libs: fix uninstall rule for header files
In reply to Jan BeulichThis again was working right only as long as $(LIBHEADER) consisted of just one entry.
---
An alternative would be to use $(addprefix ) without any shell loop.
tools/libs/libs.mk +1 -1
@@ -107,7 +107,7 @@ install: build .PHONY: uninstall uninstall: rm -f $(DESTDIR)$(PKG_INSTALLDIR)/$(LIB_FILE_NAME).pc - for i in $(LIBHEADER); do rm -f $(DESTDIR)$(includedir)/$(LIBHEADER); done + for i in $(LIBHEADER); do rm -f $(DESTDIR)$(includedir)/$$i; done rm -f $(DESTDIR)$(libdir)/lib$(LIB_FILE_NAME).so rm -f $(DESTDIR)$(libdir)/lib$(LIB_FILE_NAME).so.$(MAJOR) rm -f $(DESTDIR)$(libdir)/lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR)
Ping: [PATCH 2/2] tools/libs: fix uninstall rule for header files
Quoted 4 lines · Jan Beulich
This again was working right only as long as $(LIBHEADER) consisted of just one entry.
Signed-off-by Jan Beulich <[email protected]>
While patch 1 has become irrelevant with Juergen's more complete change, this one is still applicable afaict.
Jan
Quoted 16 lines
---
An alternative would be to use $(addprefix ) without any shell loop.tools/libs/libs.mk +1
-1@@ -107,7 +107,7 @@ install: build .PHONY: uninstall uninstall: rm -f $(DESTDIR)$(PKG_INSTALLDIR)/$(LIB_FILE_NAME).pc - for i in $(LIBHEADER); do rm -f $(DESTDIR)$(includedir)/$(LIBHEADER); done + for i in $(LIBHEADER); do rm -f $(DESTDIR)$(includedir)/$$i; done rm -f $(DESTDIR)$(libdir)/lib$(LIB_FILE_NAME).so rm -f $(DESTDIR)$(libdir)/lib$(LIB_FILE_NAME).so.$(MAJOR) rm -f $(DESTDIR)$(libdir)/lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR)
Re: [PATCH 2/2] tools/libs: fix uninstall rule for header files
In reply to Jan BeulichQuoted 8 lines · Jan Beulich
This again was working right only as long as $(LIBHEADER) consisted of just one entry.
Signed-off-by Jan Beulich <[email protected]>
The change is obviously fixing a bug :-) and the double $ is required to protect from make.
Cheers
Bertrand
Quoted 16 lines
---
An alternative would be to use $(addprefix ) without any shell loop.tools/libs/libs.mk +0
-0@@ -107,7 +107,7 @@ install: build.PHONY: uninstall
uninstall:rm -f $(DESTDIR)$(PKG_INSTALLDIR)/$(LIB_FILE_NAME).pctools/libs/libs.mk +1
-1- for i in $(LIBHEADER); do rm -f $(DESTDIR)$(includedir)/$(LIBHEADER); done + for i in $(LIBHEADER); do rm -f $(DESTDIR)$(includedir)/$$i; donerm -f $(DESTDIR)$(libdir)/lib$(LIB_FILE_NAME).so rm -f $(DESTDIR)$(libdir)/lib$(LIB_FILE_NAME).so.$(MAJOR) rm -f $(DESTDIR)$(libdir)/lib$(LIB_FILE_NAME).so.$(MAJOR).$(MINOR)
Ping²: [PATCH 2/2] tools/libs: fix uninstall rule for header files
Quoted 9 lines · Bertrand Marquis
Quoted 6 lines · Jan Beulich
This again was working right only as long as $(LIBHEADER) consisted of just one entry.
Signed-off-by Jan Beulich <[email protected]>Reviewed-by Bertrand Marquis <[email protected]>The change is obviously fixing a bug :-) and the double $ is required to protect from make.
I'll give it a day or two more to get an ack (or any negative form of feedback), but I guess I'll go ahead and commit this with just Bertrand's R-b otherwise.
Jan
Quoted 2 lines · Jan Beulich
1: fix header symlinking rule
2: fix uninstall rule for header files
Actually I've noticed these issues were introduced relatively recently only, in particular after 4.14. I've added
to both of them, albeit with the above they won't need even just considering of backport.
Jan