-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
66 lines (50 loc) · 1.3 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
# =============================
# Variables
# =============================
ansi = on
SOURCE = ./src
BUILD = ./build
CMAKE_SRC = .
EXE = csv2mdtable
# =============================
# makefile code and variable setting
# =============================
ifeq ($(ansi),on)
# Bold orange text
color_s=\033[33;1m
color_e=\033[38;22m
else
color_s=
color_e=
endif
# ====================
# Default target
# ====================
default:
# ====================
# Specific rules
# ====================
$(BUILD)/Makefile: $(CMAKE_SRC)/CMakeLists.txt
echo "$(color_s)Running cmake$(color_e)"
cmake -DCMAKE_BUILD_TYPE=Debug -S $(CMAKE_SRC) -B $(BUILD)
$(BUILD)/$(EXE): $(BUILD)/Makefile $(SOURCE)/*
echo "$(color_s)Running cmake's makefile with target $(EXE)$(color_e)"
$(MAKE) -C $(BUILD) $(EXE)
./$(EXE): $(BUILD)/$(EXE)
echo "$(color_s)Copying executable$(color_e)"
cp $(BUILD)/$(EXE) ./$(EXE)
# =============================
# Special Targets
# =============================
# No display of executed commands.
$(VERBOSE).SILENT:
.PHONY: clean clean-all default
default: ./$(EXE)
clean:
echo "$(color_s)Removing build files$(color_e)"
$(MAKE) -C $(BUILD) clean
rm -f $(SOURCE)/project.hpp
clean-all:
echo "$(color_s)Removing build files, cmake files and executable$(color_e)"
rm -rf $(BUILD)
rm -f ./$(EXE)