File: rules

package info (click to toggle)
xen-common 3.2.0-2
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 680 kB
  • ctags: 279
  • sloc: sh: 2,708; makefile: 288; perl: 186; python: 170; xml: 8
file content (89 lines) | stat: -rwxr-xr-x 2,360 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
#!/usr/bin/make -f

#export DH_VERBOSE=1

DEB_HOST_ARCH  := $(shell dpkg-architecture -qDEB_HOST_ARCH)
DEB_BUILD_ARCH := $(shell dpkg-architecture -qDEB_BUILD_ARCH)

SOURCE := $(shell dpkg-parsechangelog | sed -ne 's,^Source: *\(.*\)$$,\1,p')
VERSION_DEBIAN := $(shell dpkg-parsechangelog | sed -ne 's,^Version: *\(.*\)$$,\1,p')
VERSION := $(shell echo "$(VERSION_DEBIAN)" | sed -e 's,-[^-]*$$,,')

BUILD_DIR = debian/build
STAMPS_DIR = debian/stamps

srcfiles := $(filter-out debian, $(wildcard * .[^.]*))
source: $(STAMPS_DIR)/source
$(STAMPS_DIR)/source: $(STAMPS_DIR)
	dh_testdir
	@rm -rf $(BUILD_DIR)
	mkdir -p $(BUILD_DIR)
	cp -a $(srcfiles) $(BUILD_DIR)
	dpatch -d $(BUILD_DIR) apply-all
	touch $@

build: $(STAMPS_DIR)/source
	make -C $(BUILD_DIR)/docs man-pages

clean:
	dh_testdir
	rm -rf $(BUILD_DIR) $(STAMPS_DIR)
	dh_clean

$(BUILD_DIR) $(STAMPS_DIR):
	@[ -d $@ ] || mkdir -p $@

NO_ORIG = .svn .svk debian scripts

DIR_ORIG = ../orig/$(SOURCE)-$(VERSION)
TAR_ORIG_NAME = $(SOURCE)_$(VERSION).orig.tar.gz
TAR_ORIG = $(firstword $(wildcard ../$(TAR_ORIG_NAME)) $(wildcard ../orig/$(TAR_ORIG_NAME)))

orig: $(DIR_ORIG)
	rsync --delete $(foreach t, $(NO_ORIG), --exclude $(t)) --link-dest=$(DIR_ORIG)/ -a $(DIR_ORIG)/ .

$(DIR_ORIG):
ifeq ($(TAR_ORIG),)
	$(error Cannot find orig tarball $(TAR_ORIG_NAME))
else
	mkdir -p ../orig
	tar -C ../orig -xzf $(TAR_ORIG)
endif

# This is to make dpatch-edit-patch work
unpatch: clean

maintainerclean:
	rm -rf $(filter-out $(NO_ORIG), $(wildcard * .[^.]*))

install: $(STAMPS_DIR)/source
	dh_testdir
	dh_testroot
	dh_clean -k
	$(MAKE) -C $(BUILD_DIR)/tools/examples install DESTDIR=$(CURDIR)/debian/tmp DISTDIR=$(CURDIR)/debian/tmp
	$(MAKE) -C $(BUILD_DIR)/scripts install DESTDIR=$(CURDIR)/debian/tmp

binary-indep: install
	dh_testdir
	dh_testroot
	dh_install --sourcedir=debian/tmp
	dh_installchangelogs
	dh_installdocs
	dh_installexamples
	dh_installinit -p xen-utils-common --name xend --no-restart-on-upgrade -- defaults 20 21
	dh_installinit -p xen-utils-common --name xendomains --no-start -- defaults 21 20
	dh_installman $(BUILD_DIR)/docs/man1/* $(BUILD_DIR)/docs/man5/*
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary-arch:

binary: build binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install