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 binary-indep: install-indep
89 dh_testdir
90 dh_testroot
91 dh_installchangelogs -i ChangeLog
92 dh_installdocs -A -i debian/README.Debian AUTHORS README TODO
93 dh_installexamples -i debian/examples/myplugin.c
94 dh_compress -i
95 dh_fixperms -i
96 dh_installdeb -i
97 dh_gencontrol -i
98 dh_md5sums -i
99 dh_builddeb -i
101 binary-arch: build install-arch
102 dh_testdir
103 dh_testroot
104 dh_installchangelogs -a ChangeLog
105 dh_installdocs -A -a debian/README.Debian AUTHORS README TODO
106 dh_installexamples -a contrib/collectd2html.pl contrib/collection.cgi \
107 contrib/PerlLib/ contrib/SpamAssassin/ contrib/iptables/ \
108 contrib/extractDS.px contrib/migrate-3-4.px
109 dh_installinit -a -- defaults 95
110 dh_installman -a src/collectd.1 src/collectd.conf.5
111 dh_link -a
112 dh_strip -a --dbg-package=collectd-dbg
113 dh_compress -a
114 dh_fixperms -a
115 dh_installdeb -a
116 dh_shlibdeps -a
117 dh_gencontrol -a
118 dh_md5sums -a
119 dh_builddeb -a
121 binary: binary-arch binary-indep
122 .PHONY: build clean binary-indep binary-arch binary install-indep install-arch