aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHuang Rui <ray.huang@amd.com>2013-12-04 02:56:10 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-12-04 18:10:54 -0500
commitcb292ce222cb5ad5b8b3f9fc4b74b8109fb16c19 (patch)
treeea58f50749780a5226e3683e9c0abf09d0e2a7ed
parenteee52f9edd0ff0a1e65a6fed836c7dbaeded7355 (diff)
usb: tools: fix a regression issue that gcc can't link to pthread
Reproduce: ray@hr-bak:~/usb$ make -C tools/usb/ make: Entering directory `/home/ray/usb/tools/usb' gcc -Wall -Wextra -g -lpthread -I../include -o testusb testusb.c /tmp/cc0EMxfy.o: In function `main': /home/ray/usb/tools/usb/testusb.c:508: undefined reference to `pthread_create' /home/ray/usb/tools/usb/testusb.c:531: undefined reference to `pthread_join' collect2: error: ld returned 1 exit status make: *** [testusb] Error 1 make: Leaving directory `/home/ray/usb/tools/usb' Comments: In the latest version (4.7.3) of gcc compiler, it requres that libraries must follow the object or source files like below: "gcc hello.c -lpthread" instead of "gcc -lpthread hello.c" And it isn't encountered at gcc version 4.7.2. So this patch fix to move the pthread option after testusb.c. Signed-off-by: Huang Rui <ray.huang@amd.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--tools/usb/Makefile5
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/usb/Makefile b/tools/usb/Makefile
index 396d6c44e9d7..acf2165c04e6 100644
--- a/tools/usb/Makefile
+++ b/tools/usb/Makefile
@@ -3,11 +3,12 @@
3CC = $(CROSS_COMPILE)gcc 3CC = $(CROSS_COMPILE)gcc
4PTHREAD_LIBS = -lpthread 4PTHREAD_LIBS = -lpthread
5WARNINGS = -Wall -Wextra 5WARNINGS = -Wall -Wextra
6CFLAGS = $(WARNINGS) -g $(PTHREAD_LIBS) -I../include 6CFLAGS = $(WARNINGS) -g -I../include
7LDFLAGS = $(PTHREAD_LIBS)
7 8
8all: testusb ffs-test 9all: testusb ffs-test
9%: %.c 10%: %.c
10 $(CC) $(CFLAGS) -o $@ $^ 11 $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
11 12
12clean: 13clean:
13 $(RM) testusb ffs-test 14 $(RM) testusb ffs-test