5 ## Configurables ###########################################################################
8 jikes_java_sources := $(shell find src -name *.java)
9 gcj_java_sources := $(shell find src -name *.java \! -path src/org/xwt/plat/\*) src/org/xwt/plat/GCJ.java $(platform_java_sources)
10 xwar_sources := $(shell 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/gcjh
25 ar := $(gcc_path)/$(target)/bin/ar
26 strip := $(gcc_path)/$(target)/bin/strip
27 jar := $(shell ((type fastjar &>/dev/null) && echo fastjar) || echo jar)
28 jikes := jikes -extdirs ${JAVA_HOME}/jre/lib -nowarn
31 all_platforms := Win32 Linux Java2
34 ## Platform-Neutral ###########################################################################
36 ifneq ($(verbose),true)
37 .SILENT: $(jikes_java_objects) .headers $(gcj_java_objects) $(all_platforms) bin/org/xwt/builtin.xwar .bootclasspath
41 compile: $(jikes_java_objects) bin/org/xwt/builtin.xwar
46 echo "public class GetBootClassPath { public static void main(String[] s) { " > GetBootClassPath.java
47 echo "System.out.println(System.getProperty(\"sun.boot.class.path\")); } }" >> GetBootClassPath.java
48 javac GetBootClassPath.java
49 java -cp . GetBootClassPath > .bootclasspath
52 $(jikes_java_objects): $(jikes_java_sources) .bootclasspath
53 test "$(JAVA_HOME)"x != x || (echo "you forgot to set your JAVA_HOME environment variable"; false)
54 echo "compiling .java -> .class:"
56 $(jikes) -bootclasspath $(shell cat .bootclasspath) -sourcepath src/ -classpath lib/libgcj-minimal.jar $(jikes_java_sources) -d bin/
57 echo "compiling .java -> .class: done"
59 bin/org/xwt/builtin.xwar: $(xwar_sources)
61 cd src; $(jar) cf ../bin/org/xwt/builtin.xwar $(xwar_sources:src/%=%)
65 find . -name \*~ | xargs rm -f
66 find . -name \#\*\# | xargs rm -f
69 cvs tag -F xwt-$(current_build)
70 (echo -n 0000; (echo "10k16o16i"; cat next.build | tr a-z A-Z; echo "1+f") | dc) | tail --bytes=5 > next.build-
71 mv next.build- next.build
72 echo -n "Next build will be "
76 echo `date +%d-%b`" =========== build $(current_build) ================================================" >> CHANGES
78 cvs commit -m 'this comment should not appear in CHANGES' next.build CHANGES
82 ## GCJ-Derived Platforms #######################################################################
84 # if the user doesn't change gcc_path, and it's not built, then we'll try to build it
85 $(shell pwd)/gcc/bin/$(target)-gcj:
88 gcj: compile $(gcc_path)/bin/$(target)-gcj .headers link
90 link: $(gcj_java_objects) $(cc_objects) bin-$(platform)/org/xwt/builtin.o
91 echo "linking .o -> $(target_bin)"
92 $(ar) r bin-$(platform)/org/xwt/plat/platform.ar bin-$(platform)/org/xwt/plat/*.o
93 $(gcj) --main=org.xwt.Main -o bin-$(platform)/$(target_bin) $^ $(platform_link) bin-$(platform)/org/xwt/plat/platform.ar
95 .headers: $(jikes_java_objects)
96 cd bin; for A in `find * -name \*.class`; do \
97 echo "extracting .class -> .h: $$A"; \
98 $(gcjh) --classpath . `echo $$A | sed s_/_._g | sed s/.class$$//`; \
100 echo "extracting .class -> .h: done"
103 # turn off optimization of Trap.java due to a compiler bug
104 bin-$(platform)/org/xwt/Trap.o: gcj_flags := -O0 -g
106 $(gcj_java_objects): bin-$(platform)/%.o: src/%.java $(jikes_java_objects)
107 echo -ne "compiling .java -> .o: $<"
108 mkdir -p `dirname $@`
111 $(cc_objects): bin-$(platform)/%-nat.o: src/%.cc
112 echo -ne "compiling .cc -> .o: $$A"
113 $(gcc) -Ibin -c $< -o $@
115 bin-$(platform)/org/xwt/builtin.o: bin/org/xwt/builtin.xwar
116 echo "wrapping .xwar -> .o"
117 $(gcj) --resource org/xwt/builtin.xwar -c $< -o $@
121 ## Platforms ##############################################################################
124 echo -e "\\n=== Linux ========================================="
127 target=i686-pc-linux-gnu \
128 target_bin=xwt.linux \
129 platform_link="-L$(gcc-path)/lib -L/usr/X11R6/lib -lX11 -lXext --static" \
130 platform_java_sources="src/org/xwt/plat/POSIX.java src/org/xwt/plat/X11.java"
133 echo -e "\\n=== Win32 ========================================="
136 target=i686-pc-mingw32 \
138 platform_link="-Wl,--subsystem,windows -lcomdlg32" \
139 platform_java_sources=src/org/xwt/plat/Win32.java
141 Java2: $(jikes_java_objects) bin/org/xwt/builtin.xwar
142 echo -e "\\n=== Java2 ========================================="
143 echo "archiving .class -> .jar"
145 echo -e "Manifest-Version: 1.0\nMain-Class: org.xwt.Main\n" > bin/.manifest
146 cd bin; $(jar) cvf ../bin-Java2/xwt.jar -m .manifest \
147 org/xwt/builtin.xwar \
148 `find . -name \*.class | grep -v org/xwt/plat/` \
149 org/xwt/plat/AWT*.class org/xwt/plat/Java2*.class | tr \\012 \\015
152 $(java2_objects:bin/%=%)
155 echo "PalmOS is not yet supported"
159 ## master.dist.xwt.org ############################################################################
161 current_build := $(shell cat next.build)
162 this_branch := $(shell tail -c +2 CVS/Tag 2>/dev/null || echo HEAD)
165 # this will fail if we haven't checked-in since the comment is null; we want this.
166 cvs commit -m '' > /dev/null
167 cvs tag -F xwt-$(current_build)
169 echo "***********************************************************"
170 echo "* This build is $(current_build)"
171 echo "***********************************************************"
173 ifeq ($(shell uname -n),gosset.megacz.com)
174 (make $(silent) dist-private 2>&1) >> .make-dist.out || \
175 (tail -n 200 .make-dist.out | mail -s "Build $(current_build) FAILED" cvs@xwt.org; false)
176 tail -n 200 .make-dist.out | \
177 mail -s "Unsigned binaries of $(current_build) are now available" cvs@xwt.org
179 ssh xwt@xwt.org verbose=$(verbose) /home/xwt/dist $(this_branch) \
180 | grep -v "make...:.\(Entering\|Leaving\).directory"
185 make $(silent) update-build
187 # preserve gcc across builds so we don't have to remake it
188 mv gcc/Makefile Makefile.gcc
189 mkdir -p $(HOME)/dist.xwt.org-gcc
191 ln -s $(HOME)/dist.xwt.org-gcc gcc
192 mv Makefile.gcc gcc/Makefile
198 echo === master.dist.xwt.org ==================================
200 echo "copying xwt.jar to distribution area..."
201 cp bin-Java2/xwt.jar /var/www/master.dist.xwt.org/xwt-$(current_build).jar.unsigned
203 echo "stripping xwt.exe and copying it to the distribution area..."
204 $(strip) bin-Win32/xwt.exe -o /var/www/master.dist.xwt.org/xwt-$(current_build).exe.unsigned
206 echo "copying xwt.linux to distribution area..."
207 $(strip) bin-Linux/xwt.linux -o /var/www/master.dist.xwt.org/xwt-$(current_build).linux.unsigned
209 echo "creating source tarball in distribution area..."
210 CVSROOT=/cvs cvs export -r xwt-$(current_build) xwt
211 mv xwt xwt-$(current_build)
212 tar cvzf /var/www/master.dist.xwt.org/xwt-$(current_build).tgz xwt-$(current_build)
215 echo "*** DONE ******************************************"