From 1948f8cdda59d3b5cbcc72e3902a832108bca7ff Mon Sep 17 00:00:00 2001 From: Jakob Haufe Date: Tue, 6 Nov 2012 01:01:42 +0100 Subject: [PATCH] Restructure Makefile and create include/version.h Introduce include/version.h to contain the current version string. This removes the need to use /dev/std{in,out} in the Makefile and will create more useful error messages. --- .gitignore | 1 + Makefile | 16 +++++++++++----- src/credit_manager.c | 1 + src/itemz.c | 1 + src/kasse.c | 1 + 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index e4d5374..43f873b 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ kasse *.P00 itemz *.d64 +include/version.h diff --git a/Makefile b/Makefile index cea7061..b44b359 100644 --- a/Makefile +++ b/Makefile @@ -1,15 +1,21 @@ CC=cc65 AS=ca65 LD=cl65 -INCLUDES:=$(wildcard include/*.h) +INCLUDES:=$(wildcard include/*.h) include/version.h GV:=$(shell git describe --tags --always) +CFLAGS= -I include -t c128 -CFLAGS += -DGV=\"${GV}\" +.PHONY: include/version.h clean dist-clean -%.o: %.c ${INCLUDES} - ${CC} ${CFLAGS} -O -I include -t c128 $< -o /dev/stdout | ${AS} -I include -t c128 /dev/stdin -o $@ all: kasse itemz +%.o: %.c ${INCLUDES} + ${CC} ${CFLAGS} -O $< + ${AS} ${CFLAGS} $(addsuffix .s,$(basename $< )) + +include/version.h: + echo "#define GV \"${GV}\"" > $@ + kasse: src/config.o src/kasse.o src/general.o src/credit_manager.o src/c128time.o src/print.o ${LD} -t c128 $^ -o $@ @@ -43,6 +49,6 @@ test-package: test clean: rm -rf src/*.o src/*.s test/*.o test/*.s - + dist-clean: clean rm kasse itemz kasse.d64 diff --git a/src/credit_manager.c b/src/credit_manager.c index a76c128..670926d 100644 --- a/src/credit_manager.c +++ b/src/credit_manager.c @@ -14,6 +14,7 @@ #include "kasse.h" #include "c128time.h" #include "print.h" +#include "version.h" static char *filter = NULL; static BYTE filter_len; diff --git a/src/itemz.c b/src/itemz.c index 0b43fa8..609c76d 100644 --- a/src/itemz.c +++ b/src/itemz.c @@ -15,6 +15,7 @@ #include "general.h" #include "config.h" #include "credit_manager.h" +#include "version.h" static void itemz_print_screen() { BYTE i; diff --git a/src/kasse.c b/src/kasse.c index 7e652e0..895c2e6 100644 --- a/src/kasse.c +++ b/src/kasse.c @@ -17,6 +17,7 @@ #include "credit_manager.h" #include "c128time.h" #include "print.h" +#include "version.h" // drucker 4 oder 5 // graphic 4,0,10 -- 2.39.5