5 ## Configurables ###########################################################################
7 jpeg_headers := jpeglib.h jconfig.h jmorecfg.h jerror.h jinclude.h jpegint.h jchuff.h jdhuff.h jdct.h jmemsys.h jversion.h
8 jpeg_c_sources := jdapimin.c jdapistd.c jcomapi.c jcparam.c jdmaster.c jdinput.c jdmainct.c jdcoefct.c jdpostct.c jdmarker.c
9 jpeg_c_sources += jdhuff.c jdphuff.c jddctmgr.c jidctint.c jidctfst.c jidctflt.c jidctred.c jdsample.c jdcolor.c jdmerge.c
10 jpeg_c_sources += jquant1.c jquant2.c jerror.c jutils.c jmemnobs.c jmemmgr.c
13 java_sources := $(shell find src -name \*.java)
14 gcj_java_sources := $(shell find src -name \*.java \! -path src/org/xwt/plat/\*) src/org/xwt/plat/GCJ.java $(platform_java_sources)
15 xwar_sources := $(shell ls src/org/xwt/builtin/*.png src/org/xwt/builtin/*.xwt src/org/xwt/builtin/*.xwf)
16 cc_sources := src/org/xwt/plat/$(platform).cc
17 c_sources := $(jpeg_c_sources:%.c=src/org/ijg/%.c)
20 java_classes := $(java_sources:src/%.java=bin/%.class)
21 java_objects := $(gcj_java_sources:src/%.java=bin-$(platform)/%.java.o)
22 cc_objects := $(cc_sources:src/%.cc=bin-$(platform)/%.cc.o)
23 c_objects := $(c_sources:src/%.c=bin-$(platform)/%.c.o)
26 gcc_path := $(shell pwd)/gcc
27 #gcc_optimizations := -O9 -ffast-math -fomit-frame-pointer -foptimize-sibling-calls -finline-functions -funroll-loops
28 gcc_optimizations := -O0
30 gcc_flags := $(gcc_optimizations) $(debug) -ffunction-sections -fdata-sections -Isrc/org/ijg
31 gcj_flags := -fCLASSPATH=bin
32 gcj := $(gcc_path)/bin/$(target)-gcj $(gcj_flags) $(gcc_flags)
33 gcc := $(gcc_path)/bin/$(target)-g++ $(gcc_flags)
34 gcjh := $(gcc_path)/bin/$(target)-gcjh
35 ar := $(gcc_path)/$(target)/bin/ar
36 strip := $(gcc_path)/$(target)/bin/strip
37 jar := $(shell ((type fastjar &>/dev/null) && echo fastjar) || echo jar)
40 all_platforms := Win32 Linux Java2
43 PATH := jikes-1.18/bin:$(PATH)
46 ## Platform-Neutral ###########################################################################
48 ifneq ($(verbose),true)
49 .SILENT: $(java_classes) .headers $(java_objects) $(all_platforms) bin/org/xwt/builtin.xwar .bootclasspath .javac
53 compile: $(java_classes) bin/org/xwt/builtin.xwar
59 type jikes && (jikes --version | grep "Version 1.18"); \
61 echo "public class GetBootClassPath { public static void main(String[] s) { " > GetBootClassPath.java; \
62 echo "System.out.println(System.getProperty(\"sun.boot.class.path\")); } }" >> GetBootClassPath.java; \
63 javac GetBootClassPath.java; \
64 java -cp . GetBootClassPath > .bootclasspath; \
65 rm GetBootClassPath.*; \
66 echo -n "jikes -nowarn -sourcepath src/ -bootclasspath " > .javac; \
67 cat .bootclasspath >> .javac; \
69 echo "WARNING: You do not have jikes; falling back to javac. Compiles will be very slow."; \
70 echo javac > .javac; \
74 curl ftp://www-126.ibm.com/pub/jikes/1.18/jikes-1.18.tar.bz2 | tar xjvf -
75 cd jikes-1.18; ./configure --prefix=`pwd` && make && make install
76 ln -sf jikes-1.18/bin/jikes .jikes
78 $(java_classes): $(java_sources) .javac
79 test "$(JAVA_HOME)"x != x || (echo "you forgot to set your JAVA_HOME environment variable"; false)
80 echo "compiling .java -> .class:"
82 $(shell cat .javac) -classpath lib/libgcj-minimal.jar $(java_sources) -d bin/
83 echo "compiling .java -> .class: done"
85 bin/org/xwt/builtin.xwar: $(xwar_sources)
87 cd src; $(jar) cf ../bin/org/xwt/builtin.xwar $(xwar_sources:src/%=%)
91 find . -name \*~ | xargs rm -f
92 find . -name \#\*\# | xargs rm -f
95 cvs tag -F xwt-$(current_build)
96 (echo -n 0000; (echo "10k16o16i"; cat next.build | tr a-z A-Z; echo "1+f") | dc) | tail --bytes=5 > next.build-
97 mv next.build- next.build
98 echo -n "Next build will be "
102 echo `date +%d-%b`" =========== build $(current_build) ================================================" >> CHANGES
104 cvs commit -m 'this comment should not appear in CHANGES' next.build CHANGES
108 @echo -n "Please type a one-line description of this bug: "; \
111 echo "Please type any additional comments that explain this patch."; \
112 echo "If this patch fixes a bug, include a link to bugs.xwt.org."; \
113 echo "When you are done, press control-d on a new line."; \
115 ( echo -e "HELO patcher"; \
116 echo -e "MAIL FROM:$(USER)@xwt.org"; \
117 echo -e "RCPT TO: patches@xwt.org"; \
119 echo -e "From: $(USER)@xwt.org"; \
120 echo -e "To: patches@xwt.org"; \
121 echo -e "Subject: proposed patch to $(this_branch): $$A"; \
128 bash -c "cat .message > /dev/tcp/mail.xwt.org/25" # /dev/tcp is faked by bash; not part of the os
130 ## GCJ-Derived Platforms #######################################################################
132 # if the user doesn't change gcc_path, and it's not built, then we'll try to build it
133 $(shell pwd)/gcc/bin/$(target)-gcj:
136 gcj: compile $(gcc_path)/bin/$(target)-gcj .headers link
138 link: $(java_objects) $(cc_objects) $(c_objects) bin-$(platform)/org/xwt/builtin.o
139 echo "linking .o -> $(target_bin)"
140 $(ar) r bin-$(platform)/org/xwt/plat/platform.ar bin-$(platform)/org/xwt/plat/*.o
141 $(gcj) --main=org.xwt.Main -o bin-$(platform)/$(target_bin) $^ $(platform_link) bin-$(platform)/org/xwt/plat/platform.ar
143 .headers: $(java_classes)
144 cd bin; for A in `find * -name \*.class`; do \
145 echo "extracting .class -> .h: $$A"; \
146 $(gcjh) --classpath . `echo $$A | sed s_/_._g | sed s/.class$$//`; \
148 echo "extracting .class -> .h: done"
151 # turn off optimization of Trap.java due to a compiler bug
152 bin-$(platform)/org/xwt/Trap.o: gcj_flags := -O0 -g
154 # unpack and patch the ijg library
155 src/org/ijg/jmorecfg.h: src/org/ijg/jpegsrc.v6b.tar.gz src/org/ijg/jmorecfg.h.patch
156 cd src/org/ijg/; tar xzf jpegsrc.v6b.tar.gz
157 cd src/org/ijg/jpeg-6b; ./configure --target=$(target)
158 cd src/org/ijg/jpeg-6b; mv $(jpeg_c_sources) $(jpeg_headers) ..
159 cd src/org/ijg; patch -p0 < jmorecfg.h.patch
160 rm -rf src/org/ijg/jpeg-6b
162 $(java_objects): bin-$(platform)/%.java.o: src/%.java $(java_classes)
163 @echo "compiling .java -> .o: $<"
164 @mkdir -p `dirname $@`
167 $(cc_objects): bin-$(platform)/%.cc.o: src/%.cc src/org/ijg/jmorecfg.h
168 @echo "compiling .cc -> .o: $<"
169 @mkdir -p `dirname $@`
170 $(gcc) -Ibin -c $< -o $@
172 $(c_objects): bin-$(platform)/%.c.o: src/%.c src/org/ijg/jmorecfg.h
173 @echo "compiling .c -> .o: $<"
174 @mkdir -p `dirname $@`
175 $(gcc) -Ibin -c $< -o $@
177 bin-$(platform)/org/xwt/builtin.o: bin/org/xwt/builtin.xwar
178 @echo "wrapping .xwar -> .o"
179 $(gcj) --resource org/xwt/builtin.xwar -c $< -o $@
183 ## Platforms ##############################################################################
186 echo -e "\\n=== Linux ========================================="
189 target=i686-pc-linux-gnu \
190 target_bin=xwt.linux \
191 platform_link="-L$(gcc-path)/lib -L/usr/X11R6/lib -lX11 -lXext --static" \
192 platform_java_sources="src/org/xwt/plat/POSIX.java src/org/xwt/plat/X11.java"
195 echo -e "\\n=== Win32 ========================================="
198 target=i686-pc-mingw32 \
200 platform_link="-Wl,--subsystem,windows -lcomdlg32" \
201 platform_java_sources=src/org/xwt/plat/Win32.java
203 Java2: $(java_classes) bin/org/xwt/builtin.xwar
204 echo -e "\\n=== Java2 ========================================="
205 echo "archiving .class -> .jar"
207 echo -e "Manifest-Version: 1.0\nMain-Class: org.xwt.Main\n" > bin/.manifest
208 cd bin; $(jar) cvfm ../bin-Java2/xwt.jar .manifest \
209 org/xwt/builtin.xwar \
210 `find . -name \*.class | grep -v org/xwt/plat/` \
211 org/xwt/plat/AWT*.class org/xwt/plat/Java2*.class | tr \\012 \\015
214 $(java2_objects:bin/%=%)
217 echo "PalmOS is not yet supported"
221 ## master.dist.xwt.org ############################################################################
223 current_build := $(shell cat next.build)
224 this_branch := $(shell tail -c +2 CVS/Tag 2>/dev/null || echo HEAD)
225 this_branch_flag := $(shell test $(this_branch) = HEAD && echo || echo -r $(this_branch))
228 # this will fail if we haven't checked-in since the comment is null; we want this.
229 cvs commit -m '' > /dev/null
230 cvs tag -F xwt-$(current_build)
232 echo "***********************************************************"
233 echo "* This build is $(current_build)"
234 echo "***********************************************************"
236 ifeq ($(shell uname -n),serverbeach.megacz.com)
237 (make $(silent) dist-private 2>&1) >> .make-dist.out || \
238 (tail -n 200 .make-dist.out | mail -s "Build $(current_build) FAILED" cvs@xwt.org; false)
239 tail -n 200 .make-dist.out | \
240 mail -s "Unsigned binaries of $(current_build) are now available" cvs@xwt.org
242 ssh xwt@xwt.org verbose=$(verbose) /home/xwt/dist $(this_branch_flag) \
243 | grep -v "make...:.\(Entering\|Leaving\).directory"
248 make $(silent) update-build
250 # preserve gcc across builds so we don't have to remake it
251 mv gcc/Makefile Makefile.gcc
252 mkdir -p $(HOME)/dist.xwt.org-gcc
254 ln -s $(HOME)/dist.xwt.org-gcc gcc
255 mv Makefile.gcc gcc/Makefile
261 echo === master.dist.xwt.org ==================================
263 echo "copying xwt.jar to distribution area..."
264 cp bin-Java2/xwt.jar /var/www/master.dist.xwt.org/xwt-$(current_build).jar.unsigned
266 echo "stripping xwt.exe and copying it to the distribution area..."
267 $(strip) bin-Win32/xwt.exe -o /var/www/master.dist.xwt.org/xwt-$(current_build).exe.unsigned
269 echo "copying xwt.linux to distribution area..."
270 $(strip) bin-Linux/xwt.linux -o /var/www/master.dist.xwt.org/xwt-$(current_build).linux.unsigned
272 echo "creating source tarball in distribution area..."
273 CVSROOT=/cvs cvs export -r xwt-$(current_build) xwt
274 mv xwt xwt-$(current_build)
275 tar cvzf /var/www/master.dist.xwt.org/xwt-$(current_build).tgz xwt-$(current_build)
278 echo "*** DONE ******************************************"