5 ## Configurables ###########################################################################
8 jikes_java_sources := $(shell find src -name *.java)
9 gcj_java_sources := $(shell find src -name *.java -not -path src/org/xwt/plat/\*) src/org/xwt/plat/GCJ.java $(platform_java_sources)
10 xwar_sources := $(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/$(target)-gcjh
25 ar := $(gcc_path)/$(target)/bin/ar
26 jikes := jikes -extdirs ${JAVA_HOME}/jre/lib -nowarn
29 all_platforms := Win32 Linux Java2
32 ## Platform-Neutral ###########################################################################
34 ifneq ($(verbose),true)
35 .SILENT: dist update-build $(jikes_java_objects) .headers $(gcj_java_objects) $(all_platforms) PalmOS bin/org/xwt/builtin.xwar nohup-dist
39 compile: $(jikes_java_objects) bin/org/xwt/builtin.xwar
43 $(jikes_java_objects): $(jikes_java_sources)
44 echo -ne "compiling .java -> .class:\\r"
46 $(jikes) -sourcepath src/ -classpath lib/libgcj-minimal.jar $(jikes_java_sources) -d bin/
47 echo "compiling .java -> .class: done"
49 bin/org/xwt/builtin.xwar: $(xwar_sources)
51 cd src; fastjar cf ../bin/org/xwt/builtin.xwar $(xwar_sources:src/%=%)
55 find . -name \*~ | xargs rm -f
56 find . -name \#\*\# | xargs rm -f
59 (echo -n 0000; (echo "10k16o16i"; cat next.build | tr a-z A-Z; echo "1+f") | dc) | tail --bytes=5 > next.build-
60 mv next.build- next.build
61 echo -n "Next build will be "
64 echo `date +%d-%b`" =========== build $(current_build) ================================================" >> CHANGES
67 cvs commit -m 'this comment should not appear in CHANGES' next.build CHANGES
71 ## GCJ-Derived Platforms #######################################################################
73 # if the user doesn't change gcc_path, and it's not built, then we'll try to build it
74 $(shell pwd)/gcc/bin/$(target)-gcj:
77 gcj: compile $(gcc_path)/bin/$(target)-gcj .headers link
79 link: $(gcj_java_objects) $(cc_objects)
80 echo "linking .o -> $(target_bin)"
81 $(ar) r bin-$(platform)/org/xwt/plat/platform.ar bin-$(platform)/org/xwt/plat/*.o
82 $(gcj) --main=org.xwt.Main -o bin-$(platform)/$(target_bin) $^ $(platform_link) bin-$(platform)/org/xwt/plat/platform.ar
84 .headers: $(jikes_java_objects)
85 cd bin; for A in `find * -name \*.class`; do \
86 echo -ne "\033[K\\rextracting .class -> .h: $$A\\r"; \
87 $(gcjh) --classpath . `echo $$A | sed s_/_._g | sed s/.class$$//`; \
89 echo -e "\033[K\\rextracting .class -> .h: done"
92 # turn off optimization of Trap.java due to a compiler bug
93 bin-$(platform)/org/xwt/Trap.o: gcj_flags := -O0 -g
95 $(gcj_java_objects): bin-$(platform)/%.o: src/%.java $(jikes_java_objects)
96 echo -ne "\033[K\\rcompiling .java -> .o: $<\\r"
100 $(cc_objects): bin-$(platform)/%-nat.o: src/%.cc
101 echo -ne "\033[K\\rcompiling .cc -> .o: $$A\\r"
102 $(gcc) -Ibin -c $< -o $@
104 bin-$(platform)/org/xwt/builtin.xwar: $(xwar_sources)
105 echo "archiving .xwt -> .xwar"
106 $(gcj) --resource org/xwt/builtin.xwar -c $< -o $@
110 ## Platforms ##############################################################################
113 echo -e "\\n=== Linux ========================================="
116 target=i686-pc-linux-gnu \
117 target_bin=xwt.linux \
118 platform_link="-L$(gcc-path)/lib -L/usr/X11R6/lib -lX11 -lXext --static" \
119 platform_java_sources="src/org/xwt/plat/POSIX.java src/org/xwt/plat/X11.java"
122 echo -e "\\n=== Win32 ========================================="
125 target=i686-pc-mingw32 \
127 platform_link="-Wl,--subsystem,windows -lcomdlg32" \
128 platform_java_sources=src/org/xwt/plat/Win32.java
130 Java2: $(jikes_java_objects) bin/org/xwt/builtin.xwar
131 echo -e "\\n=== Java2 ========================================="
132 echo "archiving .class -> .jar"
134 echo -e "Manifest-Version: 1.0\nMain-Class: org.xwt.Main\n" > bin/.manifest
135 cd bin; fastjar cvf ../bin-Java2/xwt.jar -m .manifest \
136 org/xwt/builtin.xwar \
137 `find . -name \*.class | grep -v org/xwt/plat/` \
138 org/xwt/plat/AWT*.class org/xwt/plat/Java2*.class | tr \\012 \\015
141 $(java2_objects:bin/%=%)
144 echo "PalmOS is not yet supported"
148 ## dist.xwt.org ############################################################################
150 current_build := $(shell cat next.build)
155 nice -n 19 nohup make dist & \
156 tail -f .make-dist.out | grep -v "make...:.\(Entering\|Leaving\).directory"
159 test `uname -n` = gosset.megacz.com || \
160 (echo -e "um, dist is only intended for use on xwt.org...\nedit the Makefile if you really know what you're doing."; false)
161 echo "***********************************************************"
162 echo "* This build is $(current_build)"
163 echo "***********************************************************"
165 make $(silent) update-build
166 (make $(silent) dist-private &> .make-dist.out) || \
167 (cat .make-dist.out | mail -s "Build $(current_build) FAILED" cvs@xwt.org; false)
168 cat .make-dist.out | \
169 mail -s "Unsigned binaries of build $(current_build) are now available" cvs@xwt.org < /dev/null
172 # preserve gcc across builds so we don't have to remake it
173 mv gcc/Makefile Makefile.gcc
174 mkdir -p $(HOME)/dist.xwt.org-gcc
176 ln -s $(HOME)/dist.xwt.org-gcc gcc
177 mv Makefile.gcc gcc/Makefile
183 echo === dist.xwt.org ==================================
185 echo "copying xwt.jar to distribution area..."
186 cp bin-Java2/xwt.jar /var/www/dist.xwt.org/xwt-$(current_build).jar.unsigned
188 echo "copying xwt.exe to distribution area..."
189 cp bin-Win32/xwt.exe /var/www/dist.xwt.org/xwt-$(current_build).exe.unsigned
191 echo "copying xwt.linux to distribution area..."
192 cp bin-Linux/xwt.linux /var/www/dist.xwt.org/xwt-$(current_build).linux.unsigned
195 echo "*** DONE ******************************************"