[PD-dev] general makefile question

Bryan Jurish jurish at uni-potsdam.de
Wed Dec 1 22:38:07 CET 2010


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

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
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...

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

... 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
work around this with shell hackery in configure.ac -- gory details in
externals/moocow/common/m4/{ax_hack_cflags,ax_pd_external}.m4 ... so
yes: autotools are flexible enough to handle this kind of thing, but not
entirely without wailing and/or gnashing of teeth...

marmosets,
	Bryan

-- 
Bryan Jurish                       "There is *always* one more bug."
jurish at uni-potsdam.de       -Lubarsky's Law of Cybernetic Entomology



More information about the Pd-dev mailing list