sanity checks before extraction fix
[nestedvm.git] / upstream / Makefile
index 9c5ec8f..4ba354d 100644 (file)
@@ -29,11 +29,11 @@ configure_newlib = --enable-multilib --target=mips-unknown-elf
 url_openbsdglob = http://www.brianweb.net/xwt/openbsdglob.tar.gz
 url_regex = ftp://ftp.zoo.toronto.edu/pub/regex.shar
 
-version_bcel = 5.1
-url_bcel = http://mirrors.mix5.com/apache/jakarta/bcel/binaries/bcel-$(version_bcel).tar.gz
-
 url_linpack = http://www.math.iastate.edu/burkardt/f_src/linpack_bench/linpack_bench.f
 
+darcs_gcclass = http://darcs.brianweb.net/gcclass
+darcs_classgen = http://darcs.brianweb.net/classgen
+
 .SECONDARY: # This is broken in gmake < 3.79.1
 
 upstream = $(shell pwd)
@@ -51,19 +51,61 @@ tasks/build_gcc: tasks/build_linker
 tasks/build_newlib: tasks/build_gcc
 
 cross_root := $(usr)/mips-unknown-elf
-libc_a := $(cross_root)/lib/libc.a
+
+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/extract_%: tasks/download_%
+       if [ -e $@ ]; then echo "Error: $@ exists. something isn't right"; false; else true; fi
+       mkdir -p build
+       cd build && \
+               gzip -dc  ../download/$*-$(version_$*).tar.gz | $(TAR) -xf - && \
+               rm -f $* && \
+               ln -s $*-$(version_$*) $*
+       touch $@
+
+tasks/extract_darcs_%:
+       if [ -e $@ ]; then echo "Error: $@ exists. something isn't right"; false; else true; fi
+       mkdir -p build
+       if [ -z "$(darcs_$*)" ]; then echo "No darcs url for $*" >&2; false; fi
+       if [ -d "$(root)/_darcs" ]; then \
+               cd build && darcs get --repo-name="$*" --verbose "$(darcs_$*)"; \
+       else \
+               mkdir -p "build/$*" && cd "build/$*"; \
+               wget -nH -rl 16 -N -X _darcs $(darcs_$*); \
+       fi
+       touch $@
+
+update_darcs_%: tasks/extract_darcs_%
+       if [ -d "build/$*/_darcs" ]; then \
+               cd "build/$*" && darcs pull; \
+       else \
+               cd "build/$*" && wget -np -nH --cut-dirs=1 -rl 16 -N -X _darcs $(darcs_$*); \
+       fi
+       rm "tasks/build_darcs_$*" # to force a rebuild
+
+tasks/build_darcs_%: tasks/extract_darcs_%
+       cd "build/$*" && $(MAKE)
+       touch $@
 
 tasks/build_extraheaders: $(upstream)/misc/extraheaders.sh tasks/build_newlib
        # Add extra nestedvm specific headers to include
        cd $(cross_root)/include && sh $<
        touch $@
 
-tasks/build_libc: tasks/build_newlib tasks/build_extraheaders tasks/build_regex tasks/build_openbsdglob
+top_lev_stuff := $(patsubst %,../build/org/ibex/nestedvm/%.o, crt0 support support_aux)
+
+$(top_lev_stuff):
        # HACK: Get the top level makefile to build the support stuff
-       $(MAKE) -s -C $(root) $(patsubst %,build/org/ibex/nestedvm/%.o, crt0 support support_aux)
+       $(MAKE) -C .. $(top_lev_stuff:../%=%)
 
+tasks/build_libc: tasks/build_newlib tasks/build_extraheaders tasks/build_regex tasks/build_openbsdglob misc/extraheaders.sh $(top_lev_stuff)
        # Add our support stuff to libc
-       mips-unknown-elf-ar sr $(libc_a) $(patsubst %,$(root)/build/org/ibex/nestedvm/%.o, support support_aux)
+       mips-unknown-elf-ar sr $(cross_root)/lib/libc.a $(patsubst %,../build/org/ibex/nestedvm/%.o, support support_aux)
+       mips-unknown-elf-ar sr $(cross_root)/lib/single-float/libc.a $(patsubst %,../build/org/ibex/nestedvm/%.o, support support_aux)
        rm -f $(cross_root)/lib/crt0.o
        cp $(root)/build/org/ibex/nestedvm/crt0.o $(cross_root)/lib/crt0.o
 
@@ -82,24 +124,11 @@ clean_%:
        rm -f "tasks/build_$*" "tasks/patch_$*" "tasks/extract_$*"
 
 
-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-g77
        touch $@
 
-tasks/extract_%: tasks/download_%
-       mkdir -p build
-       cd build && \
-               gzip -dc  ../download/$*-$(version_$*).tar.gz | $(TAR) -xf - && \
-               rm -f $* && \
-               ln -s $*-$(version_$*) $*
-       touch $@
-
 tasks/extract_gcc: tasks/download_gcc
+       if [ -e $@ ]; then echo "Error: $@ exists. something isn't right"; false; else true; fi
        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 -
@@ -107,6 +136,7 @@ tasks/extract_gcc: tasks/download_gcc
        touch $@
 
 tasks/patch_%: tasks/extract_%
+       if [ -e $@ ]; then echo "Error: $@ exists. something isn't right"; false; else true; fi
        cd build/$*-$(version_$*) &&  \
        for p in $(patches_$*) end; do \
                [ "$$p" = "end" ] || $(PATCH) -p0 < ../../patches/$$p || exit 1; \
@@ -130,6 +160,7 @@ tasks/build_gcc_step2: tasks/patch_gcc tasks/build_libc
        touch $@
 
 tasks/extract_gpc: tasks/download_gcc tasks/download_gpc
+       if [ -e $@ ]; then echo "Error: $@ exists. something isn't right"; false; else true; fi
        mkdir -p build/gpc.extract
        cd build/gpc.extract && \
                gzip -dc ../../download/gcc-core-$(version_gcc).tar.gz | $(TAR) -xf - && \
@@ -277,14 +308,6 @@ tasks/build_busybox: tasks/patch_busybox tasks/build_libc
        cd build/busybox && $(MAKE) LDFLAGS="$(MIPS_LDFLAGS)" CFLAGS_EXTRA="$(MIPS_CFLAGS) -DNESTEDVM -g"
        touch $@
 
-tasks/extract_gcclass:
-       cd build &&  darcs get --verbose http://darcs.brianweb.net/gcclass
-       touch $@
-       
-tasks/build_gcclass: tasks/extract_gcclass
-       cd build/gcclass && $(MAKE)
-       touch $@
-
 # TeX Stuff
 
 tasks/extract_tex_tangle:
@@ -309,7 +332,7 @@ tasks/build_tex: tasks/build_tex_tangle tasks/build_gpc tasks/download_texinputs
        cp misc/tex.ch build/tex/tex.ch
        cd build/tex && \
                $(TAR) xfz ../../download/texinputs-$(version_texinputs).tgz && \
-               java -cp $(root)/build tests.Tangle \
+               java -cp $(root)/build:$(upstream)/build/classgen/build tests.Tangle \
                        --gpc-rts=-nPascalfile:tex.p    \
                        --gpc-rts=-npool:tex.pool       \
                        --gpc-rts=-nwebfile:tex.web     \