openrc/mk/dist.mk

32 lines
804 B
Makefile
Raw Normal View History

2008-01-10 22:07:42 +05:30
# rules to make a distribution tarball from a git repo
2009-05-01 19:41:40 +05:30
# Copyright (c) 2008 Roy Marples <roy@marples.name>
# All rights reserved. Released under the 2-clause BSD license.
2008-01-10 22:07:42 +05:30
2009-04-30 19:35:39 +05:30
GITREF?= HEAD
2008-03-03 18:44:54 +05:30
DISTPREFIX?= ${NAME}-${VERSION}
2008-01-10 22:07:42 +05:30
DISTFILE?= ${DISTPREFIX}.tar.bz2
2009-01-13 04:42:06 +05:30
CLEANFILES+= ${NAME}-*.tar.bz2
_SNAP_SH= date -u +%Y%m%d%H%M
_SNAP!= ${_SNAP_SH}
SNAP= ${_SNAP}$(shell ${_SNAP_SH})
SNAPDIR= ${DISTPREFIX}-${SNAP}
SNAPFILE= ${SNAPDIR}.tar.bz2
2008-01-10 22:07:42 +05:30
dist:
2009-04-30 19:35:39 +05:30
git archive --prefix=${DISTPREFIX}/ ${GITREF} | bzip2 > ${DISTFILE}
2009-01-13 04:42:06 +05:30
snapshot:
rm -rf /tmp/${SNAPDIR}
mkdir /tmp/${SNAPDIR}
cp -RPp * /tmp/${SNAPDIR}
(cd /tmp/${SNAPDIR}; make clean)
find /tmp/${SNAPDIR} -name .svn -exec rm -rf -- {} \; 2>/dev/null || true
tar -cvjpf ${SNAPFILE} -C /tmp ${SNAPDIR}
rm -rf /tmp/${SNAPDIR}
ls -l ${SNAPFILE}
snap: snapshot