-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmakefile
More file actions
314 lines (256 loc) · 8.84 KB
/
makefile
File metadata and controls
314 lines (256 loc) · 8.84 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
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
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
include scripts/Makefile.inc.config
include scripts/Makefile.inc.opensource
include scripts/Makefile.inc.version
ARCHV_LIST ?= 65 68 73 81
TESTOUT ?= test.out
TARGET ?= opt
ARCHV ?= 81
ifneq ($(findstring $(ARCHV),65,66,67),)
override ARCHV := 65
endif
ifneq ($(findstring $(ARCHV),68,71),)
override ARCHV := 68
endif
ifneq ($(findstring $(ARCHV),73,75,77,79),)
override ARCHV := 73
endif
ifneq ($(findstring $(ARCHV),81,83,85,87,89,91),)
override ARCHV := 81
endif
include scripts/Makefile.inc.tools
JFLAG ?= -j
OPT_JFLAG := $(JFLAG)
REF_JFLAG := $(JFLAG)
TEST_JFLAG ?= -j 8
ifeq ($(TARGET), 8960)
T := opt
ARCHV := 4
H2K_KERNEL_PGSIZE ?= 3
H2K_ALLOC_HEAP_SIZE ?= 0xb000
export H2K_EXTRA_CFLAGS += -DCOUNT_TLB_EVENTS
endif
ifeq ($(TARGET), 8974)
T := opt
ARCHV := 5
H2K_KERNEL_PGSIZE ?= 3
H2K_ALLOC_HEAP_SIZE ?= 0xb000
export H2K_EXTRA_CFLAGS += -DCOUNT_TLB_EVENTS
export USE_TCM ?= 1
endif
ifeq ($(TARGET), zebu_v60)
T := opt
ARCHV := 60
H2K_KERNEL_PGSIZE ?= 3
H2K_ALLOC_HEAP_SIZE ?= 0xb000
export H2K_EXTRA_CFLAGS += -DCOUNT_TLB_EVENTS
#export USE_TCM ?= 1
endif
ifeq ($(TARGET), zebu_v65)
T := opt
ARCHV := 65
H2K_KERNEL_PGSIZE ?= 3
H2K_ALLOC_HEAP_SIZE ?= 0xb000
export H2K_EXTRA_CFLAGS += -DCOUNT_TLB_EVENTS
#export USE_TCM ?= 1
endif
ifeq ($(TARGET), opt)
T := opt
#OPT_JFLAG :=
endif
ifeq ($(TARGET), opt_cov)
T := opt
OPT_JFLAG :=
export OPT_ADD := $(OPTIMIZE_COV)
endif
ifeq ($(TARGET), llvm_cov)
T := opt
OPT_JFLAG :=
export EN_LLVM_COV := 1
endif
ifeq ($(TARGET), opt_snap)
T := opt
#OPT_JFLAG :=
export H2K_LOAD_ADDR=0x00400000
export H2K_EXTRA_CFLAGS+=-DNMI_STOP
endif
ifeq ($(TARGET), opt_tiny_snap)
override ARCHV := 65 # because some things call make with ARCHV=66t
T := opt
#OPT_JFLAG :=
export TINY_CORE=1
export H2K_LOAD_ADDR=0x00400000
export H2K_EXTRA_CFLAGS+=-DNMI_STOP
endif
ifeq ($(TARGET), ref)
T := ref
#REF_JFLAG :=
endif
ifeq ($(TARGET), ref_cov)
T := ref
REF_JFLAG :=
export OPT_ADD := $(OPTIMIZE_COV)
endif
ifeq ($(TARGET), debug)
T := ref
REF_JFLAG :=
export OPTIMIZE := $(OPTIMIZE_DEBUG)
endif
ifeq ($(TARGET), opt_si)
T := opt
#OPT_JFLAG :=
export H2K_LOAD_ADDR=0x84c00000
export H2K_GUEST_START=0x87000000
export NULL_ANGEL_TRAP=1
export MAGIC_ANGEL=--magic_angel
endif
# FIXME: Remove when cluster sched ported to opt
export OMIT_OPT=dosched resched
.PHONY: all
all:
$(MAKE) $(JFLAG) $(T)
distclean: clean docclean gtagsclean
clean: covclean booterclean docclean qurtclean # ucosclean
$(MAKE) -C kernel ARCHV=$(ARCHV) clean
$(MAKE) -C stake ARCHV=$(ARCHV) clean
$(MAKE) -C libs ARCHV=$(ARCHV) clean
rm -Rf size test.exe stats.txt install kernel/stats.txt
booterclean:
$(MAKE) -C booter clean
docclean:
$(MAKE) -C libs/docs/dox clean
$(MAKE) -f scripts/docs/Makefile.sphinx clean
testclean covclean: qurtclean # ucosclean
$(MAKE) -f scripts/Makefile.coverage ARCHV=$(ARCHV) clean && \
$(MAKE) -f scripts/Makefile.coverage ARCHV=$(ARCHV) clean_top
# ucosclean:
# $(MAKE) -C ucos clean
qurtclean:
$(MAKE) -f scripts/Makefile.qurt ARCHV=$(ARCHV) clean
$(MAKE) -f scripts/Makefile.qurt clean_top
opt:
ifeq ($(USE_PKW),1)
@echo PKW_VERSIONS $(PKW_VERSIONS)
pkw --which $(CC)
endif
$(MAKE) $(OPT_JFLAG) -C kernel ARCHV=$(ARCHV) opt_install && \
$(MAKE) $(OPT_JFLAG) -C libs ARCHV=$(ARCHV) install IMPL=opt && \
$(MAKE) $(OPT_JFLAG) -C stake ARCHV=$(ARCHV) install
$(MAKE) $(OPT_JFLAG) -C booter ARCHV=$(ARCHV) install
cp scripts/Makefile.inc.config $(INSTALLPATH)/scripts
cp scripts/Makefile.inc.opensource $(INSTALLPATH)/scripts
cp scripts/devsim_v*.cfg $(INSTALLPATH)/scripts
$(MAKE) $(OPT_JFLAG) -f scripts/Makefile.coverage ARCHV=$(ARCHV) prepare;
echo "v$(ARCHV) $@ ${MAKEFLAGS}" > $(INSTALLPATH)/ver
echo "sha_short $(H2K_GIT_COMMIT)" >> $(INSTALLPATH)/ver
echo "sha_long $(H2K_GIT_COMMIT_LONG)" >> $(INSTALLPATH)/ver
ref:
ifeq ($(USE_PKW),1)
@echo PKW_VERSIONS $(PKW_VERSIONS)
pkw --which $(CC)
endif
$(MAKE) $(REF_JFLAG) -C kernel ARCHV=$(ARCHV) ref_install && \
$(MAKE) $(REF_JFLAG) -C libs ARCHV=$(ARCHV) install IMPL=ref && \
$(MAKE) $(REF_JFLAG) -C stake ARCHV=$(ARCHV) install
$(MAKE) $(REF_JFLAG) -C booter ARCHV=$(ARCHV) install
cp scripts/Makefile.inc.config $(INSTALLPATH)/scripts
cp scripts/Makefile.inc.opensource $(INSTALLPATH)/scripts
cp scripts/devsim_v*.cfg $(INSTALLPATH)/scripts
$(MAKE) $(REF_JFLAG) -f scripts/Makefile.coverage ARCHV=$(ARCHV) prepare;
echo "v$(ARCHV) $@ ${MAKEFLAGS}" > $(INSTALLPATH)/ver
echo "sha_short $(H2K_GIT_COMMIT)" >> $(INSTALLPATH)/ver
echo "sha_long $(H2K_GIT_COMMIT_LONG)" >> $(INSTALLPATH)/ver
sim: ref
$(CC) -mv$(TOOLARCH) -moslib=h2 -moslib=h2kernel -I$(INSTALLPATH)/include -L$(INSTALLPATH)/lib tst/test.c -o test.exe && \
$(RUN) $(SIMF) -- test.exe;
size:
hexagon-objdump -h $(INSTALLPATH)/lib/*.a | $(SIZE_TOOL) text > size && \
cat size;
# t:
# /prj/dsp/qdsp6/arch/scripts/test_h2.pl $(TEST_H2_OPTS)
.PHONY: testall testall_prepare
testall: testall_prepare $(ARCHV_LIST)
testall_prepare:
git clean -dxf -e 'jenkins[0-9]*'
.PHONY: $(ARCHV_LIST)
$(ARCHV_LIST):
@echo '/// $@ opt ///' | tee -a $(TESTOUT)
$(MAKE) ARCHV=$@ TARGET=opt all test
git clean -dxf -e $(TESTOUT) -e 'jenkins[0-9]*'
@echo '/// $@ ref ///' | tee -a $(TESTOUT)
$(MAKE) ARCHV=$@ TARGET=ref all test
git clean -dxf -e $(TESTOUT) -e 'jenkins[0-9]*'
test: h2_test check-fail
h2_test: # ucosclean
$(MAKE) -f scripts/Makefile.coverage ARCHV=$(ARCHV) prepare
$(MAKE) $(TEST_JFLAG) -f scripts/Makefile.coverage ARCHV=$(ARCHV) tst 2>&1 | tee -a $(TESTOUT)
#$(MAKE) -C ucos sim 2>&1 | tee make.log | tee -a $(TESTOUT)
[ `fgrep -v "WARNING: Overriding currently set revid" $(TESTOUT) | fgrep -c -i warning:` -eq 0 ]
$(MAKE) -f scripts/Makefile.coverage ARCHV=$(ARCHV) h2_report.html
head -n -1 h2_report.html > report.html
qurt_test: ./qurt/test/testcases
$(MAKE) -f scripts/Makefile.qurt ARCHV=$(ARCHV) prepare
$(MAKE) $(TEST_JFLAG) -f scripts/Makefile.qurt ARCHV=$(ARCHV) tst 2>&1 | tee $(TESTOUT)
# [ `fgrep -c -i warning: $(TESTOUT)` -eq 0 ]
$(MAKE) -f scripts/Makefile.qurt ARCHV=$(ARCHV) qurt_report.html
qurt_test_single: ./qurt/test/testcases
$(MAKE) -f scripts/Makefile.qurt ARCHV=$(ARCHV) prepare
$(MAKE) $(TEST_JFLAG) -f scripts/Makefile.qurt ARCHV=$(ARCHV) TEST=$(TEST) tst_single 2>&1 | tee $(TESTOUT)
[ `fgrep -c -i warning: $(TESTOUT)` -eq 0 ]
qurt_test_libs:
$(MAKE) -f scripts/Makefile.qurt ARCHV=$(ARCHV) qurt_test_libs
#cov: h2_test
cov: h2_cov
head -n -1 h2_report.html > report.html
# tail -n +2 qurt_report.html >> report.html
h2_cov:
$(MAKE) -f scripts/Makefile.coverage ARCHV=$(ARCHV) prepare
$(MAKE) $(TEST_JFLAG) -f scripts/Makefile.coverage ARCHV=$(ARCHV) all
# $(MAKE) -C ucos sim 2>&1 | tee make.log
# $(MAKE) -f scripts/Makefile.coverage ARCHV=$(ARCHV) coverage_report
$(MAKE) -f scripts/Makefile.coverage ARCHV=$(ARCHV) cov.rpt
$(MAKE) -f scripts/Makefile.coverage ARCHV=$(ARCHV) h2_report.html
.PHONY: check-fail test-check cov-check cov_fns
check-fail test-check cov-check:
$(MAKE) -f scripts/Makefile.coverage ARCHV=$(ARCHV) TESTOUT=$(TESTOUT) check-fail
# $(MAKE) -C ucos check
check:
$(MAKE) -f scripts/Makefile.coverage ARCHV=$(ARCHV) TESTOUT=$(TESTOUT) check
# $(MAKE) -C ucos check
doc:
$(MAKE) -C libs/docs/dox
$(MAKE) -f scripts/docs/Makefile.sphinx prepare
$(MAKE) -f scripts/docs/Makefile.sphinx doctest html
compat:
cd install/lib ; ln -s libh2kernel.a libblastkernel.a ; ln -s libh2.a libblast.a
.PHONY: gtags gtagsclean htags
gtags:
find booter examples kernel libs linux perf qurt scripts stake tst -path libs/syscall/angel/include -o -path kernel/include -prune -o -path "libs/*/include" -prune -o -type f -print | gtags -I -w -v -f -
htags: gtags
htags -ahnosTxvF --show-position --auto-completion --tree-view=filetree
gtagsclean:
rm -rf GPATH GRTAGS GSYMS GTAGS ID HTML
cov_fns:
# $(MAKE) clean ref ARCHV=v4 OPTIMIZE='-Os -fno-inline';
# ./scripts/gen_cov_fns.pl > ./scripts/v4ref_cov_fns;
# $(MAKE) clean opt ARCHV=v4 OPTIMIZE='-Os -fno-inline';
# ./scripts/gen_cov_fns.pl > ./scripts/v4opt_cov_fns;
# $(MAKE) clean ref ARCHV=v5 OPTIMIZE='-Os -fno-inline';
# ./scripts/gen_cov_fns.pl > ./scripts/v5ref_cov_fns;
# $(MAKE) clean opt ARCHV=v5 OPTIMIZE='-Os -fno-inline';
# ./scripts/gen_cov_fns.pl > ./scripts/v5opt_cov_fns;
$(MAKE) clean ref ARCHV=60 OPTIMIZE="$(OPTIMIZE_COV)";
./scripts/gen_cov_fns.pl > ./scripts/v60ref_cov_fns;
$(MAKE) clean opt ARCHV=60 OPTIMIZE="$(OPTIMIZE_COV)";
./scripts/gen_cov_fns.pl > ./scripts/v60opt_cov_fns;
$(MAKE) clean ref ARCHV=65 OPTIMIZE="$(OPTIMIZE_COV)";
./scripts/gen_cov_fns.pl > ./scripts/v65ref_cov_fns;
$(MAKE) clean opt ARCHV=65 OPTIMIZE="$(OPTIMIZE_COV)";
./scripts/gen_cov_fns.pl > ./scripts/v65opt_cov_fns;
$(MAKE) clean ref ARCHV=68 OPTIMIZE="$(OPTIMIZE_COV)";
./scripts/gen_cov_fns.pl > ./scripts/v68ref_cov_fns;
$(MAKE) clean opt ARCHV=68 OPTIMIZE="$(OPTIMIZE_COV)";
./scripts/gen_cov_fns.pl > ./scripts/v68opt_cov_fns;
.PHONY: q6testinstallenvs
q6testinstallenvs:
export Q6TESTINSTALL_MAKEJOBS=1
export Q6TESTINSTALL_TESTTARGET='testall'