2003/09/03 06:39:41
[org.ibex.core.git] / upstream / Makefile
1 #############################################################################
2 #
3 # The XWT upstream code Makefile
4 #
5
6 # upstream packages we need
7 packages               := jikes-1.18 binutils-2.13.2.1 newlib-1.11.0 w32api-2.3 mingw-runtime-3.0 freetype-2.1.4 gcc-3.3 jpeg-6b
8
9 # where to get stuff
10 url_newlib-1.11.0      := ftp://sources.redhat.com/pub/newlib/newlib-1.11.0.tar.gz
11 url_binutils-2.13.2.1  := ftp://ftp.gnu.org/gnu/binutils/binutils-2.13.2.1.tar.gz 
12 url_w32api-2.3         := http://twtelecom.dl.sourceforge.net/sourceforge/mingw/w32api-2.3.tar.gz
13 url_mingw-runtime-3.0  := http://twtelecom.dl.sourceforge.net/sourceforge/mingw/mingw-runtime-3.0.tar.gz
14 url_freetype-2.1.4     := http://umn.dl.sourceforge.net/sourceforge/freetype/freetype-2.1.4.tar.gz
15 url_gcc-3.3            := http://mirrors.rcn.net/pub/sourceware/gcc/releases/gcc-3.3/gcc-3.3.tar.gz 
16 url_jpeg-6b            := http://www.ijg.org/files/jpegsrc.v6b.tar.gz
17 url_jikes-1.18         := http://www.megacz.com/tmp/jikes-1.18.tgz       #ftp://www-126.ibm.com/pub/jikes/1.18/jikes-1.18.tar.gz
18
19 # how to configure it
20 configure_gcc-3.3                       := --enable-languages=c,c++,java --enable-gc-type=boehm --disable-shared --disable-jvmpi
21 configure_gcc-3.3                       += --disable-java-awt --disable-interpreter --enable-static
22 configure_gcc-3.3-powerpc-apple         := --enable-threads=posix --disable-hash-synchronization
23 configure_gcc-3.3-i686-pc-mingw32       := --enable-threads=win32 --enable-hash-synchronization
24 configure_gcc-3.3-i686-pc-linux-gnu     := --enable-threads=posix --enable-hash-synchronization
25 configure_gcc-3.3-sparc-sun-solaris2.7  := --enable-threads=posix --disable-multilib
26 configure_gcc-3.3-mips                  := --enable-languages=c --nfp --with-newlib=yes --enable-multilib --disable-threads
27
28 # jikes has a special target to autodetect a pre-installed jikes, and to autodetect the JVM's $CLASSPATH
29 .jikes:
30         echo "jikes " > .jikes
31         (type jikes && (jikes --version | grep "Version 1.18")) || \
32                 (make jikes-1.18/src jikes-1.18/.installed && echo -n "upstream/jikes-1.18/install/bin/jikes " > .jikes)
33         echo -n "$(jikes_flags) -bootclasspath " >> .jikes
34         echo "public class GetBootClassPath { public static void main(String[] s) { " > GetBootClassPath.java
35         echo "System.out.println(System.getProperty(\"sun.boot.class.path\")); } }"  >> GetBootClassPath.java
36         javac GetBootClassPath.java
37         java -cp . GetBootClassPath >> .jikes
38         rm GetBootClassPath.*
39
40 # make the package's directory (if it doesn't exist)
41 $(packages):
42         mkdir -p $@
43
44 # if the make target was specified in $(package)-$(target) format, break it apart and recurse
45 $(packages:%=%-$(target)): %-$(target): %
46         make $</src $</.installed target=$(patsubst $<-%,%,$@)
47
48 # download the source code
49 $(packages:%=%/src): %/src: %
50         @echo -e "\ndownloading $<..."
51         @mkdir -p $<
52         @curl $(url_$<) | tar xzf - -C $<
53         (test -e $</patches && cd $</$< && for A in ../patches/*.patch; do patch -p0 < $$A; done); true
54         @mv $</$< $</src
55
56 # configure and build it
57 setcc := CC="$(patsubst Darwin,/usr/bin/gcc3 -no-cpp-precomp,$(findstring Darwin,$(shell uname)))"
58 $(packages:%=%/.installed): %/.installed: %
59         @mkdir -p $</build-$(target) $</install
60         @echo -e "\nconfiguring $<..."
61         cd $</build-$(target); $(setcc) ../src/configure --prefix=`pwd`/../install $(configure_$<) $(configure_$<-$(target))
62         @echo -e "\nbuilding $<..."
63         @cd $</build-$(target); $(setcc) make
64         @echo -e "\ninstalling $<..."
65         @cd $</build-$(target); $(setcc) make install
66         @touch $</.installed
67