1 # Here's the (hopefully simple) versioning scheme.
3 # Releases of fips have a two-digit version (0.1, 0.2, etc.). We
4 # increment the second digit for each release and increment the first
5 # digit when we reach particularly major milestones of usability.
7 # Between releases, (such as when compiling fips from the git
8 # repository), we let git append identification of the actual commit.
11 IS_GIT=$(shell if [ -d .git ] ; then echo yes ; else echo no; fi)
14 DATE:=$(shell git log --date=short -1 --pretty=format:%cd)
16 DATE:=$(shell date +%F)
19 VERSION:=$(shell cat ${srcdir}/version)
20 ifeq ($(filter release release-message pre-release, $(MAKECMDGOALS)),)
22 VERSION:=$(shell git describe --match '[0-9.]*' 2>/dev/null | sed -e s/_/~/ -e s/-/+/ -e s/-/~/)
26 UPSTREAM_TAG=$(subst ~,_,$(VERSION))
27 DEB_TAG=debian/$(UPSTREAM_TAG)-1
29 RELEASE_HOST=cworth.org
30 RELEASE_DIR=/home/cworth/public_html/fips/releases
31 RELEASE_URL=http://cworth.org/fips/releases
32 TAR_FILE=$(PACKAGE)-$(VERSION).tar.gz
33 DEB_TAR_FILE=$(PACKAGE)_$(VERSION).orig.tar.gz
34 SHA1_FILE=$(TAR_FILE).sha1
35 GPG_FILE=$(SHA1_FILE).asc
38 if git tag -v $(VERSION) >/dev/null 2>&1; then \
42 echo "Warning: No signed tag for $(VERSION)"; \
44 git archive --format=tar --prefix=$(PACKAGE)-$(VERSION)/ $$ref > $(TAR_FILE).tmp
45 echo $(VERSION) > version.tmp
46 tar --append -f $(TAR_FILE).tmp --transform s_^_$(PACKAGE)-$(VERSION)/_ --transform 's_.tmp$$__' version.tmp
48 gzip < $(TAR_FILE).tmp > $(TAR_FILE)
49 @echo "Source is ready for release in $(TAR_FILE)"
51 $(SHA1_FILE): $(TAR_FILE)
54 $(GPG_FILE): $(SHA1_FILE)
55 @echo "Please enter your GPG password to sign the checksum."
61 # We invoke make recursively only to force ordering of our phony
62 # targets in the case of parallel invocation of make (-j).
64 # We carefully ensure that our VERSION variable is passed down to any
65 # sub-ordinate make invocations (which won't otherwise know that they
66 # are part of the release and need to take the version from the
69 release: verify-source-tree-and-version
70 $(MAKE) VERSION=$(VERSION) verify-newer
71 $(MAKE) VERSION=$(VERSION) clean
72 $(MAKE) VERSION=$(VERSION) test
73 git tag -s -m "$(PACKAGE) $(VERSION) release" $(UPSTREAM_TAG)
74 $(MAKE) VERSION=$(VERSION) $(GPG_FILE)
75 ln -sf $(TAR_FILE) $(DEB_TAR_FILE)
76 pristine-tar commit $(DEB_TAR_FILE) $(UPSTREAM_TAG)
77 git tag -s -m "$(PACKAGE) Debian $(VERSION)-1 upload (same as $(VERSION))" $(DEB_TAG)
79 mv $(TAR_FILE) $(SHA1_FILE) $(GPG_FILE) releases
80 $(MAKE) VERSION=$(VERSION) release-message > $(PACKAGE)-$(VERSION).announce
81 ifeq ($(REALLY_UPLOAD),yes)
82 git push origin $(VERSION)
83 cd releases && scp $(TAR_FILE) $(SHA1_FILE) $(GPG_FILE) $(RELEASE_HOST):$(RELEASE_DIR)
84 ssh $(RELEASE_HOST) "rm -f $(RELEASE_DIR)/LATEST-$(PACKAGE)-* ; ln -s $(TAR_FILE) $(RELEASE_DIR)/LATEST-$(TAR_FILE)"
86 @echo "Please send a release announcement using $(PACKAGE)-$(VERSION).announce as a template."
90 $(MAKE) VERSION=$(VERSION) clean
91 $(MAKE) VERSION=$(VERSION) test
92 git tag -s -m "$(PACKAGE) $(VERSION) release" $(UPSTREAM_TAG)
93 git tag -s -m "$(PACKAGE) Debian $(VERSION)-1 upload (same as $(VERSION))" $(DEB_TAG)
94 $(MAKE) VERSION=$(VERSION) $(TAR_FILE)
95 ln -sf $(TAR_FILE) $(DEB_TAR_FILE)
96 pristine-tar commit $(DEB_TAR_FILE) $(UPSTREAM_TAG)
98 mv $(TAR_FILE) $(DEB_TAR_FILE) releases
100 .PHONY: debian-snapshot
102 make VERSION=$(VERSION) clean
103 TMPFILE=$$(mktemp /tmp/fips.XXXXXX); \
104 cp debian/changelog $${TMPFILE}; \
105 EDITOR=/bin/true dch -b -v $(VERSION)+1 \
106 -D UNRELEASED 'test build, not for upload'; \
107 echo '3.0 (native)' > debian/source/format; \
109 mv -f $${TMPFILE} debian/changelog; \
110 echo '3.0 (quilt)' > debian/source/format
112 .PHONY: release-message
115 @echo "Subject: $(PACKAGE) release $(VERSION) now available"
117 @echo "Where to obtain fips $(VERSION)"
118 @echo "==========================="
119 @echo " $(RELEASE_URL)/$(TAR_FILE)"
121 @echo "Which can be verified with:"
123 @echo " $(RELEASE_URL)/$(SHA1_FILE)"
125 @cat releases/$(SHA1_FILE)
127 @echo " $(RELEASE_URL)/$(GPG_FILE)"
128 @echo " (signed by `getent passwd "$$USER" | cut -d: -f 5 | cut -d, -f 1`)"
130 @echo "What's new in fips $(VERSION)"
131 @echo "========================="
132 @sed -ne '/^[Ff]ips $(VERSION)/{n;n;b NEWS}; d; :NEWS /^===/q; {p;n;b NEWS}' < NEWS | head -n -2
136 @echo "Fips is a program for monitoring performance of OpenGL applications"
138 # This is a chain of dependencies rather than a simple list simply to
139 # avoid the messages getting interleaved in the case of a parallel
141 .PHONY: verify-source-tree-and-version
142 verify-source-tree-and-version: verify-no-dirty-code
144 .PHONY: verify-no-dirty-code
145 verify-no-dirty-code:
147 @printf "Checking that source tree is clean..."
148 ifneq ($(shell git ls-files -m),)
150 @echo "The following files have been modified since the most recent git commit:"
154 @echo "The release will be made from the committed state, but perhaps you meant"
155 @echo "to commit this code first? Please clean this up to make it more clear."
164 @echo -n "Checking that no $(VERSION) release already exists..."
165 @wget -q -O /dev/null $(RELEASE_URL)/$(TAR_FILE) ; \
169 echo "Found: $(RELEASE_URL)/$(TAR_FILE)"; \
170 echo "Refusing to replace an existing release."; \
171 echo "Don't forget to update \"version\" as described in RELEASING before release." ; \
173 *) echo "An unexpected error occured"; \