summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
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)