File: Makelocal-version

package info (click to toggle)
cod-tools 3.7.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 154,792 kB
  • sloc: perl: 57,588; sh: 36,842; ansic: 6,402; xml: 1,982; yacc: 1,117; makefile: 727; python: 166
file content (59 lines) | stat: -rw-r--r-- 1,655 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#--*- Makefile -*--

TRUNK    ?= ^/trunk
BRANCHES ?= ^/branches
RELEASES ?= ${BRANCHES}/release
PKG_NAME ?= $(shell pwd | xargs dirname | xargs basename)

.PHONY: release major minor patch

VFILE ?= .version

VERSION := $(shell grep -v "^\#" ${VFILE})

version.h: version.hin ${VFILE}
	sed 's/@VERSION@/${VERSION}/' $< > $@

src/lib/perl5/COD/ToolsVersion.pm: src/lib/perl5/COD/ToolsVersion.pmin ${VFILE}
	sed 's/@VERSION@/${VERSION}/' $< > $@

scripts/cod-tools-version: scripts/cod-tools-version.in ${VFILE}
	sed 's/@VERSION@/${VERSION}/' $< > $@
	chmod 755 $@

release:
	svn ci
	perl -lpi -e 's/\(unreleased\)/(${VERSION})/ if $$. == 1' CHANGELOG
	perl -lpi -e 's/\.\.\./${PKG_NAME}/ if $$. == 1' CHANGELOG
	svn ci -m "CHANGELOG: switching from 'unreleased' to '${VERSION}'"
	svn cp ${TRUNK} ${RELEASES}/v${VERSION} \
	   -m "Preparing version ${VERSION} for release in the release branch."
	${MAKE} patch
	echo "${PKG_NAME} (unreleased)\n\n  * ...\n" | cat - CHANGELOG \
		> CHANGELOG.$$$$.tmp; \
	mv -f CHANGELOG.$$$$.tmp CHANGELOG

major:
	awk -F. '/^#/{print} !/^#/{print $$1+1 ".0" ".0"}' \
		${VFILE} > ${VFILE}.$$$$; \
	cat ${VFILE}.$$$$ > ${VFILE}; \
	rm -f ${VFILE}.$$$$

minor:
	awk -F. '/^#/{print} !/^#/{print $$1 "." $$2+1 ".0"}' \
		${VFILE} > ${VFILE}.$$$$; \
	cat ${VFILE}.$$$$ > ${VFILE}; \
	rm -f ${VFILE}.$$$$

patch:
	awk -F. '/^#/{print} !/^#/{print $$1 "." $$2 "." $$3+1}' \
		${VFILE} > ${VFILE}.$$$$; \
	cat ${VFILE}.$$$$ > ${VFILE}; \
	rm -f ${VFILE}.$$$$

cleanAll distclean: clean-version

clean-version:
	rm -f version.h
	rm -f src/lib/perl5/COD/ToolsVersion.pm scripts/cod-tools-version
	rm -f scripts/.cod-tools-version.d