Code sync
[external/libijs.git] / 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
7
8 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
9         CFLAGS += -O0
10 else
11         CFLAGS += -O2
12 endif
13
14 ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
15         NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
16         MAKEFLAGS += -j$(NUMJOBS)
17 endif
18
19 configure: configure-stamp
20 configure-stamp:
21         dh_testdir
22         cp -f /usr/share/misc/config.sub config.sub
23         cp -f /usr/share/misc/config.guess config.guess
24         CFLAGS="$(CFLAGS)" ./configure --host=$(DEB_HOST_GNU_TYPE) \
25                 --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr \
26                 --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info \
27                 --enable-shared
28         touch $@
29
30 build: build-stamp
31 build-stamp: configure
32         dh_testdir
33         $(MAKE)
34         $(MAKE) doc
35         touch $@
36
37 clean:
38         dh_testdir
39         dh_testroot
40         [ ! -f Makefile ] || $(MAKE) distclean
41         rm -rf build-stamp configure-stamp
42 #       rm -f config.sub config.guess
43         dh_clean
44
45 install: build
46         dh_testdir
47         dh_testroot
48         dh_prep
49         dh_installdirs
50         $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
51         rm -f $(CURDIR)/debian/tmp/usr/bin/*_example
52         dh_install --fail-missing
53
54 binary-indep: build install
55
56 binary-arch: build install
57         dh_testdir
58         dh_testroot
59 #       dh_installdocs
60         dh_installchangelogs
61         dh_link
62         dh_strip --dbg-package=libijs-dbg
63         dh_compress
64         dh_fixperms
65         dh_makeshlibs
66         dh_installdeb
67         dh_shlibdeps -V "libijs-0.35 (>= 0.35)"
68         dh_gencontrol
69         dh_md5sums
70         dh_builddeb
71
72 binary: binary-indep binary-arch
73 .PHONY: build clean binary-indep binary-arch binary install configure