5 ## Configurables ###########################################################################
8 jikes_java_sources := $(shell find src -name *.java)
9 gcj_java_sources := $(shell find src -name *.java -not -path src/org/xwt/plat/\*) src/org/xwt/plat/GCJ.java $(platform_java_sources)
10 xwar_sources := $(ls src/org/xwt/builtin/*.png src/org/xwt/builtin/*.xwt src/org/xwt/builtin/*.xwf)
11 cc_sources := src/org/xwt/plat/$(platform).cc
14 jikes_java_objects := $(jikes_java_sources:src/%.java=bin/%.class)
15 cc_objects := $(cc_sources:src/%.cc=bin-$(platform)/%-nat.o)
16 gcj_java_objects := $(gcj_java_sources:src/%.java=bin-$(platform)/%.o)
19 gcc_path := $(shell pwd)/gcc
20 gcc_flags := -O9 -ffast-math -fomit-frame-pointer -foptimize-sibling-calls -finline-functions -funroll-loops -g
21 gcj_flags := -fCLASSPATH=bin
22 gcj := $(gcc_path)/bin/$(target)-gcj $(gcj_flags) $(gcc_flags)
23 gcc := $(gcc_path)/bin/$(target)-g++ $(gcc_flags)
24 gcjh := $(gcc_path)/bin/$(target)-gcjh
25 ar := $(gcc_path)/$(target)/bin/ar
26 jikes := jikes -extdirs ${JAVA_HOME}/jre/lib -nowarn
29 all_platforms := Win32 Linux Java2
32 ## Platform-Neutral ###########################################################################
34 .SILENT: new-release update-build $(jikes_java_objects) .headers $(gcj_java_objects) $(all_platforms) PalmOS bin/org/xwt/builtin.xwar
36 compile: $(jikes_java_objects) bin/org/xwt/builtin.xwar
40 $(jikes_java_objects): $(jikes_java_sources)
41 echo -ne " .java -> .class:\\r"
43 $(jikes) -sourcepath src/ -classpath lib/libgcj-minimal.jar $(jikes_java_sources) -d bin/
44 echo " .java -> .class: done"
46 bin/org/xwt/builtin.xwar: $(xwar_sources)
48 cd src; fastjar cf ../bin/org/xwt/builtin.xwar $(xwar_sources:src/%=%)
52 find . -name \*~ | xargs rm -f
53 find . -name \#\*\# | xargs rm -f
56 (echo -n 0000; (echo "10k16o16i"; cat next.build | tr a-z A-Z; echo "1+f") | dc) | tail --bytes=5 > next.build-
57 mv next.build- next.build
58 echo -n "Next build will be "
61 cvs commit -m 'updated next.build' next.build
65 ## GCJ-Derived Platforms #######################################################################
67 # if the user doesn't change gcc_path, and it's not built, then we'll try to build it
68 $(shell pwd)/gcc/bin/$(target)-gcj:
71 gcj: compile $(gcc_path)/bin/$(target)-gcj .headers link
73 link: $(gcj_java_objects) $(cc_objects)
74 $(ar) r bin-$(platform)/org/xwt/plat/platform.ar bin-$(platform)/org/xwt/plat/*.o
75 $(gcj) --main=org.xwt.Main -o bin-$(platform)/$(target_bin) $^ $(platform_link) bin-$(platform)/org/xwt/plat/platform.ar
77 .headers: $(jikes_java_objects)
78 cd bin; for A in `find * -name \*.class`; do \
79 echo -ne "\033[K\\r.class -> .h: $$A\\r"; \
80 $(gcjh) --classpath . `echo $$A | sed s_/_._g | sed s/.class$$//`; \
82 echo -e "\033[K\\r.class -> .h: done"
85 # turn off optimization of Trap.java due to a compiler bug
86 bin-$(platform)/org/xwt/Trap.o: gcj_flags := -O0 -g
88 $(gcj_java_objects): bin-$(platform)/%.o: src/%.java $(jikes_java_objects)
89 echo -ne "\033[K\\r .java -> .o: $<\\r"
93 $(cc_objects): bin-$(platform)/%-nat.o: src/%.cc
94 echo -ne "\033[K\\r .cc -> .o: $$A\\r"
95 $(gcc) -Ibin -c $< -o $@
97 bin-$(platform)/org/xwt/builtin.xwar: $(xwar_sources)
98 echo "bundling -> .xwar"
99 $(gcj) --resource org/xwt/builtin.xwar -c $< -o $@
103 ## Platforms ##############################################################################
106 echo -e "\\n=== Linux ========================================="
109 target=i686-pc-linux-gnu \
110 target_bin=xwt.linux \
111 platform_link="-L$(gcc-path)/lib -L/usr/X11R6/lib -lX11 -lXext --static" \
112 platform_java_sources="src/org/xwt/plat/POSIX.java src/org/xwt/plat/X11.java"
115 echo -e "\\n=== Win32 ========================================="
118 target=i686-pc-mingw32 \
120 platform_link="-Wl,--subsystem,windows -lcomdlg32" \
121 platform_java_sources=src/org/xwt/plat/Win32.java
123 Java2: $(jikes_java_objects) bin/org/xwt/builtin.xwar
125 echo -e "Manifest-Version: 1.0\nMain-Class: org.xwt.Main\n" > bin/.manifest
126 cd bin; fastjar cvf ../bin-Java12/xwt.jar -m .manifest \
127 org/xwt/builtin.xwar \
128 `find . -name \*.class | grep -v org/xwt/plat/` \
129 org/xwt/plat/AWT*.class org/xwt/plat/Java2*.class
131 $(java2_objects:bin/%=%)
134 echo "PalmOS is not yet supported"
138 ## dist.xwt.org ############################################################################
140 current_build := $(shell cat next.build)
143 test `uname -n` = gosset.megacz.com || \
144 (echo -e "um, new-release is only intended for use on xwt.org...\nedit the Makefile if you really know what you're doing."; false)
145 echo "***********************************************************"
146 echo "* This build is $(current_build)"
147 echo "***********************************************************"
149 make --silent update-build
150 (make --silent new-release-private &> .make-new-release.out) || \
151 (cat .make-new-release.out | mail -s "Build $(current_build) FAILED" cvs@xwt.org; false)
152 cat .make-new-release.out | \
153 mail -s "Unsigned binaries of build $(current_build) are now available" cvs@xwt.org
156 # preserve gcc across builds so we don't have to remake it
157 mv gcc/Makefile Makefile.gcc
158 mkdir -p ~/dist.xwt.org-gcc
160 ln -s ~/dist.xwt.org-gcc gcc
161 mv Makefile.gcc gcc/Makefile
166 cp bin-Java2/xwt.jar /var/www/dist.xwt.org/xwt-$(current_build).jar.unsigned
167 cp bin-Win32/xwt.exe /var/www/dist.xwt.org/xwt-$(current_build).exe.unsigned
168 cp bin-Linux/xwt.linux /var/www/dist.xwt.org/xwt-$(current_build).linux.unsigned