-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
77 lines (65 loc) · 2.64 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
#This variable stores the name/path of the directory with all the object files will be (relative to the make file)
OBJ_DIR=build
#get the number of cores
NUM_CORES=$(shell cat /proc/cpuinfo | grep processor | wc --lines)
#this builds the project with no flags but those absolutely necessary
.PHONY: plain
plain:
@mkdir -p $(OBJ_DIR)/plain
@cd $(OBJ_DIR)/plain; cmake -DBUILD_TYPE=Plain ../../src; make -j $(NUM_CORES)
@mv $(OBJ_DIR)/plain/orchid ./orchid
#this builds the project with debug flags making it easier to attach a debugger and see what is happening
.PHONY: debug
debug:
@mkdir -p $(OBJ_DIR)/debug
@cd $(OBJ_DIR)/debug; cmake -DBUILD_TYPE=Debug ../../src; make -j $(NUM_CORES)
@mv $(OBJ_DIR)/debug/orchid ./orchid
#this builds the project with debug flags and with optimization flags allowing you to attach a debugger
#to see if the optimization is screwing something up
.PHONY: opt_debug
opt_debug:
@mkdir -p $(OBJ_DIR)/opt_debug
@cd $(OBJ_DIR)/opt_debug; cmake -DBUILD_TYPE=OptDebug ../../src; make -j $(NUM_CORES)
@mv $(OBJ_DIR)/opt_debug/orchid ./orchid
#this builds the project with no debug flags and with optimization flags making it run faster
.PHONY: release
release:
@mkdir -p $(OBJ_DIR)/release
@cd $(OBJ_DIR)/release; cmake -DBUILD_TYPE=Release ../../src; make -j $(NUM_CORES)
@mv $(OBJ_DIR)/release/orchid ./orchid
#this builds the project with the generic warning flags enabled to see where you might want to make changed
.PHONY: warn
warn:
@mkdir -p $(OBJ_DIR)/warn
@cd $(OBJ_DIR)/warn; cmake -DBUILD_TYPE=Warn ../../src; make -j $(NUM_CORES)
@mv $(OBJ_DIR)/warn/orchid ./orchid
#this builds the project with the generic warning flags enabled to see where you might want to make changed
.PHONY: warn_opt
warn_opt:
@mkdir -p $(OBJ_DIR)/warn_opt
@cd $(OBJ_DIR)/warn_opt; cmake -DBUILD_TYPE=WarnOpt ../../src; make -j $(NUM_CORES)
@mv $(OBJ_DIR)/warn_opt/orchid ./orchid
.PHONY: everything
everything: debug plain opt_debug release warn warn_opt
#this builds the automatic documentation
.PHONY: docs
docs: $(patsubst %,$(SRC_DIR)/%,$(SOURCES)) $(patsubst %,$(SRC_DIR)/%,$(HEADERS))
doxygen ./docs/doxygen/Doxyfile
#cleaning targets to remove various things generated by this make file
#this removes the contents of the build directories
.PHONY: clean
clean:
-rm -rf $(OBJ_DIR)/plain/*
-rm -rf $(OBJ_DIR)/debug/*
-rm -rf $(OBJ_DIR)/opt_debug/*
-rm -rf $(OBJ_DIR)/release/*
-rm -rf $(OBJ_DIR)/warn/*
-rm -rf $(OBJ_DIR)/warn_opt/*
#this runs clean and then removes the executable
.PHONY: cleanall
cleanall: clean
-rm -f orchid
#this runs cleanall and then removes the obj directory
.PHONY: superclean
superclean: cleanall
-rm -rf $(OBJ_DIR)