-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
180 lines (161 loc) · 5.13 KB
/
Copy pathMakefile
File metadata and controls
180 lines (161 loc) · 5.13 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
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
.if exists(${.CURDIR}/config.mk)
.include "${.CURDIR}/config.mk"
.endif
GLATT_SRC?= ${.CURDIR}
all::
@echo '>>> Top-level Glatt build system.'
@echo '>>> If a file named config.mk exists, it will be included.'
###
# mk section
###
MK_CONFIG?=std
MK_FLAGS+=MK_CONFIG="${MK_CONFIG}"
MK_OBJ?=${.OBJDIR}/mk.obj
MK_FLAGS+=BUILDDIR="${MK_OBJ}"
.if defined(PLATFORM)
MK_FLAGS+=PLATFORM="${PLATFORM}"
.endif
.if defined(KERNEL_SIMCPUS)
MK_FLAGS+=KERNEL_SIMCPUS="${KERNEL_SIMCPUS}"
.endif
.if defined(KERNEL_SIMDISKS)
MK_FLAGS+=KERNEL_SIMDISKS="${KERNEL_SIMDISKS}"
.endif
.if defined(KERNEL_SIMRAM)
MK_FLAGS+=KERNEL_SIMRAM="${KERNEL_SIMRAM}"
.endif
.if defined(KERNEL_SIMVERBOSE)
MK_FLAGS+=KERNEL_SIMVERBOSE="${KERNEL_SIMVERBOSE}"
.endif
TARGETS+=mk-config
mk-config-help:
@echo 'Configures a build of the microkernel.'
@echo 'usage: '${MAKE}' mk-config'
@echo 'variables:'
@echo ' MK_CONFIG Configuration string for kernel, e.g.'
@echo ' MK_CONFIG=std+pci'
@echo ' MK_OBJ Directory to build in, e.g.'
@echo ' MK_OBJ=/usr/obj/mk.testmips'
@echo ' PLATFORM Platform to build for, e.g.'
@echo ' PLATFORM=testmips'
mk-config:
@${GO_MAKE:S,DST,mk,:S,TGT,config,} ${MK_FLAGS}
TARGETS+=mk-build
mk-build-help:
@echo 'Performs a build of the microkernel that has been configured.'
@echo 'usage: '${MAKE}' mk-build'
@echo 'variables:'
@echo ' MK_OBJ Directory to build in, e.g.'
@echo ' MK_OBJ=/usr/obj/mk.testmips'
mk-build:
@if [ -e ${MK_OBJ}/Makefile ]; then \
${GO_MAKE:S,DST,${MK_OBJ},:S,TGT,kernel,} ${MK_FLAGS} ; \
else \
echo '>>> Please run '${MAKE}' mk-config first.' ; \
fi
TARGETS+=mk-clean
mk-clean-help:
@echo 'Cleans a build of the microkernel using '${MAKE}' clean.'
@echo 'usage: '${MAKE}' mk-clean'
@echo 'variables:'
@echo ' MK_OBJ Directory to build in, e.g.'
@echo ' MK_OBJ=/usr/obj/mk.testmips'
mk-clean:
@if [ -e ${MK_OBJ}/Makefile ]; then \
${GO_MAKE:S,DST,${MK_OBJ},:S,TGT,clean,} ${MK_FLAGS} ; \
else \
echo '>>> Already clean.' ; \
fi
TARGETS+=mk-options
mk-options-help:
@echo 'Shows available configuration options for the microkernel.'
@echo 'usage: '${MAKE}' mk-options'
mk-options:
@${GO_MAKE:S,DST,mk,:S,TGT,options,} ${MK_FLAGS}
TARGETS+=mk-reconfig
mk-reconfig-help:
@echo 'Performs a reconfig of the microkernel in its build directory.'
@echo 'usage: '${MAKE}' mk-reconfig'
@echo 'variables:'
@echo ' MK_OBJ Directory to build in, e.g.'
@echo ' MK_OBJ=/usr/obj/mk.testmips'
mk-reconfig:
@if [ -e ${MK_OBJ}/Makefile ]; then \
${GO_MAKE:S,DST,${MK_OBJ},:S,TGT,reconfig,} ${MK_FLAGS} ;\
else \
echo '>>> Please run '${MAKE}' mk-config instead.' ; \
fi
TARGETS+=mk-simulate
mk-simulate-help:
@echo 'Performs a simulation of the microkernel in its build directory.'
@echo 'usage: '${MAKE}' mk-simulate'
@echo 'variables:'
@echo ' MK_OBJ Directory to build in, e.g.'
@echo ' MK_OBJ=/usr/obj/mk.testmips'
@echo ' KERNEL_SIMDISKS'
@echo ' Disk images to use with simulator, e.g.'
@echo ' KERNEL_SIMDISKS=/usr/obj/mu.img'
@echo ' KERNEL_SIMRAM'
@echo ' Amount of RAM (in MB) to use with simulator, e.g.'
@echo ' KERNEL_SIMRAM=128'
@echo ' KERNEL_SIMVERBOSE'
@echo ' If set, enables verbose simulation.'
mk-simulate:
@if [ -e ${MK_OBJ}/Makefile ]; then \
${GO_MAKE:S,DST,${MK_OBJ},:S,TGT,simulate,} ${MK_FLAGS} ;\
else \
echo '>>> Please run '${MAKE}' mk-config first.' ; \
fi
TARGETS+=mk-universe
mk-universe-help:
@echo 'Attempts to build the microkernel for all platforms.'
@echo 'usage: '${MAKE}' mk-universe'
mk-universe:
.for _platform in macppc malta octeon testmips
@cd ${.CURDIR} && ${MAKE} toolchain PLATFORM=${_platform}
.for _config in std std+db std+verbose std+invariants std-ns std+fs+exec
@cd ${.CURDIR} && ${MAKE} mk PLATFORM=${_platform} MK_CONFIG=${_config}
.endfor
@cd ${.CURDIR} && ${MAKE} mk-clean
.endfor
.PHONY: mk
TARGETS+=mk
mk-help:
@echo 'Performs mk-config and then mk-build.'
@echo 'usage: '${MAKE}' mk'
@echo 'See mk-config-help and mk-build-help for more information.'
mk: mk-config mk-build
###
# mu section
###
mu-build:
@${GO_MAKE:S,DST,mu,:S,TGT,all,}
mu-clean:
@${GO_MAKE:S,DST,mu,:S,TGT,clean,}
.if make(mu-install) && !defined(DESTDIR)
.error "Must set DESTDIR for mu-install."
.endif
mu-install:
@${GO_MAKE:S,DST,mu,:S,TGT,install,} DESTDIR=${DESTDIR}
mu-image:
@${GO_MAKE:S,DST,${.CURDIR},:S,TGT,mu-build,}
(cd ${.CURDIR} && sh mu-image.sh)
.PHONY: mu
TARGETS+=mu
mu-help:
@echo 'Performs mu-clean and then mu-image.'
@echo 'usage: '${MAKE}' mu'
@echo 'See mu-clean-help and mu-image-help for more information.'
mu: mu-clean mu-image
###
# toolchain section
###
TARGETS+=toolchain
toolchain-help:
@echo 'Builds a complete set of compilers and build tools.'
@echo 'usage: '${MAKE}' toolchain'
toolchain:
@mkdir -p ${TOOLCHAIN_ROOT}
@${GO_MAKE:S,DST,aux/toolchain,:S,TGT,install,} PREFIX=${TOOLCHAIN_ROOT}
@${GO_MAKE:S,DST,aux/toolchain,:S,TGT,clean,}
.include "${GLATT_SRC}/aux/build/root.mk"