summaryrefslogtreecommitdiff
path: root/debian/rules
blob: a3476d9f32036a3380c31082bf55b826fb1a2caf (plain)
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#! /usr/bin/make -f

#   Copyright 1994-98,2001,4   joey@infodrom.org (Martin Schulze)
#
#   This program is free software; you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation; version 2 dated June, 1991.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program;  if not, write to the Free Software
#   Foundation Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
#
SHELL=/bin/bash

# The name and version of the source
#
source = $(shell grep "^Source: " debian/control|head -n 1|sed 's/Source: \(.*\)/\1/g')
package = $(shell grep "^Package: " debian/control|head -n 1|sed 's/Package: \(.*\)/\1/g')
version = $(shell grep "^$(source) " debian/changelog|head -n 1 |sed 's/.*(\(.*\)\-[^\-]*).*/\1/g')
revision = $(shell grep "^$(source) " debian/changelog|head -n 1 |sed 's/.*([^\-]*\-\(.*\)).*/\1/g')

installbin = install -g root -o root -m 755
installdoc = install -g root -o root -m 644

build:
	pod2man --section=1 --lax --center="Debian GNU/Linux" \
	  --release="Debian Project" cvs-mailcommit \
	  > cvs-mailcommit.1
	touch stamp-build

clean: debclean
	rm -f stamp-build
	rm -rf *~ debian/*~ cvs-mailcommit.1

debclean:
# Cleans debian binary directories to allow binary creation
	rm -rf debian/tmp
	rm -f debian/{files,substvars}

binary-arch:
# Nothing to be done here

binary-indep: debclean
	test -f stamp-build || $(MAKE) -f debian/rules build
	#
	$(installbin) -d debian/tmp/DEBIAN
	chown -R root.root debian/tmp
	chmod -R g-ws debian/tmp
	#
	$(installbin) -d debian/tmp/usr/share/doc/$(package)
	$(installdoc) debian/changelog debian/tmp/usr/share/doc/$(package)/changelog.Debian
	$(installdoc) debian/copyright debian/tmp/usr/share/doc/$(package)
	gzip -9fn debian/tmp/usr/share/doc/$(package)/changelog.Debian
	#
	$(installbin) -d debian/tmp/usr/bin
	$(installbin) cvs-mailcommit debian/tmp/usr/bin/
	#
	$(installbin) -d debian/tmp/usr/share/man/man1
	$(installdoc) cvs-mailcommit.1 debian/tmp/usr/share/man/man1/
	gzip -9n debian/tmp/usr/share/man/man?/*
	#
	# dpkg-shlibdeps debian/tmp/usr/bin/*
	dpkg-gencontrol -isp
	chown root.root debian/tmp/DEBIAN/control
	dpkg --build debian/tmp ..

binary: binary-indep binary-arch

source diff:
	@echo >&2 'source and diff are obsolete - use dpkg-source -b' or dsc; false

dsc:
	-test -d debian/tmp \
		&& $(MAKE) -f debian/rules clean
	if [ ! -f ../$(source)_$(version).orig.tar.gz -a -f ../orig/$(source)_$(version).orig.tar.gz ]; \
	then \
	  ln -s orig/$(source)_$(version).orig.tar.gz ../$(source)_$(version).orig.tar.gz; \
	  touch /tmp/stamp-$(source)-link; \
	fi; \
	cd .. && dpkg-source -b $(source)-$(version)
	if [ -f /tmp/stamp-$(source)-link ]; then \
	  rm ../$(source)_$(version).orig.tar.gz /tmp/stamp-$(source)-link; \
	fi

checkroot:
	$(checkdir)
	test root = "`whoami`"

dist: binary dsc

.PHONY: binary binary-arch binary-indep clean checkroot