| 1 |
# $HeadURL$ |
|---|
| 2 |
# $Date$ |
|---|
| 3 |
# $Author$ |
|---|
| 4 |
# |
|---|
| 5 |
# experimental parallel GnuMakefile for DStress http://dstress.kuehne.cn/www/dstress.html |
|---|
| 6 |
# Copyright (C) 2006, 2007 Thomas Kuehne |
|---|
| 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 |
# |
|---|
| 22 |
|
|---|
| 23 |
# |
|---|
| 24 |
# config |
|---|
| 25 |
# |
|---|
| 26 |
|
|---|
| 27 |
date := date +"%a, %e %b %Y %T %z" |
|---|
| 28 |
uname := uname -s -m -r |
|---|
| 29 |
|
|---|
| 30 |
ifndef CAT |
|---|
| 31 |
CAT := cat |
|---|
| 32 |
endif |
|---|
| 33 |
|
|---|
| 34 |
ifndef CC |
|---|
| 35 |
CC := cc |
|---|
| 36 |
endif |
|---|
| 37 |
|
|---|
| 38 |
ifndef DMD |
|---|
| 39 |
DMD := dmd |
|---|
| 40 |
export DMD |
|---|
| 41 |
endif |
|---|
| 42 |
|
|---|
| 43 |
ifndef FIND |
|---|
| 44 |
FIND := find |
|---|
| 45 |
endif |
|---|
| 46 |
|
|---|
| 47 |
ifndef RM |
|---|
| 48 |
RM := rm -rf -- |
|---|
| 49 |
endif |
|---|
| 50 |
|
|---|
| 51 |
find := find |
|---|
| 52 |
find_filter := -type f | grep -v "\\(\\.svn\\)\\|\\(\\.exe$$\\)" |
|---|
| 53 |
|
|---|
| 54 |
############################################################################### |
|---|
| 55 |
############################################################################### |
|---|
| 56 |
# |
|---|
| 57 |
# nothing to customize below this line |
|---|
| 58 |
# |
|---|
| 59 |
############################################################################### |
|---|
| 60 |
############################################################################### |
|---|
| 61 |
|
|---|
| 62 |
ifndef NO_TORTURE |
|---|
| 63 |
torture := torture- |
|---|
| 64 |
else |
|---|
| 65 |
torture := |
|---|
| 66 |
endif |
|---|
| 67 |
|
|---|
| 68 |
dstress := ./dstress |
|---|
| 69 |
crashRun := ./crashRun |
|---|
| 70 |
logsuffix := .outlog |
|---|
| 71 |
|
|---|
| 72 |
.PHONY:: all clean compile nocompile norun run tools version |
|---|
| 73 |
|
|---|
| 74 |
all :: version compile nocompile run norun |
|---|
| 75 |
|
|---|
| 76 |
% : %.c |
|---|
| 77 |
$(CC) $(CFLAGS) -DUSE_VALGRIND $< -o $@ |
|---|
| 78 |
|
|---|
| 79 |
tools :: $(dstress) $(crashRun) |
|---|
| 80 |
|
|---|
| 81 |
version : |
|---|
| 82 |
@$(date) |
|---|
| 83 |
@$(uname) |
|---|
| 84 |
-@$(DMD) -v |
|---|
| 85 |
|
|---|
| 86 |
# |
|---|
| 87 |
# compile |
|---|
| 88 |
# |
|---|
| 89 |
compile : $(sort $(patsubst %,%.exe,$(shell $(find) compile $(find_filter)))) |
|---|
| 90 |
|
|---|
| 91 |
compile/%.exe : compile/% tools |
|---|
| 92 |
@$(dstress) $(torture)compile $< > obj/$(notdir $<)$(logsuffix) |
|---|
| 93 |
@$(CAT) obj/$(notdir $<)$(logsuffix) |
|---|
| 94 |
@$(RM) obj/$(basename $(notdir $<))* |
|---|
| 95 |
|
|---|
| 96 |
# |
|---|
| 97 |
# nocompile |
|---|
| 98 |
# |
|---|
| 99 |
nocompile : $(sort $(patsubst %,%.exe,$(shell $(find) nocompile $(find_filter)))) |
|---|
| 100 |
|
|---|
| 101 |
nocompile/%.exe : nocompile/% tools |
|---|
| 102 |
@$(dstress) $(torture)nocompile $< > obj/$(notdir $<)$(logsuffix) |
|---|
| 103 |
@$(CAT) obj/$(notdir $<)$(logsuffix) |
|---|
| 104 |
@$(RM) obj/$(basename $(notdir $<))* |
|---|
| 105 |
|
|---|
| 106 |
# |
|---|
| 107 |
# norun |
|---|
| 108 |
# |
|---|
| 109 |
norun : $(sort $(patsubst %,%.exe,$(shell $(find) norun $(find_filter)))) |
|---|
| 110 |
|
|---|
| 111 |
norun/%.exe : norun/% tools |
|---|
| 112 |
@$(dstress) $(torture)norun $< > obj/$(notdir $<)$(logsuffix) |
|---|
| 113 |
@$(CAT) obj/$(notdir $<)$(logsuffix) |
|---|
| 114 |
@$(RM) obj/$(basename $(notdir $<))* |
|---|
| 115 |
|
|---|
| 116 |
# |
|---|
| 117 |
# run |
|---|
| 118 |
# |
|---|
| 119 |
run : $(sort $(patsubst %,%.exe,$(shell $(find) run $(find_filter)))) |
|---|
| 120 |
|
|---|
| 121 |
run/%.exe : run/% tools |
|---|
| 122 |
@$(dstress) $(torture)run $< > obj/$(notdir $<)$(logsuffix) |
|---|
| 123 |
@$(CAT) obj/$(notdir $<)$(logsuffix) |
|---|
| 124 |
@$(RM) obj/$(basename $(notdir $<))* |
|---|
| 125 |
|
|---|
| 126 |
# |
|---|
| 127 |
# clean |
|---|
| 128 |
# |
|---|
| 129 |
# |
|---|
| 130 |
clean :: |
|---|
| 131 |
$(RM) $(shell $(find) run -name "*exe") |
|---|
| 132 |
$(RM) $(shell $(find) norun -name "*exe") |
|---|
| 133 |
$(RM) $(shell $(find) compile -name "*exe") |
|---|
| 134 |
$(RM) $(shell $(find) nocompile -name "*exe") |
|---|
| 135 |
$(RM) obj/[A-E]*.* |
|---|
| 136 |
$(RM) obj/[F-J]*.* |
|---|
| 137 |
$(RM) obj/[K-O]*.* |
|---|
| 138 |
$(RM) obj/[P-T]*.* |
|---|
| 139 |
$(RM) obj/[U-Z]*.* |
|---|
| 140 |
$(RM) obj/[a-e]*.* |
|---|
| 141 |
$(RM) obj/[f-j]*.* |
|---|
| 142 |
$(RM) obj/[k-o]*.* |
|---|
| 143 |
$(RM) obj/[p-t]*.* |
|---|
| 144 |
$(RM) obj/[u-z]*.* |
|---|
| 145 |
$(RM) obj/* |
|---|
| 146 |
$(RM) run.sh norun.sh compile.sh nocompile.sh |
|---|
| 147 |
$(RM) $(dstress) $(crashRun) |
|---|