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_pp_sources := $(shell find src -name \*.java.pp)
14 java_pp_postproc := $(java_pp_sources:src/%.java.pp=bin/%.java)
15 java_sources := $(shell find src -name \*.java)
16 java_headers := $(java_sources:src/%.java=bin/%.h) $(java_pp_postproc:bin/%.java=bin/%.h)
17 xwar_sources := $(shell ls src/org/xwt/builtin/*.png src/org/xwt/builtin/*.xwt src/org/xwt/builtin/*.xwf)
18 cc_sources := src/org/xwt/plat/$(platform).cc
19 c_sources := $(jpeg_c_sources:%.c=src/org/ijg/%.c)
22 freetype_base_sources := ftsystem.c ftmm.c ftbbox.c ftinit.c ftdebug.c ftbase.c ftglyph.c
23 freetype_other_sources := smooth/smooth.c autohint/autohint.c sfnt/sfnt.c truetype/truetype.c
24 freetype_sources := $(freetype_base_sources:%=gcc/src/freetype-2.1.4/src/base/%)
25 freetype_sources += $(freetype_other_sources:%=gcc/src/freetype-2.1.4/src/%)
28 java_objects := $(filter-out bin-$(platform)/org/xwt/plat/%, $(java_sources:src/%.java=bin-$(platform)/%.java.o))
29 java_objects += $(filter-out bin-$(platform)/org/xwt/plat/%, $(java_pp_postproc:bin/%.java=bin-$(platform)/%.java.o))
30 java_objects += bin-$(platform)/org/xwt/plat/GCJ.java.o
31 java_objects += $(platform_java_sources:%=bin-$(platform)/org/xwt/plat/%.java.o)
32 cc_objects := $(cc_sources:src/%.cc=bin-$(platform)/%.cc.o)
33 c_objects := $(c_sources:src/%.c=bin-$(platform)/%.c.o)
36 gcc_path := $(shell pwd)/gcc/install
37 #gcc_optimizations := -O9 -ffast-math -fomit-frame-pointer -foptimize-sibling-calls -finline-functions
38 #gcc_optimzations += -funroll-loops -ffunction-sections -fdata-sections
39 gcc_optimizations := -O2
41 gcc_flags := $(gcc_optimizations) $(debug) -Isrc/org/ijg
42 gcj_flags := -fCLASSPATH=src
43 gcj := $(gcc_path)/bin/$(target)-gcj $(gcj_flags) $(gcc_flags)
44 g++ := $(gcc_path)/bin/$(target)-g++ $(gcc_flags)
45 gcc := $(gcc_path)/bin/$(target)-gcc $(gcc_flags)
46 gcjh := $(gcc_path)/bin/$(target)-gcjh
48 as := $(gcc_path)/$(target)/bin/as
49 ar := $(gcc_path)/$(target)/bin/ar
50 ranlib := $(gcc_path)/$(target)/bin/ranlib
51 strip := $(gcc_path)/$(target)/bin/strip
52 jar := $(shell ((type fastjar &>/dev/null) && echo fastjar) || echo jar)
55 PATH := jikes-1.18/bin:$(PATH)
58 PATH := jikes-1.18/bin:$(PATH)
61 ## Platform-Neutral ###########################################################################
63 ifneq ($(verbose),true)
64 .SILENT: $(cc_objects) $(java_objects) $(java_headers) all bin/org/xwt/builtin.xwar $(target_bin) compile
68 compile: .javac $(java_pp_postproc) bin/org/xwt/builtin.xwar
69 echo "compiling .java -> .class:"
71 $(shell cat .javac) -classpath lib/libgcj-minimal.jar $(java_sources) $(java_pp_postproc) -d bin/ 2>&1 | \
72 grep -v ^\\[read | sed s_^\\[write\ bin/__ | sed s_.class\\]_.java_ | sed "s_^_compiling .java -> .class: src/_"
74 bin/org/xwt/util/Preprocessor.class: .javac
75 echo "compiling preprocessor"
77 $(shell cat .javac) -classpath lib/libgcj-minimal.jar src/org/xwt/util/Preprocessor.java -d bin/ 2>&1 | \
78 grep -v ^\\[read | sed s_^\\[write\ bin/__ | sed s_.class\\]_.java_ | sed "s_^_compiling .java -> .class: src/_"
80 $(java_pp_postproc): bin/%.java: src/%.java.pp bin/org/xwt/util/Preprocessor.class
81 @echo "preprocessing .java.pp -> .java: $<"
82 @mkdir -p `dirname $@`
83 @java -cp bin org.xwt.util.Preprocessor < $< > $@
86 all: Win32 Linux Java2 #Solaris
90 type jikes && (jikes --version | grep "Version 1.18"); \
92 echo "public class GetBootClassPath { public static void main(String[] s) { " > GetBootClassPath.java; \
93 echo "System.out.println(System.getProperty(\"sun.boot.class.path\")); } }" >> GetBootClassPath.java; \
94 javac GetBootClassPath.java; \
95 java -cp . GetBootClassPath > .bootclasspath; \
96 rm GetBootClassPath.*; \
97 echo -n "jikes -nowarn -sourcepath src/ -bootclasspath " > .javac; \
98 cat .bootclasspath >> .javac; \
100 echo "WARNING: You do not have jikes; falling back to javac. Compiles will be very slow."; \
101 echo javac > .javac; \
105 curl ftp://www-126.ibm.com/pub/jikes/1.18/jikes-1.18.tar.bz2 | tar xjvf -
106 cd jikes-1.18; ./configure --prefix=`pwd` && make && make install
107 ln -sf jikes-1.18/bin/jikes .jikes
109 bin/org/xwt/builtin.xwar: $(xwar_sources)
111 cd src; $(jar) cf ../bin/org/xwt/builtin.xwar $(xwar_sources:src/%=%)
115 find . -name \*~ | xargs rm -f
116 find . -name \#\*\# | xargs rm -f
119 cvs tag -F xwt-$(current_build)
120 (echo -n 0000; (echo "10k16o16i"; cat next.build | tr a-z A-Z; echo "1+f") | dc) | tail --bytes=5 > next.build-
121 mv next.build- next.build
122 echo -n "Next build will be "
126 echo `date +%d-%b`" =========== build $(current_build) ================================================" >> CHANGES
128 cvs commit -m 'this comment should not appear in CHANGES' next.build CHANGES
132 @echo -n "Please type a one-line description of this bug: "; \
135 echo "Please type any additional comments that explain this patch."; \
136 echo "If this patch fixes a bug, include a link to bugs.xwt.org."; \
137 echo "When you are done, press control-d on a new line."; \
139 ( echo -e "HELO patcher"; \
140 echo -e "MAIL FROM:$(USER)@xwt.org"; \
141 echo -e "RCPT TO: patches@xwt.org"; \
143 echo -e "From: $(USER)@xwt.org"; \
144 echo -e "To: patches@xwt.org"; \
145 echo -e "Subject: proposed patch to $(this_branch): $$A"; \
152 bash -c "cat .message > /dev/tcp/mail.xwt.org/25" # /dev/tcp is faked by bash; not part of the os
154 ## GCJ-Derived Platforms #######################################################################
156 # if the user doesn't change gcc_path, and it's not built, then we'll try to build it
157 $(shell pwd)/gcc/install/bin/$(target)-gcj: .upstream
162 curl http://umn.dl.sourceforge.net/sourceforge/freetype/freetype-2.1.4.tar.gz | tar xvzf - -C gcc/src
163 cd gcc/src; patch -p0 < freetype.patch
164 touch gcc/src/.freetype
166 freetype.mips: gcc/src/.freetype
167 make -C gcc mips target=mips
168 $(gcc_path)/bin/mips-gcc \
172 -I gcc/src/freetype-2.1.4/include \
173 $(freetype_sources) \
175 src/org/xwt/imp/Freetype.c \
176 $(gcc_path)/mips/lib/libc.a \
177 -Wl,-T,$(gcc_path)/mips/lib/nullmon.ld
179 # compile is here to force compilation of the .class files (they get used via -Ibin/) without
180 # having the individual .o's depend on the .java's (otherwise every .o gets recompiled when one .java changes)
181 gcj: $(gcc_path)/bin/$(target)-gcj compile $(target_bin)
183 $(target_bin): $(java_objects) $(cc_objects) $(c_objects) bin-$(platform)/org/xwt/builtin.o
184 @echo "linking .o -> $(target_bin)"
185 $(gcj) --main=org.xwt.Main -o bin-$(platform)/$(target_bin) $^ $(platform_link)
187 bin-$(platform)/org/xwt/builtin.o: bin/org/xwt/builtin.xwar
188 @echo "wrapping .xwar -> .o: bin/org/xwt/builtin.o"
189 @(echo "unsigned int builtin_xwar_length = ";\
190 (wc -c bin/org/xwt/builtin.xwar | sed "s_bin.*__");\
192 echo "unsigned char builtin_xwar[] = {";\
193 hexdump -ve '"0x" 1/1 "%x,\n"' bin/org/xwt/builtin.xwar;\
194 echo "};") > .builtin.c
195 $(gcc) -c .builtin.c -o bin-$(platform)/org/xwt/builtin.o
197 $(java_headers): bin/%.h: bin/%.class
198 @echo "extracting .class -> .h: $<"
199 cd bin; find `echo $< | sed s/.class$$// | sed s_^bin/__ `*.class |\
200 sed s_/_._g | sed s/.class$$// | sed s/.java$$// |\
201 xargs $(gcjh) --classpath .
203 $(java_objects): bin-$(platform)/%.java.o: src/%.java
204 @echo "compiling .java -> .o: $<"
205 mkdir -p `dirname $@`
208 # unpack and patch the ijg library
209 src/org/ijg/jmorecfg.h: src/org/ijg/jpegsrc.v6b.tar.gz src/org/ijg/jmorecfg.h.patch
210 cd src/org/ijg/; tar xzf jpegsrc.v6b.tar.gz
211 cd src/org/ijg/jpeg-6b; ./configure --target=$(target)
212 cd src/org/ijg/jpeg-6b; mv $(jpeg_c_sources) $(jpeg_headers) ..
213 cd src/org/ijg; patch -l -p0 < jmorecfg.h.patch
214 rm -rf src/org/ijg/jpeg-6b
216 $(cc_objects): bin-$(platform)/%.cc.o: src/%.cc $(java_headers) src/org/ijg/jmorecfg.h
217 @echo "compiling .cc -> .o: $<"
218 @mkdir -p `dirname $@`
219 $(g++) -I/usr/X11R6/include/ -I$(gcc_path)/include -Ibin -Iupstream/$(platform)/include -Wno-multichar -c $< -o $@
221 $(c_objects): bin-$(platform)/%.c.o: src/%.c src/org/ijg/jmorecfg.h
222 @echo "compiling .c -> .o: $<"
223 @mkdir -p `dirname $@`
224 $(gcc) -Ibin -c $< -o $@
227 mkdir -p gcc/install; curl http://www.megacz.com/upstream.tgz | tar xvzhf - -C gcc/install
231 ## Platforms ##############################################################################
234 echo -e "\\n=== Linux ========================================="
237 target=i686-pc-linux-gnu \
238 target_bin=xwt.linux \
239 platform_link="-L$(gcc_path)/lib -L/usr/X11R6/lib -lX11 -lXext --static" \
240 platform_java_sources="POSIX X11"
243 echo -e "\\n=== Solaris ========================================="
246 target=sparc-sun-solaris2.7 \
247 target_bin=xwt.solaris \
248 platform_link="-L$(gcc_path)/lib -lX11 -lXext" \
249 platform_java_sources="POSIX X11"
252 echo -e "\\n=== Win32 ========================================="
255 target=i686-pc-mingw32 \
257 platform_link="-Wl,--subsystem,windows -lcomdlg32" \
258 platform_java_sources="Win32"
261 echo -e "\\n=== Darwin ========================================="
262 ranlib upstream/Darwin/lib/*.a
263 ar x /usr/lib/libcc_dynamic.a upstream/Darwin/lib/darwin-fpsave.o
266 target=powerpc-apple-darwin \
267 target_bin=xwt.darwin \
268 platform_link="upstream/Darwin/lib/*.[oa] $(gcc_path)/lib/libgcj.a" \
269 platform_java_sources="POSIX X11"
272 echo -e "\\n=== Carbon ========================================="
275 target=powerpc-apple-darwin \
276 target_bin=xwt.carbon \
277 platform_link="$(gcc_path)/lib/libgcj.a -Xlinker -framework -Xlinker Carbon" \
278 platform_java_sources="POSIX Carbon"
280 Java2: compile bin/org/xwt/builtin.xwar
281 echo -e "\\n=== Java2 ========================================="
282 echo "archiving .class -> .jar"
284 echo -e "Manifest-Version: 1.0\nMain-Class: org.xwt.Main\n" > bin/.manifest
285 cd bin; $(jar) cvfm ../bin-Java2/xwt.jar .manifest \
286 org/xwt/builtin.xwar \
287 `find . -name \*.class | grep -v org/xwt/plat/` \
288 org/xwt/plat/AWT*.class org/xwt/plat/Java2*.class | tr \\012 \\015
292 echo "PalmOS is not yet supported"
296 ## master.dist.xwt.org ############################################################################
298 current_build := $(shell cat next.build)
299 this_branch := $(shell tail -c +2 CVS/Tag 2>/dev/null || echo HEAD)
300 this_branch_flag := $(shell test $(this_branch) = HEAD && echo || echo -r $(this_branch))
302 # pre-depend on compile as a sanity check
304 # this will fail if we haven't checked-in since the comment is null; we want this.
305 cvs commit -m '' > /dev/null
306 cvs tag -F xwt-$(current_build)
308 echo "***********************************************************"
309 echo "* This build is $(current_build)"
310 echo "***********************************************************"
312 ifeq ($(shell uname -n),serverbeach.megacz.com)
313 (make $(silent) dist-private 2>&1) >> .make-dist.out || \
314 (tail -n 200 .make-dist.out | mail -s "Build $(current_build) FAILED" cvs@xwt.org; false)
315 tail -n 200 .make-dist.out | \
316 mail -s "Unsigned binaries of $(current_build) are now available" cvs@xwt.org
318 echo -e 'export JAVA_HOME=/usr/lib/j2sdk1.4\n cd /home/xwt\n date=`date +%d-%b-%H%M`\n mkdir xwt-$$date\n cd xwt-$$date\n /usr/bin/cvs -d /cvs co $(this_branch_flag) xwt\n mv xwt/* .\n mv xwt/.* .\n rmdir xwt\n touch .make-dist.out\n nohup make dist &> /dev/null &\n echo\n cat .make-dist.out' | ssh xwt@xwt.org | grep -v "make...:.\(Entering\|Leaving\).directory"
323 make $(silent) update-build
325 # preserve gcc across builds so we don't have to remake it
326 mkdir -p $(HOME)/dist.xwt.org-gcc
328 ln -s $(HOME)/dist.xwt.org-gcc gcc
329 mv -f gcc-/Makefile gcc/
330 mv -f gcc-/*.patch gcc/
336 echo === master.dist.xwt.org ==================================
338 echo "copying xwt.jar to distribution area..."
339 cp bin-Java2/xwt.jar /var/www/master.dist.xwt.org/xwt-$(current_build).jar.unsigned
341 echo "stripping xwt.exe and copying it to the distribution area..."
342 $(strip) bin-Win32/xwt.exe -o /var/www/master.dist.xwt.org/xwt-$(current_build).exe.unsigned
344 echo "copying xwt.linux to distribution area..."
345 $(strip) bin-Linux/xwt.linux -o /var/www/master.dist.xwt.org/xwt-$(current_build).linux.unsigned
347 echo "creating source tarball in distribution area..."
348 CVSROOT=/cvs cvs export -r xwt-$(current_build) xwt
349 mv xwt xwt-$(current_build)
350 tar cvzf /var/www/master.dist.xwt.org/xwt-$(current_build).tgz xwt-$(current_build)
353 echo "*** DONE ******************************************"