shithub: rgbds

Download patch

ref: 48c34238eb82bd06790985c8cce303d3cbba984f
parent: e12cb95079f001aae1b1eeecd2463ccc61da1c30
author: Vegard Nossum <[email protected]>
date: Thu Jun 11 03:04:47 EDT 2009

asm: improve Makefile

Make the generated object files explicit and add a "clean" target.

Signed-off-by: Vegard Nossum <[email protected]>

--- a/src/asm/Makefile
+++ b/src/asm/Makefile
@@ -1,13 +1,29 @@
+obj := \
+	alloca.o \
+	asmy.o \
+	fstack.o \
+	globlex.o \
+	lexer.o \
+	main.o \
+	math.o \
+	output.o \
+	rpn.o \
+	symbol.o \
+	gameboy/locallex.o
+
 all: rgbasm
 
-asmy.y: yaccprt1.y gameboy/yaccprt2.y yaccprt3.y gameboy/yaccprt4.y
-	cat $^ > $@
+clean:
+	rm -rf rgbasm $(obj) asmy.y asmy.c asmy.h
 
-.y.c:
-	bison -d -o $@ $^
+rgbasm: $(obj)
+	gcc -Wall -o $@ $^ -lm
 
 .c.o:
 	gcc -Wall -DGAMEBOY -I. -I.. -Iinclude -Igameboy -g -c -o $@ $<
 
-rgbasm: $(patsubst %.c,%.o,$(wildcard *.c) $(wildcard gameboy/*.c))
-	gcc -Wall -o $@ $^ -lm
+.y.c:
+	bison -d -o $@ $^
+
+asmy.y: yaccprt1.y gameboy/yaccprt2.y yaccprt3.y gameboy/yaccprt4.y
+	cat $^ > $@