-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmk
More file actions
executable file
·113 lines (91 loc) · 2.38 KB
/
mk
File metadata and controls
executable file
·113 lines (91 loc) · 2.38 KB
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
#!/usr/bin/env bash
#
# 2025-03-22 16:21:10 dpw
#
set -eu
export project=tiny-app
export verbose=''
export os="$(uname -s)"
export arch="$(uname -m)"
[ $os == "Linux" ] && {
# export CC=/usr/local/bin/gcc
# export CXX=/usr/local/bin/g++
export FLAGS="-j8"
} || {
export FLAGS="-j20"
}
# parse the cli
while [[ $# -gt 0 ]]
do
case $1 in
verbose)
verbose='VERBOSE=1'
shift
;;
all)
./mk pull
./mk clobber init test run
exit 0
;;
init)
[ -d build ] || mkdir build
(cd build && cmake ..)
shift
;;
build)
clear
(cd build && time make ${verbose} $FLAGS || exit 1)
shift
;;
unit|test)
(cd build && time make $FLAGS)
./build/unit_tests
shift
;;
run)
./build/$project
shift
;;
format)
clang-format -i include/app/*.hpp src/*.cpp tests/*.?pp
git status -s
shift
;;
clean)
(cd build && make clean && /bin/rm -f datalogger-unit)
shift
;;
clob*)
/bin/rm -fr build/
shift
;;
watch)
watchexec -c -w src/ -w include/ -w tests/ -e h,hpp,cpp ./mk build unit
exit 0
;;
pull)
git pull
shift
;;
help)
echo "Targets:"
echo ""
echo " init : run the cmake command to create the build folder"
echo " build : compile cryptor to the build folder"
echo " run : runs the web server app"
echo " format : runs clang-format over includes and src"
echo " watch : run watcher over source and include"
echo " pull : pull the latest repo changes"
echo " clean : remove binary builds but leave the build folder"
echo " clobber : remove the entire build folder"
echo " all : special target to clobber init build unit"
echo " verbose : show a verbose build"
echo " help : show this help"
exit 0
;;
*)
./mk help
exit 0
;;
esac
done