|
@@ -13,9 +13,24 @@ CFLAGS += -fPIC
|
|
|
OBJFILES := schmidt_trigger.o ringbuf.o monotonic_queue.o
|
|
|
OBJFILES += jump_rope_count_device.o
|
|
|
|
|
|
-all: libjump.so demo/demo
|
|
|
-
|
|
|
-libjump.so: $(OBJFILES)
|
|
|
+DYLIB_SUFFIX=unknown
|
|
|
+UNAME_S := $(shell uname -s)
|
|
|
+ifeq ($(UNAME_S), Linux)
|
|
|
+ DYLIB_SUFFIX=.so
|
|
|
+endif
|
|
|
+ifeq ($(UNAME_S), Darwin)
|
|
|
+ DYLIB_SUFFIX=.dylib
|
|
|
+endif
|
|
|
+
|
|
|
+ifeq ($(DYLIB_SUFFIX), unknown)
|
|
|
+ $(error Unsupported operating system)
|
|
|
+else
|
|
|
+ DYLIB := libjump$(DYLIB_SUFFIX)
|
|
|
+endif
|
|
|
+
|
|
|
+all: $(DYLIB) demo/demo
|
|
|
+
|
|
|
+$(DYLIB): $(OBJFILES)
|
|
|
cc -o $@ -shared $^
|
|
|
|
|
|
schmidt_trigger.o: schmidt_trigger.c schmidt_trigger.h
|
|
@@ -30,11 +45,11 @@ jump_rope_count_device.o: jump_rope_count_device.c \
|
|
|
.PHONY: clean
|
|
|
|
|
|
clean:
|
|
|
- rm -v -f $(OBJFILES) libjump.so
|
|
|
+ rm -v -f $(OBJFILES) $(DYLIB)
|
|
|
make -C demo clean
|
|
|
|
|
|
.PHONY: demo/demo
|
|
|
-demo/demo: libjump.so
|
|
|
+demo/demo: $(DYLIB)
|
|
|
make -C demo demo
|
|
|
|
|
|
.PHONY: test
|