handling multi-object source files in libbb/

Bernhard Fischer rep.nop at aon.at
Tue Mar 28 06:51:28 PST 2006


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 :(

>
>
>  i can whip up a corresponding patch if there's interest.

Did you test this with at least make-3.80 and make-cvs-HEAD ?
Landley may even be able to use make-3.79.1, fwiw.

http://busybox.net/~aldot/bb/busybox.buildsys-touchup.03j.diff

Careful. Been there, done that ;) You may enjoy reading and improving
abovemention patchlet..

cheers,
Bernhard


More information about the busybox mailing list