]> git.k1024.org Git - perf-null.git/blob - Makefile
Add a run file
[perf-null.git] / Makefile
1 PROGS = \
2         asm/null \
3         c/c-diet-null \
4         c/c-libc-static-null c/c-libc-dynamic-null \
5         c/c++-static-null c/c++-dynamic-null \
6         haskell/null-single haskell/null-threaded \
7         ocaml/null-byte ocaml/null-opt \
8         java/null-gcj
9
10 SCRIPTS = \
11         dash/null.dash bash/null.bash \
12         mksh/null.mksh mksh/null.mksh-static \
13         lua/null.lua51 lua/null.lua52 lua/null.luajit \
14         perl/null.pl ruby/null.rb \
15         php/null.php php/null.php-n \
16         tcl/null.tcl84 tcl/null.tcl85 tcl/null.tcl86 \
17         python/null.py26 python/null.py26-s \
18         python/null.py27 python/null.py27-s \
19         python/null.py32 python/null.py32-s \
20         python/null.pypy
21
22 #METRICS = \
23 #       cycles,instructions,branches,branch-misses \
24 #       dtlb-loads,dtlb-load-misses,itlb-loads,itlb-load-misses \
25 #       cycles,instructions,cache-references,cache-misses \
26 #       cycles,instructions,stalled-cycles-frontend,stalled-cycles-backend
27
28 METRICS = cycles,instructions,branches,branch-misses,cpu-clock,task-clock,major-faults,minor-faults,cs
29
30 JAVA_VMS = server zero cacao jamvm
31 # see below for how this is called
32 JAVA_INVOCS = $(JAVA_VMS:%="java -cp java -% Null")
33
34 REPS = 100
35
36 all: $(PROGS) java/Null.class
37
38 $(PROGS): Makefile
39
40 asm/null: asm/null.s
41         as -o asm/null.o $<
42         ld -o $@ asm/null.o
43         strip $@
44
45 c-diet-%: %.c
46         diet gcc -O2 -Wall -o $@ $<
47         strip $@
48
49 c-libc-static-%: %.c
50         gcc -static -O2 -Wall -o $@ $<
51         strip $@
52
53 c-libc-dynamic-%: %.c
54         gcc -O2 -Wall -o $@ $<
55         strip $@
56
57 c++-static-%: %.c
58         g++ -static -O2 -Wall -o $@ $<
59         strip $@
60
61 c++-dynamic-%: %.c
62         g++ -O2 -Wall -o $@ $<
63         strip $@
64
65 haskell/null-single: haskell/null.hs
66         ghc --make -O2 -Wall -o $@ $<
67         strip $@
68
69 haskell/null-threaded: haskell/null.hs
70         ghc --make -O2 -Wall -threaded -o $@ $<
71         strip $@
72
73 ocaml/null-byte: ocaml/null.ml
74         ocamlc -o $@ $<
75         # no stripping as this is not an elf file
76
77 ocaml/null-opt: ocaml/null.ml
78         ocamlopt -o $@ $<
79         strip $@
80
81 java/null-gcj: java/Null.java
82         gcj-4.6 --main=Null -o $@ $<
83         strip $@
84
85 java/Null.class: java/Null.java Makefile
86         javac $<
87
88 log: $(PROGS) $(SCRIPTS) java/Null.class Makefile
89         rm -f log; \
90         for prog in $(PROGS:%=./%) $(SCRIPTS:%=./%) $(JAVA_INVOCS); do \
91           echo $$prog; \
92           for metric in $(METRICS); do \
93             LC_ALL=C perf stat -e "$$metric" -r $(REPS) -o log --append $$prog; \
94           done; \
95         done
96
97 .PHONY: log
98
99 clean:
100         cd asm && rm -f *.o
101         cd haskell && rm -f *.hi *.o
102         cd ocaml && rm -f *.cmo *.cmi *.cmx *.o
103         cd java && rm -f *.class
104         rm -f $(PROGS)