| 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 |
sed -e 's/<!-- \([^-]*\)-->/\1/g' README.md >> docs/main.md |
| 35 |
|
| 36 |
# the html target removes and then recreates docs/html. |
| 37 |
html: docs/main.md |
| 38 |
-[ -d docs/html ] && rm -rf docs/html |
| 39 |
cd docs && doxygen |
| 40 |
.PHONY: html |
| 41 |
|
| 42 |
install-html: html |
| 43 |
mkdir -p $(DESTDIR)$(docdir) |
| 44 |
-[ -d $(DESTDIR)$(docdir)/html ] && rm -rf $(DESTDIR)$(docdir)/html |
| 45 |
cp -a docs/html $(DESTDIR)$(docdir) |
| 46 |
.PHONY: install-html |
| 47 |
|
| 48 |
# install-examples and install-tests copy files to |
| 49 |
# $(DESTDIR)$(docdir). Since 'make check' (or other devel activity) |
| 50 |
# might "pollute" the examples/ and tests/ directories, the files to |
| 51 |
# be copied are enumerated in {examples,tests}/GNUmakefile. |
| 52 |
install-examples: |
| 53 |
cd examples; $(MAKE) install |
| 54 |
.PHONY: install-examples |
| 55 |
|
| 56 |
install-tests: |
| 57 |
cd tests; $(MAKE) install |
| 58 |
.PHONY: install-tests |
| 59 |
|