scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit a61055fd3e933cf454bae38022688538c48745ef
parent 3fec7983b6f7b1852cbc15ea9aea4adf63d0e9fd
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Sun, 31 Oct 2021 09:01:59 +0100

build/posix: Move scc.sh to cc/posix

The current implementation of scc is a shell script that only
can be executed in POSIX systems, so it makes sense to move it
to that directory. The shell script is also modified to support
external SCCPREFIX.

Diffstat:
Msrc/cmd/Makefile | 5-----
Msrc/cmd/cc/posix/Makefile | 18+++++++++++-------
Dsrc/cmd/cc/posix/cpp.sh | 4----
Asrc/cmd/cc/posix/scc.sh | 16++++++++++++++++
Dsrc/cmd/scc.sh | 8--------
5 files changed, 27 insertions(+), 24 deletions(-)

diff --git a/src/cmd/Makefile b/src/cmd/Makefile @@ -18,7 +18,6 @@ TARGET =\ $(BINDIR)/scc-objdump\ $(BINDIR)/scc-objcopy\ $(BINDIR)/scc-addr2line\ - $(BINDIR)/scc\ $(LIBEXEC)/scc/qbe\ all: $(TARGET) $(DIRS) @@ -34,10 +33,6 @@ qbe/obj/qbe: qbe $(LIBEXEC)/scc/qbe: qbe/obj/qbe cp qbe/obj/qbe $@ -$(BINDIR)/scc: scc.sh - cp scc.sh $@ - chmod +x $@ - $(BINDIR)/scc-nm: nm.o $(LIBMACH) $(LIBSCC) $(CC) $(PROJ_LDFLAGS) nm.o -lmach -lscc -o $@ diff --git a/src/cmd/cc/posix/Makefile b/src/cmd/cc/posix/Makefile @@ -12,19 +12,23 @@ SYSLST =\ i386-sysv-linux-elf\ amd64-sysv-openbsd-elf\ -TARGETS = $(BINDIR)/scc-cc $(BINDIR)/scc-cpp +TARGETS =\ + $(BINDIR)/scc-cc\ + $(BINDIR)/scc-cpp\ + $(BINDIR)/scc\ all: $(TARGETS) $(BINDIR)/scc-cc: $(LIBSCC) cc.o $(CC) $(PROJ_LDFLAGS) cc.o -lscc -o $@ -$(BINDIR)/scc-cpp: cpp.sh - trap "rm -f $$$$.sh" 0 2 3;\ - rm -f $@ ;\ - sed "s%@PREFIX@%$(PREFIX)%" < cpp.sh > $$$$.sh && \ - chmod +x $$$$.sh && \ - mv $$$$.sh $@ +$(BINDIR)/scc-cpp: scc.sh + cp scc.sh $@ + chmod +x $@ + +$(BINDIR)/scc: scc.sh + cp scc.sh $@ + chmod +x $@ config.h: PREFIX=$(PREFIX) ./mkconf $(SYSLST) diff --git a/src/cmd/cc/posix/cpp.sh b/src/cmd/cc/posix/cpp.sh @@ -1,4 +0,0 @@ -#!/bin/sh - -SCCPREFIX=${SCCPREFIX:-@PREFIX@} -${SCCPREFIX}/bin/cc -E $@ diff --git a/src/cmd/cc/posix/scc.sh b/src/cmd/cc/posix/scc.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +if test -z $SCCPREFIX +then + SCCPREFIX=`dirname $0`/.. + export SCCPREFIX +fi + +case $0 in +*cpp) + exec $SCCPREFIX/bin/scc-cc -E $@ + ;; +*scc) + exec $SCCPREFIX/bin/scc-cc $@ + ;; +esac diff --git a/src/cmd/scc.sh b/src/cmd/scc.sh @@ -1,8 +0,0 @@ -#!/bin/sh - -root=`dirname $0`/.. -SCCPREFIX=$root - -export SCCPREFIX - -exec $root/bin/scc-cc $@