Makefile 721B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. SYSTEMD_WRAPPER_SCRIPT = cmgr
  2. LIB_GPIO_SRC = ../lib/gpio/
  3. GPIO_LIB_NAME = gpio
  4. SWIG = swig
  5. SWIG_OPT = -outcurrentdir -python
  6. PYTHON = python
  7. PYPY = pypy
  8. COPY = cp
  9. REMOVE = rm
  10. all: clean build test
  11. clean:
  12. -$(REMOVE) *.o
  13. -$(REMOVE) *.so
  14. -$(REMOVE) *wrap*
  15. -$(REMOVE) *.pyc
  16. -$(REMOVE) *.dll
  17. -$(REMOVE) *.exe
  18. -$(REMOVE) gpio.py
  19. -$(REMOVE) -rf build
  20. build: $(GPIO_LIB_NAME).c
  21. $(GPIO_LIB_NAME).c:
  22. @echo "Building $@"
  23. $(eval TMP := $(shell echo $@ | sed 's:\.[h|c]::g'))
  24. $(SWIG) $(SWIG_OPT) $(TMP).i
  25. $(PYTHON) setup_$(TMP).py build_ext --inplace
  26. $(PYPY) setup_$(TMP).py build_ext --inplace
  27. install:
  28. $(COPY) ${SYSTEMD_WRAPPER_SCRIPT} /usr/sbin/
  29. test:
  30. $(PYTHON) lib_test.py
  31. $(PYPY) lib_test.py