2003/02/27 05:08:38
[org.ibex.core.git] / Makefile
index a433bcd..f93ba5b 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -21,17 +21,17 @@ gcc_flags              := -O9 -ffast-math -fomit-frame-pointer -foptimize-siblin
 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
+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
+all_platforms          := Win32 Linux Java2
 
 
 ## Platform-Neutral ###########################################################################
 
-.SILENT: $(jikes_java_objects) .headers $(gcj_java_objects) $(all_platforms) PalmOS bin/org/xwt/builtin.xwar
+.SILENT: dist update-build $(jikes_java_objects) .headers $(gcj_java_objects) $(all_platforms) PalmOS bin/org/xwt/builtin.xwar
 
 compile: $(jikes_java_objects) bin/org/xwt/builtin.xwar
 
@@ -48,10 +48,19 @@ bin/org/xwt/builtin.xwar: $(xwar_sources)
        cd src; fastjar cf ../bin/org/xwt/builtin.xwar $(xwar_sources:src/%=%)
 
 clean:
-       rm -rf bin-*
+       rm -rf bin-* bin
        find . -name \*~ | xargs rm -f
        find . -name \#\*\# | xargs rm -f
 
+update-build:
+       (echo -n 0000; (echo "10k16o16i"; cat next.build | tr a-z A-Z; echo "1+f") | dc) | tail --bytes=5 > next.build-
+       mv next.build- next.build
+       echo -n "Next build will be "
+       cat next.build
+       echo committing...
+       cvs commit -m 'updated next.build' next.build
+       echo committed.
+
 
 ## GCJ-Derived Platforms #######################################################################
 
@@ -111,9 +120,55 @@ Win32:
                platform_link="-Wl,--subsystem,windows -lcomdlg32" \
                platform_java_sources=src/org/xwt/plat/Win32.java
 
-Java: compile
+Java2: $(jikes_java_objects) bin/org/xwt/builtin.xwar
+       mkdir -p bin-Java12
+       echo -e "Manifest-Version: 1.0\nMain-Class: org.xwt.Main\n" > bin/.manifest
+       cd bin; fastjar cvf ../bin-Java12/xwt.jar -m .manifest \
+                org/xwt/builtin.xwar \
+               `find . -name \*.class | grep -v org/xwt/plat/` \
+               org/xwt/plat/AWT*.class org/xwt/plat/Java2*.class
+
+$(java2_objects:bin/%=%)
 
 PalmOS:
        echo "PalmOS is not yet supported"
        false
 
+
+## dist.xwt.org ############################################################################
+
+current_build         := $(shell cat next.build)
+
+nohup-dist:
+       rm .make-dist.out
+       touch .make-dist.out
+       (nice -n 19 nohup make dist &>/dev/null) & tail -f .make-dist.out
+
+dist:
+       test `uname -n` = gosset.megacz.com || \
+               (echo -e "um, dist is only intended for use on xwt.org...\nedit the Makefile if you really know what you're doing."; false)
+       echo "***********************************************************"
+       echo "*  This build is $(current_build)"
+       echo "***********************************************************"
+
+       make --silent update-build
+       (make --silent dist-private &> .make-dist.out) || \
+               (cat .make-dist.out | mail -s "Build $(current_build) FAILED" cvs@xwt.org; false)
+       cat .make-dist.out | \
+               mail -s "Unsigned binaries of build $(current_build) are now available" cvs@xwt.org
+
+dist-private:
+       # preserve gcc across builds so we don't have to remake it
+       mv gcc/Makefile Makefile.gcc
+       mkdir -p ~/dist.xwt.org-gcc
+       rm -rf gcc
+       ln -s ~/dist.xwt.org-gcc gcc
+       mv Makefile.gcc gcc/Makefile
+
+       # build it
+       nice -n 19 make all
+
+       cp bin-Java2/xwt.jar /var/www/dist.xwt.org/xwt-$(current_build).jar.unsigned
+       cp bin-Win32/xwt.exe /var/www/dist.xwt.org/xwt-$(current_build).exe.unsigned
+       cp bin-Linux/xwt.linux /var/www/dist.xwt.org/xwt-$(current_build).linux.unsigned
+