[PD-dev] general makefile question

IOhannes m zmoelnig zmoelnig at iem.at
Thu Dec 2 09:46:32 CET 2010


On 2010-12-01 22:38, Bryan Jurish wrote:
> moin folks,
> 
> On 2010-12-01 18:00:21, IOhannes m zmoelnig <zmoelnig at iem.at> appears to
> have written:
>> 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?
> 
> That's probably the safest way, but a bit unwieldy...  I would tend to
> favor:
> 
>   LDFLAGS += -Wl,--export-dynamic

yes that was my first guess.
unfortunately this does not work at all.
it seems that make will simply ignore any assignments to a variable that
has been defined via cmdline arguments (not via environment variables
though, which have low precedence)

> 
> in the local (pd) Makefile, just in case there happens to be something
> important in the caller's (packager's) flags... but maybe the "+="
> operator is a GNU make extension?  Maybe ":=" in the Makefile would work

the same as above.
really the only way i found to do an assignment to a variable declared like
$ make MYVAR=foo
was to add the "override" directive in the Makefile.

> to append to any predefined LDFLAGS?  Or is ":=" also a GNU extension...
> I don't really ever write makefiles for anything other than GNU make, so
> I'm not too sure...

and all this without even bothering about GNU extensions yet!

> 
> On 2010-12-01 18:16:47, Hans-Christoph Steiner <hans at at.or.at> appears
> to have written:
>> 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.
> 
> +1

again, i do like autoconf but sometimes it is really out of question.
right now i am _also_ talking about the template Makefile (and how to
make this more robust and behave like expected), and autotools is a
no-go here.

> 
> ... but I'd like to note that autotools involve a whole new dimension of
> headaches with *FLAGS variables.  In particular, AC_PROG_CC() sets
> CFLAGS="-g -O2" by default for gcc (if it's otherwise unset), which is
> not the kind of default I usually prefer.  You can reset it explicitly
> in configure.ac or Makefile.am (say CFLAGS="-O2"), *but* then you lose
> any CFLAGS your caller might have actually passed in explicitly (e.g.
> CFLAGS="-O32767 -fSuperDuperPooperScooper -WWillRobinson").  I usually

i think this is basically the same problem as i have.

the user should be able to set the CFLAGS they like, while at the same
time when doing so they should not be breaking the build system "by
default", which they are currently doing.


mfgsdr
IOhannes



-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3636 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.puredata.info/pipermail/pd-dev/attachments/20101202/e04fcaba/attachment.bin>


More information about the Pd-dev mailing list