Message ID | 20210824105038.1257926-49-anthony.perard@citrix.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | xen: Build system improvements, now with out-of-tree build! | expand |
On 24.08.2021 12:50, Anthony PERARD wrote: > Listing public headers when out-of-tree build are involved becomes > more annoying where every path to every headers needs to start with > "$(srctree)/$(src)", or $(wildcard ) will not work. This means more > repetition. > > This patch attempt to reduce the amount of duplication and make better > use of make's meta programming capability. The filters are now listed > in a variable and don't have to repeat the path to the headers files > as this is added later as needed. > > Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> Sorry, just one nit here: > --- a/xen/include/Makefile > +++ b/xen/include/Makefile > @@ -78,10 +78,21 @@ ifeq ($(XEN_TARGET_ARCH),$(XEN_COMPILE_ARCH)) > > all: $(obj)/headers.chk $(obj)/headers99.chk $(obj)/headers++.chk > > -PUBLIC_HEADERS := $(filter-out $(src)/public/arch-% $(src)/public/dom0_ops.h, $(wildcard $(src)/public/*.h $(src)/public/*/*.h)) > +hdrs-path := $(srctree)/$(src)/public > > -PUBLIC_C99_HEADERS := $(src)/public/io/9pfs.h $(src)/public/io/pvcalls.h > -PUBLIC_ANSI_HEADERS := $(filter-out $(src)/public/%ctl.h $(src)/public/xsm/% $(src)/public/%hvm/save.h $(PUBLIC_C99_HEADERS), $(PUBLIC_HEADERS)) These all had / have "PUBLIC" in their names because the makefile doesn't live in public/. I'd prefer if you could stick to this for all the new variables/macros you add (lower case then of course). Jan > +list-headers = $(wildcard $1/*.h $1/*/*.h) > +filter-headers = $(filter-out $(addprefix $(hdrs-path)/,$($1-filter)), $($1)) > + > +c99-headers := io/9pfs.h io/pvcalls.h > +public-headers := $(call list-headers,$(hdrs-path)) > +ansi-headers := $(public-headers) > + > +public-headers-filter := dom0_ops.h arch-% > +ansi-headers-filter := %ctl.h xsm/% %hvm/save.h $(public-headers-filter) $(c99-headers) > + > +PUBLIC_HEADERS := $(call filter-headers,public-headers) > +PUBLIC_ANSI_HEADERS := $(call filter-headers,ansi-headers) > +PUBLIC_C99_HEADERS := $(addprefix $(hdrs-path)/, $(c99-headers)) > > $(src)/public/io/9pfs.h-prereq := string > $(src)/public/io/pvcalls.h-prereq := string >
diff --git a/xen/include/Makefile b/xen/include/Makefile index c3172f6636be..4e64a31ecab3 100644 --- a/xen/include/Makefile +++ b/xen/include/Makefile @@ -78,10 +78,21 @@ ifeq ($(XEN_TARGET_ARCH),$(XEN_COMPILE_ARCH)) all: $(obj)/headers.chk $(obj)/headers99.chk $(obj)/headers++.chk -PUBLIC_HEADERS := $(filter-out $(src)/public/arch-% $(src)/public/dom0_ops.h, $(wildcard $(src)/public/*.h $(src)/public/*/*.h)) +hdrs-path := $(srctree)/$(src)/public -PUBLIC_C99_HEADERS := $(src)/public/io/9pfs.h $(src)/public/io/pvcalls.h -PUBLIC_ANSI_HEADERS := $(filter-out $(src)/public/%ctl.h $(src)/public/xsm/% $(src)/public/%hvm/save.h $(PUBLIC_C99_HEADERS), $(PUBLIC_HEADERS)) +list-headers = $(wildcard $1/*.h $1/*/*.h) +filter-headers = $(filter-out $(addprefix $(hdrs-path)/,$($1-filter)), $($1)) + +c99-headers := io/9pfs.h io/pvcalls.h +public-headers := $(call list-headers,$(hdrs-path)) +ansi-headers := $(public-headers) + +public-headers-filter := dom0_ops.h arch-% +ansi-headers-filter := %ctl.h xsm/% %hvm/save.h $(public-headers-filter) $(c99-headers) + +PUBLIC_HEADERS := $(call filter-headers,public-headers) +PUBLIC_ANSI_HEADERS := $(call filter-headers,ansi-headers) +PUBLIC_C99_HEADERS := $(addprefix $(hdrs-path)/, $(c99-headers)) $(src)/public/io/9pfs.h-prereq := string $(src)/public/io/pvcalls.h-prereq := string
Listing public headers when out-of-tree build are involved becomes more annoying where every path to every headers needs to start with "$(srctree)/$(src)", or $(wildcard ) will not work. This means more repetition. This patch attempt to reduce the amount of duplication and make better use of make's meta programming capability. The filters are now listed in a variable and don't have to repeat the path to the headers files as this is added later as needed. Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> --- xen/include/Makefile | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-)