[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [RFC PATCH] build: include/compat: figure out which other compat headers are needed
On 11.01.2023 19:17, Anthony PERARD wrote: > Some compat headers depends on other compat headers that may not have > been generated due to config option. > > This would be a generic way to deal with deps, instead of > headers-$(call or $(CONFIG_TRACEBUFFER),$(CONFIG_HVM)) += compat/trace.h But it would generate dependency headers even if there's only a fake dependency, like is specifically the case for hvm_op.h vs trace.h (the compat header only really needs public/trace.h, which it gets from the inclusion of the original hvm_op.h). Avoiding the generation of unnecessary compat headers is solely to speed up the build. If that wasn't an issue, I'd say we simply generate all headers at al times. In particular ... > --- a/xen/include/Makefile > +++ b/xen/include/Makefile > @@ -34,6 +34,29 @@ headers-$(CONFIG_TRACEBUFFER) += compat/trace.h > headers-$(CONFIG_XENOPROF) += compat/xenoprof.h > headers-$(CONFIG_XSM_FLASK) += compat/xsm/flask_op.h > > +# Find dependencies of compat headers. > +# e.g. hvm/hvm_op.h needs trace.h; but if CONFIG_TRACEBUFFER=n, then trace.h > would be missing. > +# > +# Using sed to remove ".." from path because unsure if something else is > available > +# There's `realpath`, but maynot be available > +# realpath --relative-to=. -mL compat/hvm/../trace.h -> compat/trace.h > +# `make` also have macro for that $(abspath), only recent version. > +# > +# The $(CC) line to gen deps is derived from $(cmd_compat_i) > +include $(obj)/.compat-header-deps.d > +$(obj)/.compat-header-deps.d: include/public/hvm/hvm_op.h > + $(CC) -MM -MF $@.tmp $(filter-out -Wa$(comma)% -include > %/include/xen/config.h,$(XEN_CFLAGS)) $< ... this removal of the config.h inclusion is to avoid introducing any dependencies on CONFIG_* in the public headers (of course we'd expect such to be caught during review). I'll try my alternative approach next, and post a patch if successful. I am, however, aware that this also won't deal with all theoretically possible cases; I think though that the remaining cases might then better be dealt with by manually recorded dependencies (kind of along the lines of your headers-$(call or $(CONFIG_TRACEBUFFER),$(CONFIG_HVM)) += compat/trace.h in the description). > + for f in $$(cat $@.tmp | sed -r '1s/^[^:]*: //; s/ \\$$//'); do \ I'm curious: Why "cat" instead of passing the file as argument to "sed"? Jan
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |