-
Notifications
You must be signed in to change notification settings - Fork 1
/
makefile
201 lines (182 loc) · 5.95 KB
/
makefile
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
#==============================================================================
#$RCSfile: $(MAKE)file,v $
#
# DESC : Make all app
#
# AUTHOR : Rick Foos, ECL, LLC
#
# CVS : $Revision: 1.56 $
#------------------------------------------------------------------------------
# Copyright (c) 1998-2005 by the EDN Embedded Microprocessor
# Benchmark Consortium (EEMBC), Inc. All Rights Reserved.
#==============================================================================
# Available commands:
#
# all - th regular, th lite build and run
# all-vers - all for V1 and V2 Benchmarks
# all-lite - th lite build and run
# all-816 - th 816 build and run
# all-regular - th regular build and run
# rerun - run and results for lite and regular
# clean - clean lite and regular for all toolchains
# cleanlogs - clean lite and regular log files for all toolchains
# distclean - clean, and delete $(MAKE)rule dependency files.
# harness - build all $(MAKE)rule generated target files.
# count - count source code lines, and build summary log files.
# profile - Build and run with profiling (gcc gprof only from ECL)
ifndef RELEASETAG
RELEASETAG=ORC8
endif
# Override to v2 from command line ($(MAKE) VER=v2)
#vers=" " "v2"
VER=v2
ver=v2
vers="v2"
harnesses=$(THLITE)
# Automatic Override from toolchain.mak
PLATFORM=x86
TLOGTYP=_time
SLOGTYP=_size
PLOGTYP=_psnr
CLOGTYP=_count
THLITE=_lite
TH816=_816
ROOT=..
TCDIR=util/$(MAKE)
PERL:=`which perl`
AWK:=`which gawk`
SCLC="$(PERL) $(ROOT)/util/perl/sclc -ignore -recurse "
LOGTAG="`date`"
DATESTAMP:=`date +%y_%m_%0d_%0l_%M_%S`
ETC_STAMP:=`date +%y_%j`
ifdef TOOLCHAIN
tchain=$(TOOLCHAIN)
else
tchain=`ls $(TCDIR)/*.mak | sed -e "s|.*/\([^\.]*\).*|\1|"`
endif
app=oav2
ifdef PGOINI
EXTRA_MAKE_OPT += TRAINING=yes
endif
ifdef PGOUSE
FAST=1
EXTRA_MAKE_OPT += USEPGO=yes EXTRA_TARGETS_S=cleanobjs
endif
ifdef FAST
EXTRA_MAKE_OPT += CMDLINE_CHEADER=skip
endif
ifndef OAFULL
EXTRA_MAKE_OPT += OAMARKONLY=1
else
EXTRA_MAKE_OPT += OAMARKONLY=0
endif
# Constants used in Makefile
all: all-lite
.PHONY:all-regular
all-regular:
@echo "This target is no longer supported"
.PHONY:all-lite
all-lite: cheader
@echo "Make ALL TH Lite by Toolchain,Application...";\
for j in $(tchain); do \
for i in $(app); do \
if [ -f "$$i/dirs$(VER)$(PLATFORM).mak" ]; then \
(cd $$i && echo EXTRA FLAGS:$(STAGE) $(EXTRA_MAKE_OPT) && $(MAKE) TCDIR=$(ROOT)/$(TCDIR) VER=$(VER) TOOLCHAIN=$$j LITE=${THLITE} $(STAGE) $(EXTRA_MAKE_OPT) );\
tlog=$$j"$(TLOGTYP)"$(VER)${THLITE}.log;\
slog=$$j"$(SLOGTYP)"$(VER)${THLITE}.log;\
plog=$$j"$(PLOGTYP)"$(VER)${THLITE}.log;\
[ ! -f "$$tlog" ] && cat util/awk/titletime.txt >$$tlog;\
[ -f "$$i/$$tlog" ] && echo $(LOGTAG) >> $$tlog && cat $$i/$$tlog >>$$tlog;\
[ ! -f "$$slog" ] && cat util/awk/titlesize.txt >$$slog;\
[ -f "$$i/$$slog" ] && echo $(LOGTAG) >> $$slog && cat $$i/$$slog >>$$slog;\
[ ! -f "$$plog" ] && cat util/awk/titlepsnr.txt >$$plog;\
[ -f "$$i/$$plog" ] && echo $(LOGTAG) >> $$plog && cat $$i/$$plog >>$$plog;\
fi; \
done; \
done;\
echo "...$@ done."
# ETC only. Distributes common routines to Applications.
new$(MAKE)file_EXCLUDE=java
.PHONY:new$(MAKE)file
new$(MAKE)file:
@echo "Distributing new $(MAKE)files...";\
for i in $(app); do \
[ "$$i" = "${new$(MAKE)file_EXCLUDE}" ] && continue;\
[ -d "$$i" ] && echo " $$i" && cp -f util/$(MAKE)/$(MAKE)file $$i/$(MAKE)file;\
done;\
echo "...$@ done."
#
# This section executes commands once per Application.
# Preambles, execution, and Post Processing
#
# Preamble: Builds Cheader executable if needed
# Removed -x check. It was missing old cheader executables with new code.
# happens to also build uudecode, and psnr
cheader ::
@echo -n "Check cheader build...";\
(cd util && $(MAKE));\
[ ! -x "./util/shell/cinit.sh" ] && chmod +x "./util/shell/cinit.sh";\
echo "done."
ifndef FAST
.PHONY:cheader count
cheader count ::
@echo "Make $@ by Version ${ver}...";\
for i in $(app); do \
([ $$i == "java" ] || [ ! -f "$$i/dirs$(VER)$(PLATFORM).mak" ]) && continue;\
(cd $$i && $(MAKE) TCDIR=$(ROOT)/$(TCDIR) VER=$(VER) $@);\
done;\
echo "...$@ done."
endif
# Post Processing: Count (Had to use sed to $(MAKE) the filename variable work.)
count ::
@echo -n "Building count${VER}.log...";\
cat util/awk/titlecount.txt >count${VER}.log;\
cat util/awk/titlecount.txt >countsum${VER}.log;\
for i in $(app); do \
([ $$i == "java" ] || [ ! -f "$$i/dirs$(VER)$(PLATFORM).mak" ]) && continue;\
clog=`echo "$$i/$$i ${CLOGTYP}${VER}.log" | sed -e "s| ||"`;\
[ -f "$$clog" ] && cat "$$clog" >>count${VER}.log && ${AWK} -f util/awk/countsum.awk BMARK=$$i $$clog >>countsum${VER}.log;\
done;\
echo "done."
#
# This section passes commands to each application for each toolchain.
#
.PHONY:clean distclean harness rerun cleanlogs
clean distclean harness cleanlogs::
@echo "Make $@ by version toolchain,application...";\
for l in ${vers}; do \
for j in $(tchain); do \
for i in $(app); do \
dirplat=`echo "$$i/dirs$$l $(PLATFORM).mak" | sed -e "s| ||g"`;\
if [ -d "$$i" ] && [ -f "$$dirplat" ]; then \
(cd $$i && $(MAKE) TCDIR=$(ROOT)/$(TCDIR) VER=$$l TOOLCHAIN=$$j LITE=$(THLITE) $@);\
fi;\
done;\
done;\
done;\
echo "...$@ done."
rerun: cleanlogs all
distclean:: clean
@echo "Clean misc files"
@rm -f *.log
(cd util && $(MAKE) clean)
.PHONY:release
release: distclean release-harness
@for suite in $(app); do \
if [[ -d $$suite ]] ; then \
echo "Creating release for $${suite}_$(ETC_STAMP)" ;\
for dname in $$suite/*; do \
[[ -d "$$dname" ]] && [[ ! "$$dname" =~ .svn ]] && \
zip -r release/$${suite}_$(ETC_STAMP).zip $$dname -x \*.svn\* > /dev/null; \
[[ ! -d "$$dname" ]] && \
zip release/$${suite}_$(ETC_STAMP).zip $$dname -x \*.svn\* > /dev/null; \
done ;\
fi; \
true ;\
done
.PHONY:release-harness
release-harness:
@[[ -d release ]] || mkdir release
@echo "Creating harness release harness_$(ETC_STAMP)"
@zip -r release/harness_$(ETC_STAMP).zip th_lite util doc -x \*.svn\* > /dev/null
@zip release/harness_$(ETC_STAMP).zip make* *.txt > /dev/null