-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
111 lines (97 loc) · 2.17 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#
# C++ Compiler
CXX := g++
#
# latexmk
TEX := $(shell command -v latexmk 2> /dev/null)
#
# git version vars
GITVERSION:= $(shell git log -1 --pretty='%h')
GITDATE:= $(shell git log -1 --format=%cd --date=local)
#
# Flags
#
# Compiler
CXXFLAGS += -c -g -Wall -std=c++11 -DGIT_VERSION="\"${GITVERSION}\"" -DGIT_DATE="\"${GITDATE}\""
#
# Linker
LDFLAGS += -g
#
# Library
LIBFLAGS :=
#
# Include
INCLUDEFLAGS := -I./utils/include
#
#
# Program name
EXE := DTarray
#
#
# Directories
#
# utils
UTILS_DIR := utils
UTILS_LIB := lib/libutils.a
#
# Headers
HEADERDIR := include
#
# Sources
SRCDIR := src
#
# Objects
OBJDIR := obj
#
# Libraries
LIBDIR := lib
#
# Binary
BINDIR := bin
#
# Build scripts
SCRIPTS := scripts
#
# Tex dir
TEX_DIR := doc/tex
#
#
################################################################################
HEADERS := $(wildcard $(HEADERDIR)/*.hpp)
SRCS := $(wildcard $(SRCDIR)/*.cpp)
OBJS := $(subst $(SRCDIR)/,$(OBJDIR)/,$(SRCS:.cpp=.o))
CXXFLAGS += $(INCLUDEFLAGS) -I$(HEADERDIR)
LDFLAGS += $(LIBFLAGS) -L$(LIBDIR)
.PHONY: all clean distclean doc
TARGETS = $(BINDIR)/$(EXE) $(BINDIR)/DTsetup helpFile.pdf DTarray_pro-Userguide.pdf
all: $(TARGETS)
DTarray_pro-Userguide.pdf : $(TEX_DIR)/DTarray_pro-Userguide.tex
ifndef TEX
$(warning "No latexmk in $(PATH), skipping build of DTarray_pro-Userguide.pdf")
else
cd $(TEX_DIR) && latexmk -pdf DTarray_pro-Userguide.tex
cp $(TEX_DIR)/DTarray_pro-Userguide.pdf .
endif
$(BINDIR)/$(EXE): $(UTILS_LIB) $(OBJS)
mkdir -p $(BINDIR)
$(CXX) $(LDFLAGS) $(OBJS) $(UTILS_LIB) -o $@
$(OBJDIR)/%.o: $(SRCDIR)/%.cpp $(HEADERS)
mkdir -p $(OBJDIR)
$(CXX) $(CXXFLAGS) $< -o $@
$(UTILS_LIB):
cd $(UTILS_DIR); $(MAKE)
mkdir -p $(LIBDIR)
cd $(LIBDIR); ln -sF ../$(UTILS_DIR)/$(UTILS_LIB)
helpFile.pdf : db/helpFile.man
bash $(SCRIPTS)/updateMan.sh
$(BINDIR)/DTsetup : DTsetup/dtsetup.sh
cp DTsetup/dtsetup.sh $(BINDIR)/DTsetup
chmod +x $(BINDIR)/DTsetup
doc:
doxygen doc/doxygen/Doxyfile
clean:
rm -f $(OBJDIR)/*.o $(BINDIR)/$(EXE) $(BINDIR)/DTsetup $(LIBDIR)/*.a
rm -f helpFile.pdf
cd $(TEX_DIR) && rm -f ./*.aux ./*.dvi ./*.fdb_latexmk ./*.fls ./*.log ./*.out ./*.pdf ./*.toc
cd $(UTILS_DIR); $(MAKE) clean
distclean: clean