aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: dc4a5ea2a471ea3ea5b0729995e1e7ade74f2275 (plain)
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
OS = $(shell uname -s)

CC 			?= 	cc
CXX			?= 	c++
DESTDIR		?= 	/usr/local
FLAGS 		+= 	-std=c++11
ifdef DEBUG
FLAGS		+=	-ggdb -O0
else
FLAGS		+=	-O0
endif

LIBS 		= 	
CFLAGS		+=	-I. $(FLAGS) -c -MMD -Wall -Wextra -Wno-unused-parameter -Werror -pedantic
LDFLAGS		+=	$(FLAGS)

SOURCES		= 	test.cxx
OBJECTS		= 	$(SOURCES:.cxx=.o)
DEPENDENCIES=	$(SOURCES:.cxx=.d)
EXECUTABLE	=	argstest

.PHONY: all clean pages runtests uninstall install installman

all: $(EXECUTABLE)

-include $(DEPENDENCIES)

$(EXECUTABLE): $(OBJECTS)
	$(CXX) -o $@ $(OBJECTS) $(LDFLAGS)

uninstall:
	-rm $(DESTDIR)/include/args.hxx
	-rmdir $(DESTDIR)/include
	-rm $(DESTDIR)/share/man/man3/args_*.3.bz2
	-rmdir -p $(DESTDIR)/share/man/man3

install:
	mkdir -p $(DESTDIR)/include
	cp args.hxx $(DESTDIR)/include

installman: doc/man
	mkdir -p $(DESTDIR)/share/man/man3
	cp doc/man/man3/*.3.bz2 $(DESTDIR)/share/man/man3

clean:
	rm -rv $(EXECUTABLE) $(OBJECTS) $(DEPENDENCIES) doc

pages:
	-rm -r pages/*
	doxygen Doxyfile
	cp -rv doc/html/* pages/

doc/man: 
	doxygen Doxyfile
	bzip2 doc/man/man3/*.3

runtests: ${EXECUTABLE}
	./${EXECUTABLE}

%.o: %.cxx
	$(CXX) $< -o $@ $(CFLAGS)