1 #############################################################################
6 all: JVM Darwin Linux Win32 Solaris
9 Linux: ; make gcj platform=Linux target=i686-pc-linux-gnu link_flags="-lX11 -lXext --static"
10 Solaris: ; make gcj platform=Solaris target=sparc-sun-solaris2.7 link_flags="-lX11 -lXext"
11 Win32: ; make gcj platform=Win32 target=i686-pc-mingw32 link_flags="-Wl,--subsystem,windows -lcomdlg32" target_bin=xwt.exe
12 Darwin: ; make gcj platform=Darwin target=powerpc-apple-darwin link_flags="-lSystem -lmathCommon.A -Wl,-framework,Carbon,-framework,OpenGL,-framework,AGL,-framework,SystemConfiguration,-dylib_file,/usr/lib/libz.1.1.3.dylib:upstream/install/powerpc-apple-darwin/lib/libz.1.1.3.dylib,-dylib_file,/usr/lib/libcups.2.dylib:upstream/install/powerpc-apple-darwin/lib/libcups.2.dylib,-dylib_file,/usr/lib/libssl.0.9.dylib:upstream/install/powerpc-apple-darwin/lib/libssl.0.9.dylib,-dylib_file,/usr/lib/libcrypto.0.9.dylib:upstream/install/powerpc-apple-darwin/lib/libcrypto.0.9.dylib,-flat_namespace"
15 #############################################################################
18 target_bin := xwt.$(shell echo $(platform) | tr A-Z a-z)
19 jikes_flags := -nowarn -sourcepath src/
20 gcc_optimizations := -O2
21 #gcc_optimizations := -O9 -ffast-math -fomit-frame-pointer -foptimize-sibling-calls
22 #gcc_optimizations += -finline-functions -funroll-loops -ffunction-sections -fdata-sections
23 gcc_flags := -nostdinc $(gcc_optimizations) -Ibuild/h -Iupstream/jpeg-6b/src/ -Iupstream/jpeg-6b/build-$(target)/
24 gcj_flags := -fCLASSPATH=build/java
25 gcj := upstream/install/bin/$(target)-gcj $(gcc_flags) $(gcj_flags)
26 g++ := upstream/install/bin/$(target)-gcj $(gcc_flags)
27 gcc := upstream/install/bin/$(target)-gcc $(gcc_flags)
28 jar := $(shell ((type fastjar &>/dev/null) && echo fastjar) || echo jar)
30 include Makefile.upstream
32 # figure out what stuff in org.xwt.plat.* this platform requires (its superclasses)
33 superclass_org.xwt.plat.Platform:; echo org.xwt.plat.OpenGL
36 @make -s superclass_org.xwt.plat.$(shell grep extends src/`echo $* | sed s_\\\\._/_g`.java | head -n 1 | sed s_.\*extends\ __ | sed s_\ .\*__)
38 plat_deps := $(shell test "$(platform)" = "" || make -s superclass_org.xwt.plat.$(platform) platform= )
39 java_sources := $(patsubst org.xwt.plat.%, build/java/org/xwt/plat/%.java, $(plat_deps))
40 java_sources += $(patsubst src/%.java.pp, build/java/%.java, $(shell find src -name \*.java.pp))
41 java_sources += build/java/org/xwt/Builtin.java
42 java_sources += $(patsubst src/%.java, build/java/%.java, $(shell find src -name '*.java' \! -path 'src/org/xwt/plat/*'))
44 build/java/%.java: src/%.java ; @echo linking $@; mkdir -p $(@D); ln -s `echo $(@D) | sed 's_[^/]*\(/\|$$\)_../_g'`/$< $@
45 build/cc/%.cc: src/%.c ; @echo linking $@; mkdir -p $(@D); ln -s `echo $(@D) | sed 's_[^/]*\(/\|$$\)_../_g'`/$< $@
46 build/c/jpeg/%.c: upstream/jpeg-6b/src/%.c
47 @echo linking $@; mkdir -p $(@D); ln -s `echo $(@D) | sed 's_[^/]*\(/\|$$\)_../_g'`/$< $@
49 build/java/%.java: src/%.java.pp
50 @make -s build/class/org/xwt/util/Preprocessor.class
51 @echo -e "\n\033[1mpreprocessing .java.pp -> .java: $<\033[0m"
54 java -cp build/class org.xwt.util.Preprocessor < $< > $@
56 build/class/%.class: build/java/%.java .jikes
57 @echo -e "\n\033[1mcompiling .java -> .class: $<\033[0m"
62 .compile: $(java_sources)
63 @echo -e "\n\033[1mcompiling .java -> .class: src/**/*.java\033[0m"
65 @./.jikes $(java_sources)
68 # PHASE 4: gcj-generated headers
69 java_headers := $(java_sources:build/java/%.java=build/h/%.h)
70 build/h/%.h: build/class/%.class .compile
71 @echo -e "\n\033[1mextracting .class -> .h: $<\033[0m"
73 ls `echo $< | sed s/.class\$$//`*.class |\
74 sed s_build/class/__ | sed s/.class\$$//g | sed s_/_._g | (cd build/class; xargs ../../upstream/install/bin/$(target)-gcjh -d ../h --classpath .)
76 # a hack since we've disabled gcj's awt implementation
77 build/$(platform)/org/xwt/plat/Java2.java.o:
78 touch .empty.c; mkdir -p $(@D); $(gcc) -c .empty.c -o $@;
79 build/$(platform)/org/xwt/plat/AWT.java.o:
80 touch .empty.c; mkdir -p $(@D); $(gcc) -c .empty.c -o $@;
82 build/$(platform)/%.java.o: build/java/%.java
83 @echo -e "\n\033[1mcompiling .java -> .o: $<\033[0m"
87 build/$(platform)/org/xwt/plat/$(platform).cc.o: src/org/xwt/plat/$(platform).cc src/org/xwt/plat/*.cc $(java_headers) .configure_jpeg-6b_$(target)
88 @echo -e "\n\033[1mcompiling .cc -> .o: $<\033[0m"
90 $(g++) -Iupstream/install/lib/gcc-lib/$(target)/3.3/include/ -Iupstream/install/$(target)/include -I/usr/X11R6/include/ -Ibuild/h -Wno-multichar -Iupstream/install/include -c $< -o $@
92 build/$(platform)/jpeg-6b/%.c.o: upstream/jpeg-6b/src/%.c
93 @echo -e "\n\033[1mcompiling .c -> .o: $<\033[0m"
95 $(gcc) -Ibuild/h -c $< -o $@
98 jpeg_sources := jdapimin.c jdapistd.c jcomapi.c jcparam.c jdmaster.c jdinput.c jdmainct.c jdcoefct.c jdpostct.c jdmarker.c
99 jpeg_sources += jdhuff.c jdphuff.c jddctmgr.c jidctint.c jidctfst.c jidctflt.c jidctred.c jdsample.c jdcolor.c jdmerge.c
100 jpeg_sources += jquant1.c jquant2.c jerror.c jutils.c jmemnobs.c jmemmgr.c
102 upstream/jpeg-6b/build-$(target)/libjpeg.a: .install_jpeg-6b_$(target)
103 $(target_bin): upstream/jpeg-6b/build-$(target)/libjpeg.a $(java_sources:build/java/%.java=build/$(platform)/%.java.o) build/$(platform)/org/xwt/plat/$(platform).cc.o
104 @echo -e "\n\033[1mlinking .o -> $(target_bin)\033[0m"
105 mkdir -p build/$(platform)
106 PATH=upstream/install/bin:$$PATH $(gcj) --main=org.xwt.Main -o build/$(platform)/$(target_bin) $^ $(jpeg_sources:%.c=upstream/jpeg-6b/build-$(target)/%.o) -Lupstream/install/$(target)/lib $(link_flags)
109 ##############################################################################
113 build/java/org/xwt/Builtin.java: $(shell ls src/org/xwt/builtin/*.png src/org/xwt/builtin/*.xwt src/org/xwt/builtin/*.xwf)
114 @mkdir -p `dirname $@` build build/java build/class build/h build
115 echo -e "\n\033[1mzipping/uuencoding .xwt -> .java: build/java/org/xwt/Builtin.java\033[0m"
116 echo "package org.xwt;" > build/java/org/xwt/Builtin.java
117 echo "class Builtin {" >> build/java/org/xwt/Builtin.java
118 echo "public static String encoded = " >> build/java/org/xwt/Builtin.java
119 cd src; $(jar) cf - $(<:src/%=%) | \
120 uuencode foo | tail -n +2 | grep -v '^end$$' | grep -v '^`$$' | \
121 sed 's_\(.+\)_"\1" +_' >> ../build/java/org/xwt/Builtin.java
122 echo "\"\"; }" >> build/java/org/xwt/Builtin.java
125 # compile is here to force compilation of the .class files (they get used via -Ibuild) without
126 # having the individual .o's depend on the .java's (otherwise every .o gets recompiled when one .java changes)
127 gcj: .compile .vendor .install_gcc-3.3_$(target) $(target_bin)
128 build/JVM/xwt.jar: .compile
129 @echo -e "\n\033[1marchiving .class -> .jar: build/JVM/xwt.jar\033[0m"
131 echo -e "Manifest-Version: 1.0\nMain-Class: org.xwt.Main\n" > build/JVM/.manifest
132 cd build/class; $(jar) cfm ../JVM/xwt.jar ../JVM/.manifest `find . -name \*.class`;
136 ##############################################################################
140 build/mips/%.c.o: src/%.c
141 make .install_freetype-2.1.4_mips-unknown-elf target=mips-unknown-elf
143 echo -e "\n\033[1mcompiling $< -> $@ (mips)\033[0m"
144 upstream/install/bin/mips-unknown-elf-gcc -march=r3000 -I upstream/freetype-2.1.4/src/include -c -o $@ $<
146 build/mips/freetype.mips: build/mips/org/xwt/imp/Freetype.c.o build/mips/org/xwt/imp/crt0.c.o build/mips/org/xwt/imp/syscalls.c.o
147 make .install_freetype-2.1.4_mips-unknown-elf target=mips-unknown-elf
148 @echo -e "\n\033[1mlinking .o -> .mips: $@\033[0m"
150 upstream/install/bin/mips-unknown-elf-gcc \
154 -T src/org/xwt/imp/linker.ld \
156 -Lupstream/freetype-2.1.4/src/objs \
158 build/mips/org/xwt/imp/Freetype.c.o \
162 build/java/org/xwt/imp/Freetype.java: build/mips/freetype.mips build/class/org/xwt/imp/MIPS.class
163 @echo -e "\n\033[1mtranslating .mips -> .java: $@\033[0m"
164 mkdir -p build/java/org/xwt/imp/
166 java -cp build/class org.xwt.imp.MIPS org.xwt.imp.Freetype build/mips/freetype.mips > build/java/org/xwt/imp/Freetype.java
170 ##############################################################################
171 # Maintainer stuff: generating numbered builds, proposing patches
175 cvs tag -F xwt-$(current_build)
176 (echo -n 0000; (echo "10k16o16i"; cat next.build | tr a-z A-Z; echo "1+f") | dc) | tail --bytes=5 > next.build-
177 mv next.build- next.build
178 echo -n "Next build will be "
182 echo `date +%d-%b`" =========== build $(current_build) ================================================" >> CHANGES
184 cvs commit -m 'this comment should not appear in CHANGES' next.build CHANGES
188 @echo -n "Please type a one-line description of this bug: "; \
191 echo "Please type any additional comments that explain this patch."; \
192 echo "If this patch fixes a bug, include a link to bugs.xwt.org."; \
193 echo "When you are done, press control-d on a new line."; \
195 ( echo -e "HELO patcher"; \
196 echo -e "MAIL FROM:$(USER)@xwt.org"; \
197 echo -e "RCPT TO: patches@xwt.org"; \
199 echo -e "From: $(USER)@xwt.org"; \
200 echo -e "To: patches@xwt.org"; \
201 echo -e "Subject: proposed patch to $(this_branch): $$A"; \
208 bash -c "cat .message > /dev/tcp/mail.xwt.org/25" # /dev/tcp is faked by bash; not part of the os
210 current_build := $(shell cat next.build)
211 this_branch := $(shell tail -c +2 CVS/Tag 2>/dev/null || echo HEAD)
212 this_branch_flag := $(shell test $(this_branch) = HEAD && echo || echo -r $(this_branch))
214 # pre-depend on compile as a sanity check
216 # this will fail if we haven't checked-in since the comment is null; we want this.
217 cvs commit -m '' > /dev/null
218 cvs tag -F xwt-$(current_build)
220 echo "***********************************************************"
221 echo "* This build is $(current_build)"
222 echo "***********************************************************"
224 ifeq ($(shell uname -n),serverbeach.megacz.com)
225 (make $(silent) dist-private 2>&1) >> .make-dist.out || \
226 (tail -n 200 .make-dist.out | mail -s "Build $(current_build) FAILED" cvs@xwt.org; false)
227 tail -n 200 .make-dist.out | \
228 mail -s "Unsigned binaries of $(current_build) are now available" cvs@xwt.org
230 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"
234 make $(silent) update-build
236 # preserve gcc across builds so we don't have to remake it
237 mkdir -p $(HOME)/dist.xwt.org-gcc
239 ln -s $(HOME)/dist.xwt.org-gcc gcc
240 mv -f gcc-/Makefile gcc/
241 mv -f gcc-/*.patch gcc/
247 echo === master.dist.xwt.org ==================================
249 echo "copying xwt.jar to distribution area..."
250 cp xwt.jar /var/www/master.dist.xwt.org/xwt-$(current_build).jar.unsigned
252 echo "stripping xwt.exe and copying it to the distribution area..."
253 $(strip) build/Win32/xwt.exe -o /var/www/master.dist.xwt.org/xwt-$(current_build).exe.unsigned
255 echo "copying xwt.linux to distribution area..."
256 $(strip) build/Linux/xwt.linux -o /var/www/master.dist.xwt.org/xwt-$(current_build).linux.unsigned
258 echo "creating source tarball in distribution area..."
259 CVSROOT=/cvs cvs export -r xwt-$(current_build) xwt
260 mv xwt xwt-$(current_build)
261 tar cvzf /var/www/master.dist.xwt.org/xwt-$(current_build).tgz xwt-$(current_build)
264 echo "*** DONE ******************************************"