File: rules

package info (click to toggle)
raidtools 0.42-21
  • links: PTS
  • area: main
  • in suites: potato
  • size: 400 kB
  • ctags: 128
  • sloc: ansic: 2,056; makefile: 137; sh: 85
file content (124 lines) | stat: -rwxr-xr-x 4,617 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
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#! /usr/bin/make -f

#   Copyright 1994-98   joey@infodrom.north.de (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., 675 Mass Ave., Cambridge, MA 02139, USA.
SHELL=/bin/bash

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

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

PROGRAMS=mdadd mdcreate mkraid ckraid

build:
	-test -f config.cache || ./configure --sysconfdir=/etc/raid
	$(MAKE) $(PROGRAMS)
	touch stamp-build

clean: debclean
	rm -f stamp-build
	rm -f $(PROGRAMS)
	-test -f Makefile && $(MAKE) -i clean
	rm -rf *~ Makefile config.cache config.log config.status

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

binary-indep:
# Nothing to be done here

binary-arch: 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) debian/{pre,post}inst debian/postrm debian/tmp/DEBIAN/
	$(installdoc) debian/conffiles debian/tmp/DEBIAN/
	#
	$(installbin) -d debian/tmp/usr/share/doc/$(package)
	$(installdoc) debian/copyright debian/tmp/usr/share/doc/$(package)
	$(installdoc) debian/changelog debian/tmp/usr/share/doc/$(package)/changelog.Debian
	$(installdoc) README debian/tmp/usr/share/doc/$(package)/readme.txt
	$(installdoc) HOWTO debian/tmp/usr/share/doc/$(package)/howto.txt
	$(installdoc) QuickStart.RAID debian/tmp/usr/share/doc/$(package)/quickstart.txt
	$(installdoc) debian/rootfs-raid debian/tmp/usr/share/doc/$(package)
	gzip -9f debian/tmp/usr/share/doc/$(package)/{{readme,howto,quickstart}.txt,changelog.Debian,rootfs-raid}
	#
	$(installbin) -d debian/tmp/usr/share/doc/$(package)/examples
	set -e; for f in *.sample; do \
		n=`echo $$f|sed 's/\.sample//'`; \
		$(installdoc) $$f debian/tmp/usr/share/doc/$(package)/examples/$$n; \
	done
	#
	$(installbin) -d debian/tmp/etc/raid debian/tmp/etc/init.d
	$(installbin) debian/raid debian/tmp/etc/init.d
	$(installbin) -d debian/tmp/etc/modutils
	$(installdoc) debian/raidtools.mod debian/tmp/etc/modutils/raidtools
	#
	$(installbin) -d debian/tmp/sbin debian/tmp/usr/share/man/man{5,8}
	set -e; for f in $(PROGRAMS); do \
		$(installbin) $$f debian/tmp/sbin; done
	set -e; for f in *.8; do \
		$(installdoc) $$f debian/tmp/usr/share/man/man8; done
	set -e; for f in *.5; do \
		$(installdoc) $$f debian/tmp/usr/share/man/man5; done
	$(installdoc) debian/{c,m}kraid.8 debian/tmp/usr/share/man/man8
	gzip -9f debian/tmp/usr/share/man/man?/*
	#
	set -e; for f in mdrun mdstop; do \
		ln -s mdadd debian/tmp/sbin/$$f ; \
		ln -s mdadd.8.gz debian/tmp/usr/share/man/man8/$$f.8.gz ; \
		chgrp root debian/tmp/sbin/$$f debian/tmp/usr/share/man/man8/$$f.8.gz ; \
	done
# I'll try to change the whole rules into debhelper once i have time
	dh_strip
	#
	dpkg-shlibdeps debian/tmp/sbin/{mdadd,mdcreate,ckraid,mkraid}
	dpkg-gencontrol
	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