[Build-common-hackers] Proposals for multi-build
Jeff Bailey
jbailey@nisa.net
Wed, 23 Jul 2003 14:10:16 -0700
I've been thinking about the multi build again.
I think I've reduced it into a series of problems. The first of which
is that we don't have an adequeate way of using a base variable usually,
and a specific variable only when needed. This little bit of code
should demonstrate what I mean and provide what I think is an adequeate
solution:
all: a b c
cdbs_curpkg = $(filter-out %/,$(subst /,/ ,$@))
cdbs_localval = $(if $($(1)_$(cdbs_curpkg)),"$($(1)_$(cdbs_curpkg))","$($(1))")
foo = foo
foo_b = foo_b
a: c
@echo a $(call cdbs_localval,foo)
b: a
@echo b $(call cdbs_localval,foo)
c:
@echo c $(call cdbs_localval,foo)
.PHONY: a b c all
This produces:
c foo
a foo
b foo_b
My initial proposal is that all of our variable access switch to using
this syntax where it's reasonable that the caller might either user foo
or foo_$(cdbs_curpkg).
The next proposal is much more complicated.
I've approached this with the thought I wanted to see what the
multi-build setup would look like. I think, based on our earlier
conversations, that I'd like to see this:
Right now we do all of our building in the common hooks. This is
suboptimal in that we have no per-package flexibility.
I'm assuming here that all builds define DEB_BUILD_MULTI. If the user
doesn't specify it, then we just fille it with the name of the first
package and proceed.
To handle this, then, a rule from makefile.mk might look like this right
now:
common-build-arch common-build-indep:: common-build-impl
common-build-impl::
$(DEB_MAKE_INVOKE) $(DEB_MAKE_BUILD_TARGET)
and instead it could look like this:
DEB_BUILD_makefile = $(DEB_BUILD_MULTI)
build/$(DEB_BUILD_makefile)::
$(call cdbs_localval,DEB_MAKE_INVOKE) $(call cdbs_localval,DEB_MAKE_BUILD_TARGET)
I think that doing it this way means that the multi-build stuff will
work without any changes to the buildcore.mk file. We're *already*
calling these targets. The only issue then is that we don't run a make
clean between runs, so they need to do VPATH builds. This is probably
solvable somehow, too, but I haven't thought about it.
Any comments? If this looks good, I can dig in on it.
Tks,
Jeff Bailey
--
Breathe into my hands, I'll cup them like a glass to drink from...
- Tattle Tale