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