X-Git-Url: http://git.megacz.com/?p=nestedvm.git;a=blobdiff_plain;f=upstream%2FMakefile;h=ecbc416d9d771fd508bf867e2be8b718491f9bca;hp=c8cede7ff4bd00fd84c4e257a657cc85fa150715;hb=3971c8cafb25854247125cb1604879f5cf4b8b37;hpb=583406fcf43b576446e24c20df5a28d7fa879822 diff --git a/upstream/Makefile b/upstream/Makefile index c8cede7..ecbc416 100644 --- a/upstream/Makefile +++ b/upstream/Makefile @@ -1,11 +1,14 @@ # Inspired by XWT's Makefile.upstream -version_gcc = 3.3.3 +version_gcc = 3.3 +version_gpc = 20030830 url_gcc-core = http://mirrors.rcn.net/pub/sourceware/gcc/releases/gcc-$(version_gcc)/gcc-core-$(version_gcc).tar.gz url_gcc-c++ = http://mirrors.rcn.net/pub/sourceware/gcc/releases/gcc-$(version_gcc)/gcc-g++-$(version_gcc).tar.gz +url_gcc-gpc = http://www.gnu-pascal.de/alpha/gpc-$(version_gpc).tar.gz +url_gcc-g77 = http://mirrors.rcn.net/pub/sourceware/gcc/releases/gcc-$(version_gcc)/gcc-g77-$(version_gcc).tar.gz patches_gcc = gcc-fixes.patch gcc-fdata-sections-bss.patch configure_gcc = --target=mips-unknown-elf --disable-threads --with-gnu-ld --with-gnu-as --with-newlib=yes --enable-sjlj-exceptions --enable-languages="c" -configure_gcc_step2 = $(configure_gcc) --enable-languages="c,c++" +configure_gcc_step2 = $(configure_gcc) --enable-languages="c,c++,pascal,f77" version_binutils = 2.14 url_binutils = ftp://ftp.gnu.org/gnu/binutils/binutils-$(version_binutils).tar.gz @@ -48,13 +51,58 @@ clean_%: rm -rf "build/$(*)"* rm -f "tasks/build_$*" "tasks/patch_$*" "tasks/extract_$*" +tasks/download_tex: ; touch $@ +tasks/extract_tex: + mkdir -p build/tex + cd build/tex; wget -N http://www.math.uni.wroc.pl/~hebisch/tex_p/tex.web + cd build/tex; wget -N http://www.math.uni.wroc.pl/~hebisch/tex_p/tex.ch + cd build/tex; wget -N http://www.gnu-pascal.de/crystal/gpc/en/attachments/5593/tangle.p.gz && gunzip tangle.p.gz + touch $@ + +gpc := $(usr)/bin/mips-unknown-elf-gpc +gpc_flags := --big-endian -w -lgpc -lc $(usr)/mips-unknown-elf/lib/support*.o +gpc_flags += -Wl,-T,$(usr)/mips-unknown-elf/lib/linker.ld +g77 := $(usr)/bin/mips-unknown-elf-g77 +g77_flags := --big-endian -w -lg2c -lc $(usr)/mips-unknown-elf/lib/support*.o +g77_flags += -Wl,-T,$(usr)/mips-unknown-elf/lib/linker.ld + +# FIXME ugly path hacks evil bad +nestedvm := java -cp $(usr)/../build/bcel/bcel-5.1.jar:$(usr)/../../nestedvm.jar org.ibex.nestedvm.Compiler -outformat class + +tasks/build_tex: tasks/full_toolchain tasks/extract_tex + cd build/tex; $(gpc) tangle.p $(gpc_flags) -o tangle.mips + cd build/tex; $(nestedvm) -o unixruntime -outfile Tangle.class Tangle tangle.mips + cd build/tex; java -cp .:$(usr)/../../nestedvm.jar Tangle \ + --gpc-rts=-nPascalfile:tex.unpatched.p \ + --gpc-rts=-npool:tex.pool \ + --gpc-rts=-nwebfile:tex.web \ + --gpc-rts=-nchangefile:tex.ch + cd build/tex; cat tex.unpatched.p | sed s_STANDARDTEXT_TEXT_ | sed 's_\\^DIV_\\^ DIV_g' > tex.p + cd build/tex; PATH=$$PATH:../../install/bin; $(gpc) tex.p $(gpc_flags) -o tex.mips + cd build/tex; $(nestedvm) -o unixruntime -outfile TeX.class TeX tex.mips + #ln -s tex.pool 'TeXformats:TEX.POOL ' + #ln -s trip.tfm 'TeXfonts:trip.tfm ' + #ln -s trip.tex 'trip.tex ' + touch $@ + +tasks/extract_linpack: tasks/download_linpack ; touch $@ +tasks/download_linpack: + mkdir -p build/linpack + cd build/linpack; wget -N http://www.math.iastate.edu/burkardt/f_src/linpack_bench/linpack_bench.f + touch $@ + +tasks/build_linpack: tasks/full_toolchain tasks/extract_linpack + cd build/linpack; $(g77) linpack_bench.f $(g77_flags) -o linpack.mips + cd build/linpack; $(nestedvm) -o unixruntime -outfile Linpack.class Linpack linpack.mips + touch $@ + tasks/download_%: if [ -z "$(url_$*)" ]; then echo "No url for $*" >&2; false; fi mkdir -p download cd download && wget --passive-ftp -N $(url_$*) touch $@ -tasks/download_gcc: tasks/download_gcc-core tasks/download_gcc-c++ +tasks/download_gcc: tasks/download_gcc-core tasks/download_gcc-c++ tasks/download_gcc-gpc tasks/download_gcc-g77 touch $@ tasks/extract_%: tasks/download_% @@ -69,6 +117,10 @@ tasks/extract_gcc: tasks/download_gcc mkdir -p build cd build && gzip -dc ../download/gcc-core-$(version_gcc).tar.gz | tar xf - cd build && gzip -dc ../download/gcc-g++-$(version_gcc).tar.gz | tar xf - + cd build && gzip -dc ../download/gcc-g77-$(version_gcc).tar.gz | tar xf - + cd build && gzip -dc ../download/gpc-$(version_gpc).tar.gz | tar xf - && \ + rm -rf gcc-$(version_gcc)/gcc/p/; mv gpc-$(version_gpc)/p gcc-$(version_gcc)/gcc/p + rmdir build/gpc-$(version_gpc) touch $@ tasks/patch_%: tasks/extract_% @@ -98,16 +150,16 @@ tasks/build_gcc_step2: tasks/patch_gcc tasks/build_libc if [ ! -e "$(usr)/mips-unknown-elf/include/getopt.h" ]; then \ echo '#include ' > "$(usr)/mips-unknown-elf/include/getopt.h"; \ fi - + mips-unknown-elf-gcc -dumpspecs \ | sed '/startfile:$$/{n;s/crt0%O%s/crt0%O%s support%O%s support_aux%O%s/;};' \ | sed '/link_command:$$/{n;s/%{T\*}/%{T*} %{!T:-T linker.ld%s}/;};' \ > "$(usr)/lib/gcc-lib/mips-unknown-elf/$(version_gcc)/specs" - + mkdir -p $(usr) mkdir -p build/gcc-obj && cd build/gcc-obj && \ - ../gcc-$(version_gcc)/configure --prefix=$(usr) $(configure_gcc_step2) && \ - $(MAKE) TARGET_CFLAGS="$(MIPS_CFLAGS)" && \ + echo | ../gcc-$(version_gcc)/configure --prefix=$(usr) $(configure_gcc_step2) && \ + $(MAKE) TARGET_CFLAGS="$(MIPS_CFLAGS)" GCC_FOR_TARGET=$(usr)/bin/mips-unknown-elf-gcc && \ $(MAKE) install touch $@