configure: Remove --with-build-number.
[sliver-openvswitch.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 PACKAGE=openvswitch
14 pdkms=openvswitch-datapath-dkms
15 DEB_UPSTREAM_VERSION=$(shell dpkg-parsechangelog | sed -rne 's,^Version: ([0-9]:)*([^-]+).*,\2,p')
16 srcfiles := $(filter-out debian, $(wildcard * .[^.]*))
17
18 ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
19 PARALLEL = -j$(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
20 else
21 PARALLEL =
22 endif
23 MAKEFLAGS += $(PARALLEL)
24
25 ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
26 CFLAGS += -O0
27 else
28 CFLAGS += -O2
29 endif
30
31 configure: configure-stamp
32 configure-stamp:
33         dh_testdir
34         test -e configure || ./boot.sh
35         test -d _debian || mkdir _debian
36         echo $(DEB_BUILD_OPTIONS)
37         echo $$CC
38         cd _debian && ( \
39                 test -e Makefile || \
40                 ../configure --prefix=/usr --localstatedir=/var --enable-ssl \
41                         --sysconfdir=/etc CFLAGS="$(CFLAGS)" \
42                         $(DATAPATH_CONFIGURE_OPTS))
43         touch configure-stamp
44
45 #Architecture 
46 build: build-arch build-indep
47
48 build-arch: build-arch-stamp
49 build-arch-stamp: configure-stamp 
50         $(MAKE) -C _debian
51 ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
52         if $(MAKE) -C _debian check TESTSUITEFLAGS='$(PARALLEL)'; then :; \
53         else \
54                 cat _debian/tests/testsuite.log; \
55                 exit 1; \
56         fi
57 endif
58         touch $@
59
60 build-indep: build-indep-stamp
61 build-indep-stamp: configure-stamp 
62         $(MAKE) -C _debian dist distdir=openvswitch
63         touch $@
64
65 clean:
66         dh_testdir
67         dh_testroot
68         rm -f build-arch-stamp build-indep-stamp configure-stamp
69         rm -rf _debian
70         [ ! -f Makefile ] || $(MAKE) distclean
71         dh_clean 
72         rm -f python/ovs/*.pyc python/ovs/db/*.pyc
73
74 install: install-indep install-arch
75 install-indep: build-indep
76         dh_testdir
77         dh_testroot
78         dh_prep -i
79         dh_installdirs -i
80         $(MAKE) -C _debian DESTDIR=$(CURDIR)/debian/tmp install
81         dh_install -i
82         cp debian/rules.modules debian/openvswitch-datapath-source/usr/src/modules/openvswitch-datapath/debian/rules
83         chmod 755 debian/openvswitch-datapath-source/usr/src/modules/openvswitch-datapath/debian/rules
84         cd debian/openvswitch-datapath-source/usr/src && tar -c modules | bzip2 -9 > openvswitch-datapath.tar.bz2 && rm -rf modules
85
86         #dkms stuff
87         # setup the dirs
88         dh_installdirs -p$(pdkms) usr/src/$(PACKAGE)-$(DEB_UPSTREAM_VERSION)
89
90         # copy the source
91         cd debian/$(pdkms)/usr/src/$(PACKAGE)-$(DEB_UPSTREAM_VERSION) && tar xvzf $(CURDIR)/_debian/openvswitch.tar.gz && mv openvswitch/* . && rmdir openvswitch
92
93         # Prepare dkms.conf from the dkms.conf.in template
94         sed "s/__VERSION__/$(DEB_UPSTREAM_VERSION)/g" debian/dkms.conf.in > debian/$(pdkms)/usr/src/$(PACKAGE)-$(DEB_UPSTREAM_VERSION)/dkms.conf
95
96         # We don't need the debian folder in there, just upstream sources...
97         rm -rf debian/$(pdkms)/usr/src/$(PACKAGE)-$(DEB_UPSTREAM_VERSION)/debian
98         # We don't need the rhel stuff in there either
99         rm -rf debian/$(pdkms)/usr/src/$(PACKAGE)-$(DEB_UPSTREAM_VERSION)/rhel
100         # And we should also clean useless license files, which are already
101         # descriped in our debian/copyright anyway.
102         rm -f debian/$(pdkms)/usr/src/$(PACKAGE)-$(DEB_UPSTREAM_VERSION)/COPYING \
103                 debian/$(pdkms)/usr/src/$(PACKAGE)-$(DEB_UPSTREAM_VERSION)/ovsdb/ovsdbmonitor/COPYING \
104                 debian/$(pdkms)/usr/src/$(PACKAGE)-$(DEB_UPSTREAM_VERSION)/xenserver/LICENSE
105
106 install-arch: build-arch
107         dh_testdir
108         dh_testroot
109         dh_prep -s
110         dh_installdirs -s
111         $(MAKE) -C _debian DESTDIR=$(CURDIR)/debian/tmp install
112         cp debian/openvswitch-switch.template debian/openvswitch-switch/usr/share/openvswitch/switch/default.template
113         dh_install -s
114
115 # Must not depend on anything. This is to be called by
116 # binary-arch/binary-indep
117 # in another 'make' thread.
118 binary-common:
119         dh_testdir
120         dh_testroot
121         dh_installchangelogs 
122         dh_installdocs
123         dh_installexamples
124         dh_installdebconf
125         dh_installlogrotate
126         dh_installinit -R
127         dh_installcron
128         dh_installman --language=C
129         dh_link
130         dh_strip --dbg-package=openvswitch-dbg
131         dh_compress 
132         dh_fixperms
133         dh_python2
134         dh_perl
135         dh_makeshlibs
136         dh_installdeb
137         dh_shlibdeps
138         dh_gencontrol
139         dh_md5sums
140         dh_builddeb
141 binary-indep: install-indep
142         $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
143 binary-arch: install-arch
144         $(MAKE) -f debian/rules DH_OPTIONS=-s binary-common
145
146 binary: binary-arch binary-indep
147 .PHONY: build clean binary-indep binary-arch binary install install-indep install-arch configure
148
149 # This GNU make extensions disables parallel builds for the current Makefile
150 # but not for sub-Makefiles.  This is appropriate here because build-arch and
151 # build-indep both invoke "make" on OVS, which can update some of the same
152 # targets in ways that conflict (e.g. both update tests/testsuite).
153 .NOTPARALLEL: