# $Id: Makefile.release,v 1.12 2005/04/06 17:52:37 ronys Exp $
# This makefile automates the build of releases for sourceforge
# The RELEASENAME should be changed per release
# The RELEASEDIR should be set to whatever works for you.
#
# 'make -f Makefile.release' or 'make -f Makefile.release release'
# will build both binary and source zipfiles.
# bin-release or src-release will build only what their names imply.
#
# Oh, this works with GNU make under Cygwin. YMMV on other makes...

RELEASENAME = 2.10

RELEASEDIR = "/cygdrive/c/local/src/PasswordSafe/Releases"

# Shouldn't need to change anything below this line

BINRELNAME = pwsafe-$(RELEASENAME)-bin
SRCRELNAME = pwsafe-$(RELEASENAME)-src

RM = /usr/bin/rm
CP = /usr/bin/cp
MV = /usr/bin/mv
GPG = /usr/local/bin/gpg
GPG_KEY = ronys@users.sourceforge.net
GPG_SIGN = $(GPG) --detach-sign --default-key $(GPG_KEY)
MD5SUM = /usr/bin/md5sum
FTP_PUT = /usr/bin/ncftpput -v upload.sourceforge.net incoming

MAKENSIS = /cygdrive/c/local/NSIS/makensis.exe

BIN_MANIFEST = README.txt ReleaseNotes.txt LICENSE \
	ChangeLog.txt Release/pwsafe.exe pwsafe.chm

.PHONY: all release bin-release src-release installable signatures \
	upload md5sums

all: release installable signatures md5sums

upload:
	(cd $(RELEASEDIR); \
	 $(FTP_PUT) pwsafe-$(RELEASENAME).exe \
	 $(BINRELNAME).zip $(SRCRELNAME).zip \
	 pwsafe-$(RELEASENAME).exe.sig \
	 $(BINRELNAME).zip.sig $(SRCRELNAME).zip.sig)

md5sums:
	(cd $(RELEASEDIR); \
	 $(MD5SUM) pwsafe-$(RELEASENAME).exe \
	 $(BINRELNAME).zip $(SRCRELNAME).zip)

signatures:
	$(GPG_SIGN) $(RELEASEDIR)/pwsafe-$(RELEASENAME).exe
	$(GPG_SIGN) $(RELEASEDIR)/$(BINRELNAME).zip
	$(GPG_SIGN) $(RELEASEDIR)/$(SRCRELNAME).zip

installable:
	$(MAKENSIS) /DVERSION=$(RELEASENAME) pwsafe.nsi
	$(MV) pwsafe-$(RELEASENAME).exe $(RELEASEDIR)

release: bin-release src-release

bin-release:
	@-mkdir $(RELEASEDIR)/$(BINRELNAME)
	$(CP) $(BIN_MANIFEST) $(RELEASEDIR)/$(BINRELNAME)
	(cd $(RELEASEDIR); zip -9 -r  foo ./$(BINRELNAME); \
	$(MV) foo.zip $(BINRELNAME).zip)
	@$(RM) -rf $(RELEASEDIR)/$(BINRELNAME)

src-release:
	@-mkdir $(RELEASEDIR)/$(SRCRELNAME)
	@$(CP) -R . $(RELEASEDIR)/$(SRCRELNAME)
	(cd $(RELEASEDIR)/$(SRCRELNAME); \
	 $(RM) -f Release/* Debug/*; \
	 find . \( -name '*~' -o -name '*.bak' -o -name \*.aps -o \
		   -name '*.plg' -o -name '*.ncb' -o -name '*.opt' -o \
		   -name '*.clw' -o \
                   -name '*.sav' -o -name '*.old' \) | xargs $(RM) -f; \
	 $(RM) -f Release/* Debug/* *~ *.bak *.sav *.old .#*; \
	 $(RM) -f corelib/Release/* corelib/Debug/* test/Debug/*; \
	 find . -type d -name CVS | xargs $(RM) -rf)
	(cd $(RELEASEDIR); zip -9 -r  bar ./$(SRCRELNAME); \
	$(MV) bar.zip $(SRCRELNAME).zip)
	@$(RM) -rf $(RELEASEDIR)/$(SRCRELNAME)

# $Log: Makefile.release,v $
# Revision 1.12  2005/04/06 17:52:37  ronys
# [1162048, 726521] Hotkey restore
#
# Revision 1.11  2005/01/15 11:04:52  ronys
# Updated for 2.08
#
# Revision 1.10  2004/11/24 16:14:15  ronys
# Updated for 2.07
#
# Revision 1.9  2004/11/02 18:29:48  ronys
# Updated for move to new machine
#
# Revision 1.8  2004/09/11 18:30:39  ronys
# Added some convenient targets
#
# Revision 1.7  2004/09/10 06:22:52  ronys
# bump version to 2.05
#
# Revision 1.6  2004/07/22 03:43:34  ronys
# Update for 2.04
#
# Revision 1.5  2004/06/11 03:57:30  ronys
# Moved older changes from ReleaseNotes to ChangeLog.
#
# Revision 1.4  2004/06/08 03:34:29  ronys
# silly mistakes
#
# Revision 1.3  2004/06/06 05:32:39  ronys
# release 2.03
#
# Revision 1.2  2004/06/03 20:29:09  ronys
# Copied from 1.92 branch.
#
# Revision 1.1.2.2  2003/08/29 06:17:25  ronys
# Removed winXP manifest file from the deliverable. I'm told that it's part of the executable...
#
# Revision 1.1.2.1  2003/08/09 11:05:41  ronys
# Added makefile to automate the building of src and binary releases (about time!)
#
