Use the host compiler for build tool c-ify.
[darkstat-debian] / debian / rules
1 #!/usr/bin/make -f
2
3 DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
4 DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
5
6 # CFLAGS += -Wall -g
7
8
9 DPKG_EXPORT_BUILDFLAGS = 1
10 include /usr/share/dpkg/buildflags.mk
11 -include /usr/share/dpkg/buildtools.mk
12 CC_FOR_BUILD ?= cc
13
14 configure: configure-stamp
15 configure-stamp: 
16         dh_testdir
17         cp /usr/share/misc/config.sub /usr/share/misc/config.guess .
18         CFLAGS="$(CFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man --disable-silent-rules
19         touch $@
20
21 build: configure-stamp build-stamp
22 build-arch: build
23 build-indep: build 
24
25 build-stamp: configure-stamp
26         dh_testdir
27         $(MAKE) HOSTCC=$(CC_FOR_BUILD)
28         touch $@
29
30 clean: 
31         dh_testdir
32         dh_testroot
33         dh_clean build-stamp configure-stamp config.status config.log install-tamp config.sub config.guess
34         [ ! -f Makefile ] || $(MAKE) clean
35         [ ! -f Makefile ] || rm -f Makefile
36         [ ! -f config.h ] || rm -f config.h
37         [ ! -f darkstat.8 ] || rm -f darkstat.8
38         debconf-updatepo
39
40 install: install-stamp
41 install-stamp: build-stamp
42         dh_testdir
43         dh_testroot
44         dh_prep
45         dh_installdirs
46         $(MAKE) install DESTDIR=$(CURDIR)/debian/darkstat
47         install -m 644 debian/init.cfg $(CURDIR)/debian/darkstat/etc/darkstat
48         touch $@
49
50 binary-indep: build install
51 # nothing to do
52
53 binary-arch: build install
54         dh_testdir
55         dh_testroot
56         dh_installdebconf
57         dh_installdocs -n
58         dh_installinit -R
59         dh_installchangelogs ChangeLog
60         dh_strip
61         dh_compress
62         dh_fixperms
63         dh_installdeb
64         dh_shlibdeps
65         dh_gencontrol
66         dh_md5sums
67         dh_builddeb
68
69 binary: binary-indep binary-arch
70 .PHONY: build clean binary-indep binary-arch binary install