Makefile 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. PYTHON=`which python`
  2. DESTDIR=/
  3. BUILDIR=$(CURDIR)/debian/python-scattnlay
  4. PROJECT=python-scattnlay
  5. VERSION=0.3.1
  6. all:
  7. @echo "make source - Create source package"
  8. @echo "make cython - Convert Cython code to c++"
  9. @echo "make python_ext - Create Python extension using C++ code"
  10. @echo "make cython_ext - Create Python extension using Cython code"
  11. @echo "make install - Install on local system"
  12. @echo "make buildrpm - Generate a rpm package"
  13. @echo "make builddeb - Generate a deb package"
  14. @echo "make standalone - Create a standalone program"
  15. @echo "make clean - Delete temporal files"
  16. # make standalone
  17. source:
  18. $(PYTHON) setup.py sdist $(COMPILE) --dist-dir=../
  19. cython: scattnlay.pyx
  20. cython --cplus scattnlay.pyx
  21. python_ext: nmie.cc py_nmie.cc scattnlay.cpp
  22. export CFLAGS='-std=c++11' && python setup.py build_ext --inplace
  23. cython_ext: nmie.cc py_nmie.cc scattnlay.pyx
  24. export CFLAGS='-std=c++11' && python setup_cython.py build_ext --inplace
  25. install:
  26. $(PYTHON) setup.py install --root $(DESTDIR) $(COMPILE)
  27. buildrpm:
  28. #$(PYTHON) setup.py bdist_rpm --post-install=rpm/postinstall --pre-uninstall=rpm/preuninstall
  29. $(PYTHON) setup.py bdist_rpm --dist-dir=../
  30. builddeb:
  31. # build the source package in the parent directory
  32. # then rename it to project_version.orig.tar.gz
  33. $(PYTHON) setup.py sdist $(COMPILE) --dist-dir=../ --prune
  34. rename -f 's/$(PROJECT)-(.*)\.tar\.gz/$(PROJECT)_$$1\.orig\.tar\.gz/' ../*
  35. # build the package
  36. export CFLAGS='-std=c++11' && dpkg-buildpackage -i -I -rfakeroot
  37. standalone: standalone.cc nmie.cc
  38. export CFLAGS='-std=c++11' && c++ -DNDEBUG -O2 -Wall -std=c++11 standalone.cc nmie.cc -lm -o scattnlay
  39. mv scattnlay ../
  40. clean:
  41. $(PYTHON) setup.py clean
  42. $(MAKE) -f $(CURDIR)/debian/rules clean
  43. rm -rf build/ MANIFEST
  44. find . -name '*.pyc' -delete
  45. find . -name '*.o' -delete
  46. find . -name '*.so' -delete