Applications/*/Makefile.6809: Tidy up dependencies in rules
authorTormod Volden <debian.tormod@gmail.com>
Sat, 28 May 2016 15:32:48 +0000 (17:32 +0200)
committerAlan Cox <alan@etchedpixels.co.uk>
Tue, 31 May 2016 11:40:58 +0000 (12:40 +0100)
Avoid having all objects depend on all source files. Instead use
better defined static rules that contain the dependencies.

By using $^ in the APPS rules the CRT0 is included because
the APPS depend on it. Makes it easy to let e.g. APPSNS depend
on CRT0NS instead.

Also fix the size.report target so that it gets built only when
needed.

Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
Applications/MWC/cmd/Makefile.6809
Applications/V7/cmd/Makefile.6809
Applications/V7/cmd/sh/Makefile.6809
Applications/V7/games/Makefile.6809
Applications/cave/Makefile.6809
Applications/dw/Makefile.6809
Applications/games/Makefile.6809
Applications/levee/Makefile.6809
Applications/util/Makefile.6809

index 142fefd..2d538d5 100644 (file)
@@ -21,14 +21,12 @@ OBJS = $(SRCS:.c=.o)
 
 APPS = $(OBJS:.o=)
 
-all: $(APPS) sizes
-
-$(OBJS): $(SRCS)
+all: $(APPS) size.report
 
 $(APPS): $(CRT0)
 
-%: %.o
-       $(LINKER) -o $@ $(LINKER_OPT) $(CRT0) $<
+$(APPS): %: %.o
+       $(LINKER) -o $@ $(LINKER_OPT) $^
 
 expr.c: expr.y
        byacc -o expr.c expr.y
@@ -36,8 +34,8 @@ expr.c: expr.y
 find.c: find.y
        byacc -o find.c find.y
 
-sizes: $(APPS)
-       ls -l $(APPS) > size.report
+size.report: $(APPS)
+       ls -l $^ > $@
 
 clean:
        rm -f $(OBJS) $(APPS) $(SRCS:.c=) core *~ *.asm *.lst *.sym *.map *.noi *.lk *.ihx *.tmp *.bin size.report
index bb70094..135175a 100644 (file)
@@ -24,17 +24,15 @@ OBJS = $(SRCS:.c=.o)
 
 APPS = $(OBJS:.o=)
 
-all: $(APPS) sizes
-
-$(OBJS): $(SRCS)
+all: $(APPS) size.report
 
 $(APPS): $(CRT0)
 
-%: %.o
-       $(LINKER) -o $@ $(LINKER_OPT) $(CRT0) $<
+$(APPS): %: %.o
+       $(LINKER) -o $@ $(LINKER_OPT) $^
 
-sizes: $(APPS)
-       ls -l $(APPS) > size.report
+size.report: $(APPS)
+       ls -l $^ > $@
 
 clean:
        rm -f $(OBJS) $(APPS) $(SRCS:.c=) core *~ *.asm *.lst *.sym *.map *.noi *.lk *.ihx *.tmp *.bin size.report
index b0cb525..37d2e48 100644 (file)
@@ -31,8 +31,8 @@ $(OBJS): $(INCS)
 $(OBJS): %.o : %.c
        $(CC) -c $(CFLAGS) $(COPT) $<
 
-sh: $(OBJS)
-       $(LINKER) -o $@ $(LINKER_OPT) $(CRT0) $(OBJS)
+sh: $(OBJS) $(CRT0)
+       $(LINKER) -o $@ $(LINKER_OPT) $^
 
 clean:
        rm -f $(OBJS) sh $(SRCS:.c=) core *~
index 44cfd92..e61bb9e 100644 (file)
@@ -21,17 +21,15 @@ OBJS = $(SRCS:.c=.o)
 
 APPS = $(OBJS:.o=)
 
-all: $(APPS) sizes
-
-$(OBJS): $(SRCS)
+all: $(APPS) size.report
 
 $(APPS): $(CRT0)
 
-%: %.o
-       $(LINKER) -o $@ $(LINKER_OPT) $(CRT0) $<
+$(APPS): %: %.o
+       $(LINKER) -o $@ $(LINKER_OPT) $^
 
-sizes: $(APPS)
-       ls -l $(APPS) > size.report
+size.report: $(APPS)
+       ls -l $^ > $@
 
 clean:
        rm -f $(OBJS) $(APPS) $(SRCS:.c=) core *~ *.asm *.lst *.sym *.map *.noi *.lk *.ihx *.tmp *.bin size.report
index 0715f84..26d18f1 100644 (file)
@@ -17,6 +17,8 @@ CRT0 = ../../Library/libs/crt0_6809.o
 
 SRC = advent.c adventdb.c database.c english.c itverb.c lib.c saveadv.c \
       turn.c verb.c
+
+
 OBJ = $(SRC:.c=.o)
 
 .SUFFIXES: .c .o
@@ -32,8 +34,8 @@ advgen: advgen.c
 .c.o:
        $(CC) $(CFLAGS) $(CCOPTS) -c $<
 
-advent: $(OBJ)
-       $(LINKER) -o $@ $(LINKER_OPT) $(CRT0) $(OBJ)
+advent: $(OBJ) $(CRT0)
+       $(LINKER) -o $@ $(LINKER_OPT) $^
 
 clean:
        rm -f advent advent.db advgen *.rel *.asm *.lst core *.sym *.map *.noi *.lk *.ihx *.tmp *.bin *.o
index e2f3250..2de2cb0 100644 (file)
@@ -21,17 +21,15 @@ OBJS = $(SRCS:.c=.o)
 
 APPS = $(OBJS:.o=)
 
-all: $(APPS) sizes
-
-$(OBJS): $(SRCS)
+all: $(APPS) size.report
 
 $(APPS): $(CRT0)
 
-%: %.o
-       $(LINKER) -o $@ $(LINKER_OPT) $(CRT0) $<
+$(APPS): %: %.o
+       $(LINKER) -o $@ $(LINKER_OPT) $^
 
-sizes: $(APPS)
-       ls -l $(APPS) > size.report
+size.report: $(APPS)
+       ls -l $^ > $@
 
 clean:
        rm -f $(OBJS) $(APPS) $(SRCS:.c=) core *~ *.asm *.lst *.sym *.map *.noi *.lk *.ihx *.tmp *.bin size.report
index afb115d..acf65e5 100644 (file)
@@ -29,19 +29,17 @@ OBJSBAD = $(SRCSBAD:.c=.rel)
 
 APPS = $(OBJS:.o=)
 
-all: $(APPS) sizes
-
-$(OBJS): $(SRCS)
+all: $(APPS) size.report
 
 $(APPS): $(CRT0)
 
 $(APPSNS): OPTS = --nostdio
 
-%: %.o
-       $(LINKER) -o $@ $(LINKER_OPT) $(CRT0) $<
+$(APPS): %: %.o
+       $(LINKER) -o $@ $(LINKER_OPT) $^
 
-sizes: $(APPS)
-       ls -l $(APPS) > size.report
+size.report: $(APPS)
+       ls -l $^ > $@
 
 clean:
        rm -f $(OBJS) $(APPS) $(SRCS:.c=) core *~ *.asm *.lst *.sym *.map *.noi *.lk *.ihx *.tmp *.bin size.report
index 2cf2318..0c05f62 100644 (file)
@@ -21,13 +21,11 @@ CSRCS += move.c rmxcall.c ucsd.c undo.c unixcall.c wildargs.c
 
 OBJS = $(CSRCS:.c=.o)
 
-levee: $(OBJS)
-       $(LINKER) -o levee $(LINKER_OPT) $(CRT0) $(OBJS)
+levee: $(OBJS) $(CRT0)
+       $(LINKER) -o levee $(LINKER_OPT) $^
 
-$(OBJS): $(CSRCS)
-
-.c.o:
-       $(CC) $(CFLAGS) $(COPT) -c $(@:.o=.c)
+$(OBJS): %.o: %.c
+       $(CC) $(CFLAGS) $(COPT) -c $<
 
 clean:
        rm -rf $(OBJS) *.lst *.sym *.map *.noi *.lk *.ihx *.tmp *~ *.o *.asm levee levee.bin
index 8cf8643..4ed3118 100644 (file)
@@ -103,17 +103,15 @@ OBJS = $(SRCS:.c=.o)
 
 APPS = $(OBJS:.o=)
 
-all: $(APPS) sizes
-
-$(OBJS): $(SRCS)
+all: $(APPS) size.report
 
 $(APPS): $(CRT0)
 
-%: %.o
-       $(LINKER) -o $@ $(LINKER_OPT) $(CRT0) $<
+$(APPS): %: %.o
+       $(LINKER) -o $@ $(LINKER_OPT) $^
 
-sizes: $(APPS)
-       ls -l $(APPS) > size.report
+size.report: $(APPS)
+       ls -l $^ > $@
 
 clean:
        rm -f $(OBJS) $(APPS) $(SRCS:.c=) core *~ *.asm *.lst *.sym *.map *.noi *.lk *.ihx *.tmp *.bin size.report