Makefile 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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. # @rm nmiejs.wasm
  54. emcc --bind -lm -Wall -pedantic -O2 -std=c++11 \
  55. -s EXPORT_ES6=1 \
  56. -s NO_DISABLE_EXCEPTION_CATCHING \
  57. -s MODULARIZE=1 \
  58. -s ASSERTIONS=1 \
  59. -s WASM=1 \
  60. -s ALLOW_MEMORY_GROWTH=1 \
  61. -s EXPORT_NAME="createNmiejsModule" \
  62. -s ENVIRONMENT="web" \
  63. -o nmiejs.js $(SRCDIR)/nmie-js-wrapper.cc
  64. @cp -f nmiejs.js guiapp/src/
  65. @cp -f nmiejs.wasm guiapp/public/
  66. @cp -f nmiejs.wasm guiapp/src/
  67. # 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
  68. # 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
  69. # 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
  70. # 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
  71. # 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
  72. # 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
  73. # "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",
  74. # emcc -O2 \
  75. # oniguruma/src/.libs/libonig.so \
  76. # src/onigasm.cc\
  77. # -Isrc -Ioniguruma/src \
  78. # -s ENVIRONMENT=shell \
  79. # -s NO_EXIT_RUNTIME=1 \
  80. # -s NO_FILESYSTEM=1 \
  81. # -s TOTAL_MEMORY=157286400 \
  82. # -s ALLOW_MEMORY_GROWTH=1 \
  83. # -s DEMANGLE_SUPPORT=1 \
  84. # -s EXTRA_EXPORTED_RUNTIME_METHODS="['ccall']" \
  85. # -s MODULARIZE=1 \
  86. # -s EXPORT_NAME="'Onigasm'" \
  87. # -o lib/onigasm.js
  88. clean:
  89. $(PYTHON) setup.py clean
  90. $(MAKE) -f $(CURDIR)/debian/rules clean
  91. rm -rf build/ MANIFEST
  92. find . -name '*.pyc' -delete
  93. find . -name '*.o' -delete
  94. find . -name '*.so' -delete