[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [XEN PATCH v3 13/23] xen/build: include include/config/auto.conf in main Makefile



On Wed, Mar 04, 2020 at 03:29:55PM +0100, Jan Beulich wrote:
> On 26.02.2020 12:33, Anthony PERARD wrote:
> > --- a/xen/Makefile
> > +++ b/xen/Makefile
> > @@ -49,7 +49,71 @@ default: build
> >  .PHONY: dist
> >  dist: install
> >  
> > -build install:: include/config/auto.conf
> > +
> > +ifeq ($(root-make-done),)
> 
> This getting communicated between make recursion instances via ...
> 
> > +# section to run before calling Rules.mk, but only once.
> > +#
> > +# To make sure we do not include .config for any of the *config targets
> > +# catch them early, and hand them over to tools/kconfig/Makefile
> > +
> > +clean-targets := %clean
> > +no-dot-config-targets := $(clean-targets) \
> > +                         uninstall debug cloc \
> > +                         cscope TAGS tags MAP gtags \
> > +                         xenversion
> > +
> > +config-build    := n
> > +need-config     := y
> > +
> > +ifneq ($(filter $(no-dot-config-targets), $(MAKECMDGOALS)),)
> > +    ifeq ($(filter-out $(no-dot-config-targets), $(MAKECMDGOALS)),)
> > +        need-config := n
> > +    endif
> > +endif
> > +
> > +ifneq ($(filter %config,$(MAKECMDGOALS)),)
> > +    config-build := y
> > +endif
> > +
> > +export root-make-done := y
> 
> ... the environment, can we be as resilient as possible against a
> variable of this name already existing in the environment before
> the top level make invocation, by making the construct above
> 
> ifneq ($(root-make-done),y)
> 
> ?

Sound good, I'll do that.

> > +endif # root-make-done
> > +
> > +ifeq ($(config-build),y)
> > +# 
> > ===========================================================================
> > +# *config targets only - make sure prerequisites are updated, and descend
> > +# in tools/kconfig to make the *config target
> > +
> > +config: FORCE
> > +   $(MAKE) -f $(BASEDIR)/tools/kconfig/Makefile.kconfig ARCH=$(ARCH) 
> > SRCARCH=$(SRCARCH) HOSTCC="$(HOSTCC)" HOSTCXX="$(HOSTCXX)" $@
> 
> This, ...
> 
> > +
> > +# Config.mk tries to include .config file, don't try to remake it
> > +%/.config: ;
> > +
> > +%config: FORCE
> > +   $(MAKE) -f $(BASEDIR)/tools/kconfig/Makefile.kconfig ARCH=$(ARCH) 
> > SRCARCH=$(SRCARCH) HOSTCC="$(HOSTCC)" HOSTCXX="$(HOSTCXX)" $@
> 
> ... this, ...
> 
> > +else # !config-build
> > +
> > +ifeq ($(need-config),y)
> > +include include/config/auto.conf
> > +# Read in dependencies to all Kconfig* files, make sure to run syncconfig 
> > if
> > +# changes are detected.
> > +include include/config/auto.conf.cmd
> > +
> > +# Allow people to just run `make` as before and not force them to configure
> > +$(KCONFIG_CONFIG):
> > +   $(MAKE) -f $(BASEDIR)/tools/kconfig/Makefile.kconfig ARCH=$(ARCH) 
> > SRCARCH=$(SRCARCH) HOSTCC="$(HOSTCC)" HOSTCXX="$(HOSTCXX)" defconfig
> 
> ... this, and ...
> 
> > +# The actual configuration files used during the build are stored in
> > +# include/generated/ and include/config/. Update them if .config is newer 
> > than
> > +# include/config/auto.conf (which mirrors .config).
> > +#
> > +# This exploits the 'multi-target pattern rule' trick.
> > +# The syncconfig should be executed only once to make all the targets.
> > +include/config/%.conf include/config/%.conf.cmd: $(KCONFIG_CONFIG)
> > +   $(MAKE) -f $(BASEDIR)/tools/kconfig/Makefile.kconfig ARCH=$(ARCH) 
> > SRCARCH=$(SRCARCH) HOSTCC="$(HOSTCC)" HOSTCXX="$(HOSTCXX)" syncconfig
> 
> ... this are almost identical, pretty long lines. Can this be macroized,
> please, with the actual make goal as parameter?

Sound good, would the following be fine?

kconfig = -f $(BASEDIR)/tools/kconfig/Makefile.kconfig ARCH=$(ARCH) 
SRCARCH=$(SRCARCH) HOSTCC="$(HOSTCC)" HOSTCXX="$(HOSTCXX)"
config:
    $(MAKE) $(kconfig) $@

I will put that new `kconfig' macro in Kbuild.include, along the
shorthand for clean.

Thanks,

-- 
Anthony PERARD

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.