-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathMakefile
156 lines (103 loc) · 4.04 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
TARGETS = check-integer bench-integer
GHC = cabal exec -- ghc
GHCFLAGS = -Wall -Werror -fwarn-tabs -funbox-strict-fields -fPIC -O3 $(PRAGMAS)
ghc_major_version := $(shell ghc --numeric-version | sed 's/\..*//')
hsdirs = Common/ Check/ GMP/ New*/ Simple/
hsfiles := $(shell find $(hsdirs) -name \*.hs -o -name \*.lhs) *.hs $(checkfiles)
bench_hsfiles = Check/BenchG.hs Check/Bench1.hs Check/Bench2.hs Check/Bench3.hs Check/Bench4.hs
checkfiles = Check/New1.hs Check/New2.hs Check/New3.hs Check/New4.hs
today := $(shell date "+%Y%m%d")
PRAGMAS = -XCPP -XMagicHash -XUnboxedTuples -XUnliftedFFITypes
BROWSER ?= firefox -no-remote
all : $(TARGETS)
check : check-integer test-internals
./test-internals
./check-integer # | tee check.log
core3 :
ghc-core New3/GHC/Integer/Internals.hs
asm3 :
$(GHC) $(GHCFLAGS) -keep-s-files New3/GHC/Integer/Internals.hs
less New3/GHC/Integer/Internals.s
llvm3 :
$(GHC) $(GHCFLAGS) -fllvm -keep-llvm-files New3/GHC/Integer/Internals.hs
less New3/GHC/Integer/Internals.ll
check-integer : check-integer.hs Stamp/ready $(hsfiles) Check/New1.hs Check/New2.hs Check/New3.hs Check/New4.hs
$(GHC) $(GHCFLAGS) --make $< -with-rtsopts="-H8m" -o $@
test-internals : test-internals.hs $(hsfiles)
$(GHC) $(GHCFLAGS) --make $< -o $@
bench-integer : bench-integer.hs Stamp/ready $(hsfiles) $(bench_hsfiles)
$(GHC) $(GHCFLAGS) --make $< -o $@
karatsubaSlice : karatsubaSlice.hs $(hsfiles)
$(GHC) $(GHCFLAGS) --make $< -o $@
karatsubaSlice2 : karatsubaSlice2.hs $(hsfiles)
$(GHC) $(GHCFLAGS) --make $< -o $@
karatsubaSlice3 : karatsubaSlice3.hs $(hsfiles)
$(GHC) -DDEBUG=0 $(GHCFLAGS) --make $< -o $@
karatsubaSlice3D : karatsubaSlice3.hs $(hsfiles)
$(GHC) -DDEBUG=1 $(GHCFLAGS) --make $< -o $@
kslice2 : karatsubaSlice2
./$+
kslice : karatsubaSlice3
./$+
ksliced : karatsubaSlice3D
./$+
Check/New1.hs : Check/NewX.template.hs
sed "s/NewX/New1/" $+ > $@
Check/New2.hs : Check/NewX.template.hs
sed "s/NewX/New2/" $+ > $@
Check/New3.hs : Check/NewX.template.hs
sed "s/NewX/New3/" $+ > $@
Check/New4.hs : Check/NewX.template.hs
sed "s/NewX/New4/" $+ > $@
Check/BenchG.hs : Check/BenchX.template.hs
sed "s/BenchX/BenchG/;s/NewX.GHC/GMP.GHC$(ghc_major_version)/" $+ > $@
Check/Bench1.hs : Check/BenchX.template.hs
sed "s/BenchX/Bench1/;s/NewX/New1/" $+ > $@
Check/Bench2.hs : Check/BenchX.template.hs
sed "s/BenchX/Bench2/;s/NewX/New2/" $+ > $@
Check/Bench3.hs : Check/BenchX.template.hs
sed "s/BenchX/Bench3/;s/NewX/New3/" $+ > $@
Check/Bench4.hs : Check/BenchX.template.hs
sed "s/BenchX/Bench4/;s/NewX/New4/" $+ > $@
bench-integer.html : bench-integer Criterion/report.tpl
./bench-integer --no-gc -o bench-integer.html --template=Criterion/report.tpl
chmod a+r bench-integer.html
Criterion/report.tpl : Criterion/report.tpl.in
sed "s/@GHC_VERSION@/$$(ghc --numeric-version)/;s/@OS_NAME@/$$(uname -s | tr 'A-Z' 'a-z')/g;s/@CPU_NAME@/$$(uname -m)/g" $< > $@
date-bench : bench-integer.html
cp $< bench-integer-$(today).html
view-bench : bench-integer.html
$(BROWSER) bench-integer.html
# Update the local copies of integer-simple and integer-gmp and patch them
# to work in this framework.
update :
rm -f Stamp/*
make Stamp/copy
Stamp/update :
mkdir -p Stamp
@if test ! -d integer-simple ; then \
git clone http://git.haskell.org/packages/integer-simple.git ; \
fi
(cd integer-simple && git checkout master && git pull --rebase)
@touch $@
Stamp/copy : Stamp/update Stamp/ghc-version
Scripts/copy_modify.sh integer-simple Simple
@touch $@
Stamp/ready : Stamp/copy
@touch $@
Stamp/ghc-version :
Scripts/ghc-version.sh
touch $@
clean :
@rm -f $(TARGETS) *.o *.hi bench-integer.html Check/Bench[GS0-9].hs Check/New[0-9].hs
@rm -f $(TARGETS) bench-integer.html Check/Bench[GS0-9].hs Check/New[0-9].hs
@rm -f Criterion/report.tpl
@find $(hsdirs) -name \*.o -o -name \*.hi -o -name \*.s -o -name \*.ll -o -name \*.hcr | xargs rm -f
hlint :
hlint Common/ Check/ New*/
realclean :
@rm -f Stamp/*
sandbox-reinit:
@if test -d .cabal-sandbox ; then cabal sandbox delete ; fi
cabal sandbox init
cabal install criterion hspec primitive