GNUmakefile (1969B)
1 # This Makefile is EXTREMELY simple. Let's keep it that way. 2 3 all: 4 @echo Random123 is a header-only package. There is nothing to build. 5 @echo 'However, "make install" understands prefix, DESTDIR, etc.,' 6 @echo 'and "make check" understands CFLAGS, CXXFLAGS, LDFLAGS, etc.' 7 @echo '"make html" will run doxygen to create docs/html' 8 .PHONY: all 9 10 check: 11 cd tests && $(MAKE) runcore 12 .PHONY: check 13 14 prefix?=/usr/local 15 includedir?=$(prefix)/include 16 datarootdir?=$(prefix)/share 17 datadir?=$(datarootdir) 18 docdir?=$(datarootdir)/doc/Random123 19 export prefix includedir datarootdir datadir docdir 20 21 install: install-html install-include install-examples install-tests 22 .PHONY: install 23 24 # recursively copy include/Random123 to $(includedir) 25 install-include: 26 mkdir -p $(DESTDIR)$(includedir) 27 cp -dr include/Random123 $(DESTDIR)$(includedir) 28 .PHONY: install-include 29 30 # docs/main.md is the same as README.md, but it has a @mainpage 31 # directive, and the @ref directives are *not* commented out. 32 docs/main.md : README.md 33 echo @mainpage Random123: a Library of Counter-Based Random Number Generators > docs/main.md 34 echo '<!--- DO NOT EDIT THIS FILE. IT IS GENERATED by ../GNUmakefile -->' >> docs/main.md 35 sed -e 's/<!-- \([^-]*\)-->/\1/g' README.md >> docs/main.md 36 37 # the html target removes and then recreates docs/html. 38 html: docs/main.md 39 -[ -d docs/html ] && rm -rf docs/html 40 cd docs && doxygen 41 .PHONY: html 42 43 install-html: html 44 mkdir -p $(DESTDIR)$(docdir) 45 -[ -d $(DESTDIR)$(docdir)/html ] && rm -rf $(DESTDIR)$(docdir)/html 46 cp -a docs/html $(DESTDIR)$(docdir) 47 .PHONY: install-html 48 49 # install-examples and install-tests copy files to 50 # $(DESTDIR)$(docdir). Since 'make check' (or other devel activity) 51 # might "pollute" the examples/ and tests/ directories, the files to 52 # be copied are enumerated in {examples,tests}/GNUmakefile. 53 install-examples: 54 cd examples; $(MAKE) install 55 .PHONY: install-examples 56 57 install-tests: 58 cd tests; $(MAKE) install 59 .PHONY: install-tests 60