Home | History | Annotate | Download | only in mk
      1 # rules to make a distribution tarball from a svn repo
      2 # Copyright 2008-2009 Roy Marples <roy (a] marples.name>
      3 
      4 GITREF?=	HEAD
      5 DISTPREFIX?=	${PROG}-${VERSION}
      6 DISTFILE?=	${DISTPREFIX}.tar.bz2
      7 
      8 CLEANFILES+=	*.tar.bz2
      9 
     10 _VERSION_SH=	sed -n 's/\#define VERSION[[:space:]]*"\(.*\)".*/\1/p' config.h
     11 _VERSION!=	${_VERSION_SH}
     12 VERSION=	${_VERSION}$(shell ${_VERSION_SH})
     13 
     14 _SNAP_SH=	date -u +%Y%m%d%H%M
     15 _SNAP!=		${_SNAP_SH}
     16 SNAP=		${_SNAP}$(shell ${_SNAP_SH})
     17 SNAPDIR=	${DISTPREFIX}-${SNAP}
     18 SNAPFILE=	${SNAPDIR}.tar.bz2
     19 
     20 dist:
     21 	git archive --prefix=${DISTPREFIX}/ ${GITREF} | bzip2 > ${DISTFILE}
     22 
     23 snapshot:
     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 
     31 snap: snapshot
     32