Makefile 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. PYTHON=`which python3`
  2. DESTDIR=/
  3. PROJECT=python-scattnlay
  4. VERSION=2.3
  5. BUILDIR=$(CURDIR)/debian/$(PROJECT)
  6. SRCDIR=$(CURDIR)/src
  7. MULTIPREC=100
  8. CXX_NMIE_HEADERS=$(SRCDIR)/nmie.hpp $(SRCDIR)/nmie-basic.hpp $(SRCDIR)/nmie-nearfield.hpp $(SRCDIR)/nmie-precision.hpp
  9. all:
  10. @echo "make source - Create source package for Python extension"
  11. @echo "make ext - Create Python extension in place"
  12. @echo "make install - Install Python extension on local system"
  13. @echo "make rpm - Generate a rpm package for Python extension"
  14. @echo "make deb - Generate a deb package for Python extension"
  15. @echo "make standalone - Create standalone programs (scattnlay and fieldnlay)"
  16. @echo "make clean - Delete temporal files"
  17. # make standalone
  18. source:
  19. $(PYTHON) setup.py sdist $(COMPILE) --dist-dir=../
  20. ext: $(SRCDIR)/pb11_wrapper.cc $(CXX_NMIE_HEADERS)
  21. $(PYTHON) setup.py build_ext --inplace
  22. install:
  23. $(PYTHON) setup.py install --root $(DESTDIR) $(COMPILE)
  24. rpm:
  25. #$(PYTHON) setup.py bdist_rpm --post-install=rpm/postinstall --pre-uninstall=rpm/preuninstall
  26. $(PYTHON) setup.py bdist_rpm --dist-dir=../
  27. deb: source
  28. # build the source package in the parent directory
  29. # then rename it to project_version.orig.tar.gz
  30. rename -f 's/$(PROJECT)-(.*)\.tar\.gz/$(PROJECT)_$$1\.orig\.tar\.gz/' ../*
  31. # build the package
  32. dpkg-buildpackage -i -I -rfakeroot
  33. standalone: scattnlay-dp fieldnlay-dp scattnlay-mp fieldnlay-mp
  34. # standalone programs with DP
  35. scattnlay-dp: $(SRCDIR)/farfield.cc $(SRCDIR)/nmie.cc $(CXX_NMIE_HEADERS)
  36. $(CXX) -DNDEBUG -O2 -Wall -std=c++11 $(SRCDIR)/farfield.cc $(SRCDIR)/nmie.cc -lm -o scattnlay-dp $(CXXFLAGS) $(LDFLAGS)
  37. fieldnlay-dp: $(SRCDIR)/nearfield.cc $(SRCDIR)/nmie.cc $(CXX_NMIE_HEADERS)
  38. $(CXX) -DNDEBUG -O2 -Wall -std=c++11 $(SRCDIR)/nearfield.cc $(SRCDIR)/nmie.cc -lm -o fieldnlay-dp $(CXXFLAGS) $(LDFLAGS)
  39. # standalone programs with MP
  40. scattnlay-mp: $(SRCDIR)/farfield.cc $(SRCDIR)/nmie.cc $(CXX_NMIE_HEADERS)
  41. $(CXX) -DNDEBUG -DMULTI_PRECISION=$(MULTIPREC) -O2 -Wall -std=c++11 $(SRCDIR)/farfield.cc $(SRCDIR)/nmie.cc -lm -o scattnlay-mp $(CXXFLAGS) $(LDFLAGS)
  42. fieldnlay-mp: $(SRCDIR)/nearfield.cc $(SRCDIR)/nmie.cc $(CXX_NMIE_HEADERS)
  43. $(CXX) -DNDEBUG -DMULTI_PRECISION=$(MULTIPREC) -O2 -Wall -std=c++11 $(SRCDIR)/nearfield.cc $(SRCDIR)/nmie.cc -lm -o fieldnlay-mp $(CXXFLAGS) $(LDFLAGS)
  44. wasm: $(SRCDIR)/nmie-js-wrapper.cc $(CXX_NMIE_HEADERS)
  45. # emcc -lm -Wall -O2 -std=c++11 --bind -s ENVIRONMENT="web" -s MODULARIZE=1 -s SINGLE_FILE=1 -s WASM=1 -o nmie.js $(SRCDIR)/nmie-js-wrapper.cc
  46. # emcc --bind -lm -Wall -O2 -std=c++11 -s WASM=1 -s NO_EXIT_RUNTIME=1 -s "EXTRA_EXPORTED_RUNTIME_METHODS=['addOnPostRun']" -o nmiejs.js $(SRCDIR)/nmie-js-wrapper.cc
  47. # emcc --bind -lm -Wall -O2 -std=c++11 -s MODULARIZE=1 -s WASM=1 -o nmie.js $(SRCDIR)/nmie-js-wrapper.cc
  48. # working as 2024-01-31 16:47:23
  49. emcc --bind -lm -Wall -pedantic -O2 -std=c++11 -s NO_DISABLE_EXCEPTION_CATCHING -s MODULARIZE=1 -s ASSERTIONS=1 -s WASM=1 -s ALLOW_MEMORY_GROWTH=1 -s EXPORT_NAME="nmiejs" -s ENVIRONMENT="web" -o nmiejs.js $(SRCDIR)/nmie-js-wrapper.cc
  50. @cp -f nmiejs.js guiapp/src/
  51. @cp -f nmiejs.wasm guiapp/public/
  52. # working with vite export
  53. emcc --bind -lm -Wall -pedantic -O2 -std=c++11 -s EXPORT_ES6=1 -s NO_DISABLE_EXCEPTION_CATCHING -s MODULARIZE=1 -s ASSERTIONS=1 -s WASM=1 -s ALLOW_MEMORY_GROWTH=1 -s EXPORT_NAME="nmiejs" -s ENVIRONMENT="web" -o nmiejs.js $(SRCDIR)/nmie-js-wrapper.cc
  54. @cp -f nmiejs.js guiapp-vite/src/
  55. @cp -f nmiejs.wasm guiapp-vite/public/
  56. @cp -f nmiejs.wasm guiapp-vite/src/
  57. # emcc --bind -lm -Wall -pedantic -Oz -std=c++11 -s NO_DISABLE_EXCEPTION_CATCHING -s MODULARIZE=1 -s ASSERTIONS=1 -s WASM=1 -s ALLOW_MEMORY_GROWTH=1 -s EXPORT_NAME="nmiejs" -s ENVIRONMENT="web" -o nmiejs.js $(SRCDIR)/nmie-js-wrapper.cc
  58. # emcc --bind -lm -Wall -pedantic -Oz -std=c++11 -s NO_DISABLE_EXCEPTION_CATCHING -s MODULARIZE=1 -s EXPORT_ES6=1 -s ASSERTIONS=1 -s WASM=1 -s ALLOW_MEMORY_GROWTH=1 -s EXPORT_NAME="nmiejs" -s ENVIRONMENT="web" -o nmiejs.js $(SRCDIR)/nmie-js-wrapper.cc
  59. # emcc --bind -lm -Wall -pedantic -O2 -std=c++11 -s NO_DISABLE_EXCEPTION_CATCHING -s MODULARIZE=1 -s EXPORT_ES6=1 -s ASSERTIONS=1 -s WASM=1 -s ALLOW_MEMORY_GROWTH=1 -s EXPORT_NAME="nmiejs" -s ENVIRONMENT="web" -o nmiejs.js $(SRCDIR)/nmie-js-wrapper.cc
  60. # emcc --bind -lm -Wall -O3 -std=c++11 -s WASM=1 -s EXTRA_EXPORTED_RUNTIME_METHODS='["cwrap"]' -s ALLOW_MEMORY_GROWTH=1 -s MODULARIZE=1 -s 'EXPORT_NAME="nmiejs"' -o ./nmiejs.js $(SRCDIR)/nmie-js-wrapper.cc
  61. # emcc -g --bind -lm -Wall -std=c++11 -s WASM=1 -s NO_EXIT_RUNTIME=1 -s "EXTRA_EXPORTED_RUNTIME_METHODS=['addOnPostRun']" -o nmie.js $(SRCDIR)/nmie-js-wrapper.cc
  62. # emcc --bind -lm -Wall -O2 -std=c++11 -s MODULARIZE=1 -s EXPORT_ES6=1 -s WASM=1 -s NO_EXIT_RUNTIME=1 -s "EXTRA_EXPORTED_RUNTIME_METHODS=['addOnPostRun']" -o nmie.js $(SRCDIR)/nmie-js-wrapper.cc
  63. # "build:codec": "emcc -O3 -s WASM=1 -s EXTRA_EXPORTED_RUNTIME_METHODS='[\"cwrap\"]' -s ALLOW_MEMORY_GROWTH=1 -s MODULARIZE=1 -s 'EXPORT_NAME=\"fibonacci\"' -o ./fibonacci.js fibonacci.c",
  64. # emcc -O2 \
  65. # oniguruma/src/.libs/libonig.so \
  66. # src/onigasm.cc\
  67. # -Isrc -Ioniguruma/src \
  68. # -s ENVIRONMENT=shell \
  69. # -s NO_EXIT_RUNTIME=1 \
  70. # -s NO_FILESYSTEM=1 \
  71. # -s TOTAL_MEMORY=157286400 \
  72. # -s ALLOW_MEMORY_GROWTH=1 \
  73. # -s DEMANGLE_SUPPORT=1 \
  74. # -s EXTRA_EXPORTED_RUNTIME_METHODS="['ccall']" \
  75. # -s MODULARIZE=1 \
  76. # -s EXPORT_NAME="'Onigasm'" \
  77. # -o lib/onigasm.js
  78. clean:
  79. $(PYTHON) setup.py clean
  80. $(MAKE) -f $(CURDIR)/debian/rules clean
  81. rm -rf build/ MANIFEST
  82. find . -name '*.pyc' -delete
  83. find . -name '*.o' -delete
  84. find . -name '*.so' -delete