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