ref: b79ca20491ce1570c50880a476106d8bf5c46acc
parent: cbc79a2cfff4aa23e628158c2aa2b7035753cbe4
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Wed May 16 16:01:22 EDT 2018
[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.
--- a/as/Makefile
+++ b/as/Makefile
@@ -8,7 +8,7 @@
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 @@
myro.o: $(PROJECTDIR)/inc/myro.h
dep:
- ./gendep.sh $(TARGETS)
+ $(PROJECTDIR)/mkdep.sh
clean:
rm -f *.o target/*/*.o
@@ -29,3 +29,22 @@
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
--- a/as/gendep.sh
+++ /dev/null
@@ -1,27 +1,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
--- a/as/target/amd64.mk
+++ b/as/target/amd64.mk
@@ -1,9 +1,10 @@
+AMD64_OBJ = $(OBJ) target/x86/amd64tbl.o target/x86/amd64.o target/x86/ins.o
-amd64_LST = target/x86/amd64tbl.o target/x86/amd64.o target/x86/ins.o
-
-$(amd64_LST): target/x86/proc.h
-
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)
--- a/as/target/i386.mk
+++ b/as/target/i386.mk
@@ -1,9 +1,7 @@
+I386_OBJ = $(OBJ) target/x86/i386tbl.o target/x86/i386.o target/x86/ins.o
-i386_LST = target/x86/i386tbl.o target/x86/i386.o target/x86/ins.o
-
-$(i386_LST): target/x86/proc.h
-
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 $@
--- a/as/target/z80.mk
+++ b/as/target/z80.mk
@@ -1,9 +1,7 @@
+Z80_OBJ = $(OBJ) target/x80/z80tbl.o target/x80/z80.o target/x80/ins.o
-Z80_LST = target/x80/z80tbl.o target/x80/z80.o target/x80/ins.o
-
-$(Z80_LST): target/x80/proc.h
-
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 $@