diff options
-rw-r--r-- | Makefile | 76 |
1 files changed, 50 insertions, 26 deletions
@@ -22,6 +22,18 @@ kde-applications.menu: menu/validated-menu @echo " OK" checktag: + @if [ -e ".git" ]; then \ + if ! git diff --quiet ; then \ + echo not all changes are committed, aborting ; \ + exit 1 ; \ + fi ; \ + if [ -e ".git/svn" ]; then \ + if ! git diff --quiet HEAD..trunk ; then \ + echo not all changes were pushed to SVN repository ; \ + exit 1 ; \ + fi ; \ + fi ; \ + fi @if [ "x$(VERSION)" == "x" -o "x$(RELEASE)" = "x" ]; then \ echo usage is "make VERSION=version_number RELEASE=release_number dist" ; \ exit 1 ; \ @@ -31,38 +43,50 @@ clean: find . -type d -name '.xvpics' -o -name '*~' |xargs rm -rf rm -f applications.menu kde-applications.menu -# rules to build a test rpm - -localdist: menus cleandist dir localcopy tar - -cleandist: checktag - rm -rf $(PACKAGE)-$(VERSION) $(PACKAGE)-$(VERSION).tar.bz2 - rm -f applications.menu kde-applications.menu - -dir: checktag - mkdir $(PACKAGE)-$(VERSION) +# rules to build a distributable rpm -localcopy: checktag - find . -not -name "$(PACKAGE)-$(VERSION)"|cpio -pd $(PACKAGE)-$(VERSION)/ - find $(PACKAGE)-$(VERSION) -type d -name CVS -o -type d -name '.svn' -o -name .cvsignore -o -name '*~' |xargs rm -rf +dist: menus checktag clean changelog tag + rm -rf ../$(NAME)-$(VERSION)*.tar* $(NAME)-$(VERSION) + @if [ -e ".svn" ]; then \ + $(MAKE) dist-svn; \ + elif [ -e ".git" ]; then \ + $(MAKE) dist-git; \ + else \ + echo "Unknown SCM (not SVN nor GIT)";\ + exit 1; \ + fi; + $(info $(NAME)-$(VERSION).tar.bz2 is ready) -tar: checktag - tar cjvf $(PACKAGE)-$(VERSION).tar.bz2 $(PACKAGE)-$(VERSION) - rm -rf $(PACKAGE)-$(VERSION) +dist-git: + @git archive --prefix=$(NAME)-$(VERSION)/ HEAD | bzip2 -9 -c >../$(NAME)-$(VERSION).tar.bz2; -# rules to build a distributable rpm +dist-svn: + svn export -q -rBASE . $(NAME)-$(VERSION) + tar cfj ../$(NAME)-$(VERSION).tar.bz2 $(NAME)-$(VERSION) + rm -rf $(NAME)-$(VERSION) -dist: menus checktag cleandist changelog svntag export tar +tag: checktag + @if [ -e ".svn" ]; then \ + svn copy $(SVNROOT)/trunk $(SVNROOT)/tags/$(TAG) -m "$(TAG)"; \ + elif [ -e ".git" -a -e ".git/svn" ]; then \ + git svn tag $(TAG); \ + fi; +.PHONY: ChangeLog log changelog -export: checktag - svn export $(SVNROOT)/tags/$(TAG) $(PACKAGE)-$(VERSION) +log: ChangeLog -svntag: checktag - svn copy $(SVNROOT)/trunk $(SVNROOT)/tags/$(TAG) -m "$(TAG)" +changelog: ChangeLog -changelog: ../common/username #svn2cl is available in our contrib. - svn2cl --authors ../common/username.xml --accum - rm -f ChangeLog.bak - svn commit -m "Generated by svn2cl the `date '+%c'`" ChangeLog +ChangeLog: ../common/username.xml + @if test -d "$$PWD/.git"; then \ + ../common/gitlog-to-changelog | sed -e '/\tgit-svn-id:.*/d' > $@.tmp \ + && mv -f $@.tmp $@ \ + || (rm -f $@.tmp; \ + echo Failed to generate ChangeLog, your ChangeLog may be outdated >&2; \ + (test -f $@ || echo git-log is required to generate this file >> $@)); \ + else \ + svn2cl --accum --authors ../../soft/common/username.xml; \ + rm -f *.bak; \ + fi; |