/
Makefile
45 lines (36 loc) · 1.22 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
ghc-prof-flags :=
ifdef ENABLE_PROFILING
ghc-prof-flags += -prof -hisuf p_hi -osuf p_o
lib-suffix := _p
else
lib-suffix :=
endif
ghc := ghc
extra-ghc-flags :=
package := unordered-containers
version := $(shell awk '/^version:/{print $$2}' ../$(package).cabal)
lib := ../dist/build/libHS$(package)-$(version)$(lib-suffix).a
ghc-flags := -Wall -O2 -hide-all-packages \
-package-conf ../dist/package.conf.inplace -package base -package mtl \
-package unordered-containers -package containers -package criterion \
-package deepseq -package hashable -package random -package bytestring \
$(ghc-prof-flags) -rtsopts
ghc-flags += $(extra-ghc-flags)
criterion-flags :=
%.o: %.hs
$(ghc) $(ghc-flags) -c -o $@ $<
programs := bench
.PHONY: all
all: $(programs)
bench: $(lib) Benchmarks.o Util/Int.o Util/ByteString.o Util/String.o
ranlib $(lib)
$(ghc) $(ghc-flags) -threaded -o $@ $(filter %.o,$^) $(lib)
.PHONY: bench-all
bench-all: bench
./bench $(criterion-flags) +RTS -H -RTS `./bench -l | sed 's/ *\(.*\)/\1/' | grep -v "Benchmarks:\|IntMap\|Map"`
.PHONY: clean
clean:
-find . \( -name '*.o' -o -name '*.hi' \) -exec rm {} \;
-rm -f $(programs)
Benchmarks.o: Util/Int.o Util/ByteString.o Util/String.o
Util/ByteString.o: Util/String.o