> One general rule in Quagmire is that if there is a simple, generic GNU
> make way to do something, then we don't need special support for it.
> This leads to many differences from the way that Automake does things.
> For instance, in Automake there is a separate quux_CFLAGS variable for
> an aggregate. In Quagmire, you would instead use a target-specific
> CFLAGS assignment.
The make documentation [1] says:
> There is one more special feature of target-specific variables: when
> you define a target-specific variable that variable value is also in
> effect for all prerequisites of this target, and all their
> prerequisites, etc.
This is a nuisance. Consider the following:
noinst_SHARED_LIBRARIES = libone.so libtwo.so libthree.so
libone.so_SOURCES = one.c
libone.so : LDFLAGS = -Wl,-soname,libone.so
libone.so_LIBS = libthree.so
libtwo.so_SOURCES = two.c
libtwo.so : LDFLAGS = -Wl,-soname,libtwo.so
libtwo.so_LIBS = libthree.so
libthree.so_SOURCES = three.c
Then we get:
$ make clean all &>/dev/null ; scanelf -S libthree.so
TYPE SONAME FILE
ET_DYN libone.so libthree.so
$ make clean libone.so &>/dev/null ; scanelf -S libthree.so
TYPE SONAME FILE
ET_DYN libone.so libthree.so
$ make clean libtwo.so &>/dev/null ; scanelf -S libthree.so
TYPE SONAME FILE
ET_DYN libtwo.so libthree.so
$ make clean libthree.so &>/dev/null ; scanelf -S libthree.so
TYPE SONAME FILE
ET_DYN libthree.so
So to set soname, I see two options. Either we use LINK instead:
libone.so_LINK = $(LINK.c) -Wl,-soname,libone.so
Or we explicitly unset target-specific variables for everything that
could accidentally pick one up, which quickly becomes an awful lot of
unsetting. Is there a better way?
1: http://www.gnu.org/software/make/manual/make.html#Target_002dspecific
--
Ciaran McCreesh
Ciaran> Or we explicitly unset target-specific variables for everything that
Ciaran> could accidentally pick one up, which quickly becomes an awful lot of
Ciaran> unsetting. Is there a better way?
Yeah, I think we have to go with the _LINK approach, and limit our use
of target-specific variables.
Care to write a patch? :-)
Tom
i ran into this with CFLAGS... and tried to come up with a patch which
allows you to define foo.o_CFLAGS
you can see in the fuzz there is an else there for older gcc's i
wasn't exactly sure what to do there and don't have an old enough gcc
around to test it out.
defining foo.o_CFLAGS
for all 2 of my .o files was rather tedious so i stuck something like
this in my Quagmire.mk
foo.so_CFLAGS=.....
$(foreach obj,$(foo.so_OBJECTS),$(eval $(obj)_CFLAGS+= $(foo.so_CFLAGS) ))
is this something which maybe also {c,sh}ould make its way into quagmire?