From d985eafb487e701e4ce9c1866f0eb8198d682e2b Mon Sep 17 00:00:00 2001 From: Tormod Volden Date: Sat, 28 May 2016 17:32:48 +0200 Subject: [PATCH] Applications/*/Makefile.6809: Tidy up dependencies in rules 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 --- Applications/MWC/cmd/Makefile.6809 | 12 +++++------- Applications/V7/cmd/Makefile.6809 | 12 +++++------- Applications/V7/cmd/sh/Makefile.6809 | 4 ++-- Applications/V7/games/Makefile.6809 | 12 +++++------- Applications/cave/Makefile.6809 | 6 ++++-- Applications/dw/Makefile.6809 | 12 +++++------- Applications/games/Makefile.6809 | 12 +++++------- Applications/levee/Makefile.6809 | 10 ++++------ Applications/util/Makefile.6809 | 12 +++++------- 9 files changed, 40 insertions(+), 52 deletions(-) diff --git a/Applications/MWC/cmd/Makefile.6809 b/Applications/MWC/cmd/Makefile.6809 index 142fefdb..2d538d54 100644 --- a/Applications/MWC/cmd/Makefile.6809 +++ b/Applications/MWC/cmd/Makefile.6809 @@ -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 diff --git a/Applications/V7/cmd/Makefile.6809 b/Applications/V7/cmd/Makefile.6809 index bb700944..135175a4 100644 --- a/Applications/V7/cmd/Makefile.6809 +++ b/Applications/V7/cmd/Makefile.6809 @@ -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 diff --git a/Applications/V7/cmd/sh/Makefile.6809 b/Applications/V7/cmd/sh/Makefile.6809 index b0cb5253..37d2e48a 100644 --- a/Applications/V7/cmd/sh/Makefile.6809 +++ b/Applications/V7/cmd/sh/Makefile.6809 @@ -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 *~ diff --git a/Applications/V7/games/Makefile.6809 b/Applications/V7/games/Makefile.6809 index 44cfd925..e61bb9e0 100644 --- a/Applications/V7/games/Makefile.6809 +++ b/Applications/V7/games/Makefile.6809 @@ -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 diff --git a/Applications/cave/Makefile.6809 b/Applications/cave/Makefile.6809 index 0715f84e..26d18f14 100644 --- a/Applications/cave/Makefile.6809 +++ b/Applications/cave/Makefile.6809 @@ -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 diff --git a/Applications/dw/Makefile.6809 b/Applications/dw/Makefile.6809 index e2f32505..2de2cb04 100644 --- a/Applications/dw/Makefile.6809 +++ b/Applications/dw/Makefile.6809 @@ -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 diff --git a/Applications/games/Makefile.6809 b/Applications/games/Makefile.6809 index afb115d5..acf65e59 100644 --- a/Applications/games/Makefile.6809 +++ b/Applications/games/Makefile.6809 @@ -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 diff --git a/Applications/levee/Makefile.6809 b/Applications/levee/Makefile.6809 index 2cf23184..0c05f62e 100644 --- a/Applications/levee/Makefile.6809 +++ b/Applications/levee/Makefile.6809 @@ -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 diff --git a/Applications/util/Makefile.6809 b/Applications/util/Makefile.6809 index 8cf8643f..4ed31186 100644 --- a/Applications/util/Makefile.6809 +++ b/Applications/util/Makefile.6809 @@ -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 -- 2.34.1