File: rules

package info (click to toggle)
ctdb 1.0.112-12-3
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 4,292 kB
  • ctags: 4,779
  • sloc: ansic: 43,144; sh: 10,967; xml: 3,034; makefile: 451; perl: 107; python: 101; awk: 59
file content (140 lines) | stat: -rwxr-xr-x 3,587 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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

# This has to be exported to make some magic below work.
export DH_OPTIONS

# Set the host and build architectures for use with config.cache loading,
# cross-building, etc.
DEB_HOST_GNU_TYPE	:= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE	:= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEB_HOST_ARCH_OS	:= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)

export DEB_HOST_GNU_TYPE
export DEB_BUILD_GNU_TYPE
export DEB_HOST_ARCH_OS

CFLAGS = -g -Wall

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
  CFLAGS += -O0
else
  CFLAGS += -O2
endif

include /usr/share/quilt/quilt.make

DESTDIR=$(CURDIR)/debian/ctdb

conf_args = \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var/lib \
		--with-logdir=/var/log/ctdb

configure: patch configure-stamp
configure-stamp:
	dh_testdir
	CFLAGS="$(CFLAGS)" ./configure $(conf_args)
	touch configure-stamp

#Architecture 
build: check-external-libs build-arch build-indep

build-arch: build-arch-stamp
build-arch-stamp: patch configure-stamp
	[ ! -f Makefile ] || $(MAKE)

build-indep: build-indep-stamp
build-indep-stamp: patch configure-stamp
	touch $@

clean:	clean-patched unpatch

clean-patched:
	dh_testdir
	dh_testroot
	rm -f build-arch-stamp build-indep-stamp configure-stamp
	rm -f utils/smnotify/smnotify.h utils/smnotify/gen_smnotify.c
	
	rm -rf $(DESTDIR)
	[ ! -f Makefile ] || $(MAKE) distclean
	
	dh_clean 

install: install-indep install-arch
install-indep:
	dh_testdir
	dh_testroot
	dh_clean -k -i 
	dh_installdirs -i
	
	dh_install -i

install-arch:
	dh_testdir
	dh_testroot
	dh_clean -k -s 
	dh_installdirs -s
	
	# Create the target build directory hierarchy
	mkdir -p $(DESTDIR)/etc/init.d
	mkdir -p $(DESTDIR)/etc/default
	$(MAKE) DESTDIR=$(DESTDIR) install
	install -m644 config/ctdb.sysconfig $(DESTDIR)/etc/default/ctdb
	dh_install -s

binary-common:
	dh_testdir
	dh_testroot
	dh_installchangelogs 
	dh_installdocs
ifeq ($(DEB_BUILD_ARCH_OS), hurd)
	dh_installdocs debian/README.hurd
endif
	#patch doc
	sed -i 's|/etc/sysconfig/|/etc/default/|' $(DESTDIR)/usr/share/doc/ctdb/web/*.html
	#upstream changelog 
	grep -A 10000 '%changelog' packaging/RPM/ctdb.spec.in > $(DESTDIR)/usr/share/doc/ctdb/changelog
	dh_installexamples
	dh_installlogrotate
	#install init script
	DH_OPTIONS= dh_installinit -pctdb --no-start --no-restart-on-upgrade
	dh_installman
	dh_link
	dh_strip --dbg-package=ctdb-dbg
	dh_compress 
	dh_fixperms
	dh_makeshlibs
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb
# Build architecture independant packages using the common target.
binary-indep: build-indep install-indep
	$(MAKE) -f debian/rules DH_OPTIONS=-i binary-common

# Build architecture dependant packages using the common target.
binary-arch: build-arch install-arch
	$(MAKE) -f debian/rules DH_OPTIONS=-s binary-common

binary: binary-arch binary-indep

check-external-libs:
	if [ -e lib/popt ]; then \
              echo " *****************************************"; \
	      echo " **                                     **"; \
	      echo " **  tar contains external libraries!   **"; \
	      echo " **                                     **"; \
              echo " *****************************************"; \
	      echo "The tarball should be made by using uscan or"; \
	      echo "debian/uupdate-wrapper"; \
	      echo ""; \
	      exit 1; \
        fi

.PHONY: build clean binary-indep binary-arch binary install install-indep install-arch configure patch unpatch