2003/02/25 21:37:08
authormegacz <megacz@xwt.org>
Fri, 30 Jan 2004 06:52:59 +0000 (06:52 +0000)
committermegacz <megacz@xwt.org>
Fri, 30 Jan 2004 06:52:59 +0000 (06:52 +0000)
darcs-hash:20040130065259-2ba56-cebcc05a168dc22d81ed73132b728e99a5af614d.gz

Makefile [new file with mode: 0644]
README
build.xml [deleted file]

diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..a433bcd
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,119 @@
+#
+# The XWT Makefile
+#
+
+## Configurables ###########################################################################
+
+# inputs
+jikes_java_sources     := $(shell find src -name *.java)
+gcj_java_sources       := $(shell find src -name *.java -not -path src/org/xwt/plat/\*) src/org/xwt/plat/GCJ.java $(platform_java_sources)
+xwar_sources           := $(ls src/org/xwt/builtin/*.png src/org/xwt/builtin/*.xwt src/org/xwt/builtin/*.xwf)
+cc_sources             := src/org/xwt/plat/$(platform).cc
+
+# outputs
+jikes_java_objects     := $(jikes_java_sources:src/%.java=bin/%.class)
+cc_objects             := $(cc_sources:src/%.cc=bin-$(platform)/%-nat.o)
+gcj_java_objects       := $(gcj_java_sources:src/%.java=bin-$(platform)/%.o)
+
+# tools
+gcc_path               := $(shell pwd)/gcc
+gcc_flags              := -O9 -ffast-math -fomit-frame-pointer -foptimize-sibling-calls -finline-functions -funroll-loops -g
+gcj_flags              := -fCLASSPATH=bin 
+gcj                    := $(gcc_path)/bin/$(target)-gcj $(gcj_flags) $(gcc_flags)
+gcc                    := $(gcc_path)/bin/$(target)-g++ $(gcc_flags)
+gcjh                   := $(gcc_path)/bin-$(target)-gcjh
+ar                     := $(gcc_path)/$(target)/bin/ar
+jikes                  := jikes -extdirs ${JAVA_HOME}/jre/lib -nowarn
+
+# platforms
+all_platforms          := Win32 Linux Java
+
+
+## Platform-Neutral ###########################################################################
+
+.SILENT: $(jikes_java_objects) .headers $(gcj_java_objects) $(all_platforms) PalmOS bin/org/xwt/builtin.xwar
+
+compile: $(jikes_java_objects) bin/org/xwt/builtin.xwar
+
+all: $(all_platforms)
+
+$(jikes_java_objects): $(jikes_java_sources)
+       echo -ne " .java -> .class:\\r"
+       mkdir -p bin
+       $(jikes) -sourcepath src/ -classpath lib/libgcj-minimal.jar $(jikes_java_sources) -d bin/
+       echo " .java -> .class: done"
+
+bin/org/xwt/builtin.xwar: $(xwar_sources)
+       mkdir -p bin/org/xwt
+       cd src; fastjar cf ../bin/org/xwt/builtin.xwar $(xwar_sources:src/%=%)
+
+clean:
+       rm -rf bin-*
+       find . -name \*~ | xargs rm -f
+       find . -name \#\*\# | xargs rm -f
+
+
+## GCJ-Derived Platforms #######################################################################
+
+# if the user doesn't change gcc_path, and it's not built, then we'll try to build it
+$(shell pwd)/gcc/bin/$(target)-gcj:
+       cd gcc; make
+
+gcj: compile $(gcc_path)/bin/$(target)-gcj .headers link
+
+link: $(gcj_java_objects) $(cc_objects)
+       $(ar) r bin-$(platform)/org/xwt/plat/platform.ar bin-$(platform)/org/xwt/plat/*.o
+       $(gcj) --main=org.xwt.Main -o bin-$(platform)/$(target_bin) $^ $(platform_link) bin-$(platform)/org/xwt/plat/platform.ar
+
+.headers: $(jikes_java_objects)
+       cd bin; for A in `find * -name \*.class`; do \
+               echo -ne "\033[K\\r.class -> .h:     $$A\\r"; \
+               $(gcjh) --classpath . `echo $$A | sed s_/_._g | sed s/.class$$//`; \
+               done
+       echo -e "\033[K\\r.class -> .h:     done"
+       touch .headers
+
+# turn off optimization of Trap.java due to a compiler bug
+bin-$(platform)/org/xwt/Trap.o: gcj_flags := -O0 -g
+
+$(gcj_java_objects): bin-$(platform)/%.o: src/%.java $(jikes_java_objects)
+       echo -ne "\033[K\\r .java -> .o:     $<\\r"
+       mkdir -p `dirname $@`
+       $(gcj) -c $< -o $@
+
+$(cc_objects): bin-$(platform)/%-nat.o: src/%.cc
+       echo -ne "\033[K\\r   .cc -> .o:     $$A\\r"
+       $(gcc) -Ibin -c $< -o $@
+
+bin-$(platform)/org/xwt/builtin.xwar: $(xwar_sources)
+       echo "bundling         -> .xwar"
+       $(gcj) --resource org/xwt/builtin.xwar -c $< -o $@
+
+
+
+## Platforms ##############################################################################
+
+Linux:
+       echo -e "\\n=== Linux ========================================="
+       make gcj \
+               platform=Linux \
+               target=i686-pc-linux-gnu \
+               target_bin=xwt.linux \
+               platform_link="-L$(gcc-path)/lib -L/usr/X11R6/lib -lX11 -lXext --static" \
+               platform_java_sources="src/org/xwt/plat/POSIX.java src/org/xwt/plat/X11.java"
+
+Win32:
+       echo -e "\\n=== Win32 ========================================="
+       make gcj \
+               platform=Win32 \
+               target=i686-pc-mingw32 \
+               target_bin=xwt.exe \
+               platform_link="-Wl,--subsystem,windows -lcomdlg32" \
+               platform_java_sources=src/org/xwt/plat/Win32.java
+
+Java: compile
+
+PalmOS:
+       echo "PalmOS is not yet supported"
+       false
+
diff --git a/README b/README
index b704c39..c7821a8 100644 (file)
--- a/README
+++ b/README
@@ -31,77 +31,49 @@ ______________________________________________________________________________
 Directory Structure
 
 /
-   AUTHORS               - people involved in developing XWT
-   README                - this file
-   COPYING               - copyright information for all files in this distro
-   TM                    - trademark information for XWT
-   ant                   - a unix shell script to launch ant
-   bin/                  - all binary stuff generated by ant builds
-
-   build.xml             - ANT build file
-   Makefile              - build file for gcc 3.3
-
-   lib/                  - any third-party binary stuff needed during the build process
-       javago            - a copy of the javago post-compilation bytecode inliner
-       ant.jar           - the Jakarta project's ANT build tool, including Sun's XML parser
-       netscape.jar      - minimal set of classes required for compiling against Netcape's Applet interfaces
-       msjvm.jar         - minimal set of classes required for compiling against Microsoft's Applet interfaces
-       javasrc.jar       - javasrc, a tool for generating hyperlinked, syntax-colored html from java code
-
-   src/                  - all java source files and xwt sources go here
+   AUTHORS                - people involved in developing XWT
+   README                 - this file
+   COPYING                - copyright information for all files in this distro
+   TM                     - trademark information for XWT
+   Makefile               - build file for gcc 3.3
+   bin/                   - all binary stuff generated by xwt builds
+   gcc/                   - build area for a custom copy of gcc3.3 and binutils2.13
+       Makefile           - will download, configure, compile, and private-install gcc3.3/binutils2.13
+   lib/                   - any third-party binary stuff needed during the build process
+       javago             - a copy of the javago post-compilation bytecode inliner
+       netscape.jar       - minimal set of classes required for compiling against Netcape's Applet interfaces
+       msjvm.jar          - minimal set of classes required for compiling against Microsoft's Applet interfaces
+       jump.jar           - the jump2 bytecode-to-palmos translator
+       libgcj-minimal.jar - a tiny portion of libgcj.jar; allows java->bytecode compilation without gcj
+   src/                   - all java source files and xwt sources go here
        org/
-           bouncycastle/ - the BouncyCastle Crypto Library
-           mozilla/      - a copy of Rhino, the Mozilla JavaScript interpreter
-           xwt/builtin/  - .xwt's and .png's that are essential to bootstrapping the engine
-           xwt/plat/     - platform-specific code
+           bouncycastle/  - the BouncyCastle Crypto Library
+           mozilla/       - a copy of Rhino, the Mozilla JavaScript interpreter
+           xwt/builtin/   - .xwt's and .png's that are essential to bootstrapping the engine
+           xwt/plat/      - platform-specific code
 
 ______________________________________________________________________________
-Build Targets
-
-        *** XWT now requires JDK 1.4 or later to build ***
-
-To build, make sure your $JAVA_HOME points to jdk1.4 or later, and type
-
-    ./ant -Dplat=<platform> <targetname>
-
-The name of any class in org.xwt.plat is a valid <platform>; here is a
-list as of 20-Mar-2002:
-
-    Win32         - Windows 95 / NT4 or later
-    Java12        - Any Java 1.2+ compliant JVM
-
-Valid <target>s are:
-
-    build         - builds a binary for the selected platform
-
-The following targets do not require that you specify a platform:
-
-    compile       - compiles all .java's to .class'es
-    clean         - empties bin/ and compiled binaries in dist/
-
-
-______________________________________________________________________________
-Building
-
-- WARNING: Jikes 1.16 has a bug which will cause it to generate
-  corrupt .class files; you must downgrade to 1.15 in order to compile
-  XWT.
-
-- If you only want to build the JVM version of XWT, delete these three
-  files:
-
-    xwt/src/org/xwt/plat/Win32.java
-    xwt/src/org/xwt/plat/POSIX.java
-    xwt/src/org/xwt/plat/GCJ.java
-
-  This will allow XWT to build correctly *without* gcc 3.1. Otherwise,
-  you must compile and install gcc 3.1.
-
-- The Win32 native version of XWT can ONLY be built with the very
-  latest pre-release of GCC 3.3.  Run "make gcc-lin" to build a gcc
-  3.3 that targets Linux; run "make gcc-win" to build a gcc 3.3 that
-  targets Win32.
-
+Build Targets and Requirements
+
+Build requirements:
+- jdk 1.4+
+- jikes (warning: Jikes 1.16 has a fatal bug; use 1.15)
+- gcj 3.3+
+- binutils 2.13+
+- fastjar
+
+If you already have a suitably configured gcj 3.3 and binutils 2.13+
+you can set "gcc_path" to point at its installation location;
+otherwise the Makefile will download, configure, compile, and install
+gcc and binutils.
+
+Public build targets:
+
+    compile       - compiles all .java files into bin/*.class
+    Win32         - Win95 or later (bin-Win32/xwt.exe)
+    Linux         - Linux 2.2 or later (bin-Linux/xwt.linux)
+    Java          - Any Java 1.1+ compliant JVM
+    clean         - cleanup
 
 
 ______________________________________________________________________________
diff --git a/build.xml b/build.xml
deleted file mode 100644 (file)
index e4a4bf8..0000000
--- a/build.xml
+++ /dev/null
@@ -1,68 +0,0 @@
-<project name="xwt" default="compile" basedir=".">
-
-    <!-- required so that libgcj.jar doesn't interfere with non-gcj compilation -->
-    <property name="build.sysclasspath" value="first"/>
-
-    <property name="gcc-path" value="/usr/local/gcc"/>
-    <property name="build.compiler" value="jikes"/>
-    <property environment="env"/>
-
-    <!-- set up our classpath -->
-    <path id="classpath">
-        <pathelement path="${envCLASSPATH}"/>
-        <pathelement path="bin/"/>
-        <fileset dir="lib">
-            <include name="**/*.jar"/>
-        </fileset>
-    </path>
-
-    <!-- purges binaries we've built -->
-    <target name="clean">
-        <delete quiet="true" dir="bin"/>
-        <delete quiet="true">
-            <fileset dir="./" casesensitive="yes" defaultexcludes="no">
-                <include name="bin-*"/>
-                <include name="**/*~"/>
-                <include name="**/#*#"/>
-                <exclude name="**/.#*"/>
-                <exclude name="**/%*%"/>
-                <exclude name="**/._*"/>
-                <exclude name="**/CVS"/>
-                <exclude name="**/CVS/**"/>
-                <exclude name="**/.cvsignore"/>
-                <exclude name="**/SCCS"/>
-                <exclude name="**/SCCS/**"/>
-                <exclude name="**/vssver.scc"/>
-                <exclude name="**/.svn"/>
-                <exclude name="**/.svn/**"/>
-            </fileset>
-        </delete>
-    </target>
-
-    <!-- compiles all .java files into .class files; all other tasks predepend on this since they need the <taskdef/>'s -->
-    <target name="compile">
-        <mkdir dir="bin/"/>
-        <echo message="compiling   .java -> .class [xwt]"/>
-        <javac destdir="bin/" deprecation="no">
-            <src path="src/"/>
-            <include name="**/*.java"/>
-            <classpath>
-
-                <!-- don't EVER include the following line anywhere else; it causes really bizarre errors -->
-                <pathelement location="${gcc-path}/share/libgcj.jar"/>
-                <path refid="classpath"/>
-
-                <!-- this is for people who don't have libgcj.jar -->
-                <pathelement location="lib/libgcj-minimal.jar"/>
-
-            </classpath>
-        </javac>
-        <echo message="updating     .xwt -> .xwar"/>
-        <zip update="true" zipfile="bin/org/xwt/builtin.xwar" basedir="src" includes="org/xwt/builtin/*.png,org/xwt/builtin/*.xwt,org/xwt/builtin/*.xwf"/>
-    </target>
-
-    <target name="build" depends="compile">
-        <ant dir="." antfile="src/org/xwt/plat/${plat}.xml" target="build"/>
-    </target>
-
-</project>