commit 538dc4fa9364a428513c012853ea49ce10fa5fb5
parent b123d04547d34405c6b32a1347b77a6539d5f60b
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Thu, 24 Aug 2017 15:14:51 +0100
[crt+driver] Set the same path in driver and in crt gendep.sh
There were different after the big tree rewrite.
Diffstat:
5 files changed, 41 insertions(+), 10 deletions(-)
diff --git a/driver/posix/scc.c b/driver/posix/scc.c
@@ -140,13 +140,15 @@ inittool(int tool)
addarg(tool, "-L");
addarg(tool, syslibs[n]);
}
- n = snprintf(NULL, 0, "%s/%s-%s-%s.o",
- prefix, "lib/scc/crt", arch, sys);
+ n = snprintf(NULL, 0,
+ "%s/lib/scc/crt/%s-%s-%s/crt.o",
+ prefix, arch, abi, sys);
if (n < 0)
die("scc: wrong crt file name");
crt = xmalloc(++n);
- n = snprintf(crt, n, "%s/%s-%s-%s.o",
- prefix, "lib/scc/crt", arch, sys);
+ sprintf(crt,
+ "%s/lib/scc/crt/%s-%s-%s/crt.o",
+ prefix, arch, abi, sys);
addarg(tool, crt);
break;
case AS:
diff --git a/lib/Makefile b/lib/Makefile
@@ -3,7 +3,7 @@
include ../config.mk
-DIRS = scc
+DIRS = scc crt
all dep clean distclean:
@pwd=$$PWD; \
diff --git a/lib/crt/Makefile b/lib/crt/Makefile
@@ -2,10 +2,13 @@
include ../../config.mk
-all: crt-$(ARCH)-$(SYS).o
+all:
-crt-$(ARCH)-$(SYS).o: $(ARCH)-$(SYS)/crt.o
- ln -f $(ARCH)-$(SYS)/crt.o $@
+dep:
+ ./gendep.sh $(TARGETS)
clean:
- rm -f */crt.o crt-*.o
+ rm -f */crt.o
+
+distclean: clean
+ rm -f makefile
diff --git a/lib/crt/gendep.sh b/lib/crt/gendep.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+set -e
+
+rm -f makefile $$.tmp
+trap "rm -f $$.mk $$.tmp" 0 2 3
+
+re='\([^-]*\)-\([^-]*\)-\([^-]*\)-\([^-]*\)'
+
+echo $@ |
+tr ' ' '\n' |
+sed "s/$re/\1-\2-\3/" |
+sort -u |
+(cat Makefile
+echo
+while read i
+do
+ cat <<EOF >> $$.tmp
+ mkdir -p ../../rootdir/lib/scc/crt/$i
+ cp $i/crt.o ../../rootdir/lib/scc/crt/$i/
+EOF
+ echo all: $i/crt.o
+done
+echo all:
+cat $$.tmp) > $$.mk && mv $$.mk makefile
diff --git a/tests/execute/Makefile b/tests/execute/Makefile
@@ -3,7 +3,8 @@
all: tests
tests:
- CFLAGS='' SCCEXECPATH=../../bin PATH=../../bin:$$PATH ./chktest.sh < scc-tests.lst
+ CFLAGS='' SCCPREFIX=../../rootdir/ PATH=../../rootdir/bin:$$PATH ./chktest.sh < scc-tests.lst
+
clean:
rm -f *.as *.o *.ir *.qbe *core test.log