commit feaa80c03c85e2732b0fe3e3672f9a541cc4bd4f
parent 9f1bdd10088af510c839b7e337d4366df693fe66
Author: Quentin Rameau <quinq@fifth.space>
Date: Tue, 24 Jan 2017 17:39:51 +0100
[cpp] provide a way to configure sys include paths
This fixes too scc internal per-architecture standard include files.
Diffstat:
8 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/Makefile b/Makefile
@@ -64,3 +64,4 @@ clean:
distclean: clean
rm -rf bin
+ rm -f inc/sysincludes.h
diff --git a/cc1/Makefile b/cc1/Makefile
@@ -11,8 +11,12 @@ OBJS = types.o decl.o lex.o error.o symbol.o main.o expr.o \
all: cc1-$(ARCH)
cpp.o: stallman.msg
+arch/$(ARCH)/arch.o: ../inc/sysincludes.h
$(OBJS): cc1.h ../inc/cc.h ../inc/$(STD)/cstd.h
+../inc/sysincludes.h:
+ cp -f ../inc/sysincludes.def.h ../inc/sysincludes.h
+
../lib/libcc.a:
cd ../lib && $(MAKE) -e
diff --git a/cc1/arch/amd64-sysv/arch.c b/cc1/arch/amd64-sysv/arch.c
@@ -2,6 +2,7 @@
static char sccsid[] = "@(#) ./cc1/arch/amd64-sysv/arch.c";
#include <stdio.h>
+#include "../../../inc/sysincludes.h"
#include "../../../inc/cc.h"
#include "../../cc1.h"
diff --git a/cc1/arch/i386-sysv/arch.c b/cc1/arch/i386-sysv/arch.c
@@ -1,6 +1,8 @@
/* See LICENSE file for copyright and license details. */
static char sccsid[] = "@(#) ./cc1/arch/i386-sysv/arch.c";
#include <stdio.h>
+
+#include "../../../inc/sysincludes.h"
#include "../../../inc/cc.h"
#include "../../cc1.h"
diff --git a/cc1/arch/qbe/arch.c b/cc1/arch/qbe/arch.c
@@ -2,6 +2,7 @@
static char sccsid[] = "@(#) ./cc1/arch/qbe/arch.c";
#include <stdio.h>
+#include "../../../inc/sysincludes.h"
#include "../../../inc/cc.h"
#include "../../cc1.h"
diff --git a/cc1/arch/z80/arch.c b/cc1/arch/z80/arch.c
@@ -2,6 +2,7 @@
static char sccsid[] = "@(#) ./cc1/arch/z80/arch.c";
#include <stdio.h>
+#include "../../../inc/sysincludes.h"
#include "../../../inc/cc.h"
#include "../../cc1.h"
diff --git a/cc1/cpp.c b/cc1/cpp.c
@@ -11,6 +11,7 @@ static char sccsid[] = "@(#) ./cc1/cpp.c";
#include "../inc/cc.h"
#include "cc1.h"
+extern char *sysincludes[];
static char *argp, *macroname;
static unsigned arglen;
static unsigned ncmdlines;
@@ -464,12 +465,6 @@ include(void)
{
char dir[FILENAME_MAX], file[FILENAME_MAX], *p, **bp;
size_t filelen;
- static char *sysinclude[] = {
- PREFIX "/include/scc/" ARCH "/",
- PREFIX "/include/",
- PREFIX "/local/include/",
- NULL
- };
int n;
if (cppoff)
@@ -517,7 +512,7 @@ include(void)
if (includefile(*bp, file, filelen))
goto its_done;
}
- for (bp = sysinclude; *bp; ++bp) {
+ for (bp = sysincludes; *bp; ++bp) {
if (includefile(*bp, file, filelen))
goto its_done;
}
diff --git a/inc/sysincludes.def.h b/inc/sysincludes.def.h
@@ -0,0 +1,7 @@
+char *sysincludes[] = {
+ PREFIX "/include/scc/" ARCH "/",
+ /* configure below your standard sys include paths */
+ PREFIX "/include/",
+ PREFIX "/local/include/",
+ NULL
+};