4d7a850b25554cde84a7aa792aa3093084f44113
1 #!/usr/bin/make -f
2 # -*- makefile -*-
4 # Uncomment this to turn on verbose mode.
5 #export DH_VERBOSE=1
7 Makefile.am:librrd_la_LDFLAGS = -version-info 2:12:0
8 Makefile.am:librrd_th_la_LDFLAGS = $(MULTITHREAD_LDFLAGS) -version-info 2:11:0
12 #library versions
13 LIB_version := $(shell grep '^librrd_la_LDFLAGS' src/Makefile.am | \
14 sed 's,^[^0-9]*,,g;s,:,.,g')
15 LIB_major := $(shell echo $(LIB_version) | sed 's,\..*,,g')
16 LIB_TH_version := $(shell grep '^librrd_th_la_LDFLAGS' src/Makefile.am | \
17 sed 's,^[^0-9]*,,g;s,:,.,g')
18 LIB_major := $(shell echo $(LIB_th_version) | sed 's,\..*,,g')
22 #Ruby versions to build for
23 RUBY_VERS := 1.8 1.9
24 RUBY_DEFAULT_VERS := 1.8
26 #Python versions to build for. The work-around-doko way.
27 PY_VERS := $(shell set -e; \
28 for py in `pysupport-parseversions debian/pyversions`; do \
29 if [ -x /usr/bin/python$$py ]; then echo $$py; fi; \
30 done)
32 #let's help configure to figure out our host/build system
33 DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
34 DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
35 ifeq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
36 CONFFLAGS += --build $(DEB_HOST_GNU_TYPE)
37 else
38 CONFFLAGS += --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
39 endif
41 #we build the bindings manually from debian/rules
42 CONFFLAGS += --disable-python --disable-ruby
44 #set the right paths
45 CONFFLAGS += --prefix=/usr --docdir=/usr/share/doc/rrdtool
47 #install perl libs in vendor mode
48 CONFFLAGS += --with-perl-options=INSTALLDIRS=vendor
53 #let's take care of optimization + debug builds
54 CFLAGS += -Wall -g
55 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
56 CFLAGS += -O0
57 else
58 CFLAGS += -O2
59 endif
61 LDFLAGS="-Wl,-z,defs"
63 configure: config.status
64 config.status:
66 ifneq "$(wildcard /usr/share/misc/config.sub)" ""
67 cp -f /usr/share/misc/config.sub config.sub
68 endif
69 ifneq "$(wildcard /usr/share/misc/config.guess)" ""
70 cp -f /usr/share/misc/config.guess config.guess
71 endif
73 LDFLAGS="$(LDFLAGS)"
74 CFLAGS="$(CFLAGS)" \
75 RRDDOCDIR=/usr/share/doc/rrdtool \
76 ./configure $(CONFFLAGS)
78 build: build-arch build-indep
80 build-arch: build-arch-stamp $(PY_VERS:%=build-python%)
81 build-arch-stamp: config.status
83 #configure forgets to set TCL_INC_DIR.
84 make TCL_INC_DIR=/usr/include/tcl
85 touch $@
87 build-python%: build-arch-stamp
88 cd bindings/python && env BUILDLIBDIR=../../src/.libs LIBDIR=../../src/.libs python$* setup.py build
89 touch $@
91 build-indep: build-indep-stamp
92 build-indep-stamp: config.status
94 clean: $(PY_VERS:%=clean-python%)
95 dh_testdir
96 dh_testroot
97 #sanity check if debian/control lists the right package name
98 grep -q '^Package: librrd$(LIB_major)' debian/control
100 [ ! -f Makefile ] || make distclean
102 ifneq "$(wildcard /usr/share/misc/config.sub)" ""
103 rm -f config.sub
104 endif
105 ifneq "$(wildcard /usr/share/misc/config.guess)" ""
106 rm -f config.guess
107 endif
108 rm -f build-arch-stamp build-indep-stamp config.status
109 find . -name \*.pyc | xargs rm -f
110 rm -rf bindings/python/build
112 #clean what the Makefiles do not clean....
113 rm -rf bindings/perl-piped/blib bindings/perl-shared/blib \
114 bindings/perl-piped/Makefile.old bindings/perl-shared/Makefile.old
115 rm -f bindings/tcl/pkgIndex.tcl bindings/tcl/tclrrd*.so
116 rm -f examples/cgi-demo.cgi
118 dh_clean
120 clean-python%:
121 cd bindings/python && python$* setup.py clean
122 rm -f build-python$*
124 install: install-indep install-arch
125 install-indep:
126 dh_testdir
127 dh_testroot
128 dh_clean -k -ppython-rrd
129 dh_installdirs -s
132 dh_install -s
134 install-arch: $(PY_VERS:%=install-python%)
135 dh_testdir
136 dh_testroot
137 dh_clean -k -s -Npython-rrd
138 dh_installdirs -s
140 make install DESTDIR=$(CURDIR)/debian/tmp
142 #build and install ruby
143 set -e; \
144 cd bindings/ruby ;\
145 for rbv in $(RUBY_VERS); do \
146 ruby$$rbv extconf.rb ;\
147 make ;\
148 make install sitelibdir=$(CURDIR)/debian/librrd-ruby$$rbv`ruby$$rbv -r rbconfig -e 'print Config::CONFIG["rubylibdir"]'` \
149 sitearchdir=$(CURDIR)/debian/librrd-ruby$$rbv`ruby$$rbv -r rbconfig -e 'print Config::CONFIG["archdir"]'` ;\
150 make distclean ;\
151 done
153 dh_install -s --sourcedir=$(CURDIR)/debian/tmp
154 dh_installexamples -s
156 install-python%:
157 dh_testdir
158 dh_testroot
159 dh_clean -k -s
160 cd bindings/python && python$* setup.py install --root=$(CURDIR)/debian/python-rrd
163 binary-indep:
164 dh_testdir
165 dh_testroot
166 echo 'rubydefault:Depends=librrd-ruby$(RUBY_DEFAULT_VERS)' >> debian/librrd-ruby.substvars
167 dh_link -plibrrd-ruby /usr/share/doc/librrd-ruby$(RUBY_DEFAULT_VERS) /usr/share/doc/librrd-ruby
168 dh_link -plibrrd2-dev /usr/share/doc/librrd-dev /usr/share/doc/librrd2-dev
169 dh_installchangelogs
170 dh_installdocs -s -Nlibrrd-ruby -Nlibrrd2-dev
171 dh_link -s -Nlibrrd-ruby -Nlibrrd2-dev
172 dh_perl -s
173 dh_compress -s
174 dh_fixperms -s
175 dh_installdeb -s
176 dh_gencontrol -s
177 dh_md5sums -s
178 dh_builddeb -s
181 binary-arch: build-arch install-arch
182 dh_testdir
183 dh_testroot
184 dh_installchangelogs -a CHANGES
185 dh_installdocs -a
186 # dh_installexamples -a
187 dh_pysupport -ppython-rrd
188 dh_perl -a
189 dh_installman -a
190 dh_link -a
191 dh_strip -a
192 dh_compress -a
193 dh_fixperms -a
194 dh_makeshlibs -a
195 dh_installdeb -a
196 dh_shlibdeps -a
197 dh_gencontrol -a
198 dh_md5sums -a
199 dh_builddeb -a
202 binary: binary-arch binary-indep
203 .PHONY: build clean configure \
204 binary-indep binary-arch binary \
205 install install-arch install-indep \
206 install-python% clean-python%