mauricioariel1234 / skipfish

Automatically exported from code.google.com/p/skipfish
Apache License 2.0
0 stars 0 forks source link

Makefile, LDFLAGS #31

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Sorry I think we had a bit of misunderstanding here,

1.15b's Makefile has:

LDFLAGS   += -lcrypto -lssl -lidn -lz -L/usr/local/lib/ -L/opt/local/lib

$(CC) $(PROGNAME).c -o $(PROGNAME) $(CFLAGS_OPT) $(OBJFILES) $(LDFLAGS)

This won't work because LDFLAGS are appended too late, and as such, are
ignored.

It should be:

LIBS       = -lcrypto -lssl -lidn -lz -L/usr/local/lib/ -L/opt/local/lib

$(CC) $(LDFLAGS) $(PROGNAME).c -o $(PROGNAME) $(CFLAGS_OPT) \
$(OBJFILES) $(LIBS)

In order to respect environment's LDFLAGS they can't be mixed with -l
flags... and even when not respecting them, `make LDFLAGS=""` as argument
would be broken.

(That's what I really tried to say on the previous bug, and got a bit
sidetracked by other vars there, I guess, sorry...)

Attached is the way I would write it...

Then you can:

export CFLAGS="-march=core2 -pipe -O2"
export LDFLAGS="-Wl,--as-needed"

make debug          -> -g -ggdb is only appended then, and above is used

make                -> build with upstream optimization, -O3, above is
prepended to this too

make OPT_CFLAGS=""  -> use only your own above environment flags

Original issue reported on code.google.com by ssuomi...@unk.fi on 23 Mar 2010 at 10:27

Attachments:

GoogleCodeExporter commented 8 years ago
Yeah, sorry. Fixed in 1.16 (pending a good reason to push it out ;-).

Original comment by lcam...@gmail.com on 23 Mar 2010 at 10:34