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 \
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 \
15 awk/null.mawk awk/null.gawk \
16 ruby/null.rb18 ruby/null.rb19 \
17 php/null.php php/null.php-n \
18 tcl/null.tcl84 tcl/null.tcl85 tcl/null.tcl86 \
19 python/null.py26 python/null.py26-s \
20 python/null.py27 python/null.py27-s \
21 python/null.py32 python/null.py32-s \
25 # cycles,instructions,branches,branch-misses \
26 # dtlb-loads,dtlb-load-misses,itlb-loads,itlb-load-misses \
27 # cycles,instructions,cache-references,cache-misses \
28 # cycles,instructions,stalled-cycles-frontend,stalled-cycles-backend
30 METRICS = cycles,instructions,branches,branch-misses,cpu-clock,task-clock,major-faults,minor-faults,cs
32 JAVA_VMS = server zero cacao jamvm
33 # see below for how this is called
34 JAVA_INVOCS = $(JAVA_VMS:%="java -cp java -% Null")
38 all: $(PROGS) java/Null.class
48 diet gcc -O2 -Wall -o $@ $<
52 gcc -static -O2 -Wall -o $@ $<
56 gcc -O2 -Wall -o $@ $<
60 g++ -static -O2 -Wall -o $@ $<
64 g++ -O2 -Wall -o $@ $<
67 haskell/null-single: haskell/null.hs
68 ghc --make -O2 -Wall -o $@ $<
71 haskell/null-threaded: haskell/null.hs
72 ghc --make -O2 -Wall -threaded -o $@ $<
75 ocaml/null-byte: ocaml/null.ml
77 # no stripping as this is not an elf file
79 ocaml/null-opt: ocaml/null.ml
83 java/null-gcj: java/Null.java
84 gcj-4.6 --main=Null -o $@ $<
87 java/Null.class: java/Null.java Makefile
90 log: $(PROGS) $(SCRIPTS) java/Null.class Makefile
92 for prog in $(PROGS:%=./%) $(SCRIPTS:%=./%) $(JAVA_INVOCS); do \
94 for metric in $(METRICS); do \
95 LC_ALL=C perf stat -e "$$metric" -r $(REPS) -o log --append $$prog; \
103 cd haskell && rm -f *.hi *.o
104 cd ocaml && rm -f *.cmo *.cmi *.cmx *.o
105 cd java && rm -f *.class