scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

selfhost.sh (1033B)


      1 #! /bin/sh
      2 
      3 # A script to self host whatever object files that we can as a regression test.
      4 # One day it can be replaced with:
      5 # make install && make clean && make CC=scc install
      6 
      7 set -e
      8 set -u
      9 
     10 unset SCCEXECPATH
     11 
     12 selfhostedobj=\
     13 "lib/xstrdup.o
     14  lib/xmalloc.o
     15  lib/xcalloc.o
     16  lib/xrealloc.o"
     17 #lib/newitem.o
     18 #lib/debug.o
     19 #lib/die.o
     20 #driver/posix/scc.o
     21 #cc1/error.o
     22 #cc1/stmt.o
     23 #cc1/init.o
     24 #cc1/arch/qbe/arch.o
     25 #cc1/fold.o
     26 #cc1/types.o
     27 #cc1/builtin.o
     28 #cc1/cpp.o
     29 #cc1/symbol.o
     30 #cc1/lex.o
     31 #cc1/decl.o
     32 #cc1/main.o
     33 #cc1/code.o
     34 #cc1/expr.o
     35 #cc2/arch/qbe/cgen.o
     36 #cc2/arch/qbe/types.o
     37 #cc2/arch/qbe/optm.o
     38 #cc2/arch/qbe/code.o
     39 #cc2/peep.o
     40 #cc2/parser.o
     41 #cc2/node.o
     42 #cc2/symbol.o
     43 #cc2/optm.o
     44 #cc2/main.o
     45 #cc2/code.o"
     46 
     47 if ! test -d ./cc1
     48 then
     49 	echo "run this script from the root of the scc repository."
     50 	exit 1
     51 fi
     52 
     53 boostrapdir="$(pwd)/_bootstrap"
     54 rm -rf "$boostrapdir"
     55 mkdir "$boostrapdir"
     56 
     57 make clean
     58 make PREFIX="$boostrapdir" install
     59 export PATH="$boostrapdir/bin:$PATH"
     60 
     61 rm lib/libcc.a bin/scc bin/cc*
     62 rm $selfhostedobj
     63 
     64 make CC=scc tests