Makefile 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #
  2. # **************************************************************
  3. # * C++ Mathematical Expression Toolkit Library *
  4. # * *
  5. # * Author: Arash Partow (1999-2020) *
  6. # * URL: http://www.partow.net/programming/exprtk/index.html *
  7. # * *
  8. # * Copyright notice: *
  9. # * Free use of the Mathematical Expression Toolkit Library is *
  10. # * permitted under the guidelines and in accordance with the *
  11. # * most current version of the MIT License. *
  12. # * http://www.opensource.org/licenses/MIT *
  13. # * *
  14. # **************************************************************
  15. #
  16. COMPILER := -c++
  17. #COMPILER := -clang++
  18. OPTIMIZATION_OPT := -O1
  19. BASE_OPTIONS := -pedantic-errors -Wall -Wextra -Werror -Wno-long-long
  20. OPTIONS := $(BASE_OPTIONS) $(OPTIMIZATION_OPT)
  21. LINKER_OPT := -L/usr/lib -lstdc++ -lm
  22. ASAN_OPT := -g -fsanitize=address -fno-omit-frame-pointer
  23. MSAN_OPT := -g -fsanitize=memory -fno-omit-frame-pointer
  24. LSAN_OPT := -g -fsanitize=leak -fno-omit-frame-pointer
  25. USAN_OPT := -g -fsanitize=undefined -fno-omit-frame-pointer
  26. BUILD_SRC := $(sort $(wildcard exprtk_*.cpp))
  27. BUILD_LIST := $(BUILD_SRC:%.cpp=%)
  28. all: $(BUILD_LIST)
  29. $(BUILD_LIST) : %: %.cpp exprtk.hpp
  30. $(COMPILER) $(OPTIONS) -o $@ $@.cpp $(LINKER_OPT)
  31. strip_bin :
  32. @for f in $(BUILD_LIST); do if [ -f $$f ]; then strip -s $$f; echo $$f; fi done;
  33. valgrind :
  34. @for f in $(BUILD_LIST); do \
  35. if [ -f $$f ]; then \
  36. cmd="valgrind --leak-check=full --show-reachable=yes --track-origins=yes --log-file=$$f.log -v ./$$f"; \
  37. echo $$cmd; \
  38. $$cmd; \
  39. fi done;
  40. pgo: exprtk_benchmark.cpp exprtk.hpp
  41. $(COMPILER) $(BASE_OPTIONS) -O3 -march=native -fprofile-generate -o exprtk_benchmark exprtk_benchmark.cpp $(LINKER_OPT)
  42. ./exprtk_benchmark
  43. $(COMPILER) $(BASE_OPTIONS) -O3 -march=native -fprofile-use -o exprtk_benchmark exprtk_benchmark.cpp $(LINKER_OPT)
  44. clean:
  45. rm -f core.* *~ *.o *.bak *stackdump gmon.out *.gcda *.gcno *.gcnor *.gch