1 #!/usr/bin/make -f
2 # debian/rules for collectd
3 #
4 # Written by Sebastian Harl <sh@tokkee.org>.
6 # Uncomment this to turn on verbose mode.
7 #export DH_VERBOSE=1
9 # These are used for cross-compiling and for saving the configure script
10 # from having to guess our platform (since we know it already)
11 DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
12 DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)
13 DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
15 CFLAGS = -Wall -g
17 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
18 CFLAGS += -O0
19 else
20 CFLAGS += -O2
21 endif
23 confflags = --host=$(DEB_HOST_GNU_TYPE) \
24 --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr \
25 --mandir=\$${prefix}/share/man \
26 --localstatedir=/var --sysconfdir=/etc \
27 --enable-debug
29 # The static libraries iptc and upsclient cannot be used on 64bit systems
30 # (see bugs #358637 and #419684 for more details).
31 ifneq (,$(findstring $(DEB_BUILD_ARCH),amd64 ia64 ppc64))
32 confflags += --disable-iptables --disable-nut
33 endif
35 config.status: configure
36 dh_testdir
37 CFLAGS="$(CFLAGS)" ./configure $(confflags)
39 build: build-stamp
41 build-stamp: config.status
42 dh_testdir
44 $(MAKE)
46 touch build-stamp
48 clean:
49 dh_testdir
50 dh_testroot
51 rm -f build-stamp
53 -$(MAKE) distclean
55 dh_clean
57 install-indep:
58 dh_testdir
59 dh_testroot
60 dh_clean -k
61 dh_installdirs -i
63 include_dir=$(CURDIR)/debian/collectd-dev/usr/include/collectd/ \
64 && mkdir -p $$include_dir \
65 && cp src/*.h $$include_dir
67 install-arch: build
68 dh_testdir
69 dh_testroot
70 dh_clean -k
71 dh_installdirs -a
73 $(MAKE) install DESTDIR=$(CURDIR)/debian/collectd
75 rm -f $(CURDIR)/debian/collectd/usr/lib/collectd/*.la
77 rm -f $(CURDIR)/debian/collectd/etc/collectd.conf
78 install -D -m 0644 $(CURDIR)/debian/collectd.conf \
79 $(CURDIR)/debian/collectd/etc/collectd/collectd.conf
81 for PLUGIN in apache dns mysql perl ping sensors; do \
82 plugin_dir=$(CURDIR)/debian/collectd-$$PLUGIN/usr/lib/collectd/; \
83 mkdir -p $$plugin_dir; \
84 mv $(CURDIR)/debian/collectd/usr/lib/collectd/$$PLUGIN.so \
85 $$plugin_dir; \
86 done
88 mkdir -p debian/collectd/usr/lib/collectd/utils/
89 for UTIL in extractDS.px migrate-3-4.px; do \
90 cp contrib/$$UTIL debian/collectd/usr/lib/collectd/utils/; \
91 done
93 binary-indep: install-indep
94 dh_testdir
95 dh_testroot
96 dh_installchangelogs -i ChangeLog
97 dh_installdocs -A -i debian/README.Debian AUTHORS README TODO
98 dh_installexamples -i debian/examples/myplugin.c
99 dh_compress -i
100 dh_fixperms -i
101 dh_installdeb -i
102 dh_gencontrol -i
103 dh_md5sums -i
104 dh_builddeb -i
106 binary-arch: build install-arch
107 dh_testdir
108 dh_testroot
109 dh_installchangelogs -a ChangeLog
110 dh_installdocs -A -a debian/README.Debian AUTHORS README TODO
111 dh_installexamples -a contrib/collectd2html.pl contrib/collection.cgi \
112 contrib/PerlLib/ contrib/SpamAssassin/ contrib/iptables/
113 dh_installinit -a -- defaults 95
114 dh_installman -a src/collectd.1 src/collectd.conf.5
115 dh_link -a
116 dh_strip -a --dbg-package=collectd-dbg
117 dh_compress -a
118 dh_fixperms -a
119 dh_installdeb -a
120 dh_shlibdeps -a
121 dh_gencontrol -a
122 dh_md5sums -a
123 dh_builddeb -a
125 binary: binary-arch binary-indep
126 .PHONY: build clean binary-indep binary-arch binary install-indep install-arch