updgrade to gcc 3.3.6
[nestedvm.git] / Makefile
1 .SECONDARY:
2
3
4 # What to build
5 #
6
7 # Java sources that are part of the compiler/interpreter
8 java_sources = $(wildcard src/org/ibex/nestedvm/*.java) $(wildcard src/org/ibex/nestedvm/util/*.java)
9
10 # C sources that are part of the compiler/interpreter
11 mips_sources = crt0.c support_aux.c
12 mips_asm_sources = support.s
13
14 mips2java_root = $(shell pwd)
15 build = $(mips2java_root)/build
16 tasks = upstream/tasks
17
18 #
19 # MIPS Settings (don't change these)
20 #
21 flags = -march=mips1
22 MIPS_CC = mips-unknown-elf-gcc
23 MIPS_CXX = mips-unknown-elf-g++
24 MIPS_G77 = mips-unknown-elf-g77
25 MIPS_PC = mips-unknown-elf-gpc
26
27 # Be VERY careful about changing any of these as they can break binary 
28 # compatibility and create hard to find bugs
29 mips_optflags = -O3 \
30         -mmemcpy \
31         -ffunction-sections -fdata-sections \
32         -falign-functions=512 \
33         -fno-rename-registers \
34         -fno-schedule-insns \
35         -fno-delayed-branch \
36         -freduce-all-givs
37
38 MIPS_CFLAGS = $(mips_optflags) $(flags) -I. -Wall -Wno-unused -Werror
39 MIPS_CXXFLAGS = $(MIPS_CFLAGS)
40 MIPS_PCFLAGS = $(MIPS_CFLAGS) --big-endian
41 MIPS_LD = mips-unknown-elf-gcc
42 MIPS_LDFLAGS= $(flags) --static -Wl,--gc-sections
43 MIPS_STRIP = mips-unknown-elf-strip
44
45 # Java compiler/VM settings
46 JAVAC = javac -source 1.3 -target 1.3
47 JAVA = java
48 ifeq ($(firstword $(JAVAC)),gcj)
49         JAVAC_NODEBUG_FLAGS = -g0
50 else
51         JAVAC_NODEBUG_FLAGS = -g:none
52 endif
53
54 CYGWIN = $(findstring CYGWIN,$(shell uname))
55 CLASSGEN_PATH = upstream/build/classgen/build
56 ifneq ($(CYGWIN),)
57         classpath = $(shell cygpath -wp build:$(CLASSGEN_PATH))
58 else
59         classpath = build:$(CLASSGEN_PATH)
60 endif
61
62 GCJ = gcj
63 EXE_EXT = 
64
65 #####
66
67 java_classes = $(java_sources:src/%.java=build/%.class)
68 mips_c_objects = $(mips_sources:%.c=build/org/ibex/nestedvm/%.o)
69 mips_asm_objects = $(mips_asm_sources:%.s=build/org/ibex/nestedvm/%.o)
70 mips_objects = $(mips_asm_objects) $(mips_c_objects)
71
72 usr = $(mips2java_root)/upstream/install
73 PATH := $(usr)/bin:$(PATH)
74 export PATH
75
76 #
77 # General Build Stuff
78 #
79 all: $(java_classes) $(tasks)/build_libc
80 ifdef NATIVE_MIPS2JAVA_COMPILER
81 all: build/mips2java$(EXE_EXT) $(mips_objects)
82 endif
83
84 # HACK: Ensure libc is kept up to date when our mips_objects change
85 $(tasks)/build_libc: $(mips_objects) $(tasks)/build_extraheaders
86 $(tasks)/build_extraheaders: upstream/misc/extraheaders.sh
87
88 $(tasks)/%:
89         $(MAKE) -C upstream tasks/$* usr="$(usr)" \
90                 MIPS_CFLAGS="$(filter-out -Werror,$(MIPS_CFLAGS))" \
91                 MIPS_PCFLAGS="$(filter-out -Werror,$(MIPS_PCFLAGS))" \
92                 MIPS_LDFLAGS="$(MIPS_LDFLAGS)"
93
94 upstream_clean_%:
95         $(MAKE) -C upstream clean_$* usr="$(usr)"
96
97 #
98 # Interpreter/Compiler/Runtime Java Compilation
99 #
100
101 # This works around a gcj -C bug
102 ifeq ($(firstword $(JAVAC)),gcj)
103 build/org/ibex/nestedvm/util/.Dummy.class:
104         mkdir -p `dirname $@`
105         touch $@
106 $(java_classes): build/org/ibex/nestedvm/util/.Dummy.class
107 endif
108
109 $(java_classes): $(java_sources) $(tasks)/build_darcs_classgen
110         $(JAVAC) -classpath "$(classpath)" -d build $(java_sources)
111
112 # GCJ Stuff
113 # FIXME: We're cramming more than we need into the binary here
114 build/mips2java$(EXE_EXT): $(java_sources) $(java_gen_sources)
115         @mkdir -p `dirname $@`
116         $(GCJ) -s -o $@ --main=org.ibex.nestedvm.Compiler $(java_sources) $(java_gen_sources)
117
118 #
119 # MIPS Binary compilation
120 #
121
122 # The nestedvm support library is special, it doesn't a full libc
123 $(mips_c_objects): build/%.o: src/%.c $(tasks)/build_gcc $(tasks)/build_newlib $(tasks)/build_extraheaders
124         @mkdir -p `dirname $@`
125         $(MIPS_CC) $(MIPS_CFLAGS) -c -o $@ $<
126
127 # Everything else needs a full libc
128 build/%.o: src/%.c $(tasks)/build_gcc $(tasks)/build_libc
129         @mkdir -p `dirname $@`
130         $(MIPS_CC) $(MIPS_CFLAGS) $($(notdir $*)_CFLAGS) -c -o $@ $<
131
132 build/%.o: src/%.s $(tasks)/build_gcc
133         @mkdir -p `dirname $@`
134         $(MIPS_CC) -x assembler-with-cpp -c -o $@ $<
135
136 tmp/%.s: src/%.c $(tasks)/build_gcc
137         @mkdir -p `dirname $@`
138         $(MIPS_CC) $(MIPS_CFLAGS) $($(notdir $*)_CFLAGS) -c -S -o $@ $<
139
140 build/%.mips: build/%.o $(tasks)/build_gcc $(tasks)/build_libc
141         $(MIPS_LD) -o $@ $< $(MIPS_LDFLAGS) $($(notdir $*)_LDFLAGS)
142
143 build/%.mips: src/%.cc $(tasks)/build_gcc_step2 $(tasks)/build_libc
144         @mkdir -p `dirname $@`
145         $(MIPS_CXX) $(MIPS_CXXFLAGS) $($(notdir $*)_CXXFLAGS) $(MIPS_LDFLAGS) $($(notdir $*)_LDFLAGS) -o $@ $<
146
147 build/%.mips: src/%.pas $(tasks)/build_gpc
148         @mkdir -p `dirname $@`
149         $(MIPS_PC) $(MIPS_PCFLAGS) $($(notdir $*)_PCFLAGS) $(MIPS_LDFLAGS) $($(notdir $*)_LDFLAGS) -o $@ $<
150
151 build/%.mips.stripped: build/%.mips $(tasks)/build_linker
152         cp $< $@
153         $(MIPS_STRIP) -s $@
154
155 # MIPS Compiler generated class compilation
156 ifdef DO_JAVASOURCE
157
158 build/%.java: build/%.mips build/org/ibex/nestedvm/JavaSourceCompiler.class 
159         $(JAVA) -cp "$(classpath)" org.ibex.nestedvm.Compiler -outformat javasource $(compiler_flags) $($(notdir $*)_COMPILERFLAGS) $(subst /,.,$*) $< > build/$*.java
160
161 build/%.class: build/%.java build/org/ibex/nestedvm/Runtime.class
162         $(JAVAC) $(JAVAC_NODEBUG_FLAGS) -classpath build -d build $<
163 else
164
165 build/%.class: build/%.mips build/org/ibex/nestedvm/ClassFileCompiler.class
166         $(JAVA) -cp "$(classpath)" org.ibex.nestedvm.Compiler -outformat class -d build $(compiler_flags) $($(notdir $*)_COMPILERFLAGS) $(subst /,.,$*) $<
167
168
169 endif
170
171 # General Java Class compilation
172 build/%.class: src/%.java
173         $(JAVAC) -classpath build -d build $<
174
175 clean:
176         rm -rf build/tests build/org/ibex/nestedvm *.jar build/mips2java$(EXE_EXT)
177
178 #
179 # env.sh
180 #
181 env.sh: Makefile $(tasks)/build_gcc $(tasks)/build_libc build/org/ibex/nestedvm/Compiler.class
182         @rm -f "$@~"
183         @echo 'PATH="$(mips2java_root)/build:$(usr)/bin:$$PATH"; export PATH' >> $@~
184         @echo 'CC=mips-unknown-elf-gcc; export CC' >> $@~
185         @echo 'CXX=mips-unknown-elf-g++; export CXX' >> $@~
186         @echo 'AS=mips-unknown-elf-as; export AS' >> $@~
187         @echo 'AR=mips-unknown-elf-ar; export AR' >> $@~
188         @echo 'LD=mips-unknown-elf-ld; export LD' >> $@~
189         @echo 'RANLIB=mips-unknown-elf-ranlib; export RANLIB' >> $@~
190         @echo 'CFLAGS="$(mips_optflags)"; export CFLAGS' >> $@~
191         @echo 'CXXFLAGS="$(mips_optflags)"; export CXXFLAGS' >> $@~
192         @echo 'LDFLAGS="$(MIPS_LDFLAGS)"; export LDFLAGS' >> $@~
193         @echo 'CLASSPATH=$(mips2java_root)/build:$(mips2java_root)/upstream/build/classgen/build:.; export CLASSPATH' >> $@~
194         @chmod a+x "$@~"
195         @mv "$@~" "$@"
196         @echo "$@ created successfully"
197
198 #
199 # Runtime.jar
200 #
201
202 runtime_classes = Runtime Registers UsermodeConstants util/Seekable
203 unix_runtime_classes = $(runtime_classes) UnixRuntime util/Platform util/InodeCache
204
205 tex.jar: $(mips_objects) $(runtime_classes:%=build/org/ibex/nestedvm/%.class) build/tests/TeX.class
206         echo -e "Manifest-Version: 1.0\nMain-Class: Tex\n" > .manifest
207         cp upstream/build/tex/TeX.class build
208         cd build && jar cfm ../$@ ../.manifest \
209                 $(runtime_classes:%=org/ibex/nestedvm/%.class) \
210                 org/ibex/nestedvm/Runtime\$$*.class \
211                 org/ibex/nestedvm/util/Seekable\$$*.class
212
213 runtime.jar: $(runtime_classes:%=build/org/ibex/nestedvm/%.class)
214         cd build && jar cf ../$@ \
215                 $(runtime_classes:%=org/ibex/nestedvm/%.class) \
216                 org/ibex/nestedvm/Runtime\$$*.class \
217                 org/ibex/nestedvm/util/Seekable\$$*.class
218
219 unix_runtime.jar: $(unix_runtime_classes:%=build/org/ibex/nestedvm/%.class)
220         cd build && jar cf ../$@ \
221                 $(unix_runtime_classes:%=org/ibex/nestedvm/%.class) \
222                 org/ibex/nestedvm/Runtime\$$*.class \
223                 org/ibex/nestedvm/util/Seekable\$$*.class \
224                 org/ibex/nestedvm/UnixRuntime\$$*.class \
225                 org/ibex/nestedvm/util/Platform\$$*.class
226         cd upstream/build/classgen/build && jar -uf ../../../../$@ \
227                 org/ibex/classgen/util/Sort*.class
228
229 .manifest:
230         printf "Manifest-Version: 1.0\nMain-Class: org.ibex.nestedvm.RuntimeCompiler\n" > $@
231
232 nestedvm.jar: $(java_classes) .manifest
233         cd build && jar cfm ../$@ ../.manifest $(java_classes:build/%.class=%*.class)
234         cd $(CLASSGEN_PATH) && jar uf $(mips2java_root)/$@ .
235
236 .gcclass_hints: $(java_sources)
237         sed -n 's/.*GCCLASS_HINT: \([^ ]*\) \([^ ]*\).*/hint:\1:\2/p' $(java_sources) > $@
238
239 compact_runtime_compiler.jar: $(java_classes) .manifest $(tasks)/build_darcs_gcclass .gcclass_hints
240         mkdir -p tmp/pruned
241         rm -rf tmp/pruned/*
242         $(JAVA) -cp \
243                 upstream/build/gcclass/build:upstream/build/gcclass/upstream/bcel-5.2/bcel-5.2.jar \
244         com.brian_web.gcclass.GCClass \
245                 "$(classpath)" tmp/pruned org.ibex.nestedvm.RuntimeCompiler.main `cat .gcclass_hints`
246         cd tmp/pruned && jar cfm ../../$@ ../../.manifest .
247
248 sizecheck: compact_runtime_compiler.jar
249         @for c in `find tmp/pruned -name '*.class'|fgrep -v '$$'`; do \
250                 for f in `echo $$c|sed 's,\.class$$,,;'`*.class; do gzip -c $$f; done | wc -c | tr -d '\n'; \
251                 echo -e "\t`echo $$c | sed 's,tmp/pruned/org/ibex,,;s,\.class$$,,;s,/,.,g;'`"; \
252         done | sort -rn | awk '{ sum += $$1; print }  END { print sum,"Total"; }'
253
254
255 # This is only for Brian to use... don't mess with it
256 rebuild-constants: $(tasks)/build_libc
257         @mkdir -p `dirname $@`
258         ( \
259                 cat \
260                         src/org/ibex/nestedvm/syscalls.h \
261                         $(usr)/mips-unknown-elf/include/nestedvm/socket.h \
262                         $(usr)/mips-unknown-elf/include/sys/{errno.h,unistd.h,syslimits.h,sysctl.h}; \
263                 $(MIPS_CC) -E -dM $(usr)/mips-unknown-elf/include/sys/fcntl.h | awk '$$2 ~ /^[OF]_/ { print; }'; \
264         ) | ( \
265                 echo "// THIS FILE IS AUTOGENERATED! DO NOT EDIT!"; \
266                 echo "// run \"make rebuild-constants\" if it needs to be updated"; \
267                 echo ""; \
268                 echo "package org.ibex.nestedvm;"; \
269                 echo "public interface UsermodeConstants {"; \
270                 tr '\t' ' ' | sed -n ' \
271                         s/  */ /g; \
272                         s/ *# *define \([A-Z_][A-Za-z0-9_]*\) \([0-9][0-9a-fA-Fx]*\)/    public static final int \1 = \2;/p'; \
273                 echo "}"; \
274         ) > src/org/ibex/nestedvm/UsermodeConstants.java
275
276 #
277 # Tests
278 # These are simply here for convenience. They aren't required 
279 # to build or run mips2java
280 #
281
282 build/tests/Env.class: build/org/ibex/nestedvm/Runtime.class build/org/ibex/nestedvm/Interpreter.class
283
284 # Generic Hello Worldish test
285 test_COMPILERFLAGS = -o unixruntime
286 test: build/tests/Test.class
287         $(JAVA) -cp build tests.Test "arg 1" "arg 2" "arg 3"
288 inttest: build/tests/Test.mips build/org/ibex/nestedvm/Interpreter.class
289         $(JAVA) -cp build org.ibex.nestedvm.Interpreter build/tests/Test.mips "arg 1" "arg 2" "arg 3"
290 cxxtest: build/tests/CXXTest.class
291         $(JAVA) -cp build tests.CXXTest
292
293 # CallTest
294 build/tests/CallTest.class: build/tests/Test.class
295 calltest: build/tests/CallTest.class
296         $(JAVA) -cp build tests.CallTest `date|perl -pe 's/\D+/ /g;'` `id -u`
297
298 # FDTest
299 build/tests/FDTest.class: build/tests/Test.class
300 fdtest: build/tests/FDTest.class
301         $(JAVA) -cp build tests.FDTest
302
303 # Pascal Test
304 pascaltest: build/tests/PascalHello.class
305         $(JAVA) -cp build tests.PascalHello
306
307 # Simple
308 Simple_LDFLAGS = -nostdlib
309 simpletest: build/tests/Simple.class
310         $(JAVA) -cp build tests.Simple
311
312 # Paranoia
313 Paranoia_CFLAGS = "-Wno-error"
314 Paranoia_LDFLAGS = -lm
315 paranoiatest: build/tests/Paranoia.class
316         $(JAVA) -cp build tests.Paranoia
317
318 # Linpack
319 build/tests/Linpack.mips: $(tasks)/download_linpack $(tasks)/build_gcc_step2
320         mkdir -p `dirname "$@"`
321         $(MIPS_G77) $(MIPS_CFLAGS) $(Linpack_CFLAGS) $(MIPS_LDFLAGS) -o $@ upstream/download/linpack_bench.f -lc
322
323 linpacktest: build/tests/Linpack.class
324         $(JAVA) -cp build tests.Linpack
325
326 #
327 # Freetype Stuff
328 #
329 FreeType_CFLAGS = -Iupstream/build/freetype/include
330 FreeType_LDFLAGS =  -Lupstream/build/freetype/objs -lfreetype
331
332 FreeTypeDemoHelper_CFLAGS = $(FreeType_CFLAGS)
333 FreeTypeDemoHelper_LDFLAGS = $(FreeType_LDFLAGS)
334 build/tests/FreeTypeDemoHelper.o: $(tasks)/build_freetype
335 build/tests/FreeTypeDemoHelper.mips: 
336 build/tests/FreeTypeDemo.class: build/tests/FreeTypeDemoHelper.class
337
338 FTBench_CFLAGS =  $(FreeType_CFLAGS)
339 FTBench_LDFLAGS = $(FreeType_LDFLAGS)
340 build/tests/FTBench.o: $(tasks)/build_freetype
341
342 #
343 # MSPack Stuff
344 #
345 MSPackHelper_CFLAGS = -Iupstream/build/libmspack/mspack
346 MSPackHelper_LDFLAGS = -Lupstream/build/libmspack/mspack -lmspack
347 build/tests/MSPackHelper.o: $(tasks)/build_libmspack
348 build/tests/MSPack.class: build/tests/MSPackHelper.class
349
350 MSPackBench_CFLAGS = -Iupstream/build/libmspack/mspack
351 MSPackBench_LDFLAGS = -Lupstream/build/libmspack/mspack -lmspack
352 build/tests/MSPackBench.o: $(tasks)/build_libmspack
353
354 #
355 # Echo
356 #
357 build/tests/Echo.class: build/tests/EchoHelper.class
358
359 #
360 # Libjpeg
361 #
362 DJpeg_COMPILERFLAGS = -o onepage,pagesize=8m
363 build/tests/DJpeg.mips: $(tasks)/build_libjpeg
364         @mkdir -p `dirname $@`
365         cp upstream/build/libjpeg/djpeg $@
366
367 #
368 # Busybox
369 #
370 BusyBox_COMPILERFLAGS = -o unixruntime
371 build/tests/BusyBox.mips: $(tasks)/build_busybox
372         @mkdir -p `dirname $@`
373         cp upstream/build/busybox/busybox $@
374
375 busyboxtest: build/tests/BusyBox.class
376         $(JAVA) -Dnestedvm.busyboxhack=true -cp "$(classpath)" tests.BusyBox ash
377
378 #
379 # Boehm GC
380 #
381 build/tests/GCTest.mips: $(tasks)/build_boehmgc
382         @mkdir -p `dirname $@`
383         cp upstream/build/boehmgc/gctest $@
384
385 boehmgctest: build/tests/Env.class build/tests/GCTest.class
386         $(JAVA) -cp build tests.Env GC_PRINT_STATS=1  tests.GCTest
387
388
389 # TeX
390
391 Tangle_COMPILERFLAGS = -o unixruntime
392
393 build/tests/Tangle.mips: $(tasks)/build_tex_tangle
394         @mkdir -p `dirname $@`
395         cp upstream/build/tex/tangle.mips $@
396
397
398 TeX_COMPILERFLAGS = -o unixruntime
399 build/tests/TeX.mips: $(tasks)/build_tex
400         @mkdir -p `dirname $@`
401         cp upstream/build/tex/tex.mips $@
402
403 NtlmAuth_COMPILERFLAGS = -o unixruntime
404 build/tests/NtlmAuth.mips: $(tasks)/build_samba
405         mkdir -p `dirname $@`
406         cp upstream/build/samba/source/bin/ntlm_auth $@
407
408 ntlmtest: build/tests/NtlmAuth.class
409         @test -e smb.conf || cp upstream/build/samba/examples/smb.conf.default smb.conf
410         $(JAVA) -cp "$(classpath)" tests.NtlmAuth --username=brian --password=test --diagnostics -d 5
411
412 ntlmauth.jar: build/tests/NtlmAuth.class $(tasks)/build_darcs_gcclass .gcclass_hints
413         mkdir -p tmp/pruned
414         rm -rf tmp/pruned/*
415         java -cp \
416                 upstream/build/gcclass/build:upstream/build/gcclass/upstream/bcel-5.1/bcel-5.1.jar \
417                 com.brian_web.gcclass.GCClass "$(classpath)" tmp/pruned tests.NtlmAuth.main `cat .gcclass_hints`
418         printf "Manifest-Version: 1.0\nMain-Class: tests.NtlmAuth\n" > .manifest.ntlm
419         cd tmp/pruned && jar cfm ../../$@ ../../.manifest.ntlm .
420         rm -f  .manifest.ntlm
421
422 gmptest: $(tasks)/build_gmp
423         cd upstream/build/gmp && \
424         make check TESTS_ENVIRONMENT="java -cp \"$(classpath)\" org.ibex.nestedvm.RuntimeCompiler"
425
426 #
427 # Speed tests
428 #
429
430 build/tests/SpeedTest.class: build/org/ibex/nestedvm/Runtime.class
431
432 tmp/thebride_1280.jpg:
433         @mkdir -p tmp
434         cd tmp && curl -O http://www.kill-bill.com/images/wallpaper/thebride_1280.jpg
435
436 oldspeedtest: build/tests/DJpeg.class tmp/thebride_1280.jpg
437         bash -c "time $(JAVA) -cp build tests.DJpeg -targa -outfile tmp/thebride_1280.tga tmp/thebride_1280.jpg"
438         @echo "e90f6b915aee2fc0d2eb9fc60ace6203  tmp/thebride_1280.tga" | md5sum -c && echo "MD5 is OK"
439
440 djpegspeedtest: build/tests/SpeedTest.class build/tests/DJpeg.class tmp/thebride_1280.jpg
441         @echo "Running DJpeg test..."
442         @$(JAVA) -cp build tests.SpeedTest tests.DJpeg 8 -targa -outfile tmp/thebride_1280.tga tmp/thebride_1280.jpg
443
444 mspackspeedtest: build/tests/SpeedTest.class build/tests/MSPackBench.class
445         @if [ -e tmp/mspack/comic32.exe ]; then \
446                 echo "Running MSPackBench test..."; \
447                 cd tmp/mspack && $(JAVA) -cp ../../build tests.SpeedTest tests.MSPackBench 20 *32.exe; \
448         else \
449                 echo "Run \"make check\" to get the MS True Type fonts for the MSPackBench test"; \
450         fi
451
452 speedtest: build/tests/SpeedTest.class build/tests/DJpeg.class build/tests/FTBench.class tmp/thebride_1280.jpg build/tests/MSPackBench.class
453         @echo "Running DJpeg test..."
454         @$(JAVA) -cp build tests.SpeedTest tests.DJpeg 10 -targa -outfile tmp/thebride_1280.tga tmp/thebride_1280.jpg
455         @if [ -e tmp/mspack/Comic.TTF ]; then \
456                 echo "Running FTBench test..."; \
457                 $(JAVA) -cp build tests.SpeedTest tests.FTBench 10 tmp/mspack/Comic.TTF tmp/mspack/Comic.TTF.render; \
458         else \
459                 echo "Run \"make check\" to get Arial.TTF for the FTBench test"; \
460         fi
461         @if false && [ -e tmp/mspack/comic32.exe ]; then \
462                 echo "Running MSPackBench test..."; \
463                 cd tmp/mspack && $(JAVA) -cp ../../build tests.SpeedTest tests.MSPackBench 10 *32.exe; \
464         else \
465                 echo "Run \"make check\" to get the MS True Type fonts for the MSPackBench test"; \
466         fi
467
468 intspeed: build/tests/DJpeg.mips  build/org/ibex/nestedvm/Interpreter.class tmp/thebride_1280.jpg
469         time $(JAVA) -cp build org.ibex.nestedvm.Interpreter build/tests/DJpeg.mips -targa  -outfile tmp/thebride_1280.tga tmp/thebride_1280.jpg
470         @echo "e90f6b915aee2fc0d2eb9fc60ace6203  tmp/thebride_1280.tga" | md5sum -c && echo "MD5 is OK"
471
472 #
473 # Verification checks
474 #
475
476 check: $(patsubst %,build/tests/%.class, FTBench MSPackBench DJpeg GCTest) tmp/thebride_1280.jpg
477         @/bin/bash ./src/tests/check.sh running_from_make
478
479 compiletests: $(patsubst %,build/tests/%.class,FTBench MSPackBench DJpeg Test FreeTypeDemoHelper MSPackHelper EchoHelper BusyBox GCTest Fork)
480         @true
481
482
483 #
484 # Darcs stuff
485 #
486
487 commit:
488         @if [ -d _darcs ]; then darcs push; \
489         else echo "You need darcs to commit"; false; \
490         fi
491
492 update:
493         @if [ -d _darcs ]; then darcs pull; \
494         else wget -nH -rl 16 -N -X _darcs http://nestedvm.darcs.brianweb.net; \
495         fi
496
497 #
498 # Paper stuff
499 #
500 charts := $(shell find doc/charts -name \*.dat)
501
502 # IVME Paper
503 doc/charts/%.pdf: doc/charts/%.dat doc/charts/%.gnuplot
504         cd doc/charts; gnuplot $*.gnuplot
505         cd doc/charts; chmod +x boxfill.pl; ./boxfill.pl -g -o unfilled.eps $*.eps
506         cd doc/charts; ps2pdf $*.eps
507
508 doc/ivme04.pdf: doc/ivme04.tex doc/acmconf.cls $(charts:%.dat=%.pdf) build/tests/TeX.class
509         cp upstream/build/tex/tex.pool upstream/build/tex/texinputs/tex.pool
510         cd upstream/build/tex/texinputs && echo '\latex.ltx' | java -cp $(mips2java_root)/build:$(mips2java_root)/$(CLASSGEN_PATH) tests.TeX
511         cd upstream/build/tex/texinputs && ln -fs ../../../../doc/* .; rm -f ivme04.aux; touch ivme04.aux; touch ivme04.bbl
512         cd upstream/build/tex/texinputs && echo '\&latex \input ivme04.tex' | java -cp $(mips2java_root)/build:$(mips2java_root)/$(CLASSGEN_PATH) tests.TeX
513         cd upstream/build/tex/texinputs && bibtex ivme04
514         cd upstream/build/tex/texinputs && echo '\&latex \input ivme04.tex' | java -cp $(mips2java_root)/build:$(mips2java_root)/$(CLASSGEN_PATH) tests.TeX
515         cd upstream/build/tex/texinputs && dvipdf ivme04.dvi
516         #cp upstream/build/tex/texinputs/ivme04.pdf $@
517
518 pdf: doc/ivme04.pdf
519         open doc/ivme04.pdf