diff --git a/Makefile b/Makefile index 6bf0232..4bb0608 100644 --- 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 diff --git a/flash/Makefile b/flash/Makefile index cb7dcd2..4914587 100644 --- a/flash/Makefile +++ b/flash/Makefile @@ -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) diff --git a/gdbserver/Makefile b/gdbserver/Makefile index 8cca572..bd5c73d 100644 --- a/gdbserver/Makefile +++ b/gdbserver/Makefile @@ -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) diff --git a/src/stlink-sg.h b/src/stlink-sg.h index d4d7723..beecac3 100644 --- a/src/stlink-sg.h +++ b/src/stlink-sg.h @@ -12,7 +12,7 @@ extern "C" { #endif -#include +#include #include "stlink-common.h" // device access diff --git a/src/stlink-usb.c b/src/stlink-usb.c index 65d92ec..2a82b88 100644 --- a/src/stlink-usb.c +++ b/src/stlink-usb.c @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include "stlink-common.h" #include "stlink-usb.h" diff --git a/src/stlink-usb.h b/src/stlink-usb.h index 2f3b8cc..63b5369 100644 --- a/src/stlink-usb.h +++ b/src/stlink-usb.h @@ -12,7 +12,7 @@ extern "C" { #endif -#include +#include #include "stlink-common.h" #define STLINK_SG_SIZE 31