scc

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

commit f32c29193303956080b8464b51fca4a89a1af70b
parent 0c64d08544cf7178fe10562a6169838202f43de5
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Wed, 16 May 2018 20:01:22 +0100

[as] Simplify build system

Get rid of gendep.sh. This was very stupid since all the rules can be
encoded directly in the Makefile. If you don't want to build everything
then you only have to run make with a different target than all.

Diffstat:
Mas/Makefile | 23+++++++++++++++++++++--
Das/gendep.sh | 27---------------------------
Mas/target/amd64.mk | 11++++++-----
Mas/target/i386.mk | 8+++-----
Mas/target/z80.mk | 8+++-----
5 files changed, 33 insertions(+), 44 deletions(-)

diff --git a/as/Makefile b/as/Makefile @@ -8,7 +8,7 @@ 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: +all: as-amd64 as-i386 as-z80 $(OBJ): $(HDR) @@ -18,7 +18,7 @@ as: $(OBJ) myro.o: $(PROJECTDIR)/inc/myro.h dep: - ./gendep.sh $(TARGETS) + $(PROJECTDIR)/mkdep.sh clean: rm -f *.o target/*/*.o @@ -29,3 +29,22 @@ clean: 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 diff --git a/as/gendep.sh b/as/gendep.sh @@ -1,27 +0,0 @@ -#!/bin/sh - -set -e - -rm -f makefile -trap "rm -f $$.mk" 0 2 3 - -re='\([^-]*\)-\([^-]*\)-\([^-]*\)-\([^-]*\)' - -echo $@ | -tr ' ' '\n' | -sed "s/$re/\1/" | -sort -u | -(cat Makefile -while read i -do - cat <<EOF -include target/$i.mk - -\$(OBJ-$i): \$(HDR) -all: as-$i -OBJ-$i: \$(HDR) -as-$i: \$(OBJ-$i) \$(LIBDIR)/libscc.a - \$(CC) \$(SCC_LDFLAGS) \$(OBJ-$i) -lscc -o \$@ - -EOF -done) > $$.mk && mv $$.mk makefile diff --git a/as/target/amd64.mk b/as/target/amd64.mk @@ -1,9 +1,10 @@ - -amd64_LST = target/x86/amd64tbl.o target/x86/amd64.o target/x86/ins.o - -$(amd64_LST): target/x86/proc.h +AMD64_OBJ = $(OBJ) target/x86/amd64tbl.o target/x86/amd64.o target/x86/ins.o target/x86/amd64tbl.c: gentbl.awk target/x86/x86.dat target/x86/rules.dat ./gentbl.sh -f x86 -c amd64 -OBJ-amd64 = $(OBJ) $(amd64_LST) +as-amd64: $(AMD64_OBJ) $(LIBDIR)/libscc.a + $(CC) $(SCC_LDFLAGS) $(AMD64_OBJ) -lscc -o $@ + +debug: + echo $(AMD64_OBJ) diff --git a/as/target/i386.mk b/as/target/i386.mk @@ -1,9 +1,7 @@ - -i386_LST = target/x86/i386tbl.o target/x86/i386.o target/x86/ins.o - -$(i386_LST): target/x86/proc.h +I386_OBJ = $(OBJ) target/x86/i386tbl.o target/x86/i386.o target/x86/ins.o target/x86/i386tbl.c: gentbl.awk target/x86/x86.dat target/x86/rules.dat ./gentbl.sh -f x86 -c i386 -OBJ-i386 = $(OBJ) $(i386_LST) +as-i386: $(I386_OBJ) $(LIBDIR)/libscc.a + $(CC) $(SCC_LDFLAGS) $(I386_OBJ) -lscc -o $@ diff --git a/as/target/z80.mk b/as/target/z80.mk @@ -1,9 +1,7 @@ - -Z80_LST = target/x80/z80tbl.o target/x80/z80.o target/x80/ins.o - -$(Z80_LST): target/x80/proc.h +Z80_OBJ = $(OBJ) target/x80/z80tbl.o target/x80/z80.o target/x80/ins.o target/x80/z80tbl.c: gentbl.awk target/x80/x80.dat target/x80/rules.dat LC_ALL=C ./gentbl.sh -f x80 -c z80 -OBJ-z80 = $(OBJ) $(Z80_LST) +as-z80: $(OBJ) $(Z80_OBJ) $(LIBDIR)/libscc.a + $(CC) $(SCC_LDFLAGS) $(Z80_OBJ) -lscc -o $@