commit 117792ec9773e594fe3831ed96f2a4fb7c87b690
parent 2fe6447857b6fc3a99313d40db6030b9edaeb2e3
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Tue, 12 Nov 2024 22:04:31 +0100
scc: Use the scc wrapper to execute any tool
Scc was designed to run scc-cc, but it can be easily
expanded to run any of the scc tools with the same
advantages.
Diffstat:
4 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/README b/README
@@ -29,8 +29,10 @@ After a successful install the following programs are installed:
with the scc libc.
- scc: A wrapper shell script that allows the execution
- of scc-cc from any directory independently of the PREFIX
- used in the build.
+ of any scc tool from any directory independently of the
+ PREFIX used in the build. The tool can be selected as
+ the first parameter (like for example `scc as` or `scc ar`)
+ and by default is cc.
- scc-addr2line: A work in progress to implement a tool
that is able to translate a hexadecimal address into
@@ -49,10 +51,8 @@ After a successful install the following programs are installed:
library files. This value can be overriden by the
`SCCPREFIX` environment variable.
- - scc-cpp: A wrapper shell script that only preprocess
- the file, and it allows the execution from any
- directory independently of the PREFIX used in the
- build.
+ - scc-cpp: A wrapper shell script that uses scc-cc
+ to preprocess a file without compiling it.
- scc-ld: A work in progress to implement a linker for
the scc toolchain.
diff --git a/src/cmd/scc-cc/posix/Makefile b/src/cmd/scc-cc/posix/Makefile
@@ -14,8 +14,8 @@ scc-cc: $(LIBSCC) cc.o
$(CC) $(PROJ_LDFLAGS) cc.o -lscc $(PROJ_LDLIBS) -o $@
cp $@ $(BINDIR)
-scc-cpp: scc.sh
- cp scc.sh $@
+scc-cpp: scc-cpp.sh
+ cp scc-cpp.sh $@
chmod +x $@
cp $@ $(BINDIR)
diff --git a/src/cmd/scc-cc/posix/scc-cpp.sh b/src/cmd/scc-cc/posix/scc-cpp.sh
@@ -0,0 +1,3 @@
+#/bin/sh
+
+scc-cc -E $@
diff --git a/src/cmd/scc-cc/posix/scc.sh b/src/cmd/scc-cc/posix/scc.sh
@@ -12,11 +12,13 @@ then
export SCCLIBPREFIX
fi
-case $0 in
-*cpp)
- exec $SCCPREFIX/bin/scc-cc -E $@
+case $1 in
+cc|cpp|as|ar|addr2line|ld|make|nm|objcopy|objdump|size|strip)
+ tool=$1
+ shift
+ exec $SCCPREFIX/bin/scc-$tool $@
;;
-*scc)
+*)
exec $SCCPREFIX/bin/scc-cc $@
;;
esac