4f157c20f1947270174a36a6231fb227397ab16d
[citadel.git] / libcitadel / debian / rules
1 #!/usr/bin/make -f
2 # -*- mode: makefile; coding: utf-8 -*-
3
4 # Uncomment this to turn on verbose mode.
5 #export DH_VERBOSE=1
6
7 export DH_COMPAT = 5
8
9 DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
10 DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
11
12 CFLAGS = -Wall -g  -Wformat -Werror=format-security
13 #-finline-functions
14 LDFALGS =
15 # -finline-functions
16 ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
17         CFLAGS += -O0 -ggdb -rdynamic -MD -MP -D DEBUG -D VALGRIND
18         EXTRA_ARGS =  --with-backtrace
19 else
20 #       CFLAGS += -O2 -fPIC
21         CFLAGS += -O0 -ggdb -rdynamic -MD -MP -D DEBUG -D VALGRIND
22 endif
23
24 ifneq (,$(findstring profiling,$(DEB_BUILD_OPTIONS)))
25         CFLAGS += -pg
26         LDFLAGS += -pg
27 endif
28
29 ifneq (,$(findstring sprofiling,$(DEB_BUILD_OPTIONS)))
30         CFLAGS += -D SIZE_DEBUG
31 endif
32
33 ifneq (,$(findstring gcov,$(DEB_BUILD_OPTIONS)))
34         CFLAGS += -fprofile-arcs -ftest-coverage
35         LDFLAGS += -fprofile-arcs -ftest-coverage
36 endif
37
38
39 build: build-stamp
40 build-stamp:
41         dh_testdir
42
43         export CFLAGS="$(CFLAGS)"; export LDFLAGS="$(LDFLAGS)";  ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
44                 $(EXTRA_ARGS) \
45                 --prefix=/usr
46
47 # Build libcitadel
48         $(MAKE)
49
50         touch build-stamp
51
52 clean:
53         dh_testdir
54         dh_testroot
55         rm -f build-stamp install*-stamp
56
57         [ ! -f Makefile ] || $(MAKE) distclean
58
59         dh_clean
60
61 install: install-stamp
62 install-stamp: build-stamp
63         dh_testdir
64         dh_testroot
65         dh_clean -k
66         dh_installdirs
67
68         $(MAKE) DESTDIR=`pwd`/debian/tmp install
69
70         touch install-stamp
71
72 # Build architecture-independent files here.
73 binary-indep: build install
74 #       dh_testdir -i
75         dh_testroot -i
76 #       dh_installdocs -i -A README
77 #       dh_installchangelogs -i debian/no-upstream-changelog
78 #       dh_install -i --sourcedir=debian/tmp
79 #       dh_link -i
80 #       dh_strip -i
81 #       dh_compress -i
82 #       dh_fixperms -i
83 #       dh_installdeb -i
84 #       dh_shlibdeps -i
85 #       dh_gencontrol -i
86 #       dh_md5sums -i
87 #       dh_builddeb -i
88
89 # Build architecture-dependent files here.
90 binary-arch: build install
91         dh_testdir -a
92         dh_testroot -a
93         dh_installchangelogs -a -plibcitadel3
94         dh_installdocs -a
95         dh_install -a --sourcedir=debian/tmp
96         dh_link -a
97         dh_strip -a --dbg-package=libcitadel3-dbg
98         dh_compress -a
99         dh_fixperms -a
100         dh_makeshlibs -a -V
101         dh_installdeb -a
102         dh_shlibdeps -a
103         dh_gencontrol -a
104         dh_md5sums -a
105         dh_builddeb -a
106
107 source diff:                                                                  
108         @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
109
110 binary: binary-indep binary-arch
111 .PHONY: build clean binary-indep binary-arch binary install