Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions projects/unix/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,14 @@ ifeq ($(OS), OSX)
endif
endif

# test for essential build dependencies
ifeq ($(origin PKG_CONFIG), undefined)
PKG_CONFIG = $(CROSS_COMPILE)pkg-config
ifeq ($(shell which $(PKG_CONFIG) 2>/dev/null),)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't use this. "which" is less likely to be installed than "pkg-config".

"command -v" is a portable (POSIX mandated) equivalent to "which".

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll see about improving the check for mupen64plus-core in the near future and then change it here too depending on their response.

$(error $(PKG_CONFIG) not found)
endif
endif

ifeq ($(OS), LINUX)
HIDAPI_NAME=hidapi-hidraw
else
Expand All @@ -145,17 +153,11 @@ endif

# test for presence of HIDLIB
ifeq ($(origin HID_CFLAGS) $(origin HID_LDLIBS), undefined undefined)
HIDAPI_CONFIG = $(CROSS_COMPILE)pkg-config $(HIDAPI_NAME)
ifeq ($(shell which $(HIDAPI_CONFIG) 2>/dev/null),)
HIDAPI_CONFIG = $(CROSS_COMPILE)pkg-config $(HIDAPI_NAME)
ifeq ($(shell which $(HIDAPI_CONFIG) 2>/dev/null),)
$(error No HIDAPI development libraries found!)
else
$(warning Using HIDAPI libraries)
endif
ifeq ($(shell $(PKG_CONFIG) --modversion $(HIDAPI_NAME) 2>/dev/null),)
$(error No HIDAPI development libraries found!)
endif
HID_CFLAGS += $(shell $(HIDAPI_CONFIG) --cflags)
HID_LDLIBS += $(shell $(HIDAPI_CONFIG) --libs)
HID_CFLAGS = $(shell $(PKG_CONFIG) --cflags $(HIDAPI_NAME))
HID_LDLIBS = $(shell $(PKG_CONFIG) --libs $(HIDAPI_NAME))
endif
CFLAGS += $(HID_CFLAGS)
LDLIBS += $(HID_LDLIBS)
Expand Down