1SRCDIR = ../single_include
2SED:=$(shell command -v gsed || which sed)
3
4all: doxygen
5
6
7##########################################################################
8# example files
9##########################################################################
10
11# where are the example cpp files
12EXAMPLES = $(wildcard examples/*.cpp)
13
14# create output from a stand-alone example file
15%.output: %.cpp
16	make $(<:.cpp=) CPPFLAGS="-I $(SRCDIR)" CXXFLAGS="-std=c++11"
17	./$(<:.cpp=) > $@
18	rm $(<:.cpp=)
19
20# compare created output with current output of the example files
21%.test: %.cpp
22	make $(<:.cpp=) CPPFLAGS="-I $(SRCDIR)" CXXFLAGS="-std=c++11"
23	./$(<:.cpp=) > $@
24	diff $@ $(<:.cpp=.output)
25	rm $(<:.cpp=) $@
26
27# create links to try the code online
28%.link: %.cpp
29	rm -fr tmp
30	mkdir tmp
31	cp -r $(SRCDIR)/nlohmann tmp
32	python2 scripts/send_to_wandbox.py tmp $< > $@.tmp
33	/bin/echo -n "<a target=\"_blank\" href=\"`cat $@.tmp`\"><b>online</b></a>" > $@
34	rm -fr tmp $@.tmp
35
36# create output from all stand-alone example files
37create_output: $(EXAMPLES:.cpp=.output)
38
39create_links: $(EXAMPLES:.cpp=.link)
40
41# check output of all stand-alone example files
42check_output: $(EXAMPLES:.cpp=.test)
43
44
45clean:
46	rm -fr me.nlohmann.json.docset html $(EXAMPLES:.cpp=)
47
48
49##########################################################################
50# Doxygen HTML documentation
51##########################################################################
52
53# create Doxygen documentation
54doxygen: create_output create_links
55	doxygen
56	$(SED) -i 's@&lt; ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberFloatType, AllocatorType, JSONSerializer &gt;@@g' html/*.html
57	$(SED) -i 's@&lt;&#160;ObjectType,&#160;ArrayType,&#160;StringType,&#160;BooleanType,&#160;NumberIntegerType,&#160;NumberFloatType,&#160;AllocatorType&#160;JSONSerializer&#160;&gt;@@g' html/*.html
58	$(SED) -i 's@&lt; ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer &gt;@@g' html/*.html
59	$(SED) -i 's@< ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer >@@g' html/*.html
60	$(SED) -i 's@&lt;&#160;ObjectType,&#160;ArrayType,&#160;StringType,&#160;BooleanType,&#160;NumberIntegerType,&#160;NumberUnsignedType,&#160;NumberFloatType,&#160;AllocatorType&#160;JSONSerializer&#160;&gt;@@g' html/*.html
61	$(SED) -i 's@template&lt;template&lt; typename U, typename V, typename... Args &gt; class ObjectType = std::map, template&lt; typename U, typename... Args &gt; class ArrayType = std::vector, class StringType = std::string, class BooleanType = bool, class NumberIntegerType = std::int64_t, class NumberUnsignedType = std::uint64_t, class NumberFloatType = double, template&lt; typename U &gt; class AllocatorType = std::allocator, template&lt; typename T, typename SFINAE=void &gt; class JSONSerializer = adl_serializer&gt;@@g' html/*.html
62	$(SED) -i 's@&lt; ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberUnsignedType, NumberFloatType, AllocatorType, JSONSerializer &gt;@@g' html/*.html
63	$(SED) -i 's@&lt;&#160;ObjectType,&#160;ArrayType,&#160;StringType,&#160;BooleanType,&#160;NumberIntegerType,&#160;NumberUnsignedType,&#160;NumberFloatType,&#160;AllocatorType,&#160;JSONSerializer&#160;&gt;@@g' html/*.html
64	$(SED) -i 's@JSON_HEDLEY_RETURNS_NON_NULL@@g' html/*.html
65	$(SED) -i 's@JSON_HEDLEY_WARN_UNUSED_RESULT@@g' html/*.html
66
67upload: clean doxygen check_output
68	scripts/git-update-ghpages nlohmann/json html
69	rm -fr html
70	open http://nlohmann.github.io/json/
71
72
73##########################################################################
74# docset
75##########################################################################
76
77# create docset for Dash
78docset: create_output
79	cp Doxyfile Doxyfile_docset
80	$(SED) -i 's/DISABLE_INDEX          = NO/DISABLE_INDEX          = YES/' Doxyfile_docset
81	$(SED) -i 's/SEARCHENGINE           = YES/SEARCHENGINE           = NO/' Doxyfile_docset
82	$(SED) -i 's@HTML_EXTRA_STYLESHEET  = css/mylayout.css@HTML_EXTRA_STYLESHEET  = css/mylayout_docset.css@' Doxyfile_docset
83	rm -fr html *.docset
84	doxygen Doxyfile_docset
85	$(SED) -i 's@&lt; ObjectType, ArrayType, StringType, BooleanType, NumberIntegerType, NumberFloatType, AllocatorType &gt;@@g' html/*.html
86	$(SED) -i 's@&lt;&#160;ObjectType,&#160;ArrayType,&#160;StringType,&#160;BooleanType,&#160;NumberIntegerType,&#160;NumberFloatType,&#160;AllocatorType&#160;&gt;@@g' html/*.html
87	make -C html
88	mv html/*.docset .
89	$(SED) -i 's@<string>doxygen</string>@<string>json</string>@' me.nlohmann.json.docset/Contents/Info.plist
90	rm -fr Doxyfile_docset html
91