commit 9f3f093fde9fb05a0763d886623c03137b6833dd
parent ee01bdf6773085ef479902da629d4c216e56e2ca
Author: Quentin Rameau <quinq@fifth.space>
Date: Wed, 22 Mar 2017 13:13:48 +0100
[driver] Use internal library path
And provide a way to configure them via inc/syslibs.h
Diffstat:
4 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/Makefile b/Makefile
@@ -76,4 +76,4 @@ clean:
rm -f bin/cc* bin/scc
distclean: clean
- rm -f inc/sysincludes.h
+ rm -f inc/sysincludes.h inc/syslibs.h
diff --git a/driver/posix/Makefile b/driver/posix/Makefile
@@ -7,14 +7,17 @@ OBJS = scc.o
all: scc
-$(OBJS): ../../inc/cc.h ../../inc/arg.h
-
-../../lib/libcc.a:
- cd ../../lib && $(MAKE) -e
+$(OBJS): ../../inc/cc.h ../../inc/arg.h ../../inc/syslibs.h
scc: $(OBJS) ../../lib/libcc.a
$(CC) $(SCC_LDFLAGS) $(OBJS) ../../lib/libcc.a -o $@
+../../inc/syslibs.h: ../../inc/syslibs.def.h
+ cp -f ../../inc/syslibs.def.h ../../inc/syslibs.h
+
+../../lib/libcc.a:
+ cd ../../lib && $(MAKE) -e
+
clean:
rm -f $(OBJS)
rm -f scc
diff --git a/driver/posix/scc.c b/driver/posix/scc.c
@@ -16,6 +16,7 @@ static char sccsid[] = "@(#) ./driver/posix/scc.c";
#include "../../inc/arg.h"
#include "../../inc/cc.h"
+#include "../../inc/syslibs.h"
enum {
CC1,
@@ -118,6 +119,10 @@ inittool(int tool)
addarg(tool, "-o");
t->outfile = outfile ? outfile : xstrdup("a.out");
addarg(tool, t->outfile);
+ for (n = 0; syslibs[n]; ++n) {
+ addarg(tool, "-L");
+ addarg(tool, syslibs[n]);
+ }
break;
case AS:
addarg(tool, "-o");
diff --git a/inc/syslibs.def.h b/inc/syslibs.def.h
@@ -0,0 +1,7 @@
+char *syslibs[] = {
+ PREFIX "/lib/scc/" ,
+ /* configure below your standard sys include paths */
+ PREFIX "/lib/",
+ PREFIX "/local/lib/",
+ NULL
+};