Makefile 4.6 KB

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