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 strip := $(gcc_path)/$(target)/bin/strip
27 jikes := jikes -extdirs ${JAVA_HOME}/jre/lib -nowarn
30 all_platforms := Win32 Linux Java2
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 (echo -n 0000; (echo "10k16o16i"; cat next.build | tr a-z A-Z; echo "1+f") | dc) | tail --bytes=5 > next.build-
62 mv next.build- next.build
63 echo -n "Next build will be "
67 echo `date +%d-%b`" =========== build $(current_build) ================================================" >> CHANGES
69 cvs commit -m 'this comment should not appear in CHANGES' next.build CHANGES
73 ## GCJ-Derived Platforms #######################################################################
75 # if the user doesn't change gcc_path, and it's not built, then we'll try to build it
76 $(shell pwd)/gcc/bin/$(target)-gcj:
79 gcj: compile $(gcc_path)/bin/$(target)-gcj .headers link
81 link: $(gcj_java_objects) $(cc_objects)
82 echo "linking .o -> $(target_bin)"
83 $(ar) r bin-$(platform)/org/xwt/plat/platform.ar bin-$(platform)/org/xwt/plat/*.o
84 $(gcj) --main=org.xwt.Main -o bin-$(platform)/$(target_bin) $^ $(platform_link) bin-$(platform)/org/xwt/plat/platform.ar
86 .headers: $(jikes_java_objects)
87 cd bin; for A in `find * -name \*.class`; do \
88 echo "extracting .class -> .h: $$A"; \
89 $(gcjh) --classpath . `echo $$A | sed s_/_._g | sed s/.class$$//`; \
91 echo "extracting .class -> .h: done"
94 # turn off optimization of Trap.java due to a compiler bug
95 bin-$(platform)/org/xwt/Trap.o: gcj_flags := -O0 -g
97 $(gcj_java_objects): bin-$(platform)/%.o: src/%.java $(jikes_java_objects)
98 echo -ne "compiling .java -> .o: $<"
102 $(cc_objects): bin-$(platform)/%-nat.o: src/%.cc
103 echo -ne "compiling .cc -> .o: $$A"
104 $(gcc) -Ibin -c $< -o $@
106 bin-$(platform)/org/xwt/builtin.xwar: $(xwar_sources)
107 echo "archiving .xwt -> .xwar"
108 $(gcj) --resource org/xwt/builtin.xwar -c $< -o $@
112 ## Platforms ##############################################################################
115 echo -e "\\n=== Linux ========================================="
118 target=i686-pc-linux-gnu \
119 target_bin=xwt.linux \
120 platform_link="-L$(gcc-path)/lib -L/usr/X11R6/lib -lX11 -lXext --static" \
121 platform_java_sources="src/org/xwt/plat/POSIX.java src/org/xwt/plat/X11.java"
124 echo -e "\\n=== Win32 ========================================="
127 target=i686-pc-mingw32 \
129 platform_link="-Wl,--subsystem,windows -lcomdlg32" \
130 platform_java_sources=src/org/xwt/plat/Win32.java
132 Java2: $(jikes_java_objects) bin/org/xwt/builtin.xwar
133 echo -e "\\n=== Java2 ========================================="
134 echo "archiving .class -> .jar"
136 echo -e "Manifest-Version: 1.0\nMain-Class: org.xwt.Main\n" > bin/.manifest
137 cd bin; fastjar cvf ../bin-Java2/xwt.jar -m .manifest \
138 org/xwt/builtin.xwar \
139 `find . -name \*.class | grep -v org/xwt/plat/` \
140 org/xwt/plat/AWT*.class org/xwt/plat/Java2*.class | tr \\012 \\015
143 $(java2_objects:bin/%=%)
146 echo "PalmOS is not yet supported"
150 ## dist.xwt.org ############################################################################
152 current_build := $(shell cat next.build)
155 # this will fail if we haven't checked-in since the comment is null; we want this.
156 # cvs commit -m '' > /dev/null
158 echo "***********************************************************"
159 echo "* This build is $(current_build)"
160 echo "***********************************************************"
162 ifeq ($(shell uname -n),gosset.megacz.com)
163 (make $(silent) dist-private 2>&1) >> .make-dist.out || \
164 (tail -n 200 .make-dist.out | mail -s "Build $(current_build) FAILED" cvs@xwt.org; false)
165 tail -n 200 .make-dist.out | \
166 mail -s "Unsigned binaries of $(current_build) are now available" cvs@xwt.org
168 ssh xwt@xwt.org verbose=$(verbose) /home/xwt/dist \
169 | grep -v "make...:.\(Entering\|Leaving\).directory"
174 make $(silent) update-build
176 # preserve gcc across builds so we don't have to remake it
177 mv gcc/Makefile Makefile.gcc
178 mkdir -p $(HOME)/dist.xwt.org-gcc
180 ln -s $(HOME)/dist.xwt.org-gcc gcc
181 mv Makefile.gcc gcc/Makefile
187 echo === dist.xwt.org ==================================
189 echo "copying xwt.jar to distribution area..."
190 cp bin-Java2/xwt.jar /var/www/dist.xwt.org/xwt-$(current_build).jar.unsigned
192 echo "stripping xwt.exe and copying it to the distribution area..."
193 $(strip) bin-Win32/xwt.exe -o /var/www/dist.xwt.org/xwt-$(current_build).exe.unsigned
195 echo "copying xwt.linux to distribution area..."
196 $(strip) bin-Linux/xwt.linux -o /var/www/dist.xwt.org/xwt-$(current_build).linux.unsigned
199 echo "*** DONE ******************************************"