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: $(jikes_java_objects) .headers $(gcj_java_objects) $(all_platforms) bin/org/xwt/builtin.xwar
39 compile: $(jikes_java_objects) bin/org/xwt/builtin.xwar
43 $(jikes_java_objects): $(jikes_java_sources)
44 test "$(JAVA_HOME)"x != x || (echo "you forgot to set your $$JAVA_HOME environment variable"; false)
45 echo "compiling .java -> .class:"
47 $(jikes) -sourcepath src/ -classpath lib/libgcj-minimal.jar $(jikes_java_sources) -d bin/
48 echo "compiling .java -> .class: done"
50 bin/org/xwt/builtin.xwar: $(xwar_sources)
52 cd src; fastjar cf ../bin/org/xwt/builtin.xwar $(xwar_sources:src/%=%)
56 find . -name \*~ | xargs rm -f
57 find . -name \#\*\# | xargs rm -f
60 (echo -n 0000; (echo "10k16o16i"; cat next.build | tr a-z A-Z; echo "1+f") | dc) | tail --bytes=5 > next.build-
61 mv next.build- next.build
62 echo -n "Next build will be "
66 echo `date +%d-%b`" =========== build $(current_build) ================================================" >> CHANGES
68 cvs commit -m 'this comment should not appear in CHANGES' next.build CHANGES
72 ## GCJ-Derived Platforms #######################################################################
74 # if the user doesn't change gcc_path, and it's not built, then we'll try to build it
75 $(shell pwd)/gcc/bin/$(target)-gcj:
78 gcj: compile $(gcc_path)/bin/$(target)-gcj .headers link
80 link: $(gcj_java_objects) $(cc_objects)
81 echo "linking .o -> $(target_bin)"
82 $(ar) r bin-$(platform)/org/xwt/plat/platform.ar bin-$(platform)/org/xwt/plat/*.o
83 $(gcj) --main=org.xwt.Main -o bin-$(platform)/$(target_bin) $^ $(platform_link) bin-$(platform)/org/xwt/plat/platform.ar
85 .headers: $(jikes_java_objects)
86 cd bin; for A in `find * -name \*.class`; do \
87 echo "extracting .class -> .h: $$A"; \
88 $(gcjh) --classpath . `echo $$A | sed s_/_._g | sed s/.class$$//`; \
90 echo "extracting .class -> .h: done"
93 # turn off optimization of Trap.java due to a compiler bug
94 bin-$(platform)/org/xwt/Trap.o: gcj_flags := -O0 -g
96 $(gcj_java_objects): bin-$(platform)/%.o: src/%.java $(jikes_java_objects)
97 echo -ne "compiling .java -> .o: $<"
101 $(cc_objects): bin-$(platform)/%-nat.o: src/%.cc
102 echo -ne "compiling .cc -> .o: $$A"
103 $(gcc) -Ibin -c $< -o $@
105 bin-$(platform)/org/xwt/builtin.xwar: $(xwar_sources)
106 echo "archiving .xwt -> .xwar"
107 $(gcj) --resource org/xwt/builtin.xwar -c $< -o $@
111 ## Platforms ##############################################################################
114 echo -e "\\n=== Linux ========================================="
117 target=i686-pc-linux-gnu \
118 target_bin=xwt.linux \
119 platform_link="-L$(gcc-path)/lib -L/usr/X11R6/lib -lX11 -lXext --static" \
120 platform_java_sources="src/org/xwt/plat/POSIX.java src/org/xwt/plat/X11.java"
123 echo -e "\\n=== Win32 ========================================="
126 target=i686-pc-mingw32 \
128 platform_link="-Wl,--subsystem,windows -lcomdlg32" \
129 platform_java_sources=src/org/xwt/plat/Win32.java
131 Java2: $(jikes_java_objects) bin/org/xwt/builtin.xwar
132 echo -e "\\n=== Java2 ========================================="
133 echo "archiving .class -> .jar"
135 echo -e "Manifest-Version: 1.0\nMain-Class: org.xwt.Main\n" > bin/.manifest
136 cd bin; fastjar cvf ../bin-Java2/xwt.jar -m .manifest \
137 org/xwt/builtin.xwar \
138 `find . -name \*.class | grep -v org/xwt/plat/` \
139 org/xwt/plat/AWT*.class org/xwt/plat/Java2*.class | tr \\012 \\015
142 $(java2_objects:bin/%=%)
145 echo "PalmOS is not yet supported"
149 ## dist.xwt.org ############################################################################
151 current_build := $(shell cat next.build)
154 # this will fail if we haven't checked-in since the comment is null; we want this.
155 # cvs commit -m '' > /dev/null
157 echo "***********************************************************"
158 echo "* This build is $(current_build)"
159 echo "***********************************************************"
161 (test `uname -n` = gosset.megacz.com) || \
162 ssh xwt@xwt.org verbose=$(verbose) /home/xwt/dist \
163 | grep -v "make...:.\(Entering\|Leaving\).directory"
165 (test `uname -n` = gosset.megacz.com) && \
166 (((make $(silent) dist-private 2>&1) >> .make-dist.out) || \
167 (cat .make-dist.out | mail -s "Build $(current_build) FAILED" cvs@xwt.org; false))
169 (test `uname -n` = gosset.megacz.com) && \
170 (cat .make-dist.out | \
171 mail -s "Unsigned binaries of $(current_build) are now available" cvs@xwt.org < /dev/null)
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 "copying xwt.exe to distribution area..."
193 cp bin-Win32/xwt.exe /var/www/dist.xwt.org/xwt-$(current_build).exe.unsigned
195 echo "copying xwt.linux to distribution area..."
196 cp bin-Linux/xwt.linux /var/www/dist.xwt.org/xwt-$(current_build).linux.unsigned
199 echo "*** DONE ******************************************"