debian: New automatic versioning from release tags
[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 CFLAGS = -Wall -g
23
24 CONCURRENCY_LEVEL ?= 1
25 export CONCURRENCY_LEVEL
26
27 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
28         CFLAGS += -O0
29 else
30         CFLAGS += -O2
31 endif
32
33 destdir=$(CURDIR)/debian/tmp
34
35 configure: configure-stamp
36 configure-stamp:
37         dh_testdir
38 #       Add here commands to configure the package.
39         rm -f Doxyfile.local SConfig local_config.hh
40         scons prepare
41 #       If needed, we could create new files 'Doxyfile.local',
42 #       'SConfig' and/or 'local_config.hh' here.  We don't remove them
43 #       in 'clean' to allow building a source package from an
44 #       individually configured svn working copy. (The files are ignored
45 #       by dpkg-buildpackge because of appropriate -I arguments provided 
46 #       by 'scons deb' and 'scons debsrc'
47         touch configure-stamp
48
49 build: build-arch build-indep
50
51 build-arch: build-arch-final build-arch-debug
52
53 build-arch-final: build-arch-final-stamp
54 build-arch-final-stamp: configure-stamp
55 #       Add here commands to compile the arch part of the package.
56         scons -j $(CONCURRENCY_LEVEL) default final=1
57         scons $(destdir)/usr/lib final=1 PREFIX='$(destdir)/usr'
58         touch $@
59
60 build-arch-debug: build-arch-debug-stamp
61 build-arch-debug-stamp: configure-stamp
62 #       Add here commands to compile the arch part of the package.
63         scons -j $(CONCURRENCY_LEVEL) default LIBADDSUFFIX=_g OBJADDSUFFIX=_g
64         scons $(destdir)/usr/lib LIBADDSUFFIX=_g OBJADDSUFFIX=_g \
65                 PREFIX='$(destdir)/usr' OBJINSTALLDIR='$$LIBINSTALLDIR/debug'
66         touch $@
67
68 build-indep: build-indep-stamp
69 build-indep-stamp: configure-stamp
70 #       Add here commands to compile the indep part of the package.
71         scons -j $(CONCURRENCY_LEVEL) all_docs
72         scons all_docs
73         scons linklint
74         scons fixlinks
75         scons $(destdir)/usr/include $(destdir)/usr/share/doc \
76                 PREFIX='$(destdir)/usr' \
77                 DOCINSTALLDIR='$$PREFIX/share/doc/libsenf-doc/html' \
78                 INCLUDEINSTALLDIR='$$PREFIX/include/senf' 
79 #       Remove all the files not really needed from the documentation directories
80         find $(destdir)/usr/share/doc/libsenf-doc/html \
81                 -type f ! -regex '.*\.\(html\|css\|png\|php\|idx\|tag\)' | xargs rm -f
82 #       We need to install the example sourcecode
83         find Examples \( -name "*.hh" -o -name "*.cc" \) -printf "%P\n" | \
84                 while read src; do \
85                         dir="$(destdir)/usr/share/doc/libsenf-doc/examples/$$(dirname "$$src")"; \
86                         mkdir -p "$$dir"; \
87                         cp "Examples/$$src" "$$dir"; \
88                 done
89         touch $@
90
91 clean: debclean
92 #       Add here commands to clean up after the build process.
93         -scons -c all
94         -scons -c all LIBADDSUFFIX=_g OBJADDSUFFIX=_g
95
96 debclean:
97         dh_testdir
98         dh_testroot
99         rm -f build-arch-*-stamp build-indep-stamp configure-stamp
100         dh_clean
101
102 install: install-arch install-indep
103 install-indep: build-indep
104         dh_testdir
105         dh_testroot
106         dh_clean -k -i -Xdebian/tmp
107         dh_installdirs -i
108 #       Add here commands to install the indep part of the package into
109 #       debian/<package>-doc.
110         dh_install -X.svn -i
111
112 install-arch: build-arch
113         dh_testdir
114         dh_testroot
115         dh_clean -k -s -Xdebian/tmp
116         dh_installdirs -s
117 #       Add here commands to install the arch part of the package into 
118 #       debian/tmp.
119         dh_install -X.svn -s
120
121 # Must not depend on anything. This is to be called by
122 # binary-arch/binary-indep
123 # in another 'make' thread.
124 binary-common:
125         dh_testdir
126         dh_testroot
127         dh_installchangelogs
128         dh_installdocs
129         dh_installexamples
130 #       dh_installmenu
131 #       dh_installdebconf       
132 #       dh_installlogrotate     
133 #       dh_installemacsen
134 #       dh_installpam
135 #       dh_installmime
136 #       dh_python
137 #       dh_installinit
138 #       dh_installcron
139 #       dh_installinfo
140         dh_installman
141         dh_link
142         dh_strip
143         dh_compress -Xhtml -Xdoclib -Xexamples
144         dh_fixperms
145 #       dh_perl
146         dh_makeshlibs
147         dh_installdeb
148         dh_shlibdeps
149         dh_gencontrol
150         dh_md5sums
151         dh_builddeb
152
153 binary-indep: build-indep install-indep
154         $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
155
156 binary-arch: build-arch install-arch
157         $(MAKE) -f debian/rules DH_OPTIONS=-s binary-common
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