handling multi-object source files in libbb/
Robert P. J. Day
rpjday at mindspring.com
Tue Mar 28 16:28:06 UTC 2006
On Tue, 28 Mar 2006, Bernhard Fischer wrote:
> On Tue, Mar 28, 2006 at 09:20:00AM -0500, Robert P. J. Day wrote:
> >
> > the following basic structure would appear to handle building
> >multiple object files from a single source file in libbb/:
> >
> >define gen-obj-names
> >$(addsuffix .o,$(sort $(shell grep -h "^\#ifdef L_" ${1} | sed -e "s/^\#ifdef L_"//)))
> >endef
> >
> >define multisrc-rule-template
> >$(call gen-obj-names,${1}) : ${1}
> > gcc -DL_$$(basename $$@) $$< -o $$@
> s/gcc/$(CC) $(CFLAGS).../;# but i'm not arguing about this mere detail.
> >endef
> >
> >MULTISRCS := $(shell grep -l "^\#ifdef L_" $(wildcard *.c))
> >$(foreach src,${MULTISRCS},$(eval $(call multisrc-rule-template,${src})))
>
> This may not work reliably due to a bug in make-3.80 (eval in
> conditionals are broken). Sad thing is that if this part doesn't
> generally work, the whole effort is invain and doomed to fail :(
yes, you're right -- if it doesn't work under make-3.80 at the very
least, it's unusable.
> Did you test this with at least make-3.80 and make-cvs-HEAD ?
currently, i'm running make-3.81beta4, so it's not surprising it works
for me. oh, well. at the very least, maybe i can just add this
technique as a comment somewhere for future reference. maybe i'll
revert make temporarily and test it to see what happens.
rday
More information about the busybox
mailing list