-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.in
88 lines (69 loc) · 2.1 KB
/
Makefile.in
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# @configure_input@
package = @PACKAGE_NAME@
version = @PACKAGE_VERSION@
# paths
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
# VPATH-specific substitution variables
srcdir = @srcdir@
VPATH = @srcdir@
# package structure
INCDIR = @srcdir@/include
TESTDIR = @srcdir@/test
DEBUGDIR = @srcdir@/bin
SRCDIR = @srcdir@/src
# CXX - reference to the system C++ compiler
# LDFLAGS - linker flags
# -lboost_unit_test_framework for unit testing
# CXXFLAGS - C++ compiler flags
# -std=c++1y for new standard c++
# CPPFLAGS C/C++ preprocessor flags
# -g needed for debugging with gdb based debuggers
# -Wall shows almost all compile warnings
# https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
# compiler
CXX = @CXX@ -std=c++1y
# compiler vars
CXXFLAGS += @CXXFLAGS@ -I. -I$(srcdir) -I.. -I$(INCDIR)
# linker flags for boost
LDFLAGS += $(ARCHIVENAME) -lboost_unit_test_framework
# pre-processor
CPPFLAGS = @CPPFLAGS@
# Installation tools
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
# source files
SOURCE = $(wildcard $(SRCDIR)/*.cpp) # wildcard get all files with ext cpp
# objects to build test
OBJS = $(addprefix $(DEBUGDIR)/, $(patsubst %.cpp, %.o, $(notdir $(wildcard $(SRCDIR)/*.cpp))))
TESTOBJS = $(addprefix $(DEBUGDIR)/, $(patsubst %.cpp, %.o, $(notdir $(wildcard $(TESTDIR)/*.cpp))))
# executables for testing
ARCHIVENAME = $(DEBUGDIR)/panacea.a
TESTNAME = $(DEBUGDIR)/test-panacea
DEBUGNAME = $(DEBUGDIR)/debug-panacea
BUILDNAME = $(DEBUGDIR)/panacea
include src/Makefile
include test/Makefile
all: $(BUILDNAME) $(DEBUGNAME) $(TESTNAME)
# build binary
panacea: $(BUILDNAME)
# debug binary
debug: $(DEBUGNAME)
# unit testing
test: $(TESTNAME)
# installation
install: panacea
$(INSTALL) -d $(DESTDIR)$(bindir)
$(INSTALL_PROGRAM) -m 0755 $(BUILDNAME) $(DESTDIR)$(bindir)
# remove installation
uninstall:
rm -f $(DESTDIR)$(bindir)/panacea
# make sure to include build directory
FORCE:
-mkdir -p $(DEBUGDIR)
clean:
$(RM) $(DEBUGDIR)/*.d $(DEBUGDIR)/*.o $(ARCHIVENAME) $(TESTNAME) $(DEBUGNAME)
.PHONY: all clean FORCE install uninstall