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 jikes := jikes -bootclasspath /System/Library/Frameworks/JavaVM.framework/Versions/1.3.1/Classes/classes.jar -extdirs ${JAVA_HOME}/jre/lib -nowarn
30 all_platforms := Win32 Linux Java2 Darwin
33 ## Platform-Neutral ###########################################################################
35 ifneq ($(verbose),true)
36 .SILENT: $(jikes_java_objects) .headers $(gcj_java_objects) $(all_platforms) bin/org/xwt/builtin.xwar
40 compile: $(jikes_java_objects) bin/org/xwt/builtin.xwar
44 $(jikes_java_objects): $(jikes_java_sources)
45 test "$(JAVA_HOME)"x != x || (echo "you forgot to set your JAVA_HOME environment variable"; false)
46 echo "compiling .java -> .class:"
48 $(jikes) -sourcepath src/ -classpath lib/libgcj-minimal.jar $(jikes_java_sources) -d bin/
49 echo "compiling .java -> .class: done"
51 bin/org/xwt/builtin.xwar: $(xwar_sources)
53 cd src; fastjar cf ../bin/org/xwt/builtin.xwar $(xwar_sources:src/%=%)
57 find . -name \*~ | xargs rm -f
58 find . -name \#\*\# | xargs rm -f
61 cvs tag -F xwt-$(current_build)
62 (echo -n 0000; (echo "10k16o16i"; cat next.build | tr a-z A-Z; echo "1+f") | dc) | tail --bytes=5 > next.build-
63 mv next.build- next.build
64 echo -n "Next build will be "
68 echo `date +%d-%b`" =========== build $(current_build) ================================================" >> CHANGES
70 cvs commit -m 'this comment should not appear in CHANGES' next.build CHANGES
74 ## GCJ-Derived Platforms #######################################################################
76 # if the user doesn't change gcc_path, and it's not built, then we'll try to build it
77 $(shell pwd)/gcc/bin/$(target)-gcj:
80 gcj: compile $(gcc_path)/bin/$(target)-gcj .headers link
82 link: $(gcj_java_objects) $(cc_objects) bin-$(platform)/org/xwt/builtin.o
83 echo "linking .o -> $(target_bin)"
84 $(ar) r bin-$(platform)/org/xwt/plat/platform.ar bin-$(platform)/org/xwt/plat/*.o
85 $(gcj) --main=org.xwt.Main -o bin-$(platform)/$(target_bin) $^ $(platform_link) bin-$(platform)/org/xwt/plat/platform.ar
87 .headers: $(jikes_java_objects)
88 cd bin; for A in `find * -name \*.class`; do \
89 echo "extracting .class -> .h: $$A"; \
90 $(gcjh) --classpath . `echo $$A | sed s_/_._g | sed s/.class$$//`; \
92 echo "extracting .class -> .h: done"
95 # turn off optimization of Trap.java due to a compiler bug
96 bin-$(platform)/org/xwt/Trap.o: gcj_flags := -O0 -g
98 $(gcj_java_objects): bin-$(platform)/%.o: src/%.java $(jikes_java_objects)
99 echo -ne "compiling .java -> .o: $<"
100 mkdir -p `dirname $@`
103 $(cc_objects): bin-$(platform)/%-nat.o: src/%.cc
104 echo -ne "compiling .cc -> .o: $$A"
105 $(gcc) -Ibin -c $< -o $@
107 bin-$(platform)/org/xwt/builtin.o: bin/org/xwt/builtin.xwar
108 echo "wrapping .xwar -> .o"
109 $(gcj) --resource org/xwt/builtin.xwar -c $< -o $@
113 ## Platforms ##############################################################################
116 echo -e "\\n=== Linux ========================================="
119 target=i686-pc-linux-gnu \
120 target_bin=xwt.linux \
121 platform_link="-L$(gcc-path)/lib -L/usr/X11R6/lib -lX11 -lXext --static" \
122 platform_java_sources="src/org/xwt/plat/POSIX.java src/org/xwt/plat/X11.java"
125 echo -e "\\n=== Darwin ========================================="
128 target=powerpc-apple-darwin \
129 target_bin=xwt-x11.darwin \
130 platform_link="-L$(gcc-path)/lib -L/usr/X11R6/lib -lX11 -lXext --static" \
131 platform_java_sources="src/org/xwt/plat/POSIX.java src/org/xwt/plat/X11.java"
134 echo -e "\\n=== Win32 ========================================="
137 target=i686-pc-mingw32 \
139 platform_link="-Wl,--subsystem,windows -lcomdlg32" \
140 platform_java_sources=src/org/xwt/plat/Win32.java
142 Java2: $(jikes_java_objects) bin/org/xwt/builtin.xwar
143 echo -e "\\n=== Java2 ========================================="
144 echo "archiving .class -> .jar"
146 echo -e "Manifest-Version: 1.0\nMain-Class: org.xwt.Main\n" > bin/.manifest
147 cd bin; fastjar cvf ../bin-Java2/xwt.jar -m .manifest \
148 org/xwt/builtin.xwar \
149 `find . -name \*.class | grep -v org/xwt/plat/` \
150 org/xwt/plat/AWT*.class org/xwt/plat/Java2*.class | tr \\012 \\015
153 $(java2_objects:bin/%=%)
156 echo "PalmOS is not yet supported"
160 ## master.dist.xwt.org ############################################################################
162 current_build := $(shell cat next.build)
165 # this will fail if we haven't checked-in since the comment is null; we want this.
166 cvs commit -m '' > /dev/null
168 echo "***********************************************************"
169 echo "* This build is $(current_build)"
170 echo "***********************************************************"
172 ifeq ($(shell uname -n),gosset.megacz.com)
173 (make $(silent) dist-private 2>&1) >> .make-dist.out || \
174 (tail -n 200 .make-dist.out | mail -s "Build $(current_build) FAILED" cvs@xwt.org; false)
175 tail -n 200 .make-dist.out | \
176 mail -s "Unsigned binaries of $(current_build) are now available" cvs@xwt.org
178 ssh xwt@xwt.org verbose=$(verbose) /home/xwt/dist \
179 | grep -v "make...:.\(Entering\|Leaving\).directory"
184 make $(silent) update-build
186 # preserve gcc across builds so we don't have to remake it
187 mv gcc/Makefile Makefile.gcc
188 mkdir -p $(HOME)/dist.xwt.org-gcc
190 ln -s $(HOME)/dist.xwt.org-gcc gcc
191 mv Makefile.gcc gcc/Makefile
197 echo === master.dist.xwt.org ==================================
199 echo "copying xwt.jar to distribution area..."
200 cp bin-Java2/xwt.jar /var/www/master.dist.xwt.org/xwt-$(current_build).jar.unsigned
202 echo "stripping xwt.exe and copying it to the distribution area..."
203 $(strip) bin-Win32/xwt.exe -o /var/www/master.dist.xwt.org/xwt-$(current_build).exe.unsigned
205 echo "copying xwt.linux to distribution area..."
206 $(strip) bin-Linux/xwt.linux -o /var/www/master.dist.xwt.org/xwt-$(current_build).linux.unsigned
208 echo "creating source tarball in distribution area..."
209 CVSROOT=/cvs cvs export -r xwt-$(current_build) xwt
210 mv xwt xwt-$(current_build)
211 tar cvzf /var/www/master.dist.xwt.org/xwt-$(current_build).tgz xwt-$(current_build)
214 echo "*** DONE ******************************************"