-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.mb
104 lines (78 loc) · 2.41 KB
/
build.mb
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
sector config
section files
str src 'src/'
str obj 'build/obj/'
str bindest 'build/'
list str sources 'logging', 'events', 'error', 'window', 'workspace', 'mawimctl_server', 'commands', 'mawim'
end
section mariebuild
str build_type 'incremental'
str cc 'clang'
str cflags '-Iinclude/ -Isrc/ -Imawimctl/ -Wall -Wextra -Wno-unused-parameter -std=c17'
str ldflags '-lX11'
list str targets 'clean', 'debug', 'release', 'mawimctl-debug', 'mawimctl-release'
str default 'debug'
end
end
sector targets
section clean
str exec '#!/bin/sh
if [ -d $(/config/files/obj) ]; then
echo "Removing old object files"
rm -rf $(/config/files/obj)
fi
if [ -d $(/config/files/bindest) ]; then
echo "Removing old binaries"
rm -rf $(/config/files/bindest)
fi
mkdir -p $(/config/files/bindest)
mkdir -p $(/config/files/obj)
'
end
section debug
str target_cflags '-ggdb -DDEFAULT_LOG_LEVEL=LOG_DEBUG -DDEBUG -DCOMMIT_HASH=\\"\$(git rev-parse --short HEAD)\\"'
str target_bindest '$(/config/files/bindest)debug/'
list str c_rules 'executable'
end
section release
str target_cflags '-DDEFAULT_LOG_LEVEL=LOG_INFO -Oz'
str target_bindest '$(/config/files/bindest)release/'
list str required_targets 'clean', 'mawimctl-release'
list str c_rules 'executable'
end
section mawimctl-debug
str exec 'cd mawimctl && mb -n -t debug && cd ..'
end
section mawimctl-release
str exec 'cd mawimctl && mb -n -t release && cd ..'
end
end
sector c_rules
section executable
list str c_rules 'main'
str binname 'mawim'
str build_type 'full'
str exec_mode 'unify'
str input_src '/config/files/sources'
str input_format '$(/config/files/obj)$(%element%).o'
str output_format '$(%target_bindest%)$(binname)'
str exec '#!/bin/bash
if [[ ! -d $(%target_bindest%) ]]; then
mkdir -p $(%target_bindest%)
fi
$(/config/mariebuild/cc) -o $(%output%) $(%input%) $(/config/mariebuild/ldflags)
'
end
section main
str exec_mode 'singular'
str input_src '/config/files/sources'
str input_format '$(/config/files/src)$(%element%).c'
str output_format '$(/config/files/obj)$(%element%).o'
str exec '#!/bin/bash
if [[ ! -d $(/config/files/obj) ]]; then
mkdir -p $(/config/files/obj)
fi
$(/config/mariebuild/cc) $(%target_cflags%) $(/config/mariebuild/cflags) -c $(%input%) -o $(%output%)
'
end
end