git » nmdb » commit 934fab2

Put the objects before the libraries when building

author Alberto Bertogli
2012-09-12 20:24:50 UTC
committer Alberto Bertogli
2012-09-12 20:24:50 UTC
parent 64ca6e81024bb4b608e026b2e2e0e90aabe97596

Put the objects before the libraries when building

Newer gcc requires the objects to come before the libraries, otherwise it
fails to link.

Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>

tests/c/make.sh +2 -2
utils/Makefile +1 -2

diff --git a/tests/c/make.sh b/tests/c/make.sh
index f8dda75..0cf980f 100755
--- a/tests/c/make.sh
+++ b/tests/c/make.sh
@@ -3,7 +3,7 @@
 set -e
 
 USAGE="\
-Use: build.sh [build|debug_build|strict_build|profile_build|clean]
+Use: $0 [build|debug_build|strict_build|profile_build|clean]
 "
 
 
@@ -45,7 +45,7 @@ for p in TIPC TCP UDP SCTP MULT; do
 			else
 				# build only if src is newer than the binary
 				if [ "$t.c" -nt "$t-$OP" ]; then
-					cc -lnmdb $ALLCF $TF -o $t-$OP $t.c
+					cc $t.c -lnmdb $ALLCF $TF -o $t-$OP
 				fi
 			fi
 		done
diff --git a/utils/Makefile b/utils/Makefile
index b56f6ae..04dfb2b 100644
--- a/utils/Makefile
+++ b/utils/Makefile
@@ -27,8 +27,7 @@ default: all
 all: nmdb-stats
 
 nmdb-stats: nmdb-stats.o
-	$(NICE_CC) $(ALL_CFLAGS) -L../libnmdb -lnmdb nmdb-stats.o \
-		-o nmdb-stats
+	$(NICE_CC) $(ALL_CFLAGS) $< -L../libnmdb -lnmdb -o $@
 
 .c.o:
 	$(NICE_CC) $(ALL_CFLAGS) -I../libnmdb -c $< -o $@