-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
71 lines (43 loc) · 1.2 KB
/
Makefile
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
60
61
62
63
64
65
66
67
68
69
70
71
prefix = /usr/local
exec_prefix = $(prefix)
libdir = $(exec_prefix)/lib
includedir = $(prefix)/include
datarootdir = $(prefix)/share
CLANGFORMAT = clang-format
RAKE = rake
HEADERS := dogma.hpp
# The default target:
all: $(HEADERS)
.PHONY: all
# Rules for verification:
test: test.cpp dogma.hpp
$(CXX) -std=c++17 -Wall -Wextra -o $@ $< && ./$@
check: lint test
.PHONY: check
# Rules for installation:
install: installdirs $(HEADERS)
install -c -m 0644 dogma.hpp $(DESTDIR)$(includedir)
installdirs:
install -d $(DESTDIR)$(includedir)
installcheck:
.PHONY: install installdirs installcheck
# Rules for uninstallation:
uninstall:
-rm -f $(DESTDIR)$(includedir)/dogma.hpp
.PHONY: uninstall
# Rules for development:
dogma.hpp: Rakefile dogma.hpp.in $(wildcard dogma/*.hpp)
@$(RAKE) $@
lint: lint-hpp
lint-hpp:
@printf '%s\n' $(HEADERS) | sort | xargs -n1 $(CXX) -x c++-header -std=c++17 -Wall -Wextra -fsyntax-only
format:
find . -name '*.[ch]pp' | xargs $(CLANGFORMAT) -style=file -i
clean:
@rm -Rf test *~
distclean: clean
mostlyclean: clean
maintainer-clean: clean
.PHONY: lint lint-hpp format clean distclean mostlyclean maintainer-clean
.SECONDARY:
.SUFFIXES: