Makefile 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. # ANSI C conformance
  2. CFLAGS += -ansi -pedantic-errors -Werror=pedantic -fno-asm -fno-common
  3. # Optimization
  4. CFLAGS += -O3 -fipa-pta
  5. # Additional warnings
  6. CFLAGS += -Wall -Wextra
  7. # To build shared object
  8. CFLAGS += -fPIC
  9. OBJFILES := schmidt_trigger.o ringbuf.o monotonic_queue.o
  10. OBJFILES += jump_rope_count_device.o
  11. DYLIB_SUFFIX=unknown
  12. UNAME_S := $(shell uname -s)
  13. ifeq ($(UNAME_S), Linux)
  14. DYLIB_SUFFIX=.so
  15. endif
  16. ifeq ($(UNAME_S), Darwin)
  17. DYLIB_SUFFIX=.dylib
  18. endif
  19. ifeq ($(DYLIB_SUFFIX), unknown)
  20. $(error Unsupported operating system)
  21. else
  22. DYLIB := libjump$(DYLIB_SUFFIX)
  23. endif
  24. all: $(DYLIB) demo/demo
  25. $(DYLIB): $(OBJFILES)
  26. cc -o $@ -shared $^
  27. schmidt_trigger.o: schmidt_trigger.c schmidt_trigger.h
  28. ringbuf.o: ringbuf.c ringbuf.h
  29. monotonic_queue.o: monotonic_queue.c monotonic_queue.h
  30. jump_rope_count_device.o: jump_rope_count_device.c \
  31. jump_rope_count_device.h monotonic_queue.h ringbuf.h schmidt_trigger.h
  32. .PHONY: clean
  33. clean:
  34. rm -v -f $(OBJFILES) $(DYLIB)
  35. make -C demo clean
  36. .PHONY: demo/demo
  37. demo/demo: $(DYLIB)
  38. make -C demo demo
  39. .PHONY: test
  40. test: demo/demo
  41. make -C data test