Skip to content

Commit 92736a8

Browse files
committed
Honor PKG_CONFIG variable if exists
Some build systems want to pass location for pkg-config. Closes #315.
1 parent 9f1de74 commit 92736a8

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Makefile

+4-3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ INSTALL := install
1010
INSTALL_DIR := $(INSTALL) -m 755 -d
1111
INSTALL_PROGRAM := $(INSTALL) -m 755
1212
RM := rm -rf
13+
PKG_CONFIG ?= pkg-config
1314

1415
CC ?= gcc
1516
CFLAGS ?= -g -O0
@@ -26,9 +27,9 @@ ifeq ($(UNAME_S),Linux)
2627
endif
2728

2829
# Use pkg-config if available
29-
ifneq (,$(shell which pkg-config))
30-
CFLAGS += $(shell pkg-config --cflags libusb-1.0)
31-
LDFLAGS += $(shell pkg-config --libs libusb-1.0)
30+
ifneq (,$(shell which $(PKG_CONFIG)))
31+
CFLAGS += $(shell $(PKG_CONFIG) --cflags libusb-1.0)
32+
LDFLAGS += $(shell $(PKG_CONFIG) --libs libusb-1.0)
3233
else
3334
# But it should still build if pkg-config is not available (e.g. Linux or Mac homebrew)
3435
LDFLAGS += -lusb-1.0

0 commit comments

Comments
 (0)