Merge pull request #51 from DanielO/master
authortexane <texane@gmail.com>
Tue, 31 Jan 2012 17:11:04 +0000 (09:11 -0800)
committertexane <texane@gmail.com>
Tue, 31 Jan 2012 17:11:04 +0000 (09:11 -0800)
Use pkg-config to find libusb

Makefile
flash/Makefile
gdbserver/Makefile
src/stlink-sg.h
src/stlink-usb.c
src/stlink-usb.h

index 6bf02323d731c9b8d0e360c8b34bcfe812a40897..4bb0608b1d2ca5317c3939713d8e7bbdbb8112d8 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -5,7 +5,11 @@ VPATH=src
 SOURCES_LIB=stlink-common.c stlink-usb.c stlink-sg.c uglylogging.c
 OBJS_LIB=$(SOURCES_LIB:.c=.o)
 TEST_PROGRAMS=test_usb test_sg
-LDFLAGS=-L. -lstlink -lusb-1.0
+LDFLAGS=-L. -lstlink 
+
+# libusb location
+LDFLAGS+=`pkg-config --libs libusb-1.0`
+CFLAGS+=`pkg-config --cflags libusb-1.0`
 
 CFLAGS+=-g
 CFLAGS+=-DDEBUG=1
index cb7dcd2c27491ed9ac0daa5c4891acae3f23b160..4914587179b287eb3d4560c06f770313cd955912 100644 (file)
@@ -4,7 +4,11 @@ CFLAGS+=-std=gnu99
 CFLAGS+=-Wall -Wextra
 CFLAGS+=-I../src
 
-LDFLAGS=-L.. -lstlink -lusb-1.0
+LDFLAGS=-L.. -lstlink
+
+# libusb location
+LDFLAGS+=`pkg-config --libs libusb-1.0`
+CFLAGS+=`pkg-config --cflags libusb-1.0`
 
 SRCS=main.c
 OBJS=$(SRCS:.c=.o)
index 8cca5726d25abc341c23f786804b8fc0b36a3547..bd5c73dbc9107f0be46c32533a604001d4d29362 100644 (file)
@@ -2,7 +2,11 @@ PRG := st-util
 OBJS = gdb-remote.o gdb-server.o
 
 CFLAGS+=-g -Wall -Werror -std=gnu99 -I../src
-LDFLAGS=-L.. -lstlink -lusb-1.0
+LDFLAGS=-L.. -lstlink
+
+# libusb location
+LDFLAGS+=`pkg-config --libs libusb-1.0`
+CFLAGS+=`pkg-config --cflags libusb-1.0`
 
 all: $(PRG)
 
index d4d7723b84a7327fb608586ef889f3c1c6920c9f..beecac324e63b9408f1353789c70dedbacb17bb3 100644 (file)
@@ -12,7 +12,7 @@
 extern "C" {
 #endif
     
-#include <libusb-1.0/libusb.h>
+#include <libusb.h>
 #include "stlink-common.h"
     
         // device access
index 65d92ecabb2bbebc19b5fd167ba9708edc411e5b..2a82b8837230d6f27df12436ecf633cf47bf0ee4 100644 (file)
@@ -4,7 +4,7 @@
 #include <stdint.h>
 #include <time.h>
 #include <sys/types.h>
-#include <libusb-1.0/libusb.h>
+#include <libusb.h>
 
 #include "stlink-common.h"
 #include "stlink-usb.h"
index 2f3b8cc3ed7f84c17994debaaa68da442aaf86bd..63b53695e270fd5ecd1e5ec28ae6c4636d630ba3 100644 (file)
@@ -12,7 +12,7 @@
 extern "C" {
 #endif
 
-#include <libusb-1.0/libusb.h>
+#include <libusb.h>
 #include "stlink-common.h"
     
 #define STLINK_SG_SIZE 31