5 ## Configurables ###########################################################################
8 javac_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 javac_java_objects := $(javac_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_optimizations := -O9 -ffast-math -fomit-frame-pointer -foptimize-sibling-calls -finline-functions -funroll-loops
21 gcc_optimizations := -O0
22 gcc_flags := $(gcc_optimizations) -g -ffunction-sections -fdata-sections
23 gcj_flags := -fCLASSPATH=bin
24 gcj := $(gcc_path)/bin/$(target)-gcj $(gcj_flags) $(gcc_flags)
25 gcc := $(gcc_path)/bin/$(target)-g++ $(gcc_flags)
26 gcjh := $(gcc_path)/bin/$(target)-gcjh
27 ar := $(gcc_path)/$(target)/bin/ar
28 strip := $(gcc_path)/$(target)/bin/strip
29 jar := $(shell ((type fastjar &>/dev/null) && echo fastjar) || echo jar)
32 all_platforms := Win32 Linux Java2
35 PATH := jikes-1.18/bin:$(PATH)
38 ## Platform-Neutral ###########################################################################
40 ifneq ($(verbose),true)
41 .SILENT: $(javac_java_objects) .headers $(gcj_java_objects) $(all_platforms) bin/org/xwt/builtin.xwar .bootclasspath .javac
45 compile: $(javac_java_objects) bin/org/xwt/builtin.xwar
51 type jikes && (jikes --version | grep "Version 1.18"); \
53 echo "public class GetBootClassPath { public static void main(String[] s) { " > GetBootClassPath.java; \
54 echo "System.out.println(System.getProperty(\"sun.boot.class.path\")); } }" >> GetBootClassPath.java; \
55 javac GetBootClassPath.java; \
56 java -cp . GetBootClassPath > .bootclasspath; \
57 rm GetBootClassPath.*; \
58 echo -n "jikes -nowarn -sourcepath src/ -bootclasspath " > .javac; \
59 cat .bootclasspath >> .javac; \
61 echo "WARNING: You do not have jikes; falling back to javac. Compiles will be very slow."; \
62 echo javac > .javac; \
66 curl ftp://www-126.ibm.com/pub/jikes/1.18/jikes-1.18.tar.bz2 | tar xjvf -
67 cd jikes-1.18; ./configure --prefix=`pwd` && make && make install
68 ln -sf jikes-1.18/bin/jikes .jikes
70 $(javac_java_objects): $(javac_java_sources) .javac
71 test "$(JAVA_HOME)"x != x || (echo "you forgot to set your JAVA_HOME environment variable"; false)
72 echo "compiling .java -> .class:"
74 $(shell cat .javac) -classpath lib/libgcj-minimal.jar $(javac_java_sources) -d bin/
75 echo "compiling .java -> .class: done"
77 bin/org/xwt/builtin.xwar: $(xwar_sources)
79 cd src; $(jar) cf ../bin/org/xwt/builtin.xwar $(xwar_sources:src/%=%)
83 find . -name \*~ | xargs rm -f
84 find . -name \#\*\# | xargs rm -f
87 cvs tag -F xwt-$(current_build)
88 (echo -n 0000; (echo "10k16o16i"; cat next.build | tr a-z A-Z; echo "1+f") | dc) | tail --bytes=5 > next.build-
89 mv next.build- next.build
90 echo -n "Next build will be "
94 echo `date +%d-%b`" =========== build $(current_build) ================================================" >> CHANGES
96 cvs commit -m 'this comment should not appear in CHANGES' next.build CHANGES
100 @echo -n "Please type a one-line description of this bug: "; \
103 echo "Please type any additional comments that explain this patch."; \
104 echo "If this patch fixes a bug, include a link to bugs.xwt.org."; \
105 echo "When you are done, press control-d on a new line."; \
107 ( echo -e "HELO patcher"; \
108 echo -e "MAIL FROM:$(USER)@xwt.org"; \
109 echo -e "RCPT TO: patches@xwt.org"; \
111 echo -e "From: $(USER)@xwt.org"; \
112 echo -e "To: patches@xwt.org"; \
113 echo -e "Subject: proposed patch to $(this_branch): $$A"; \
120 bash -c "cat .message > /dev/tcp/mail.xwt.org/25" # /dev/tcp is faked by bash; not part of the os
122 ## GCJ-Derived Platforms #######################################################################
124 # if the user doesn't change gcc_path, and it's not built, then we'll try to build it
125 $(shell pwd)/gcc/bin/$(target)-gcj:
128 gcj: compile $(gcc_path)/bin/$(target)-gcj .headers link
130 link: $(gcj_java_objects) $(cc_objects) bin-$(platform)/org/xwt/builtin.o
131 echo "linking .o -> $(target_bin)"
132 $(ar) r bin-$(platform)/org/xwt/plat/platform.ar bin-$(platform)/org/xwt/plat/*.o
133 $(gcj) --main=org.xwt.Main -o bin-$(platform)/$(target_bin) $^ $(platform_link) bin-$(platform)/org/xwt/plat/platform.ar
135 .headers: $(javac_java_objects)
136 cd bin; for A in `find * -name \*.class`; do \
137 echo "extracting .class -> .h: $$A"; \
138 $(gcjh) --classpath . `echo $$A | sed s_/_._g | sed s/.class$$//`; \
140 echo "extracting .class -> .h: done"
143 # turn off optimization of Trap.java due to a compiler bug
144 bin-$(platform)/org/xwt/Trap.o: gcj_flags := -O0 -g
146 $(gcj_java_objects): bin-$(platform)/%.o: src/%.java $(javac_java_objects)
147 echo "compiling .java -> .o: $<"
148 mkdir -p `dirname $@`
151 $(cc_objects): bin-$(platform)/%-nat.o: src/%.cc
152 echo "compiling .cc -> .o: $$A"
153 $(gcc) -Ibin -c $< -o $@
155 bin-$(platform)/org/xwt/builtin.o: bin/org/xwt/builtin.xwar
156 echo "wrapping .xwar -> .o"
157 $(gcj) --resource org/xwt/builtin.xwar -c $< -o $@
161 ## Platforms ##############################################################################
164 echo -e "\\n=== Linux ========================================="
167 target=i686-pc-linux-gnu \
168 target_bin=xwt.linux \
169 platform_link="-L$(gcc-path)/lib -L/usr/X11R6/lib -lX11 -lXext --static" \
170 platform_java_sources="src/org/xwt/plat/POSIX.java src/org/xwt/plat/X11.java"
173 echo -e "\\n=== Win32 ========================================="
176 target=i686-pc-mingw32 \
178 platform_link="-Wl,--subsystem,windows -lcomdlg32" \
179 platform_java_sources=src/org/xwt/plat/Win32.java
181 Java2: $(javac_java_objects) bin/org/xwt/builtin.xwar
182 echo -e "\\n=== Java2 ========================================="
183 echo "archiving .class -> .jar"
185 echo -e "Manifest-Version: 1.0\nMain-Class: org.xwt.Main\n" > bin/.manifest
186 cd bin; $(jar) cvfm ../bin-Java2/xwt.jar .manifest \
187 org/xwt/builtin.xwar \
188 `find . -name \*.class | grep -v org/xwt/plat/` \
189 org/xwt/plat/AWT*.class org/xwt/plat/Java2*.class | tr \\012 \\015
192 $(java2_objects:bin/%=%)
195 echo "PalmOS is not yet supported"
199 ## master.dist.xwt.org ############################################################################
201 current_build := $(shell cat next.build)
202 this_branch := $(shell tail -c +2 CVS/Tag 2>/dev/null || echo HEAD)
205 # this will fail if we haven't checked-in since the comment is null; we want this.
206 cvs commit -m '' > /dev/null
207 cvs tag -F xwt-$(current_build)
209 echo "***********************************************************"
210 echo "* This build is $(current_build)"
211 echo "***********************************************************"
213 ifeq ($(shell uname -n),serverbeach.megacz.com)
214 (make $(silent) dist-private 2>&1) >> .make-dist.out || \
215 (tail -n 200 .make-dist.out | mail -s "Build $(current_build) FAILED" cvs@xwt.org; false)
216 tail -n 200 .make-dist.out | \
217 mail -s "Unsigned binaries of $(current_build) are now available" cvs@xwt.org
219 ssh xwt@xwt.org verbose=$(verbose) /home/xwt/dist $(this_branch) \
220 | grep -v "make...:.\(Entering\|Leaving\).directory"
225 make $(silent) update-build
227 # preserve gcc across builds so we don't have to remake it
228 mv gcc/Makefile Makefile.gcc
229 mkdir -p $(HOME)/dist.xwt.org-gcc
231 ln -s $(HOME)/dist.xwt.org-gcc gcc
232 mv Makefile.gcc gcc/Makefile
238 echo === master.dist.xwt.org ==================================
240 echo "copying xwt.jar to distribution area..."
241 cp bin-Java2/xwt.jar /var/www/master.dist.xwt.org/xwt-$(current_build).jar.unsigned
243 echo "stripping xwt.exe and copying it to the distribution area..."
244 $(strip) bin-Win32/xwt.exe -o /var/www/master.dist.xwt.org/xwt-$(current_build).exe.unsigned
246 echo "copying xwt.linux to distribution area..."
247 $(strip) bin-Linux/xwt.linux -o /var/www/master.dist.xwt.org/xwt-$(current_build).linux.unsigned
249 echo "creating source tarball in distribution area..."
250 CVSROOT=/cvs cvs export -r xwt-$(current_build) xwt
251 mv xwt xwt-$(current_build)
252 tar cvzf /var/www/master.dist.xwt.org/xwt-$(current_build).tgz xwt-$(current_build)
255 echo "*** DONE ******************************************"