Makefile 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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 for Python extension"
  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 Python extension on local system"
  12. @echo "make buildrpm - Generate a rpm package for Python extension"
  13. @echo "make builddeb - Generate a deb package for Python extension"
  14. @echo "make standalone - Create a standalone programs (scattnlay and fieldnlay)"
  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: farfield.cc nearfield.cc nmie.cc
  38. export CFLAGS='-std=c++11' && c++ -DNDEBUG -O2 -Wall -std=c++11 farfield.cc nmie.cc -lm -o scattnlay
  39. mv scattnlay ../
  40. export CFLAGS='-std=c++11' && c++ -DNDEBUG -O2 -Wall -std=c++11 nearfield.cc nmie.cc -lm -o fieldnlay
  41. mv fieldnlay ../
  42. clean:
  43. $(PYTHON) setup.py clean
  44. $(MAKE) -f $(CURDIR)/debian/rules clean
  45. rm -rf build/ MANIFEST
  46. find . -name '*.pyc' -delete
  47. find . -name '*.o' -delete
  48. find . -name '*.so' -delete