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