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_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)
30 all_platforms := Win32 Linux Java2
33 PATH := jikes-1.18/bin:$(PATH)
36 ## Platform-Neutral ###########################################################################
38 ifneq ($(verbose),true)
39 .SILENT: $(javac_java_objects) .headers $(gcj_java_objects) $(all_platforms) bin/org/xwt/builtin.xwar .bootclasspath .javac
43 compile: $(javac_java_objects) bin/org/xwt/builtin.xwar
49 type jikes && (jikes --version | grep "Version 1.18"); \
51 echo "public class GetBootClassPath { public static void main(String[] s) { " > GetBootClassPath.java; \
52 echo "System.out.println(System.getProperty(\"sun.boot.class.path\")); } }" >> GetBootClassPath.java; \
53 javac GetBootClassPath.java; \
54 java -cp . GetBootClassPath > .bootclasspath; \
55 rm GetBootClassPath.*; \
56 echo -n "jikes -nowarn -sourcepath src/ -bootclasspath " > .javac; \
57 cat .bootclasspath >> .javac; \
59 echo "WARNING: You do not have jikes; falling back to javac. Compiles will be very slow."; \
60 echo javac > .javac; \
64 wget ftp://www-126.ibm.com/pub/jikes/1.18/jikes-1.18.tar.bz2 -O jikes-1.18.tar.bz2
65 bunzip2 jikes-1.18.tar.bz2
66 tar xvf jikes-1.18.tar && rm jikes-1.18.tar
67 cd jikes-1.18; ./configure --prefix=`pwd`
68 cd jikes; make && make install
69 ln -s jikes-1.18/bin/jikes .jikes
71 $(javac_java_objects): $(javac_java_sources) .javac
72 test "$(JAVA_HOME)"x != x || (echo "you forgot to set your JAVA_HOME environment variable"; false)
73 echo "compiling .java -> .class:"
75 $(shell cat .javac) -classpath lib/libgcj-minimal.jar $(javac_java_sources) -d bin/
76 echo "compiling .java -> .class: done"
78 bin/org/xwt/builtin.xwar: $(xwar_sources)
80 cd src; $(jar) cf ../bin/org/xwt/builtin.xwar $(xwar_sources:src/%=%)
84 find . -name \*~ | xargs rm -f
85 find . -name \#\*\# | xargs rm -f
88 cvs tag -F xwt-$(current_build)
89 (echo -n 0000; (echo "10k16o16i"; cat next.build | tr a-z A-Z; echo "1+f") | dc) | tail --bytes=5 > next.build-
90 mv next.build- next.build
91 echo -n "Next build will be "
95 echo `date +%d-%b`" =========== build $(current_build) ================================================" >> CHANGES
97 cvs commit -m 'this comment should not appear in CHANGES' next.build CHANGES
101 @echo -n "Please type a one-line description of this bug: "; \
104 echo "Please type any additional comments that explain this patch."; \
105 echo "If this patch fixes a bug, include a link to bugs.xwt.org."; \
106 echo "When you are done, press control-d on a new line."; \
108 ( echo -e "HELO patcher"; \
109 echo -e "MAIL FROM:$(USER)@xwt.org"; \
110 echo -e "RCPT TO: patches@xwt.org"; \
112 echo -e "From: $(USER)@xwt.org"; \
113 echo -e "To: patches@xwt.org"; \
114 echo -e "Subject: proposed patch to $(this_branch): $$A"; \
121 bash -c "cat .message > /dev/tcp/mail.xwt.org/25" # /dev/tcp is faked by bash; not part of the os
123 ## GCJ-Derived Platforms #######################################################################
125 # if the user doesn't change gcc_path, and it's not built, then we'll try to build it
126 $(shell pwd)/gcc/bin/$(target)-gcj:
129 gcj: compile $(gcc_path)/bin/$(target)-gcj .headers link
131 link: $(gcj_java_objects) $(cc_objects) bin-$(platform)/org/xwt/builtin.o
132 echo "linking .o -> $(target_bin)"
133 $(ar) r bin-$(platform)/org/xwt/plat/platform.ar bin-$(platform)/org/xwt/plat/*.o
134 $(gcj) --main=org.xwt.Main -o bin-$(platform)/$(target_bin) $^ $(platform_link) bin-$(platform)/org/xwt/plat/platform.ar
136 .headers: $(javac_java_objects)
137 cd bin; for A in `find * -name \*.class`; do \
138 echo "extracting .class -> .h: $$A"; \
139 $(gcjh) --classpath . `echo $$A | sed s_/_._g | sed s/.class$$//`; \
141 echo "extracting .class -> .h: done"
144 # turn off optimization of Trap.java due to a compiler bug
145 bin-$(platform)/org/xwt/Trap.o: gcj_flags := -O0 -g
147 $(gcj_java_objects): bin-$(platform)/%.o: src/%.java $(javac_java_objects)
148 echo -ne "compiling .java -> .o: $<"
149 mkdir -p `dirname $@`
152 $(cc_objects): bin-$(platform)/%-nat.o: src/%.cc
153 echo -ne "compiling .cc -> .o: $$A"
154 $(gcc) -Ibin -c $< -o $@
156 bin-$(platform)/org/xwt/builtin.o: bin/org/xwt/builtin.xwar
157 echo "wrapping .xwar -> .o"
158 $(gcj) --resource org/xwt/builtin.xwar -c $< -o $@
162 ## Platforms ##############################################################################
165 echo -e "\\n=== Linux ========================================="
168 target=i686-pc-linux-gnu \
169 target_bin=xwt.linux \
170 platform_link="-L$(gcc-path)/lib -L/usr/X11R6/lib -lX11 -lXext --static" \
171 platform_java_sources="src/org/xwt/plat/POSIX.java src/org/xwt/plat/X11.java"
174 echo -e "\\n=== Win32 ========================================="
177 target=i686-pc-mingw32 \
179 platform_link="-Wl,--subsystem,windows -lcomdlg32" \
180 platform_java_sources=src/org/xwt/plat/Win32.java
182 Java2: $(javac_java_objects) bin/org/xwt/builtin.xwar
183 echo -e "\\n=== Java2 ========================================="
184 echo "archiving .class -> .jar"
186 echo -e "Manifest-Version: 1.0\nMain-Class: org.xwt.Main\n" > bin/.manifest
187 cd bin; $(jar) cvf ../bin-Java2/xwt.jar -m .manifest \
188 org/xwt/builtin.xwar \
189 `find . -name \*.class | grep -v org/xwt/plat/` \
190 org/xwt/plat/AWT*.class org/xwt/plat/Java2*.class | tr \\012 \\015
193 $(java2_objects:bin/%=%)
196 echo "PalmOS is not yet supported"
200 ## master.dist.xwt.org ############################################################################
202 current_build := $(shell cat next.build)
203 this_branch := $(shell tail -c +2 CVS/Tag 2>/dev/null || echo HEAD)
206 # this will fail if we haven't checked-in since the comment is null; we want this.
207 cvs commit -m '' > /dev/null
208 cvs tag -F xwt-$(current_build)
210 echo "***********************************************************"
211 echo "* This build is $(current_build)"
212 echo "***********************************************************"
214 ifeq ($(shell uname -n),gosset.megacz.com)
215 (make $(silent) dist-private 2>&1) >> .make-dist.out || \
216 (tail -n 200 .make-dist.out | mail -s "Build $(current_build) FAILED" cvs@xwt.org; false)
217 tail -n 200 .make-dist.out | \
218 mail -s "Unsigned binaries of $(current_build) are now available" cvs@xwt.org
220 ssh xwt@xwt.org verbose=$(verbose) /home/xwt/dist $(this_branch) \
221 | grep -v "make...:.\(Entering\|Leaving\).directory"
226 make $(silent) update-build
228 # preserve gcc across builds so we don't have to remake it
229 mv gcc/Makefile Makefile.gcc
230 mkdir -p $(HOME)/dist.xwt.org-gcc
232 ln -s $(HOME)/dist.xwt.org-gcc gcc
233 mv Makefile.gcc gcc/Makefile
239 echo === master.dist.xwt.org ==================================
241 echo "copying xwt.jar to distribution area..."
242 cp bin-Java2/xwt.jar /var/www/master.dist.xwt.org/xwt-$(current_build).jar.unsigned
244 echo "stripping xwt.exe and copying it to the distribution area..."
245 $(strip) bin-Win32/xwt.exe -o /var/www/master.dist.xwt.org/xwt-$(current_build).exe.unsigned
247 echo "copying xwt.linux to distribution area..."
248 $(strip) bin-Linux/xwt.linux -o /var/www/master.dist.xwt.org/xwt-$(current_build).linux.unsigned
250 echo "creating source tarball in distribution area..."
251 CVSROOT=/cvs cvs export -r xwt-$(current_build) xwt
252 mv xwt xwt-$(current_build)
253 tar cvzf /var/www/master.dist.xwt.org/xwt-$(current_build).tgz xwt-$(current_build)
256 echo "*** DONE ******************************************"