Let 'make dist' use fairymax.c version in tar-ball name
authorH.G.Muller <hgm@hgm-xboard.(none)>
Thu, 23 Oct 2014 18:41:06 +0000 (20:41 +0200)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Thu, 23 Oct 2014 18:41:06 +0000 (20:41 +0200)
The VERSION is extracted from the C source with grep|sed, and assigned
to a variable in the Makefile (if it was not defined already), which is
then used in the tar-ball name when creating the distro tar ball.

Makefile

index 6e8f804..1d0a677 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -4,7 +4,7 @@ CC?=gcc
 CFLAGS?= -O2 -s
 INI_F?=$(DESTDIR)/usr/share/games/fairymax/fmax.ini
 INI_Q?=$(DESTDIR)/usr/share/games/fairymax/qmax.ini
-
+VERSION?=`grep 'define VERSION' fairymax.c | sed -e 's/.*"\(.*\)".*/\1/'`
 
 ALL= fairymax shamax maxqi fairymax.6.gz
 
@@ -48,15 +48,16 @@ clean:
 dist-clean:
        rm -f ${ALL} *~ data/*~ *.man md5sums
 
-dist:
+dist: fairymax
        install -d -m0755 Fairy-Max
        install -d -m0755 Fairy-Max/data
        rm -f fairymax.tar fairymax.tar.gz
        cp fairymax.c maxqi.c fairymax.pod Makefile README changelog copyright Fairy-Max
        cp data/* Fairy-Max/data
        (md5sum Fairy-Max/* Fairy-Max/data/* > Fairy-Max/md5sums) || true
-       tar -cvvf fairymax.tar Fairy-Max
-       gzip fairymax.tar
+       tar -cvvf fairymax-$(VERSION).tar Fairy-Max
+       gzip fairymax-$(VERSION).tar
+       rm fairymax
        rm Fairy-Max/data/*
        rmdir Fairy-Max/data
        rm Fairy-Max/*