scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit 96a4b58a74f86d848e9a32f7dc35d9ead549f6c7
parent f32c29193303956080b8464b51fca4a89a1af70b
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Wed, 16 May 2018 20:30:57 +0100

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.

Diffstat:
Mas/Makefile | 52++++++++++++++++++++++++++++++----------------------
Mld/Makefile | 24++++++++++++------------
Mmkdep.sh | 6++++--
Mnm/Makefile | 20++++++++++----------
4 files changed, 56 insertions(+), 46 deletions(-)

diff --git a/as/Makefile b/as/Makefile @@ -5,46 +5,54 @@ include $(PROJECTDIR)/rules.mk 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 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 diff --git a/ld/Makefile b/ld/Makefile @@ -21,15 +21,15 @@ clean: 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 diff --git a/mkdep.sh b/mkdep.sh @@ -4,8 +4,10 @@ set -e 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 diff --git a/nm/Makefile b/nm/Makefile @@ -21,13 +21,13 @@ clean: 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