-build/java/org/xwt/Builtin.java:: $(shell ls src/org/xwt/builtin/*.png src/org/xwt/builtin/*.xwt src/org/xwt/builtin/*.xwf)
- @mkdir -p `dirname $@` build build/java build/class build/h build
- echo -e "\n\033[1mzipping/uuencoding .xwt -> .java: build/java/org/xwt/Builtin.java\033[0m"
- echo "package org.xwt;" > build/java/org/xwt/Builtin.java
- echo "class Builtin {" >> build/java/org/xwt/Builtin.java
- echo "public static String encoded = " >> build/java/org/xwt/Builtin.java
- cd src; $(jar) cf - $(<:src/%=%) | \
- uuencode foo | tail -n +2 | grep -v '^end$$' | grep -v '^`$$' | \
- sed 's_\(.+\)_"\1" +_' >> ../build/java/org/xwt/Builtin.java
- echo "\"\"; }" >> build/java/org/xwt/Builtin.java
-
-build/java/org/xwt/imp/Freetype.java:: build/mips/freetype.mips build/class/org/xwt/imp/MIPS.class
- @echo -e "\n\033[1mtranslating .mips -> .java: $@\033[0m"
- mkdir -p build/java/org/xwt/imp/
- rm -f $@
- java -cp build/class org.xwt.imp.MIPS org.xwt.imp.Freetype build/mips/freetype.mips > build/java/org/xwt/imp/Freetype.java
-
-build/mips/%.o: src/org/xwt/imp/%.c $(gcc_path)/bin/mips-gcc upstream/.freetype
- @mkdir -p build/mips
+builtin_src := $(shell find src/org/xwt/builtin -name '*.*' \! -name '*.xcf')
+build/res/fonts/vera: .download_vera-1.10
+ mkdir -p build/res/fonts/vera
+ cd build/res/fonts/vera; ln -s ../../../../upstream/vera-1.10/ttf-bitstream-vera-1.10/Vera.ttf
+ cd build/res/fonts/vera; ln -s ../../../../upstream/vera-1.10/ttf-bitstream-vera-1.10/VeraBd.ttf
+build/res/builtin.jar: $(builtin_src:src/%=build/res/%) build/res/freetype.mips build/res/libmspack.mips build/res/fonts/vera
+ @echo -e "\n\033[1mzipping res/* -> .jar: builtin.jar\033[0m"
+ cd build/res; $(jar) cf builtin.jar $(^:build/res/%=%)
+
+build/$(platform)/builtin.o: build/res/builtin.jar
+ @echo -e "\n\033[1mwrapping .jar -> .o: resources.o\033[0m"
+ @(echo "unsigned int builtin_length = "; \
+ (wc -c build/res/builtin.jar | sed "s_build.*__"); \
+ echo \;; \
+ echo "unsigned char builtin_bytes[] = {"; \
+ hexdump -ve '"0x" 1/1 "%x,\n"' build/res/builtin.jar; \
+ echo "};") > .builtin.c
+ $(gcc) -c .builtin.c -o build/$(platform)/builtin.o
+
+# compile is here to force compilation of the .class files (they get used via -Ibuild) without
+# having the individual .o's depend on the .java's (otherwise every .o gets recompiled when one .java changes)
+gcj: .vendor .compile .install_gcc-3.3_$(target) $(target_bin)
+
+build/JVM/xwt.jar: .compile build/res/builtin.jar
+ @echo -e "\n\033[1marchiving .class -> .jar: build/JVM/xwt.jar\033[0m"
+ mkdir -p build/JVM
+ echo -e "Manifest-Version: 1.0\nMain-Class: org.xwt.Main\n" > build/JVM/.manifest
+ cd build/class/org/xwt; ln -sf ../../../res/builtin.jar
+ cd build/class; $(jar) cfm ../JVM/xwt.jar ../JVM/.manifest `find . \! -type d`;
+
+
+
+##############################################################################
+# Freetype
+#
+
+build/mips/%.c.o: src/%.c
+ make .install_freetype-2.1.4_mips-unknown-elf target=mips-unknown-elf
+ mkdir -p $(@D)