ref: c6fdc59547c448477e8994e87e0c4487abbb752a
parent: b5b9eac2d984b1f67cd71c4547a3afd7f2bb6dd4
author: Roberto E. Vargas Caballero <[email protected]>
date: Thu Aug 24 11:14:51 EDT 2017
[crt+driver] Set the same path in driver and in crt gendep.sh There were different after the big tree rewrite.
--- a/driver/posix/scc.c
+++ b/driver/posix/scc.c
@@ -140,13 +140,15 @@
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:
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -3,7 +3,7 @@
include ../config.mk
-DIRS = scc
+DIRS = scc crt
all dep clean distclean:
@pwd=$$PWD; \
--- 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
--- /dev/null
+++ b/lib/crt/gendep.sh
@@ -1,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
--- 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