diff --git a/NT/tools/ar b/NT/tools/ar index e7e3b77851858f54584a4379418c67a2a110d357..43acc3bf6ed4b8259f86213efd029f9ae79331a0 100755 --- a/NT/tools/ar +++ b/NT/tools/ar @@ -9,6 +9,42 @@ shift OUTPUT=$1 shift +XOPTS="-b -c" + +case "E$OPTIONS" in + *x*) + OPCHAR='*' + if [ $# = 0 ]; then + TMPDIR=TMP$$.d + rm -rf $TMPDIR >/dev/null 2>/dev/null || : + mkdir $TMPDIR + do_cmd wlib -x -d=$TMPDIR `fixpath $OUTPUT` + ( + cd $TMPDIR + for a in * + do + BASE=`echo $a | sed -e 's/\.[^.]$//'` + mv $a ../$BASE.o + done + ) + rm -rf $TMPDIR >/dev/null 2>/dev/null || : + exit 0 + fi + ;; + + *d*) + OPTCHAR='-' + ;; + + *r*) + OPCHAR='-+' + ;; + + *q*) + OPCHAR='+' + ;; +esac + XFILE=TMP$$.l rm $XFILE 2>/dev/null 1>/dev/null || : @@ -16,12 +52,12 @@ rm $XFILE 2>/dev/null 1>/dev/null || : OPTS= for a in "$@" do - OPTS="$OPTS +$a" + OPTS="$OPTS $OPCHAR$a" done -echo >$XFILE $OPTS +echo >$XFILE "$OPTS" -do_cmd wlib -b -c $OUTPUT @$XFILE +do_cmd wlib $XOPTS `fixpath $OUTPUT` @$XFILE if [ $CLEANUP = yes ]; then if [ -f $XFILE ]; then diff --git a/NT/tools/lib b/NT/tools/lib index 3147c1042b2ab103366191dc03770ea6724db9a4..1fda8363d3614afb39225508f454eefc865c5025 100644 --- a/NT/tools/lib +++ b/NT/tools/lib @@ -37,6 +37,6 @@ silent_do_cmd() { } do_cmd() { - echo "DOING $*" + echo "DOING $*" >&2 silent_do_cmd "$@" } diff --git a/NT/tools/rntcc b/NT/tools/rntcc index bd230c9f317473fecba39072a1986f4d10c72e42..15e8340342138f0b2b0173902ce63bf8d7b5b9d7 100755 --- a/NT/tools/rntcc +++ b/NT/tools/rntcc @@ -8,7 +8,7 @@ OPTS="" CFLAGS="" SOURCES="" OBJECTS="" -OUTPUT=a.out +OUTPUT= OPERATION=linking INCLUDE_PATH= LDOPTS="OPTION STACK=8m" @@ -53,7 +53,7 @@ while test "$#" != 0; do CFLAGS="$CFLAGS -otexan" OPTIMIZE=yes ;; - *.c) SOURCES="$SOURCES $1" ;; + *.c | *.s | *.S) SOURCES="$SOURCES $1" ;; *.o | *.a) OBJECTS="$OBJECTS $1" ;; -o) OUTPUT="$2" ; shift ;; @@ -88,20 +88,24 @@ while test "$#" != 0; do LIBRARIES="$LIBRARIES LIBRARY $tmp" ;; - *) + -*) echo "Unrecognized option $1" exit 1 ;; + + *) + SOURCES="$SOURCES $1" + ;; esac shift done -if [ x$DEBUG$OPTIMIZE = xyesyes ]; then - echo Debug and optimization not supported at the same time - exit 1 -else - : -fi +#if [ x$DEBUG$OPTIMIZE = xyesyes ]; then +# echo Debug and optimization not supported at the same time +# exit 1 +#else +# : +#fi rm $OUTPUT 2>/dev/null 1>/dev/null || : @@ -131,31 +135,47 @@ rm $ERRORFILE 2>/dev/null 1>/dev/null || : CFLAGS="$CFLAGS -bm -zq -hw -fr$ERRORFILE" -if [ "x$OUTPUT" != x ]; then - OFLAGS="$OFLAGS -fo$OUTPUT" -else - OFLAGS= -fi + +compile() { + if [ "x$2" != x ]; then + OFLAGS="$OFLAGS -fo$2" + else + OFLAGS="$OFLAGS -fo`echo $1 | sed -e 's/\.[^.]$//'`.o" + fi + + case $1 in + *.s | *.S) + do_cmd wasm -fe$ERRORFILE $OFLAGS `fixpath $1` + ;; + + *) + do_cmd $NTCC $CFLAGS $OFLAGS `fixpath $1` + ;; + esac +} case $OPERATION in compiling) - do_cmd $NTCC $CFLAGS $OFLAGS `fixpath $SOURCES $OBJECTS` + compile $SOURCES $OUTPUT TARGET=$OUTPUT ;; preprocessing) - do_cmd $NTCC -p $CFLAGS `fixpath $SOURCES` + silent_do_cmd $NTCC -p $CFLAGS `fixpath $SOURCES` ;; linking) for a in `fixpath $SOURCES` do - BASE=`echo $a | sed -e 's/\.c//'` - do_cmd $NTCC -i$IPATH $CFLAGS -fo=$BASE.obj $a + BASE=`echo $a | sed -e 's/\.[^.]$//'` + compile $a $BASE.obj OBJECTS="$OBJECTS $BASE.obj" done LDFILE=TMP$$.lk + if [ "x$OUTPUT" = "x" ]; then + OUTPUT=a.out + fi echo "name $OUTPUT.exe $LDOPTS FIL `fixpath $OBJECTS | sed -e 's/ /,/g'` $LIBRARIES" >$LDFILE OK=`do_cmd wlink @$LDFILE | check_linker_error` if [ x$OK != xok ]; then