Mercurial > projects > dstress
annotate Makefile @ 1630:d0efa3ae5522 default tip
run/mini/naked_asm5: New x86_64 ABI passes the arguments in reverse order.
author | David Nadlinger <code@klickverbot.at> |
---|---|
date | Sat, 23 Apr 2011 22:57:32 +0200 |
parents | c6ef09dfba4d |
children |
rev | line source |
---|---|
735 | 1 # $HeadURL$ |
145
553c8aaa0982
added support for detecting segfaults with pseudo return code 1
thomask
parents:
109
diff
changeset
|
2 # $Date$ |
553c8aaa0982
added support for detecting segfaults with pseudo return code 1
thomask
parents:
109
diff
changeset
|
3 # $Author$ |
553c8aaa0982
added support for detecting segfaults with pseudo return code 1
thomask
parents:
109
diff
changeset
|
4 # |
239 | 5 # GnuMakefile for DStress http://dstress.kuehne.cn/www/dstress.html |
882 | 6 # Copyright (C) 2004, 2005, 2006 Thomas Kuehne |
46 | 7 # |
8 # This program is free software; you can redistribute it and/or modify | |
9 # it under the terms of the GNU General Public License as published by | |
10 # the Free Software Foundation; either version 2 of the License, or | |
11 # (at your option) any later version. | |
12 # | |
13 # This program is distributed in the hope that it will be useful, | |
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 # GNU General Public License for more details. | |
17 # | |
18 # You should have received a copy of the GNU General Public License | |
19 # along with this program; if not, write to the Free Software | |
20 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
21 # | |
0 | 22 |
46 | 23 # dir: temp objects will be placed there |
32 | 24 ifndef OBJ_DIR |
190 | 25 OBJ_DIR := obj |
32 | 26 endif |
27 | |
46 | 28 # file: append compiler messages and runtime assertions |
83 | 29 # NOTE: this has to be an absolut path (required for some complex.mak files) |
32 | 30 ifndef LOG |
190 | 31 LOG := $(PWD)/log.txt |
32 | 32 endif |
0 | 33 |
46 | 34 # executeable: the compiler |
0 | 35 ifndef DMD |
190 | 36 DMD := dmd |
0 | 37 endif |
38 | |
46 | 39 # executeable: a GNU findutils compatible find (e.g.: find path -regex "?\\.*something") |
0 | 40 ifndef FIND |
190 | 41 FIND := find |
0 | 42 endif |
43 | |
46 | 44 # executeable: remove zero or more files (e.g.: rm -f a b c) |
0 | 45 ifndef RM |
936
daeca9f37d08
adapeted "clean" target to the large number of files
thomask
parents:
882
diff
changeset
|
46 RM := rm -f -- |
0 | 47 endif |
48 | |
46 | 49 # executeable: change to a given dir (e.g. cd some/other/dir) |
50 ifndef CD | |
190 | 51 CD := cd |
46 | 52 endif |
53 | |
716 | 54 # executeable: display a message test (e.g. echo "something to say") |
0 | 55 ifndef ECHO |
190 | 56 ECHO := echo |
0 | 57 endif |
58 | |
46 | 59 # executeable: update the timestamp of an existing file or create a new empty file |
0 | 60 ifndef TOUCH |
190 | 61 TOUCH := touch |
0 | 62 endif |
63 | |
145
553c8aaa0982
added support for detecting segfaults with pseudo return code 1
thomask
parents:
109
diff
changeset
|
64 # executeable: detect if stdin contains "Internal error" (dmd) or "gcc.gnu.org/bugs" (gcd) |
553c8aaa0982
added support for detecting segfaults with pseudo return code 1
thomask
parents:
109
diff
changeset
|
65 ifndef GREP |
190 | 66 GREP := grep -s '\(Internal error\)\|\(gcc.gnu.org/bugs\)' > /dev/null 2>&1 |
145
553c8aaa0982
added support for detecting segfaults with pseudo return code 1
thomask
parents:
109
diff
changeset
|
67 endif |
553c8aaa0982
added support for detecting segfaults with pseudo return code 1
thomask
parents:
109
diff
changeset
|
68 |
553c8aaa0982
added support for detecting segfaults with pseudo return code 1
thomask
parents:
109
diff
changeset
|
69 # executeable: used to concat files |
553c8aaa0982
added support for detecting segfaults with pseudo return code 1
thomask
parents:
109
diff
changeset
|
70 ifndef CAT |
190 | 71 CAT := cat |
145
553c8aaa0982
added support for detecting segfaults with pseudo return code 1
thomask
parents:
109
diff
changeset
|
72 endif |
553c8aaa0982
added support for detecting segfaults with pseudo return code 1
thomask
parents:
109
diff
changeset
|
73 |
46 | 74 ############################################################################### |
75 ############################################################################### | |
76 # | |
77 # nothing to customize below | |
78 # | |
79 ############################################################################### | |
80 ############################################################################### | |
6 | 81 |
83 | 82 # tools |
969 | 83 return__ := $(PWD)/return__ |
190 | 84 ifeq__ := ./ifeq__ |
85 extract__ := ./extract__ | |
639 | 86 dstress__ := ./dstress |
87 crashRun__ := ./crashRun | |
83 | 88 |
72 | 89 # settings |
190 | 90 to_log := >> $(LOG) 2>&1 |
91 ext_run := exe | |
92 ext_norun := bin | |
93 ext_nocompile := no | |
94 ext_compile := o | |
95 ext_source := d | |
96 ext_source_html := html | |
97 ext_log := log | |
98 complex_todo := complex.mak | |
99 complex_done := complex.done | |
100 flag_pattern := __DSTRESS_DFLAGS__ | |
0 | 101 |
605 | 102 .PHONY:: all version basic_tools compile nocompile run norun complex clean distclean clean_log |
190 | 103 |
755
fb70ca0d80ba
updated resutls of DMD-0.093 - 0.101, 0.104, 0.121, 0.140
thomask
parents:
735
diff
changeset
|
104 .SUFFIXES:: $(ext_run) $(ext_norun) $(ext_nocompile) $(ext_compile) |
46 | 105 # |
106 # test everything | |
107 # | |
441 | 108 all : Makefile version compile nocompile run norun complex |
6 | 109 |
46 | 110 # |
72 | 111 # the tools |
112 # | |
971
8da09834526d
* Valgrind support is now part of dstress.c instead of crashRun.c
thomask
parents:
969
diff
changeset
|
113 % : %.c Makefile |
72 | 114 $(CC) $(CFLAGS) $< -o $@ |
115 | |
490 | 116 $(dstress__) : dstress.c $(crashRun__) Makefile |
1387 | 117 $(CC) $(CFLAGS) $< -o $@ |
251 | 118 |
119 basic_tools : $(ifeq__) $(return__) $(extract__) $(dstress__) | |
441 | 120 |
121 # | |
122 # kludge to get version information from DMD and GDC's dmd wraper | |
123 # | |
124 version: | |
125 @$(ECHO) ">>>> VERSION <<<<" | |
494 | 126 @date +"%a, %e %b %Y %T %z" |
127 @uname -s -m -r | |
441 | 128 -@$(DMD) |
129 -@$(DMD) --version version_dummy.d | |
130 @$(ECHO) "<<<< VERSION >>>>" | |
83 | 131 |
72 | 132 # |
46 | 133 # include complex test cases |
134 # | |
190 | 135 complex_makefiles := $(sort $(shell $(FIND) complex -regex ".*$(complex_todo)")) |
46 | 136 include $(complex_makefiles) |
6 | 137 |
83 | 138 # |
139 # extract potential compiling flags from the test case sources | |
140 # | |
141 define extract_z_flags | |
142 $(eval z_flags = $(shell $(extract__) $(flag_pattern) < $<)) | |
143 endef | |
144 | |
46 | 145 # |
146 # target should fail to compile | |
147 # | |
529 | 148 nocompile : $(dstress__) nocompile_clean |
1390 | 149 echo '#!/bin/sh' > nocompile.sh |
1628
c6ef09dfba4d
add mini test set from ldc project
Moritz Warning <moritzwarning@web.de>
parents:
1627
diff
changeset
|
150 find nocompile -type f | grep -v ".svn" | sort -f | xargs -n 1 echo "$(dstress__) nocompile" >> nocompile.sh |
251 | 151 chmod +x nocompile.sh |
152 ./nocompile.sh 2>> $(LOG) | |
17 | 153 |
529 | 154 nocompile_clean : |
155 $(eval z_rm = $(shell find nocompile -type f -name "*\\.o" | grep -v ".svn")) | |
936
daeca9f37d08
adapeted "clean" target to the large number of files
thomask
parents:
882
diff
changeset
|
156 $(RM) $(z_rm) |
529 | 157 |
251 | 158 # used in some complex test cases |
75 | 159 define analyse_nocompile |
72 | 160 @if $(ifeq__) $(z_return) 0 ; then \ |
882 | 161 $(ECHO) "Torture-Sub-1/31-XPASS: $(z_name)"; $(RM) $@; \ |
46 | 162 else \ |
145
553c8aaa0982
added support for detecting segfaults with pseudo return code 1
thomask
parents:
109
diff
changeset
|
163 if $(CAT) $(z_log) | $(GREP) ; then \ |
882 | 164 $(ECHO) "Torture-Sub-1/31-ERROR: $(z_name) [Internal compiler error]"; $(RM) $@; \ |
72 | 165 else \ |
145
553c8aaa0982
added support for detecting segfaults with pseudo return code 1
thomask
parents:
109
diff
changeset
|
166 if $(ifeq__) $(z_return) 256 ; then \ |
882 | 167 $(ECHO) "Torture-Sub-1/31-XFAIL: $(z_name)"; $(TOUCH) $@; \ |
145
553c8aaa0982
added support for detecting segfaults with pseudo return code 1
thomask
parents:
109
diff
changeset
|
168 else \ |
882 | 169 $(ECHO) "Torture-Sub-1/31-ERROR: $(z_name) [$(z_return)]"; $(RM) $@; \ |
145
553c8aaa0982
added support for detecting segfaults with pseudo return code 1
thomask
parents:
109
diff
changeset
|
170 fi \ |
72 | 171 fi \ |
46 | 172 fi |
75 | 173 endef |
174 | |
46 | 175 # |
176 # target should compile (excludes linking) | |
177 # | |
529 | 178 compile : $(dstress__) compile_clean |
1390 | 179 echo '#!/bin/sh' > compile.sh |
1628
c6ef09dfba4d
add mini test set from ldc project
Moritz Warning <moritzwarning@web.de>
parents:
1627
diff
changeset
|
180 find compile -type f | grep -v ".svn" | sort -f | xargs -n 1 echo "$(dstress__) compile" >> compile.sh |
251 | 181 chmod +x compile.sh |
182 ./compile.sh 2>> $(LOG) | |
0 | 183 |
529 | 184 compile_clean : |
185 $(eval z_rm = $(shell find compile -type f -name "*\\.o" | grep -v ".svn")) | |
936
daeca9f37d08
adapeted "clean" target to the large number of files
thomask
parents:
882
diff
changeset
|
186 $(RM) $(z_rm) |
1093 | 187 $(eval z_rm = $(shell find compile -type f -name "*\\.exe" | grep -v ".svn")) |
188 $(RM) $(z_rm) | |
529 | 189 |
251 | 190 # used in some complex test cases |
75 | 191 define analyse_compile |
72 | 192 @if $(ifeq__) $(z_return) 0 ; then \ |
882 | 193 $(ECHO) "Torture-Sub-1/31-PASS: $(z_name)"; $(TOUCH) $@; \ |
46 | 194 else \ |
72 | 195 if $(ifeq__) $(z_return) 256 ; then \ |
882 | 196 $(ECHO) "Torture-Sub-1/31-FAIL: $(z_name)"; $(RM) $@; \ |
72 | 197 else \ |
882 | 198 $(ECHO) "Torture-Sub-1/31-ERROR: $(z_name) [$(z_return)]"; $(RM) $@; \ |
72 | 199 fi \ |
46 | 200 fi |
75 | 201 endef |
202 | |
46 | 203 # |
204 # target should compile, link and run | |
205 # | |
529 | 206 run : $(dstress__) run_clean |
1390 | 207 echo '#!/bin/sh' > run.sh |
1628
c6ef09dfba4d
add mini test set from ldc project
Moritz Warning <moritzwarning@web.de>
parents:
1627
diff
changeset
|
208 find run -type f -name "*\\.d" | grep -v ".svn" | sort -f | xargs -n 1 echo "$(dstress__) run" >> run.sh |
251 | 209 chmod +x run.sh |
210 ./run.sh 2>> $(LOG) | |
0 | 211 |
529 | 212 run_clean : |
213 $(eval z_rm = $(shell find run -type f -name "*\\.exe" | grep -v ".svn")) | |
214 $(RM) $(z_rm) | |
215 | |
251 | 216 # used in some complex testcases |
75 | 217 define analyse_run |
72 | 218 @if $(ifeq__) $(z_return) 0 ; then \ |
80 | 219 $(eval z_return2 = $(shell $(return__) "./$@ $(to_log)")) \ |
220 if $(ifeq__) $(z_return2) 0 ; then \ | |
882 | 221 $(ECHO) "Torture-Sub-1/31-PASS: $(z_name)"; \ |
46 | 222 else \ |
80 | 223 if $(ifeq__) $(z_return2) 256 ; then \ |
882 | 224 $(ECHO) "Torture-Sub-1/31-FAIL: $(z_name)"; $(RM) $@; \ |
80 | 225 else \ |
882 | 226 $(ECHO) "Torture-Sub-1/31-ERROR: $(z_name) [run: $(z_return2)]"; $(RM) $@; \ |
80 | 227 fi \ |
46 | 228 fi \ |
229 else \ | |
72 | 230 if $(ifeq__) $(z_return) 256 ; then \ |
882 | 231 $(ECHO) "Torture-Sub-1/31-FAIL: $(z_name) (compiling error)"; \ |
72 | 232 else \ |
882 | 233 $(ECHO) "Torture-Sub-1/31-ERROR: $(z_name) [$(z_return)]"; \ |
72 | 234 fi \ |
46 | 235 fi |
75 | 236 endef |
46 | 237 |
238 # | |
108 | 239 # target should compile, link and run |
240 # (used for Makefile diagnosis) | |
241 # | |
242 %.diagnose.$(ext_run) : %.$(ext_source) basic_tools | |
243 # destination: $@ | |
244 # source: $< | |
109
0e5c059a7658
added diagnosis for GNUMake's $(eval ...), $(shell ...) and $(eval ... $(shell ...))
thomask
parents:
108
diff
changeset
|
245 $(eval y_tmp = OK) |
0e5c059a7658
added diagnosis for GNUMake's $(eval ...), $(shell ...) and $(eval ... $(shell ...))
thomask
parents:
108
diff
changeset
|
246 # eval: $(y_tmp) |
0e5c059a7658
added diagnosis for GNUMake's $(eval ...), $(shell ...) and $(eval ... $(shell ...))
thomask
parents:
108
diff
changeset
|
247 # shell: |
0e5c059a7658
added diagnosis for GNUMake's $(eval ...), $(shell ...) and $(eval ... $(shell ...))
thomask
parents:
108
diff
changeset
|
248 @$(ECHO) $(shell $(ECHO) "OK") |
0e5c059a7658
added diagnosis for GNUMake's $(eval ...), $(shell ...) and $(eval ... $(shell ...))
thomask
parents:
108
diff
changeset
|
249 $(eval y_tmp = $(shell $(ECHO) "OK")) |
0e5c059a7658
added diagnosis for GNUMake's $(eval ...), $(shell ...) and $(eval ... $(shell ...))
thomask
parents:
108
diff
changeset
|
250 # eval.shell: $(y_tmp) |
108 | 251 $(eval z_name = $(subst .diagnose.$(ext_run),,$@)) |
252 # name: $(z_name) | |
253 # extract__: $(extract__) | |
254 # extract__.cmd: $(extract__) $(flag_pattern) < $< | |
255 $(extract_z_flags) | |
256 # extract__.result: $(z_flags) | |
257 # ifeq__: $(ifeq__) | |
258 # continue if ifeq__ works | |
259 $(ifeq__) someString someString | |
260 # return__: $(return__) | |
261 # dmd: $(DMD) | |
262 $(eval y_tmp = $(shell $(return__) "$(ifeq__) 1 1")) | |
263 # return__.return_code_0: $(y_tmp) (expect=0) | |
264 $(eval y_tmp = $(shell $(return__) "$(DMD) > /dev/null")) | |
265 # return__.return_code_1: $(y_tmp) (expect=256) | |
266 # dmd.cmd: $(DMD) $(DFLAGS) $(z_flags) -od$(OBJ_DIR) -of$@ $< $(to_log) | |
267 $(eval z_return = $(shell $(return__) "$(DMD) $(DFLAGS) $(z_flags) -od$(OBJ_DIR) -of$@ $< $(to_log)")) | |
268 # dmd.return: $(z_return) | |
269 # for analyse_run diagnosis: '@if' -> 'if' in 'define analyse_run' (line 185) | |
270 $(analyse_run) | |
271 | |
272 # | |
46 | 273 # target should compile and link but fail to run |
274 # | |
529 | 275 norun : $(dstress__) norun_clean |
1390 | 276 echo '#!/bin/sh' > norun.sh |
1628
c6ef09dfba4d
add mini test set from ldc project
Moritz Warning <moritzwarning@web.de>
parents:
1627
diff
changeset
|
277 find norun -type f -name "*\\.d" | grep -v ".svn" | sort -f | xargs -n 1 echo "$(dstress__) norun" >> norun.sh |
251 | 278 chmod +x norun.sh |
279 ./norun.sh 2>> $(LOG) | |
0 | 280 |
529 | 281 norun_clean : |
282 $(eval z_rm = $(shell find norun -type f -name "*\\.exe" | grep -v ".svn")) | |
283 $(RM) $(z_rm) | |
284 | |
251 | 285 # used in some complex test cases |
75 | 286 define analyse_norun |
72 | 287 @if $(ifeq__) $(z_return) 0; then \ |
288 if ./$@ $(to_log); \ | |
882 | 289 then $(ECHO) "Torture-Sub-1/31-XPASS: $(z_name)"; $(RM) $@; \ |
46 | 290 else \ |
882 | 291 $(ECHO) "Torture-Sub-1/31-XFAIL: $(z_name)"; \ |
46 | 292 fi \ |
293 else \ | |
72 | 294 if $(ifeq__) $(z_return) 256 ; then \ |
882 | 295 $(ECHO) "Torture-Sub-1/31-FAIL: $(z_name) (compiling error)"; $(RM) $@; \ |
72 | 296 else \ |
882 | 297 $(ECHO) "Torture-Sub-1/31-ERROR: $(z_name) [$(z_return)]"; \ |
72 | 298 fi \ |
46 | 299 fi |
75 | 300 endef |
301 | |
46 | 302 # |
303 # run all complex test cases | |
304 # | |
251 | 305 complex : basic_tools $(sort $(subst $(complex_todo),$(complex_done),$(complex_makefiles))) |
32 | 306 |
46 | 307 # |
308 # | |
309 # | |
17 | 310 distclean : clean_log clean |
708 | 311 $(RM) $(shell $(FIND) . -regex ".*~") |
312 $(RM) $(shell $(FIND) . -regex "\\..*\\.swp") | |
313 $(RM) $(shell $(FIND) . -regex "#.*#") | |
314 $(RM) $(shell $(FIND) . -regex ".*\\.map") | |
315 $(RM) $(shell $(FIND) . -regex ".*\\.bak") | |
490 | 316 $(RM) $(crashRun__) $(return__) $(ifeq__) $(extract__) $(dstress__) www/*.class |
6 | 317 |
46 | 318 # |
319 # remove compiler and assertion messages | |
320 # | |
0 | 321 clean_log : |
322 $(RM) $(LOG) | |
323 | |
46 | 324 # |
325 # remove targets and all temp objects | |
326 # | |
605 | 327 complex_clean : $(sort $(subst $(complex_todo),clean,$(complex_makefiles))) |
328 | |
939 | 329 clean :: complex_clean nocompile_clean compile_clean norun_clean run_clean |
936
daeca9f37d08
adapeted "clean" target to the large number of files
thomask
parents:
882
diff
changeset
|
330 $(RM) $(OBJ_DIR)/[A-E]*.* |
daeca9f37d08
adapeted "clean" target to the large number of files
thomask
parents:
882
diff
changeset
|
331 $(RM) $(OBJ_DIR)/[F-J]*.* |
daeca9f37d08
adapeted "clean" target to the large number of files
thomask
parents:
882
diff
changeset
|
332 $(RM) $(OBJ_DIR)/[K-O]*.* |
daeca9f37d08
adapeted "clean" target to the large number of files
thomask
parents:
882
diff
changeset
|
333 $(RM) $(OBJ_DIR)/[P-T]*.* |
daeca9f37d08
adapeted "clean" target to the large number of files
thomask
parents:
882
diff
changeset
|
334 $(RM) $(OBJ_DIR)/[U-Z]*.* |
daeca9f37d08
adapeted "clean" target to the large number of files
thomask
parents:
882
diff
changeset
|
335 $(RM) $(OBJ_DIR)/[a-e]*.* |
daeca9f37d08
adapeted "clean" target to the large number of files
thomask
parents:
882
diff
changeset
|
336 $(RM) $(OBJ_DIR)/[f-j]*.* |
daeca9f37d08
adapeted "clean" target to the large number of files
thomask
parents:
882
diff
changeset
|
337 $(RM) $(OBJ_DIR)/[k-o]*.* |
daeca9f37d08
adapeted "clean" target to the large number of files
thomask
parents:
882
diff
changeset
|
338 $(RM) $(OBJ_DIR)/[p-t]*.* |
daeca9f37d08
adapeted "clean" target to the large number of files
thomask
parents:
882
diff
changeset
|
339 $(RM) $(OBJ_DIR)/[u-z]*.* |
971
8da09834526d
* Valgrind support is now part of dstress.c instead of crashRun.c
thomask
parents:
969
diff
changeset
|
340 $(RM) -rf $(OBJ_DIR)/* |
251 | 341 $(RM) run.sh norun.sh compile.sh nocompile.sh |
83 | 342 |
343 # the empty line above has to remain, otherwise some weired problems can arise |