scc

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

commit bbd527058259a2bac5fed45610949b110645e805
parent ab709ce7d4bc60982fa69b0956e58e9330892f2c
Author: Sören Tempel <soeren@soeren-tempel.net>
Date:   Tue,  9 Jun 2026 14:23:28 +0200

Make it easier to configure the name of the QBE binary

While it is already possible to configure the as(1) and ld(1) binary
name through C macros, the QBE binary name is itself currently
hardcoded.  However, for distribution following the functional software
deployment model (e.g., Guix or Nix), it is useful to also make the
name of the QBE binary configurable. This is implemented here through
the addition of a QBEBIN macro.

Diffstat:
MREADME | 2++
Minclude/scc/bits/scc/sys-musl.h | 1+
Minclude/scc/bits/scc/sys-scc.h | 1+
Msrc/cmd/scc-cc/posix/cc.c | 4++--
4 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/README b/README @@ -208,6 +208,8 @@ file `include/bits/scc/sys.h` and it included basically 5 elements: - ASBIN: macro with the name of the assembler binary. + - QBEBIN: macro with the name of the qbe binary. + - sysincludes: It is a list of diretories used to locate the system headers diff --git a/include/scc/bits/scc/sys-musl.h b/include/scc/bits/scc/sys-musl.h @@ -1,5 +1,6 @@ #define LDBIN "ld" #define ASBIN "as" +#define QBEBIN "qbe" /* configure below your system linker command line */ #define GCCLIBPATH "/usr/lib/gcc/x86_64-unknown-linux-gnu/10.2/" diff --git a/include/scc/bits/scc/sys-scc.h b/include/scc/bits/scc/sys-scc.h @@ -1,5 +1,6 @@ #define LDBIN "ld" #define ASBIN "as" +#define QBEBIN "qbe" /* configure below your standard sys include paths */ char *sysincludes[] = { diff --git a/src/cmd/scc-cc/posix/cc.c b/src/cmd/scc-cc/posix/cc.c @@ -53,7 +53,7 @@ static struct tool { [TEEIR] = {.bin = "tee"}, [CC2] = {.bin = "cc2"}, [TEEQBE] = {.bin = "tee"}, - [QBE] = {.bin = "qbe"}, + [QBE] = {.bin = QBEBIN}, [TEEAS] = {.bin = "tee"}, [AS] = {.bin = ASBIN}, [LD] = {.bin = LDBIN}, @@ -242,7 +242,7 @@ settool(int tool, char *infile, int nexttool) die("scc-cc: target tool path is too long"); break; case QBE: - strcpy(t->cmd, "qbe"); + strcpy(t->cmd, QBEBIN); if (!strcmp(arch, "amd64") && !strcmp(abi, "sysv")) fmt = "amd64_sysv";