shithub: scc

Download patch

ref: 866b125797cfd5ab0ebb60024c39ca91c5053cea
parent: b79ca20491ce1570c50880a476106d8bf5c46acc
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Wed May 16 16:30:57 EDT 2018

Include dependencies of files out of current directory

Mkdep.sh was generating dependencies for source files in
the current directory. This change extends it to all the directories
under the current directory. Special care was taken to have always
the same result.

--- a/as/Makefile
+++ b/as/Makefile
@@ -5,21 +5,17 @@
 include $(LIBDIR)/libdep.mk
 
 OBJ = main.o symbol.o ins.o parser.o expr.o myro.o
-HDR = $(PROJECTDIR)/inc/scc.h as.h
 MOREFLAGS = -I$(PROJECTDIR)/inc/$(STD) $(AS_CFLAGS)
 
 all: as-amd64 as-i386 as-z80
 
-$(OBJ): $(HDR)
-
 as: $(OBJ)
 	$(CC) $(SCC_LDFLAGS) $(OBJ) -lscc -o $@
 
-myro.o: $(PROJECTDIR)/inc/myro.h
-
 dep:
 	$(PROJECTDIR)/mkdep.sh
 
+distclean: clean
 clean:
 	rm -f *.o target/*/*.o
 	rm -f target/*/*tbl.c
@@ -26,25 +22,37 @@
 	rm -f as-*
 	rm -f *.log
 
-distclean: clean
-	rm -f makefile
-
 include target/amd64.mk
 include target/i386.mk
 include target/z80.mk
 
 #deps
-expr.c: as.h
-expr.c: ../inc/scc.h
-ins.c: as.h
-ins.c: ../inc/scc.h
-main.c: as.h
-main.c: ../inc/arg.h
-main.c: ../inc/scc.h
-myro.c: as.h
-myro.c: ../inc/myro.h
-myro.c: ../inc/scc.h
-parser.c: as.h
-parser.c: ../inc/scc.h
-symbol.c: as.h
-symbol.c: ../inc/scc.h
+expr.c: ./../inc/scc.h
+expr.c: ./as.h
+ins.c: ./../inc/scc.h
+ins.c: ./as.h
+main.c: ./../inc/arg.h
+main.c: ./../inc/scc.h
+main.c: ./as.h
+myro.c: ./../inc/myro.h
+myro.c: ./../inc/scc.h
+myro.c: ./as.h
+parser.c: ./../inc/scc.h
+parser.c: ./as.h
+symbol.c: ./../inc/scc.h
+symbol.c: ./as.h
+target/x80/ins.c: target/x80/../../../inc/scc.h
+target/x80/ins.c: target/x80/../../as.h
+target/x80/ins.c: target/x80/proc.h
+target/x80/z80.c: target/x80/../../../inc/scc.h
+target/x80/z80.c: target/x80/../../as.h
+target/x80/z80.c: target/x80/../x80/proc.h
+target/x86/amd64.c: target/x86/../../../inc/scc.h
+target/x86/amd64.c: target/x86/../../as.h
+target/x86/i386.c: target/x86/../../../inc/scc.h
+target/x86/i386.c: target/x86/../../as.h
+target/x86/i386.c: target/x86/../x86/proc.h
+target/x86/i8086.c: target/x86/arch16.h
+target/x86/ins.c: target/x86/../../../inc/scc.h
+target/x86/ins.c: target/x86/../../as.h
+target/x86/ins.c: target/x86/proc.h
--- a/ld/Makefile
+++ b/ld/Makefile
@@ -21,15 +21,15 @@
 distclean: clean
 
 #deps
-coff32.c: ../inc/coff32/filehdr.h
-coff32.c: ../inc/coff32/scnhdr.h
-coff32.c: ../inc/coff32/syms.h
-coff32.c: ../inc/scc.h
-coff32.c: ld.h
-formats.c: ld.h
-main.c: ../inc/ar.h
-main.c: ../inc/scc.h
-main.c: ../inc/syslibs.h
-main.c: ld.h
-obj.c: ../inc/scc.h
-obj.c: ld.h
+coff32.c: ./../inc/coff32/filehdr.h
+coff32.c: ./../inc/coff32/scnhdr.h
+coff32.c: ./../inc/coff32/syms.h
+coff32.c: ./../inc/scc.h
+coff32.c: ./ld.h
+formats.c: ./ld.h
+main.c: ./../inc/ar.h
+main.c: ./../inc/scc.h
+main.c: ./../inc/syslibs.h
+main.c: ./ld.h
+obj.c: ./../inc/scc.h
+obj.c: ./ld.h
--- a/mkdep.sh
+++ b/mkdep.sh
@@ -4,8 +4,10 @@
 trap "rm -f $$.tmp" 0 2 3
 
 (sed '/^#deps/q' Makefile
-for i in *.c
+for i in `find . -name '*.c'`
 do
-	sed -n '/#include "/ s/#include "\(.*\)"/'$i': \1/p' $i
+	file=${i#./}
+	dir=`dirname $i | sed -e 's,/*$,,' -e 's,\./,,'`
+	sed -n '/#include "/ s,#include "\(.*\)",'"$file: $dir"'/\1,p' $i
 done |
 sort) > $$.tmp && mv $$.tmp Makefile
--- a/nm/Makefile
+++ b/nm/Makefile
@@ -21,13 +21,13 @@
 distclean: clean
 
 #deps
-coff32.c: ../inc/coff32/filehdr.h
-coff32.c: ../inc/coff32/scnhdr.h
-coff32.c: ../inc/coff32/syms.h
-coff32.c: ../inc/scc.h
-coff32.c: nm.h
-formats.c: nm.h
-main.c: ../inc/ar.h
-main.c: ../inc/arg.h
-main.c: ../inc/scc.h
-main.c: nm.h
+coff32.c: ./../inc/coff32/filehdr.h
+coff32.c: ./../inc/coff32/scnhdr.h
+coff32.c: ./../inc/coff32/syms.h
+coff32.c: ./../inc/scc.h
+coff32.c: ./nm.h
+formats.c: ./nm.h
+main.c: ./../inc/ar.h
+main.c: ./../inc/arg.h
+main.c: ./../inc/scc.h
+main.c: ./nm.h