Makefile 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. SRCDIR = ../single_include
  2. all: create_output
  3. ##########################################################################
  4. # example files
  5. ##########################################################################
  6. # where are the example cpp files
  7. EXAMPLES = $(wildcard examples/*.cpp)
  8. cxx_standard = $(lastword c++11 $(filter c++%, $(subst ., ,$1)))
  9. # create output from a stand-alone example file
  10. %.output: %.cpp
  11. @echo "standard $(call cxx_standard $(<:.cpp=))"
  12. $(MAKE) $(<:.cpp=) \
  13. CPPFLAGS="-I $(SRCDIR) -DJSON_USE_GLOBAL_UDLS=0" \
  14. CXXFLAGS="-std=$(call cxx_standard,$(<:.cpp=)) -Wno-deprecated-declarations"
  15. ./$(<:.cpp=) > $@
  16. rm $(<:.cpp=)
  17. # compare created output with current output of the example files
  18. %.test: %.cpp
  19. $(MAKE) $(<:.cpp=) \
  20. CPPFLAGS="-I $(SRCDIR) -DJSON_USE_GLOBAL_UDLS=0" \
  21. CXXFLAGS="-std=$(call cxx_standard,$(<:.cpp=)) -Wno-deprecated-declarations"
  22. ./$(<:.cpp=) > $@
  23. diff $@ $(<:.cpp=.output)
  24. rm $(<:.cpp=) $@
  25. # create output from all stand-alone example files
  26. create_output: $(EXAMPLES:.cpp=.output)
  27. # check output of all stand-alone example files
  28. check_output: $(EXAMPLES:.cpp=.test)
  29. # check output of all stand-alone example files (exclude files with platform-dependent output.)
  30. # This target is used in the CI (ci_test_documentation).
  31. check_output_portable: $(filter-out examples/meta.test examples/max_size.test examples/std_hash.test examples/basic_json__CompatibleType.test,$(EXAMPLES:.cpp=.test))
  32. clean:
  33. rm -fr $(EXAMPLES:.cpp=)
  34. $(MAKE) clean -C docset
  35. $(MAKE) clean -C mkdocs