2012-05-11 11:00:08

by Du, ChangbinX

[permalink] [raw]
Subject: [PATCH 1/3] testusb: fix a makefile bug in tools/usb

For gcc, link options must behind of compiling options, else it could lead to "undefined reference ..." error since gcc cannot find specific library.

Signed-off-by: Du Changbin <[email protected]>
---
tools/usb/Makefile | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/usb/Makefile b/tools/usb/Makefile index 396d6c4..acf2165 100644
--- a/tools/usb/Makefile
+++ b/tools/usb/Makefile
@@ -3,11 +3,12 @@
CC = $(CROSS_COMPILE)gcc
PTHREAD_LIBS = -lpthread
WARNINGS = -Wall -Wextra
-CFLAGS = $(WARNINGS) -g $(PTHREAD_LIBS) -I../include
+CFLAGS = $(WARNINGS) -g -I../include
+LDFLAGS = $(PTHREAD_LIBS)

all: testusb ffs-test
%: %.c
- $(CC) $(CFLAGS) -o $@ $^
+ $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)

clean:
$(RM) testusb ffs-test
--
1.7.9.5


2012-05-11 22:10:34

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 1/3] testusb: fix a makefile bug in tools/usb

On Fri, May 11, 2012 at 11:00:01AM +0000, Du, ChangbinX wrote:
> For gcc, link options must behind of compiling options, else it could lead to "undefined reference ..." error since gcc cannot find specific library.

How is this working today? What version of gcc causes this change to be
needed? What about clang, does this also work there?

And please, wrap your changelog comments at column 72.

Care to resend after providing this information?

thanks,

greg k-h