[PD-dev] general makefile question

Hans-Christoph Steiner hans at at.or.at
Wed Dec 1 18:16:47 CET 2010


On Dec 1, 2010, at 12:00 PM, IOhannes m zmoelnig wrote:

> during the debian packaging of externals i once more stumbled across  
> one
> of my many problems with make, which i was never able to solve in a
> satisfactory way.
>
> it is:
> the Makefile uses CFLAGS and LDFLAGS to set crucial flags to the build
> process e.g. LDFLAGS uses "-Wl,--export-dynamic -shared" to build  
> shared
> libraries (in our case: externals)
>
> however, some meta build processes (like debian packaging) explicitely
> set these FLAGS to what they think are good optimization/debugging  
> defaults
> e.g. make get's called like
> $ /usr/bin/make LDFLAGS="" CFLAGS="-I/usr/local/include"
>
> this however effectively disables all the settings done within the
> Makefile, which leads to not passing "-Wl,--export-dynamic  -shared"  
> to
> the linker, leading to a fatal error when linking.
>
> what is the canonical way to use the passed FLAGS and at the same time
> adding whatever is needed?
> something like 'PD_LDFLAGS="-Wl,--export-dynamic  -shared $(LDFLAGS)"'
> and then consequently using $(PD_LDFLAGS) in the linking stage?
>
> this is such a fundamental thing that i'm sure there has to be an
> elegant solution to this but i never came across one.
> the PD_LDFLAGS seems a bit like a kludge to me.


What optimization do you need to include in LDFLAGS? I can't think of  
any. I think the best source of info for this would be to see what  
Debian builders set as LDFLAGS.

But if you really want to have all the possibilities for overriding  
things, then go with autotools, especially with automake.  They  
generate makefiles that have lots of room for customization. From my  
point of view the Makefile template was never intended to work in all  
situations, only simple libraries that don't have special dependencies.

.hc


----------------------------------------------------------------------------

Man has survived hitherto because he was too ignorant to know how to  
realize his wishes.  Now that he can realize them, he must either  
change them, or perish.    -William Carlos Williams





More information about the Pd-dev mailing list