debian: Add README.Debian file to all packages
[senf.git] / debian / rules
1 #!/usr/bin/make -f
2 # -*- makefile -*-
3 # Sample debian/rules that uses debhelper.
4 #
5 # This file was originally written by Joey Hess and Craig Small.
6 # As a special exception, when this file is copied by dh-make into a
7 # dh-make output file, you may use that output file without restriction.
8 # This special exception was added by Craig Small in version 0.37 of dh-make.
9 #
10 # Modified to make a template file for a multi-binary package with separated
11 # build-arch and build-indep targets  by Bill Allombert 2001
12
13 # Uncomment this to turn on verbose mode.
14 #export DH_VERBOSE=1
15
16 debian_build=1
17 export debian_build
18
19 # This has to be exported to make some magic below work.
20 export DH_OPTIONS
21
22 #DPKG_ARCH#
23
24 CFLAGS = -Wall -g
25
26 CONCURRENCY_LEVEL ?= 1
27 export CONCURRENCY_LEVEL
28
29 LIBTYPE ?= UNSPEC
30
31 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
32         CFLAGS += -O0
33 else
34         CFLAGS += -O2
35 endif
36
37 destdir=$(CURDIR)/debian/tmp
38
39 configure: configure-stamp
40 configure-stamp:
41         dh_testdir
42 #       # Add here commands to configure the package.
43         rm -f Doxyfile.local SConfig local_config.hh
44         scons prepare
45 #       If needed, we could create new files 'Doxyfile.local',
46 #       'SConfig' and/or 'local_config.hh' here.  We don't remove them
47 #       in 'clean' to allow building a source package from an
48 #       individually configured svn working copy. (The files are ignored
49 #       by dpkg-buildpackge because of appropriate -I arguments provided 
50 #       by 'scons deb' and 'scons debsrc'
51         touch configure-stamp
52
53 build: build-arch build-indep
54
55 build-arch: build-arch-final build-arch-debug
56
57 build-arch-final: build-arch-final-stamp
58 build-arch-final-stamp: configure-stamp
59 #       Add here commands to compile the arch part of the package.
60         scons -j $(CONCURRENCY_LEVEL) default final=1
61         scons $(destdir)/usr/lib final=1 PREFIX='$(destdir)/usr'
62         touch $@
63
64 build-arch-debug: build-arch-debug-stamp
65 build-arch-debug-stamp: configure-stamp
66 #       Add here commands to compile the arch part of the package.
67         scons -j $(CONCURRENCY_LEVEL) default LIBADDSUFFIX=_g OBJADDSUFFIX=_g
68         scons $(destdir)/usr/lib LIBADDSUFFIX=_g OBJADDSUFFIX=_g \
69                 PREFIX='$(destdir)/usr' OBJINSTALLDIR='$$LIBINSTALLDIR/debug'
70         touch $@
71
72 build-indep: build-indep-stamp
73 build-indep-stamp: configure-stamp
74 #       Add here commands to compile the indep part of the package.
75         scons -j $(CONCURRENCY_LEVEL) all_docs
76         scons all_docs
77         scons linklint
78         scons fixlinks
79         scons $(destdir)/usr/include $(destdir)/usr/share/doc $(SCONS_OPTIONS) \
80                 PREFIX='$(destdir)/usr' \
81                 DOCINSTALLDIR='$$PREFIX/share/doc/libsenf-doc' \
82                 INCLUDEINSTALLDIR='$$PREFIX/include/senf' 
83 #       We need to install the example sourcecode
84         find Examples \( -name "*.hh" -o -name "*.cc" \) -printf "%P\n" | \
85                 while read src; do \
86                         dir="$(destdir)/usr/share/doc/libsenf-doc/examples/$$(dirname "$$src")"; \
87                         mkdir -p "$$dir"; \
88                         cp "Examples/$$src" "$$dir"; \
89                 done
90         touch $@
91
92 clean: debclean
93 #       Add here commands to clean up after the build process.
94         -scons -c all
95         -scons -c all LIBADDSUFFIX=_g OBJADDSUFFIX=_g
96
97 debclean:
98         dh_testdir
99         dh_testroot
100         rm -f build-arch-*-stamp build-indep-stamp configure-stamp
101         dh_clean
102
103 install: install-arch install-indep
104 install-indep: build-indep
105         dh_testdir
106         dh_testroot
107         dh_clean -k -i -Xdebian/tmp
108         dh_installdirs -i
109 #       Add here commands to install the indep part of the package into
110 #       debian/<package>-doc.
111         dh_install -X.svn -i
112
113 install-arch: build-arch
114         dh_testdir
115         dh_testroot
116         dh_clean -k -s -Xdebian/tmp
117         dh_installdirs -s
118 #       Add here commands to install the arch part of the package into 
119 #       debian/tmp.
120         dh_install -X.svn -s
121
122 # Must not depend on anything. This is to be called by
123 # binary-arch/binary-indep
124 # in another 'make' thread.
125 binary-common:
126         dh_testdir
127         dh_testroot
128         dh_installchangelogs
129         dh_installdocs
130         dh_installexamples
131 #       dh_installmenu
132 #       dh_installdebconf       
133 #       dh_installlogrotate     
134 #       dh_installemacsen
135 #       dh_installpam
136 #       dh_installmime
137 #       dh_python
138 #       dh_installinit
139 #       dh_installcron
140 #       dh_installinfo
141         dh_installman
142         dh_link
143         dh_strip
144         dh_compress -Xhtml -Xdoclib -Xexamples
145         dh_fixperms
146 #       dh_perl
147         dh_makeshlibs
148         dh_installdeb
149         dh_shlibdeps
150         dh_gencontrol
151         dh_md5sums
152         dh_builddeb
153
154 binary-indep: build-indep install-indep
155         $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
156
157 binary-arch: build-arch install-arch
158
159 binary: binary-arch binary-indep
160 .PHONY: build clean binary-indep binary-arch binary install install-indep install-arch \
161         binary-arch-common binary-arch-final binary-arch-debug