ref: 3fb3ff2c0b27f8468e1e1ad24465742d3b89dc4e
parent: 5a94ac5ea5a6f895a0b1190b839bc4245455fcb2
author: Quentin Rameau <quinq@fifth.space>
date: Tue Jan 24 12:39:51 EST 2017
[cpp] provide a way to configure sys include paths This fixes too scc internal per-architecture standard include files.
--- a/Makefile
+++ b/Makefile
@@ -64,3 +64,4 @@
distclean: clean
rm -rf bin
+ rm -f inc/sysincludes.h
--- a/cc1/Makefile
+++ b/cc1/Makefile
@@ -11,7 +11,11 @@
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
--- 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"
--- 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"
--- 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"
--- 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"
--- a/cc1/cpp.c
+++ b/cc1/cpp.c
@@ -11,6 +11,7 @@
#include "../inc/cc.h"
#include "cc1.h"
+extern char *sysincludes[];
static char *argp, *macroname;
static unsigned arglen;
static unsigned ncmdlines;
@@ -464,12 +465,6 @@
{
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 @@
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;
}
--- /dev/null
+++ b/inc/sysincludes.def.h
@@ -1,0 +1,7 @@
+char *sysincludes[] = {
+ PREFIX "/include/scc/" ARCH "/",
+ /* configure below your standard sys include paths */
+ PREFIX "/include/",
+ PREFIX "/local/include/",
+ NULL
+};