2b7f19371958cbb9ce348a9b98dc6585095057ef
[org.ibex.core.git] / Makefile
1 ############################################################################# 
2 #
3 # The Ibex Makefile
4 #
5
6 #  auto directory creation with %/%: %?
7
8 ifeq ($(platform),)
9 # default
10 platform := Java2
11 endif
12
13 target_Darwin := powerpc-apple-darwin
14 target_Win32  := i686-pc-mingw32
15 target_Solaris := sparc-sun-solaris2.7
16 target_Linux := i686-pc-linux-gnu
17 target := $(target_$(platform))
18
19 all:         Java2 Linux Win32 Darwin Solaris
20
21 clean:      ; rm -rf build; rm .preprocessor
22 dist-clean:
23         rm -rf .configure* .install* build .compile .build*
24         find upstream -name config.cache -exec rm {} \;
25         test -e upstream/nestedvm && make -C upstream/nestedvm clean
26         rm .install_nestedvm
27
28 libwing_Linux := -Lupstream/install/i686-pc-linux-gnu/lib/
29 libwing_Linux +=   upstream/install/i686-pc-linux-gnu/lib/libWINGs.a
30 libwing_Linux +=   upstream/install/i686-pc-linux-gnu/lib/libwraster.a
31
32 libwing_Solaris := -Lupstream/install/sparc-sun-solaris2.7/lib/
33 libwing_Solaris +=   upstream/install/sparc-sun-solaris2.7/lib/libWINGs.a
34 libwing_Solaris +=   upstream/install/sparc-sun-solaris2.7/lib/libwraster.a
35
36 Java2:        build/Java2/ibex.jar
37 JVM:; make Java2
38 Linux:    ; make gcj platform=Linux   link_flags="$(libwing_Linux) -lXpm -lX11 -lXext"
39 Solaris:  ; make gcj platform=Solaris link_flags="$(libwing_Solaris) -lXpm -lX11 -lXext -lpthread"
40 Win32:    ; make gcj platform=Win32   link_flags="-Wl,--subsystem,windows -lcomdlg32"
41 Darwin:   ; make gcj platform=Darwin  link_flags="$(darwin_linker_flags)"
42
43 darwin_libdir       := upstream/install/powerpc-apple-darwin/lib
44 darwin_linker_flags := -Wl,-dylib_file,/usr/lib/libSystem.B.dylib:$(darwin_libdir)/libSystem.B.dylib
45 darwin_linker_flags += -Wl,-dylib_file,/usr/lib/system/libmathCommon.A.dylib:$(darwin_libdir)/libmathCommon.A.dylib
46 darwin_ogl_libdir   := /System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries
47 darwin_linker_flags += -Wl,-dylib_file,$(darwin_ogl_libdir)/libGL.dylib:$(darwin_libdir)/libGL.dylib
48 darwin_linker_flags += -Wl,-dylib_file,$(darwin_ogl_libdir):$(darwin_libdir)/libGLU.dylib
49 darwin_linker_flags += -lSystem.B -lmathCommon.A -lGL -lGLU
50
51 # stupid broke-ass darwin linker...
52 darwin_linker_flags += build/Darwin/org/ibex/plat/OpenGL.java.o build/Darwin/org/ibex/plat/POSIX.java.o
53
54 target_bin_extension_$(platform) := $(shell echo $(platform) | tr A-Z a-z)
55 target_bin_extension_Win32       := exe
56 target_bin_extension_Java2       := jar
57 target_bin_extension             := $(target_bin_extension_$(platform))
58 target_bin                       := ibex.$(target_bin_extension)
59
60 javac   := javac -classpath upstream/bcel-5.1/src/bcel-5.1.jar:build/class -d build/class/ -sourcepath build/java/:upstream/mips:upstream/mips/build:src
61 gcc_optimizations  := -Os
62 #gcc_optimizations  := -O9 -ffast-math -fomit-frame-pointer -foptimize-sibling-calls
63 #gcc_optimizations  += -finline-functions -funroll-loops -ffunction-sections -fdata-sections
64 gcc_flags          := -nostdinc $(gcc_optimizations) -Ibuild/h -Iupstream/jpeg-6b/src -Iupstream/jpeg-6b/build-$(target) -g
65 gcc_flags          += -Iupstream/install/lib/gcc-lib/$(target)/3.3/include -Iupstream/install/$(target)/include
66 gcc_flags          += -ffunction-sections -fdata-sections -fno-omit-frame-pointer
67 gcj                := upstream/install/bin/$(target)-gcj $(gcc_flags) -fCLASSPATH=build/java
68 gcj                += -fassume-compiled -fmerge-all-constants -finhibit-reflection
69 gcj                += -foptimize-static-class-initialization -feliminate-dwarf2-dups -w
70 gcjh               := $(shell pwd)/upstream/install/bin/$(shell test -e upstream/install/bin/$(target)-gcjh && echo $(target)-)gcjh
71 g++                := upstream/install/bin/$(target)-gcj $(gcc_flags) -Iupstream/install/include -Wno-multichar
72 gcc                := upstream/install/bin/$(target)-gcc $(gcc_flags)
73 nm                 := upstream/install/$(target)/bin/nm
74 jar                := $(shell ((type fastjar &>/dev/null) && echo fastjar) || echo jar)
75
76 gcj: .install_gcc-3.3_$(target)
77         make build/$(platform)/$(target_bin) link_flags="$(link_flags)" platform=$(platform)
78
79 include Makefile.upstream
80
81 # find the superclasses of a platform class
82 #superclass_%:
83 #       @if [ "$*" = "org.ibex.plat.Darwin" ]; then echo org.ibex.plat.OpenGL; fi
84 #       @echo $*
85 #       @grep -s extends src/$(subst .,/,$*).java | sed s_.\*extends\ __ | head -n 1 | sed s_\ .\*__ |\
86 #               xargs --replace make -s superclass_org.ibex.plat.{}
87
88 plat_classes_Platform := org.ibex.plat.Platform
89 plat_classes_AWT      := org.ibex.plat.AWT $(plat_classes_Platform)
90 plat_classes_Java2    := org.ibex.plat.Java2 org.ibex.plat.JVM $(plat_classes_AWT)
91 plat_classes_GCJ      := org.ibex.plat.GCJ $(plat_classes_Platform)
92 plat_classes_Win32    := org.ibex.plat.Win32 $(plat_classes_GCJ)
93 plat_classes_POSIX    := org.ibex.plat.POSIX $(plat_classes_GCJ)
94 plat_classes_X11      := org.ibex.plat.X11 $(plat_classes_POSIX)
95 plat_classes_Linux    := org.ibex.plat.Linux $(plat_classes_X11)
96 plat_classes_Solaris  := org.ibex.plat.Solaris $(plat_classes_X11)
97 plat_classes_Darwin   := org.ibex.plat.Darwin org.ibex.plat.OpenGL $(plat_classes_POSIX)
98
99 plat_java_src_sources     := $(patsubst %,build/java/%.java,$(subst .,/,$(plat_classes_$(platform))))
100 java_src_sources          := $(shell find src -name '*.java' | grep -v Preprocessor | grep -v /plat/)
101 java_src_sources          += $(plat_java_src_sources)
102 java_sources              := $(patsubst src/%.java,     build/java/%.java, $(java_src_sources))
103
104 # FIXME ugly
105 java_sources              += build/java/org/xwt/mips/util/SeekableByteArray.java
106 java_sources              += build/java/org/xwt/mips/util/SeekableData.java
107 java_sources              += build/java/org/xwt/mips/util/SeekableFile.java
108 java_sources              += build/java/org/xwt/mips/util/SeekableInputStream.java
109 java_sources              += build/java/org/xwt/mips/Registers.java
110 java_sources              += build/java/org/xwt/mips/Runtime.java
111 java_sources              += build/java/org/xwt/mips/UsermodeConstants.java
112
113 java_classes              := $(java_sources:build/java/%.java=build/class/%.class)
114 java_classes              += build/class/gnu/regexp/CharUnit.class build/class/gnu/regexp/IntPair.class
115
116 ### Java Source Files ##############################################################################
117
118 build/java/gnu/regexp: .download_gnu.regexp-1.1.4
119         mkdir -p $(@D); cd $(@D); ln -sf ../../../upstream/gnu.regexp-1.1.4/src/src/gnu/regexp
120 build/java/org/xwt/mips: .download_nestedvm
121         mkdir -p $(@D); cd $(@D); ln -sf ../../../../upstream/nestedvm/src/org/xwt/mips
122 build/java/org/ibex/crypto: .download_org.ibex.crypto
123         mkdir -p $(@D); cd $(@D); ln -sf ../../../../upstream/org.ibex.crypto/src/org/ibex/crypto
124         mkdir -p build/java/org/ibex/net;
125         cd build/java/org/ibex/net; ln -sf ../../../../../upstream/org.ibex.crypto/src/org/ibex/net/SSL.java
126         cd build/java/org/ibex/net; ln -sf ../../../../../upstream/org.ibex.crypto/src/org/ibex/net/ssl
127
128 ifeq ($(platform),Java2)
129 .preprocessor: build/java/gnu/regexp src/org/ibex/util/Preprocessor.java src/org/ibex/util/Vec.java build/java/org/xwt/mips build/java/org/ibex/crypto
130
131         @mkdir -p build/class/org/ibex/util build/class/gnu/regexp
132         $(javac) src/org/ibex/util/Preprocessor.java src/org/ibex/util/Vec.java build/java/gnu/regexp/*.java  -d build/class
133         @touch $@
134 else
135 .preprocessor: build/java/gnu/regexp src/org/ibex/util/Preprocessor.java src/org/ibex/util/Vec.java build/java/org/xwt/mips build/java/org/ibex/crypto
136         @mkdir -p build/class/org/ibex/util build/class/gnu/regexp
137         $(gcj) -Isrc -C src/org/ibex/util/Preprocessor.java src/org/ibex/util/Vec.java build/java/gnu/regexp/*.java  -d build/class
138         @touch $@
139 endif
140 build/cc/%.cc:     src/%.c    ; @echo linking $@; mkdir -p $(@D); ln -fs `echo $(@D)/ | sed 's_[^/]*//*_../_g'`/$< $@
141 build/res/%:       src/%      ; @echo linking $@; mkdir -p $(@D); ln -fs `echo $(@D)/ | sed 's_[^/]*//*_../_g'`/$< $@
142 build/java/org/ibex/%.java: src/org/ibex/%.java .preprocessor
143         @echo -e "\n\033[1mpreprocessing      .java -> .java:  $<\033[0m"
144         mkdir -p `dirname $@`; java -cp build/class:build/java org.ibex.util.Preprocessor < $^ > $@
145 build/java/%.java: src/%.java ; @echo linking $@; mkdir -p $(@D); ln -fs `echo $(@D)/ | sed 's_[^/]*//*_../_g'`/$< $@
146
147
148 ### Java Class Files ##############################################################################
149
150 build/class/org/ibex/util/MIPSApps.class: build/mips/mipsapps.mips .install_nestedvm 
151         mkdir -p build/java/org/ibex/util
152         @echo -e "\n\033[1mtranslating        .mips -> .class:  $<\033[0m"
153         java -cp upstream/nestedvm/build:upstream/nestedvm/upstream/build/bcel-5.1/bcel-5.1.jar \
154                 org.xwt.mips.Compiler org.ibex.util.MIPSApps $< -outfile $@
155 #-o onepage,pagesize=8m
156
157 compile: .compile
158 .compile: .download_nestedvm .download_bcel-5.1 $(java_sources) $(java_classes); touch $@
159
160 ifeq ($(platform),Java2)
161 build/class/%.class: build/java/%.java .preprocessor
162         @echo -e "\n\033[1mcompiling          .java -> .class: $<\033[0m"
163         mkdir -p build/class
164         @$(javac) $< -d build/class
165 else
166 build/class/%.class: build/java/%.java
167         @echo -e "\n\033[1mcompiling          .java -> .class: $<\033[0m"
168         mkdir -p $(@D)
169         $(gcj) -I$(bcel_jar) -C -O0 $< -d build/class
170 endif
171
172 build/Java2/ibex.jar: .compile build/res/builtin.jar build/class/org/ibex/util/MIPSApps.class
173         @echo -e "\n\033[1marchiving         .class -> .jar:   build/Java2/ibex.jar\033[0m"
174         mkdir -p build/Java2
175         echo -e "Manifest-Version: 1.0\nMain-Class: org.ibex.core.Main\n" > build/Java2/.manifest
176         cd build/class/org/ibex; ln -sf ../../../res/builtin.jar
177         cd build/class; $(jar) cfm ../Java2/ibex.jar ../Java2/.manifest `find . -name \*.class -or -name \*.jar`
178
179
180 ### Headers ##################################################################################
181
182 java_headers          := $(java_sources:build/java/%.java=build/h/%.h) 
183 build/h/edu/stanford/ejalbert/BrowserLauncher.h:; mkdir -p $(@D); touch $@
184 build/h/%.h: build/class/%.class .compile
185         @echo -e "\n\033[1mextracting        .class -> .h:     $<\033[0m"
186         mkdir -p `dirname $@`
187         ls `echo $< | sed s/.class\$$//`*.class |\
188                  sed s_build/class/__ | sed s/.class\$$//g | sed s_/_._g | (cd build/class; xargs $(gcjh) -d ../h --classpath .)
189
190
191 ### Native Code ##############################################################################
192
193 # a hack since we've disabled gcj's awt implementation
194 build/$(platform)/org/ibex/plat/Linux.cc.o: .install_WindowMaker-0.80.2_$(target) 
195 build/$(platform)/org/ibex/plat/Solaris.cc.o: .install_WindowMaker-0.80.2_$(target) 
196
197 libjava_dir := $(shell pwd)/upstream/gcc-3.3/build-$(target)/$(target)/libjava
198 nat_libjava_files_ := boehm.o exception.o posix-threads.o posix.o prims.o resolve.o java/net/natInetAddress.o
199 nat_libjava_files_ += java/net/natPlainSocketImpl.o java/util/zip/nat*.o gnu/gcj/runtime/natFirstThread.o
200 nat_libjava_files_ += gnu/gcj/runtime/natNameFinder.o gnu/gcj/runtime/natStackTrace.o gnu/gcj/runtime/natSharedLibLoader.o
201 nat_libjava_files_ += gnu/gcj/runtime/natStringBuffer.o gnu/gcj/runtime/natVMClassLoader.o gnu/gcj/runtime/natFinalizerThread.o
202 nat_libjava_files_ += $(shell cd $(libjava_dir) 2>/dev/null; find java/lang -name \*.o -not -name '*[A-Z]*' 2>/dev/null)
203 nat_libjava_files_ += $(shell cd $(libjava_dir) 2>/dev/null; find java/lang -name nat\*.o 2>/dev/null)
204 nat_libjava_files := $(nat_libjava_files_:%=$(libjava_dir)/%)
205 nat_libjava_files += $(libjava_dir)/java/io/natFile.o $(libjava_dir)/java/io/natFileDescriptor.o
206
207 build/$(platform)/org/ibex/plat/$(platform).cc.o: src/org/ibex/plat/$(platform).cc src/org/ibex/plat/*.cc .configure_jpeg-6b_$(target)
208         @make $(java_headers)
209         @echo -e "\n\033[1mcompiling            .cc -> .o:     $<\033[0m"
210         mkdir -p `dirname $@`
211         $(g++) -Iupstream/gcc-3.3/build-$(target)/$(target)/libjava -c $< -o $@
212
213
214 bcel_jar := upstream/bcel-5.1/src/bcel-5.1.jar
215 build/$(platform)/ibex.pruned.jar: .compile $(java_classes) .install_jpeg-6b_$(target) build/$(platform)/builtin.o build/$(platform)/org/ibex/plat/$(platform).cc.o
216         @echo -e "\n\033[1mpruning              .jar -> .jar\033[0m"
217         cp upstream/install/share/java/libgcj-3.3.jar build/$(platform)/ibex.jar
218         cd build/class; jar uf ../$(platform)/ibex.jar $(java_classes:build/class/%.class=%*.class)
219         (nm $(nat_libjava_files) build/$(platform)/org/ibex/plat/$(platform).cc.o; echo org.ibex.plat.$(platform).main) |\
220                 grep _ZN | c++filt --format java | grep " U " | sed 's_ * U __' | sed 's_(.*__' \
221                 | java -cp $(bcel_jar):build/class org.ibex.util.NanoGoat build/$(platform)/ibex.jar | tee nanogoat.log
222         mkdir tmp; cd tmp; fastjar xvf ../build/$(platform)/ibex.jar.pruned; rm gnu/gcj/runtime/FirstThread*; cp ../build/class/org/ibex/plat/GCJ* org/ibex/plat/; cp -r ../build/class/org/xwt/mips/* org/xwt/mips/; mkdir -p $(shell pwd)/build/$(platform)/java/lang; mv java/lang/Class.class $(shell pwd)/build/$(platform)/java/lang; fastjar cvf ../build/$(platform)/ibex.jar.pruned .; cd ..; rm -rf tmp
223         mv build/$(platform)/ibex.jar.pruned $@
224
225 ifeq ($(platform),Win32)
226 filedes := $(shell pwd)/upstream/gcc-3.3/src/libjava/java/io/natFileWin32.cc
227 filedes += $(shell pwd)/upstream/gcc-3.3/src/libjava/java/io/natFileDescriptorWin32.cc
228 else
229 filedes := $(shell pwd)/upstream/gcc-3.3/src/libjava/java/io/natFilePosix.cc
230 filedes += $(shell pwd)/upstream/gcc-3.3/src/libjava/java/io/natFileDescriptorPosix.cc
231 endif
232
233 ifneq ($(target_bin_extension),jar)
234 build/$(platform)/$(target_bin): build/$(platform)/ibex.pruned.jar src/org/ibex/plat/*.cc build/$(platform)/builtin.o $(java_headers)
235
236         @echo -e "\n\033[1mlinking              .jar -> $(target_bin).phat\033[0m"
237 # -Os
238         cd build/$(platform); $(shell pwd)/upstream/install/bin/$(target)-gcj        \
239                 -fCLASSPATH=$(shell pwd)/upstream/install/share/java/libgcj-3.3.jar  \
240                 -finhibit-reflection                                                 \
241                 -fno-store-check                                                     \
242                 -c java/lang/Class.class
243         cd upstream/gcc-3.3/src/libjava/java/lang;\
244                 ln -sf ../../../../build-$(target)/$(target)/libjava/java/lang/natConcreteProcess.cc
245 # we need -fno-store-check since we can't dynamically resolve references to array classes
246         PATH=upstream/install/bin:$$PATH upstream/install/bin/$(target)-gcj              \
247                 -Wl,-O2,--relax,--gc-sections,--noinhibit-exec,--no-whole-archive        \
248                 --main=org.ibex.plat.$(platform)                                         \
249                 -Dfile.encoding=UTF8                                                     \
250                 -DPREFIX=\"\"                                                            \
251                 -Lupstream/install/$(target)/lib -Lupstream/install/lib                  \
252                 -finhibit-reflection                                                     \
253                 -fno-store-check                                                         \
254                 -w -g                                                                    \
255                 -Iupstream/jpeg-6b/build-$(target)/                                      \
256                 -Iupstream/jpeg-6b/src                                                   \
257                 -Ibuild/h                                                                \
258                 -Iupstream/gcc-3.3/src/gcc \
259                 -Iupstream/gcc-3.3/build-i686-pc-linux-gnu/i686-pc-linux-gnu/boehm-gc/    \
260                 -Iupstream/gcc-3.3/build-i686-pc-linux-gnu/i686-pc-linux-gnu/boehm-gc/include    \
261                 -Iupstream/gcc-3.3/src/boehm-gc                                           \
262                 -Iupstream/gcc-3.3/src/boehm-gc/include                                       \
263                 -Iupstream/gcc-3.3/build-i686-pc-linux-gnu/i686-pc-linux-gnu/libjava/    \
264                 -Iupstream/gcc-3.3/build-i686-pc-linux-gnu/i686-pc-linux-gnu/libjava/include    \
265                 -Iupstream/gcc-3.3/src/libjava                                           \
266                 -Iupstream/gcc-3.3/src/libjava/include                                       \
267                 -Ufile \
268                 build/$(platform)/ibex.pruned.jar                                        \
269                 src/org/ibex/plat/$(platform).cc                                         \
270                 $(nat_libjava_files_:%.o=$(shell pwd)/upstream/gcc-3.3/src/libjava/%.c*) \
271                 $(filedes) \
272                 build/$(platform)/builtin.o                                              \
273                 upstream/jpeg-6b/build-$(target)/libjpeg.a                               \
274                 $(link_flags)                                                            \
275                 $(libjava_dir)/../boehm-gc/.libs/libgcjgc.a                              \
276                 build/$(platform)/Class.o                                                \
277                 $(libjava_dir)/gnu/gcj/runtime/FirstThread.o \
278                 -lz -o $@.phat
279         @echo; ls -l $@.phat
280
281         @echo -e "\n\033[1mstripping              $(target_bin).phat -> $(target_bin)\033[0m"
282         strip $@.phat -o $@
283         @echo; ls -l $@.phat
284
285         @echo -e "\n\033[1mcompressing              $(target_bin) -> $(target_bin)\033[0m"
286         upx-ucl-beta $@
287         @echo; ls -l $@.phat
288 endif
289
290 ### Builtin Resources ##############################################################################
291
292 builtin_src := $(shell find src/org/ibex/core/builtin -name '*.*' \! -name '*.xcf')
293 build/res/fonts/vera: .download_vera-1.10
294         mkdir -p build/res/fonts/vera
295         cd build/res/fonts/vera; ln -fs ../../../../upstream/vera-1.10/ttf-bitstream-vera-1.10/Vera.ttf
296         cd build/res/fonts/vera; ln -fs ../../../../upstream/vera-1.10/ttf-bitstream-vera-1.10/VeraMono.ttf
297         cd build/res/fonts/vera; ln -fs ../../../../upstream/vera-1.10/ttf-bitstream-vera-1.10/VeraSe.ttf
298 build/res/builtin.jar: $(builtin_src:src/%=build/res/%) build/res/fonts/vera
299         @echo -e "\n\033[1mzipping            res/* -> .jar: builtin.jar\033[0m"
300         cd build/res; $(jar) cf builtin.jar org/ibex/core/builtin/scar.png fonts
301 build/$(platform)/builtin.o: build/res/builtin.jar
302         @echo -e "\n\033[1mwrapping            .jar -> .o: resources.o\033[0m"
303         @mkdir -p $(@D)
304         @(echo "unsigned int builtin_length = ";                                \
305                 (wc -c build/res/builtin.jar | sed "s_build.*__");              \
306                 echo \;;                                                        \
307                 echo "unsigned char builtin_bytes[] = {";                       \
308                 hexdump -ve '"0x" 1/1 "%x,\n"' build/res/builtin.jar;           \
309                 echo "};") > .builtin.c
310         $(gcc) -c .builtin.c -o build/$(platform)/builtin.o
311
312 build/mips/%.c.o: src/%.c .download_libmspack-20030726 .install_nestedvm
313         make .install_freetype-2.1.4_mips-unknown-elf target=mips-unknown-elf
314         make .install_libmspack-20030726_mips-unknown-elf target=mips-unknown-elf
315         mkdir -p $(@D)
316         echo -e "\n\033[1mcompiling $< -> $@ (mips)\033[0m"
317         upstream/install/bin/mips-unknown-elf-gcc -march=r3000 \
318                 -Iupstream/freetype-2.1.4/src/include  \
319                 -Iupstream/libmspack-20030726/src/mspack \
320                 -c -o $@ $<
321
322 build/mips/mipsapps.mips: build/mips/org/ibex/graphics/Freetype.c.o build/mips/org/ibex/util/MSPack.c.o
323         make .install_freetype-2.1.4_mips-unknown-elf target=mips-unknown-elf
324         make .install_libmspack-20030726_mips-unknown-elf target=mips-unknown-elf
325         @echo -e "\n\033[1mlinking               .o -> .mips:  $@\033[0m"
326         mkdir -p build/mips build/res
327         upstream/install/bin/mips-unknown-elf-gcc \
328                 --static \
329                 -march=mips1 \
330                 -T upstream/nestedvm/src/org/xwt/mips/linker.ld \
331                 -L upstream/nestedvm/build/org/xwt/mips/ \
332                 -L upstream/freetype-2.1.4/src/objs \
333                 -L upstream/libmspack-20030726/build-mips-unknown-elf/ \
334                 -o $@ \
335                 $^ \
336                 -lfreetype \
337                 -lmspack   \
338                 -Wl,--gc-sections
339
340
341 ### Maintainer ######################################################################################
342
343 current_build         := $(shell cat next.build)
344 strip_$(platform)     := upstream/install/$(target)/bin/strip build/$(platform)/$(target_bin) -o 
345 strip_Java2             := cp build/$(platform)/$(target_bin)
346 install-dist:;     $(strip_$(platform)) /var/www/org/xwt/dist/master/ibex-$(current_build).$(target_bin_extension).unsigned
347 dist: compile
348         (echo -n 0000; (echo "10k16o16i"; cat next.build | tr a-z A-Z; echo "1+f") | dc) | tail --bytes=5 > next.build-
349         mv next.build- next.build
350         echo -n "Next build will be "; cat next.build
351         nice -n 19 make all
352         make install-dist platform=Win32
353         make install-dist platform=Linux
354         make install-dist platform=Solaris
355         make install-dist platform=Darwin
356         make install-dist platform=Java2
357         echo -e "\n\n\n*** DONE ******************************************"
358
359 propose-patch:
360         @darcs send --edit-description -o .darcspatch -T patches@xwt.org http://core.ibex.org/
361         @(echo "To: patches@xwt.org";\
362          SUB=`grep -A10000 New.patches .darcspatch | grep '^\\[' | cut -b 2- | tr \\\n , | sed s_,_,\ _g | sed "s_, *\\$$__"`;\
363          echo "Subject: $$SUB";\
364          echo;\
365          cat .darcspatch) | /usr/sbin/sendmail -bm -f $(USER)@xwt.org patches@xwt.org;
366         @rm .darcspatch 
367
368 commit: propose-patch
369         darcs push --and-apply xwt@xwt.org:/var/www/org/ibex/core/
370
371 doc/%.pdf: build/class/org/ibex/util/XML.class build/class/org/ibex/util/Doc.class doc/%.xml
372         cd $(@D); java -cp ../../build/class org.ibex.util.Doc slides < `basename $*`.xml > `basename $*`.tex
373         cd $(@D); pdflatex `basename $*`.tex
374         open doc/$*.pdf
375
376