summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorVadim Mikhailov <vadim.mikhailov@gmail.com>2017-04-04 17:36:50 -0700
committerVadim Mikhailov <mvp@users.noreply.github.com>2017-04-06 11:43:02 -0700
commit40d446b3943d2b4dcee9b51a9007d54045e6efb8 (patch)
tree6167df9b805ae661799497e34009e6317694552a /Makefile
parent37057c241e3282fca8e6a3ba9fe6c43e91e06fc7 (diff)
Add support for FreeBSD and MacPorts on Mac
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile20
1 files changed, 16 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index 936ed35..311d62c 100644
--- a/Makefile
+++ b/Makefile
@@ -13,17 +13,29 @@ RM := rm -rf
CC ?= gcc
CFLAGS ?= -g -O0
-
-CFLAGS += -Wall -Wextra
+CFLAGS += -Wall -Wextra
ifeq ($(UNAME_S),Linux)
- LDFLAGS += -Wl,-z,relro
+ LDFLAGS += -Wl,-z,relro -lusb-1.0
+endif
+
+ifeq ($(UNAME_S),Darwin)
+ifneq ($(wildcard /opt/local/include),)
+ # MacPorts
+ CFLAGS += -I/opt/local/include
+ LDFLAGS += -L/opt/local/lib
+endif
+ LDFLAGS += -lusb-1.0
+endif
+
+ifeq ($(UNAME_S),FreeBSD)
+ LDFLAGS += -lusb
endif
PROGRAM = uhubctl
$(PROGRAM): $(PROGRAM).c
- $(CC) $(CFLAGS) $@.c -o $@ -lusb-1.0 $(LDFLAGS)
+ $(CC) $(CFLAGS) $@.c -o $@ $(LDFLAGS)
install:
$(INSTALL_DIR) $(DESTDIR)$(sbindir)