Makefile 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. CC=gcc
  2. CFLAGS=-O3 -std=c99 -D_DEFAULT_SOURCE
  3. #PYTHON_INC=/usr/include/python3.6
  4. PYTHON_INC=/usr/include/python3.5
  5. PY_BIN_FILES:=$(patsubst src/%.py,bin/%.py,$(wildcard src/*.py))
  6. PY_DEV_FILES:=$(patsubst src/%.py,dev/%.py,$(wildcard src/*.py))
  7. VALGRIND_SUPPRESSION_BIN_FILES:=$(patsubst src/%.supp,bin/%.supp,$(wildcard src/*.supp))
  8. VALGRIND_SUPPRESSION_DEV_FILES:=$(patsubst src/%.supp,dev/%.supp,$(wildcard src/*.supp))
  9. all: bin_dir $(PY_BIN_FILES) bin/accelerated_functions.so $(VALGRIND_SUPPRESSION_BIN_FILES)
  10. dev: dev_dir $(PY_DEV_FILES) dev/accelerated_functions.so $(VALGRIND_SUPPRESSION_DEV_FILES)
  11. clean:
  12. @if [ -d bin ]; then rm -r bin; fi
  13. @if [ -d dev ]; then rm -r dev; fi
  14. bin/accelerated_functions.so: src/accelerated_functions.c
  15. dev/accelerated_functions.so: src/accelerated_functions.c
  16. #######
  17. bin/%.so: src/%.c
  18. $(CC) $(CFLAGS) -I $(PYTHON_INC) -shared -fPIC $^ -o $@
  19. bin/%.py: src/%.py
  20. @cp $< $@
  21. bin/%.supp: src/%.supp
  22. @cp $< $@
  23. bin_dir:
  24. @mkdir -p bin
  25. #######
  26. dev/%.so: src/%.c
  27. $(CC) $(CFLAGS) -I $(PYTHON_INC) -shared -fPIC $^ -o $@
  28. dev/%.py: src/%.py
  29. rm -f $@
  30. ln $< $@
  31. dev/%.supp: src/%.supp
  32. rm -f $@
  33. ln $< $@
  34. dev_dir:
  35. @mkdir -p dev