Browse files

$(LDFLAGS) must be at the end of the link options

The implicit link command in GNU make places $(LDFLAGS) just after $(CC).
This causes linking to fail on MinGW gcc 3.4.2 because of "undefined
reference" errors for libpcre functions.  Placing $(LDFLAGS) at the end of
the link options fixes the problem.
  • Loading branch information...
1 parent 5e85f7d commit 20f10196e90e01603d4d9ee50881d0e07b587ca5 @ossguy committed May 25, 2009
Showing with 4 additions and 1 deletion.
  1. +4 −1 Makefile
@@ -27,8 +27,11 @@ LDFLAGS = $(shell test -d ../pcre && echo -L../pcre) -lpcre
all: driver combine
driver: driver.o libbitconvert.a
-driver.o: driver.c bitconvert.h
+ $(CC) driver.o libbitconvert.a -o $@ $(LDFLAGS)
combine: combine.o libbitconvert.a
+ $(CC) combine.o libbitconvert.a -o $@ $(LDFLAGS)
+driver.o: driver.c bitconvert.h
combine.o: combine.c bitconvert.h
bitconvert.o: bitconvert.c bitconvert.h

0 comments on commit 20f1019

Please sign in to comment.