Fix linking of fio executable
authorDiego Elio Pettenò <flameeyes@gmail.com>
Mon, 21 Mar 2011 19:13:53 +0000 (20:13 +0100)
committerJens Axboe <jaxboe@fusionio.com>
Mon, 21 Mar 2011 19:13:53 +0000 (20:13 +0100)
First of all make sure that $(LDFLAGS) are used during linking so that the
user can set the linker's flags.

Then also make sure that libraries are listed after the objects, so that
GNU ld's --as-needed option will not cause fio linking to fail.

Cc: Robin H. Johnson <robbat2@gentoo.org>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Makefile

index 07e011e332d8623b654f2eb374e1ad8a4be8e81a..1d815624c44228a1cedcfb1c28ccd8ddd4dff4aa 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -70,9 +70,9 @@ mandir = $(prefix)/man
 
 .c.o:
        $(QUIET_CC)$(CC) -o $@ -c $(CFLAGS) $(CPPFLAGS) $<
-       
+
 fio: $(OBJS)
-       $(QUIET_CC)$(CC) $(CFLAGS) -o $@ $(LIBS) $(OBJS)
+       $(QUIET_CC)$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(OBJS) $(LIBS)
 
 depend:
        $(QUIET_DEP)$(CC) -MM $(CFLAGS) $(CPPFLAGS) $(SOURCE) 1> .depend