1# rules to make a distribution tarball from a svn repo 2# Copyright 2008-2009 Roy Marples <roy@marples.name> 3 4GITREF?= HEAD 5DISTPREFIX?= ${PROG}-${VERSION} 6DISTFILE?= ${DISTPREFIX}.tar.bz2 7 8CLEANFILES+= *.tar.bz2 9 10_VERSION_SH= sed -n 's/\#define VERSION[[:space:]]*"\(.*\)".*/\1/p' config.h 11_VERSION!= ${_VERSION_SH} 12VERSION= ${_VERSION}$(shell ${_VERSION_SH}) 13 14_SNAP_SH= date -u +%Y%m%d%H%M 15_SNAP!= ${_SNAP_SH} 16SNAP= ${_SNAP}$(shell ${_SNAP_SH}) 17SNAPDIR= ${DISTPREFIX}-${SNAP} 18SNAPFILE= ${SNAPDIR}.tar.bz2 19 20dist: 21 git archive --prefix=${DISTPREFIX}/ ${GITREF} | bzip2 > ${DISTFILE} 22 23snapshot: 24 mkdir /tmp/${SNAPDIR} 25 cp -RPp * /tmp/${SNAPDIR} 26 (cd /tmp/${SNAPDIR}; make clean) 27 tar -cvjpf ${SNAPFILE} -C /tmp ${SNAPDIR} 28 rm -rf /tmp/${SNAPDIR} 29 ls -l ${SNAPFILE} 30 31snap: snapshot 32