-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
92 lines (59 loc) · 1.83 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
#
# C++ Makefile template
#
BIN_NAME = waterfall
VERSION = 0.1.2
# yes / no
IS_LIBRARY = no
SRC_DIR = src
CPP_FILES = $(shell ls $(SRC_DIR)/*.cpp)
H_FILES = $(shell ls $(SRC_DIR)/*.h)
OBJECT_FILES = $(foreach CPP_FILE, $(CPP_FILES), $(patsubst %.cpp,%.o,$(CPP_FILE)))
DEP_FILES = $(foreach CPP_FILE, $(CPP_FILES), $(patsubst %.cpp,%.d,$(CPP_FILE)))
DOCS_ARCH = $(BIN_NAME)-$(VERSION)-docs.html.tar.gz
UNAME := $(shell uname)
CXXFLAGS = -g -O0 -Wall -Icppapp
LDFLAGS = -Lcppapp -lcppapp -lfftw3 -lcfitsio
ifeq ($(UNAME),Darwin)
LDFLAGS += -framework jackmp
else
LDFLAGS += $(shell pkg-config --libs jack)
endif
ECHO = $(shell which echo)
build: $(BIN_NAME)
-include $(DEP_FILES)
clean:
@echo "========= CLEANING =================================================="
rm -f $(OBJECT_FILES) $(BIN_NAME)
@echo
rebuild:
@$(MAKE) clean
@$(MAKE) build
deps: $(DEP_FILES)
clean-deps:
rm -f $(DEP_FILES)
docs:
@echo "========= GENERATING DOCS ==========================================="
doxygen
cd docs/html; tar -czf ../../$(DOCS_ARCH) ./*
clean-docs:
@echo "========= CLEANING DOCS ============================================="
rm -fR docs/html
upload-docs:
@$(MAKE) docs
scp $(DOCS_ARCH) [email protected]:public_html/waterfall
ssh -t [email protected] "cd ~/public_html/waterfall/docs; tar -xzf ../$(DOCS_ARCH)"
$(BIN_NAME): $(OBJECT_FILES)
ifeq ($(IS_LIBRARY),yes)
@echo "========= LINKING LIBRARY $@ ========================================"
$(AR) -r $@ $^
else
@echo "========= LINKING EXECUTABLE $@ ====================================="
$(CXX) $(CXXFLAGS) -o $@ $^ $(LDFLAGS)
endif
@echo
.PHONY: all build clean rebuild deps clean-deps docs clean-docs
%.d: %.cpp $(H_FILES)
@$(ECHO) "Generating \"$@\"..."
@$(ECHO) -n "$(SRC_DIR)/" > $@
@$(CXX) $(CXXFLAGS) -MM $< >> $@