# The XWT Makefile
#
-all: Linux Win32 Java2 #Solaris
+all: JVM Linux Win32 Java2 #Solaris
.SILENT: $(cc_objects) $(java_objects) $(java_headers) all build/xwar/builtin.xwar $(target_bin) compile
#
target_bin := xwt.$(shell echo $(target) | tr A-Z a-z)
jikes_flags := -verbose -nowarn -sourcepath src/
-gcc_path := upstream/prefix
+gcc_path := upstream/gcc-3.3/install
gcc_optimizations := -O2
#gcc_optimizations := -O9 -ffast-math -fomit-frame-pointer -foptimize-sibling-calls -finline-functions -funroll-loops -ffunction-sections -fdata-sections
gcc_flags := $(gcc_optimizations)
jpeg_c_sources := jdapimin.c jdapistd.c jcomapi.c jcparam.c jdmaster.c jdinput.c jdmainct.c jdcoefct.c jdpostct.c jdmarker.c
jpeg_c_sources += jdhuff.c jdphuff.c jddctmgr.c jidctint.c jidctfst.c jidctflt.c jidctred.c jdsample.c jdcolor.c jdmerge.c
jpeg_c_sources += jquant1.c jquant2.c jerror.c jutils.c jmemnobs.c jmemmgr.c
-jpeg_sources := $(jpeg_c_sources:%.c=upstream/jpeg-6b/%.c)
+jpeg_sources := $(jpeg_c_sources:%.c=upstream/jpeg-6b/src/%.c)
$(jpeg_sources):
- make -C upstream .jpeg-6b
+ make -C upstream jpeg-6b/.installed
-freetype_sources := $(patsubst %,upstream/freetype-2.1.4/base/%,ftsystem.c ftmm.c ftbbox.c ftinit.c ftdebug.c ftbase.c ftglyph.c)
-freetype_sources += $(patsubst %,upstream/freetype-2.1.4/%,smooth/smooth.c autohint/autohint.c sfnt/sfnt.c truetype/truetype.c)
-$(freetype_sources): upstream/.freetype-2.1.4a
- make -C upstream .freetype-2.1.4
+freetype_sources := $(patsubst %,upstream/freetype-2.1.4/src/base/%,ftsystem.c ftmm.c ftbbox.c ftinit.c ftdebug.c ftbase.c ftglyph.c)
+freetype_sources += $(patsubst %,upstream/freetype-2.1.4/src/%,smooth/smooth.c autohint/autohint.c sfnt/sfnt.c truetype/truetype.c)
+$(freetype_sources):
+ make -C upstream freetype-2.1.4/.installed
upstream/.jikes:
make -C upstream .jikes
$(gcc_path)/bin/$(target)-gcj:
- make -C upstream .gcc-$(target)
+ make -C upstream gcc-3.3-$(target)
# PHASE 2: ready-to-compile java files (either symlinked to phase 1a sources or else generated from them)
# PHASE 3: class files
class_files := $(java_sources:build/java/%.java=build/class/%.class)
class_files += build/class/org/xwt/imp/Freetype.class
-build/%.class: build/java/%.java src/%.java upstream/.jikes mkdir_build
+$(class_files): build/class/%.class: build/java/%.java src/%.java upstream/.jikes mkdir_build
@$(shell cat upstream/.jikes) -classpath lib/libgcj-minimal.jar $< -d build/ 2>&1 | \
grep -v ^\\[read | sed s_^\\[write\ build/__ | sed s_.class\\]_.java_ | sed "s_^_compiling .java -> .class: src/_"
# Special treatment:
#
-build/java/org/xwt/Builtin.java: $(handwritten_xwar_sources) mkdir_build
- @echo "wrapping .xwar -> .o: build/java/org/xwt/Builtin.java"
- 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 - $(xwar_sources: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/Builtin.java: $(handwritten_xwar_sources) mkdirs
+ @mkdir -p `dirname $@`
+ @echo "wrapping .xwar -> .o: build/java/org/xwt/Builtin.java"
+ 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 - $(handwritten_xwar_sources: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
postprocessed_sources := $(handwritten_java_pp_sources:src/%.pp=build/java/%)
-$(postprocessed_sources): build/java/%.java: src/%.java.pp build/org/xwt/util/Preprocessor.class
+$(postprocessed_sources): build/java/%.java: src/%.java.pp build/class/org/xwt/util/Preprocessor.class
@echo "preprocessing .java.pp -> .java: $<"
@mkdir -p `dirname $@`
@java -cp build org.xwt.util.Preprocessor < $< > $@
@mkdir -p build/java/org/xwt/imp/
@java -cp build org.xwt.imp.MIPS org.xwt.imp.Freetype build/mips/freetype.mips > build/java/org/xwt/imp/Freetype.java
-build/mips/freetype.mips: upstream/.freetype
- make -C upstream .gcc-mips target=mips
+build/mips/freetype.mips:
+ make -C upstream gcc-3.3-mips freetype-2.1.4/src target=mips
$(gcc_path)/bin/mips-gcc \
--static \
-mabi=32 \
Carbon:
make gcj platform=Carbon arget=powerpc-apple-darwin platform_link="$(gcc_path)/lib/libgcj.a -Xlinker -framework -Xlinker Carbon" platform_java_sources="POSIX Carbon"
-JVM: compile build/xwar/builtin.xwar
+JVM: compile
echo -e "\\n=== JVM ========================================="
echo "archiving .class -> .jar"
mkdir -p build/JVM
echo -e "Manifest-Version: 1.0\nMain-Class: org.xwt.Main\n" > bin/.manifest
cd build; $(jar) cvfm ../xwt.jar .manifest \
- org/xwt/builtin.xwar \
`find . -name \*.class | grep -v org/xwt/plat/` \
org/xwt/plat/AWT*.class org/xwt/plat/Java2*.class | tr \\012 \\015
echo
echo "*** DONE ******************************************"
-compile: .javac $(java_sources) build/xwar/builtin.xwar build/org/xwt/imp/Freetype.class
+compile: upstream/.jikes $(java_sources) build/class/org/xwt/imp/Freetype.class
echo "compiling .java -> .class: src/**/*.java"
mkdir -p build
cp build/org/xwt/imp/MIPS.class build/org/xwt/imp/MIPS.class.old
# how to configure it
configure_gcc-3.3 := --enable-languages=c,c++,java --enable-gc-type=boehm --disable-shared --disable-jvmpi
configure_gcc-3.3 += --disable-java-awt --disable-interpreter --enable-static
-configure_gcc-3.3-powerpc-apple := --enable-threads=posix --disable-hash-synchronization # FIXME: can we enable hashsync?
+configure_gcc-3.3-powerpc-apple := --enable-threads=posix --disable-hash-synchronization
configure_gcc-3.3-i686-pc-mingw32 := --enable-threads=win32 --enable-hash-synchronization
configure_gcc-3.3-i686-pc-linux-gnu := --enable-threads=posix --enable-hash-synchronization
-configure_gcc-3.3-mips := --nfp --with-newlib=yes --enable-multilib --disable-threads
configure_gcc-3.3-sparc-sun-solaris2.7 := --enable-threads=posix --disable-multilib
+configure_gcc-3.3-mips := --enable-languages=c --nfp --with-newlib=yes --enable-multilib --disable-threads
# jikes has a special target to autodetect a pre-installed jikes, and to autodetect the JVM's $CLASSPATH
.jikes:
# make the package's directory (if it doesn't exist)
$(packages):
- mkdir -p $<
+ mkdir -p $@
# if the make target was specified in $(package)-$(target) format, break it apart and recurse
$(packages:%=%-$(target)): %-$(target): %
- make mkdirs $</src $</.installed target=$(patsubst $<-%,%,$@)
+ make $</src $</.installed target=$(patsubst $<-%,%,$@)
# download the source code
$(packages:%=%/src): %/src: %
@mv $</$< $</src
# configure and build it
+setcc := CC="$(patsubst Darwin,/usr/bin/gcc3 -no-cpp-precomp,$(findstring Darwin,$(shell uname)))"
$(packages:%=%/.installed): %/.installed: %
@mkdir -p $</build-$(target) $</install
@echo -e "\nconfiguring $<..."
- cd $</build-$(target); \
- CC="$(patsubst Darwin,/usr/bin/gcc3 -no-cpp-precomp,$(findstring Darwin,$(host)))" \
- ../src/configure --prefix=`pwd`/../install $(configure_$<) $(configure_$<-$(target))
+ cd $</build-$(target); $(setcc) ../src/configure --prefix=`pwd`/../install $(configure_$<) $(configure_$<-$(target))
@echo -e "\nbuilding $<..."
- @cd $</build-$(target); make
+ @cd $</build-$(target); $(setcc) make
@echo -e "\ninstalling $<..."
- @cd $</build-$(target); make install
+ @cd $</build-$(target); $(setcc) make install
@touch $</.installed