-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathBeelzebub.mk
280 lines (206 loc) · 6.99 KB
/
Beelzebub.mk
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
###
# I assume $(PREFIX) and $(MAKECMDGOALS) are set!
###
##########
# Target #
KERNEL_NAME := beelzebub
ARC :=
AUX :=
############
# Settings #
PRECOMPILER_FLAGS := __BEELZEBUB
SETTINGS :=
################################################
# ARCHITECTURE-SPECIFIC SETTINGS AND FLAGS #
################################################
##############
# 64-bit x86 #
ifneq (,$(findstring amd64,$(MAKECMDGOALS)))
ARC := amd64
AUX := x86
PRECOMPILER_FLAGS += __BEELZEBUB__ARCH_AMD64 __BEELZEBUB__ARCH_X86
####################################
# 32-bit x86 with 36-bit addresses #
else ifneq (,$(findstring ia32pae,$(MAKECMDGOALS)))
ARC := ia32pae
AUX := x86
PRECOMPILER_FLAGS += __BEELZEBUB__ARCH_IA32PAE __BEELZEBUB__ARCH_IA32
PRECOMPILER_FLAGS += __BEELZEBUB__ARCH_X86
##############
# 32-bit x86 #
else ifneq (,$(findstring ia32,$(MAKECMDGOALS)))
ARC := ia32
AUX := x86
PRECOMPILER_FLAGS += __BEELZEBUB__ARCH_IA32 __BEELZEBUB__ARCH_X86
endif
################
# SETTINGS #
################
####################################### CONFIGURATION ##########
#########
# Debug #
ifneq (,$(findstring conf-profile,$(MAKECMDGOALS)))
PRECOMPILER_FLAGS += __BEELZEBUB__PROFILE __BEELZEBUB__RELEASE
PRECOMPILER_FLAGS += __JEGUDIEL__PROFILE __JEGUDIEL__RELEASE
SETTINGS += conf-profile
else ifneq (,$(findstring conf-release,$(MAKECMDGOALS)))
PRECOMPILER_FLAGS += __BEELZEBUB__RELEASE
PRECOMPILER_FLAGS += __JEGUDIEL__RELEASE
SETTINGS += conf-release
else
# Yes, debug is default!
PRECOMPILER_FLAGS += __BEELZEBUB__DEBUG
PRECOMPILER_FLAGS += __JEGUDIEL__DEBUG
SETTINGS += conf-debug
endif
####################################### FLAGS ##########
###############
# SMP disable #
ifneq (,$(findstring no-smp,$(MAKECMDGOALS)))
PRECOMPILER_FLAGS += __BEELZEBUB_SETTINGS_NO_SMP
PRECOMPILER_FLAGS += __JEGUDIEL_SETTINGS_NO_SMP
SETTINGS += no-smp
else
PRECOMPILER_FLAGS += __BEELZEBUB_SETTINGS_SMP
PRECOMPILER_FLAGS += __JEGUDIEL_SETTINGS_SMP
SETTINGS += smp
endif
##########################
# Don't inline spinlocks #
ifneq (,$(findstring no-inline-spinlocks,$(MAKECMDGOALS)))
PRECOMPILER_FLAGS += __BEELZEBUB_SETTINGS_NO_INLINE_SPINLOCKS
SETTINGS += no-inline-spinlocks
else
PRECOMPILER_FLAGS += __BEELZEBUB_SETTINGS_INLINE_SPINLOCKS
SETTINGS += inline-spinlocks
endif
#################
# No Unit Tests #
ifneq (,$(findstring no-unit-tests,$(MAKECMDGOALS)))
PRECOMPILER_FLAGS += __BEELZEBUB_SETTINGS_NO_UNIT_TESTS
SETTINGS += no-unit-tests
else ifneq (,$(findstring unit-tests-quiet,$(MAKECMDGOALS)))
PRECOMPILER_FLAGS += __BEELZEBUB_SETTINGS_UNIT_TESTS
PRECOMPILER_FLAGS += __BEELZEBUB_SETTINGS_UNIT_TESTS_QUIET
SETTINGS += unit-tests-quiet
else
PRECOMPILER_FLAGS += __BEELZEBUB_SETTINGS_UNIT_TESTS
SETTINGS += unit-tests
endif
####################################### Tests ##########
############
# ALL!!!1! #
ifneq (,$(findstring test-all,$(MAKECMDGOALS)))
PRECOMPILER_FLAGS += __BEELZEBUB__TEST_ALL
# Aye, these are added explicitly.
PRECOMPILER_FLAGS += __BEELZEBUB__TEST_MT
PRECOMPILER_FLAGS += __BEELZEBUB__TEST_STR
PRECOMPILER_FLAGS += __BEELZEBUB__TEST_OBJA
PRECOMPILER_FLAGS += __BEELZEBUB__TEST_METAP
PRECOMPILER_FLAGS += __BEELZEBUB__TEST_EXCP
PRECOMPILER_FLAGS += __BEELZEBUB__TEST_APP
PRECOMPILER_FLAGS += __BEELZEBUB__TEST_STACKINT
PRECOMPILER_FLAGS += __BEELZEBUB__TEST_AVL_TREE
PRECOMPILER_FLAGS += __BEELZEBUB__TEST_TERMINAL
PRECOMPILER_FLAGS += __BEELZEBUB__TEST_CMDO
PRECOMPILER_FLAGS += __BEELZEBUB__TEST_FPU
PRECOMPILER_FLAGS += __BEELZEBUB__TEST_BIGINT
PRECOMPILER_FLAGS += __BEELZEBUB__TEST_LOCK_ELISION
PRECOMPILER_FLAGS += __BEELZEBUB__TEST_RW_SPINLOCK
PRECOMPILER_FLAGS += __BEELZEBUB__TEST_VAS
PRECOMPILER_FLAGS += __BEELZEBUB__TEST_INTERRUPT_LATENCY
SETTINGS += test-all
else
ifneq (,$(findstring test-mt,$(MAKECMDGOALS)))
PRECOMPILER_FLAGS += __BEELZEBUB__TEST_MT
SETTINGS += test-mt
endif
ifneq (,$(findstring test-str,$(MAKECMDGOALS)))
PRECOMPILER_FLAGS += __BEELZEBUB__TEST_STR
SETTINGS += test-str
endif
ifneq (,$(findstring test-obja,$(MAKECMDGOALS)))
PRECOMPILER_FLAGS += __BEELZEBUB__TEST_OBJA
SETTINGS += test-obja
endif
ifneq (,$(findstring test-metap,$(MAKECMDGOALS)))
PRECOMPILER_FLAGS += __BEELZEBUB__TEST_METAP
SETTINGS += test-metap
endif
ifneq (,$(findstring test-excp,$(MAKECMDGOALS)))
PRECOMPILER_FLAGS += __BEELZEBUB__TEST_EXCP
SETTINGS += test-excp
endif
ifneq (,$(findstring test-app,$(MAKECMDGOALS)))
PRECOMPILER_FLAGS += __BEELZEBUB__TEST_APP __BEELZEBUB__TEST_MT
SETTINGS += test-app test-mt
endif
ifneq (,$(findstring test-stackint,$(MAKECMDGOALS)))
PRECOMPILER_FLAGS += __BEELZEBUB__TEST_STACKINT
SETTINGS += test-stackint
endif
ifneq (,$(findstring test-avl-tree,$(MAKECMDGOALS)))
PRECOMPILER_FLAGS += __BEELZEBUB__TEST_AVL_TREE
SETTINGS += test-avl-tree
endif
ifneq (,$(findstring test-terminal,$(MAKECMDGOALS)))
PRECOMPILER_FLAGS += __BEELZEBUB__TEST_TERMINAL
SETTINGS += test-terminal
endif
ifneq (,$(findstring test-cmdo,$(MAKECMDGOALS)))
PRECOMPILER_FLAGS += __BEELZEBUB__TEST_CMDO
SETTINGS += test-cmdo
endif
ifneq (,$(findstring test-fpu,$(MAKECMDGOALS)))
PRECOMPILER_FLAGS += __BEELZEBUB__TEST_FPU
SETTINGS += test-fpu
endif
ifneq (,$(findstring test-bigint,$(MAKECMDGOALS)))
PRECOMPILER_FLAGS += __BEELZEBUB__TEST_BIGINT
SETTINGS += test-bigint
endif
ifneq (,$(findstring test-lock-elision,$(MAKECMDGOALS)))
PRECOMPILER_FLAGS += __BEELZEBUB__TEST_LOCK_ELISION
SETTINGS += test-lock-elision
endif
ifneq (,$(findstring test-rw-spinlock,$(MAKECMDGOALS)))
PRECOMPILER_FLAGS += __BEELZEBUB__TEST_RW_SPINLOCK
SETTINGS += test-rw-spinlock
endif
ifneq (,$(findstring test-vas,$(MAKECMDGOALS)))
PRECOMPILER_FLAGS += __BEELZEBUB__TEST_VAS
SETTINGS += test-vas
endif
ifneq (,$(findstring test-interrupt-latency,$(MAKECMDGOALS)))
PRECOMPILER_FLAGS += __BEELZEBUB__TEST_INTERRUPT_LATENCY
SETTINGS += test-interrupt-latency
endif
endif
####################################### PRECOMPILER FLAGS ##########
GCC_PRECOMPILER_FLAGS := $(patsubst %,-D %,$(PRECOMPILER_FLAGS))
# When architecture files are present...
ifneq (,$(ARC))
GCC_PRECOMPILER_FLAGS += -D __BEELZEBUB__ARCH=$(ARC)
endif
# When auxiliary files are present...
ifneq (,$(AUX))
GCC_PRECOMPILER_FLAGS += -D __BEELZEBUB__AUX=$(AUX)
endif
####################################### COMMON PATHS ##########
# Binary blobs
KERNEL_BIN := $(KERNEL_NAME).$(ARC).bin
# Sysroot
ifneq (,$(ARC))
SYSROOT := $(PREFIX)/sysroot.$(ARC)
endif
# Installation
KERNEL_INSTALL_DIR := $(PREFIX)/bin
KERNEL_INSTALL_PATH := $(KERNEL_INSTALL_DIR)/$(KERNEL_BIN)
# ISO
ISO_PATH := $(PREFIX)/$(KERNEL_NAME).$(ARC).$(AUX).iso
####################################### WRAP UP ##########
$(SETTINGS):: $(ARC)
@ true
# Just makin' sure these don't error out. Adding '@ true' stops GNU Make from
# displaying 'Nothing to be done for ...', which gets annoying when there are
# more settings.