3 # Sample debian/rules that uses debhelper.
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.
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
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 * .[^.]*))
18 ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
19 PARALLEL = -j$(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
23 MAKEFLAGS += $(PARALLEL)
26 ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
32 configure: configure-stamp
35 test -e configure || ./boot.sh
36 test -d _debian || mkdir _debian
37 echo $(DEB_BUILD_OPTIONS)
41 ../configure --prefix=/usr --localstatedir=/var --enable-ssl \
42 --sysconfdir=/etc CFLAGS="$(CFLAGS)" \
43 $(DATAPATH_CONFIGURE_OPTS))
47 build: build-arch build-indep
49 build-arch: build-arch-stamp
50 build-arch-stamp: configure-stamp
52 ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
53 if $(MAKE) -C _debian check TESTSUITEFLAGS='$(PARALLEL)'; then :; \
55 cat _debian/tests/testsuite.log; \
61 build-indep: build-indep-stamp
62 build-indep-stamp: configure-stamp
63 $(MAKE) -C _debian dist distdir=openvswitch
69 rm -f build-arch-stamp build-indep-stamp configure-stamp
71 [ ! -f Makefile ] || $(MAKE) distclean
73 rm -f python/ovs/*.pyc python/ovs/db/*.pyc
75 install: install-indep install-arch
76 install-indep: build-indep
81 $(MAKE) -C _debian DESTDIR=$(CURDIR)/debian/tmp install
83 cp debian/rules.modules debian/openvswitch-datapath-source/usr/src/modules/openvswitch-datapath/debian/rules
84 chmod 755 debian/openvswitch-datapath-source/usr/src/modules/openvswitch-datapath/debian/rules
85 cd debian/openvswitch-datapath-source/usr/src && tar -c modules | bzip2 -9 > openvswitch-datapath.tar.bz2 && rm -rf modules
89 dh_installdirs -p$(pdkms) usr/src/$(PACKAGE)-$(DEB_UPSTREAM_VERSION)
92 cd debian/$(pdkms)/usr/src/$(PACKAGE)-$(DEB_UPSTREAM_VERSION) && tar xvzf $(CURDIR)/_debian/openvswitch.tar.gz && mv openvswitch/* . && rmdir openvswitch
94 # Prepare dkms.conf from the dkms.conf.in template
95 sed "s/__VERSION__/$(DEB_UPSTREAM_VERSION)/g" debian/dkms.conf.in > debian/$(pdkms)/usr/src/$(PACKAGE)-$(DEB_UPSTREAM_VERSION)/dkms.conf
97 # We don't need the debian folder in there, just upstream sources...
98 rm -rf debian/$(pdkms)/usr/src/$(PACKAGE)-$(DEB_UPSTREAM_VERSION)/debian
99 # We don't need the rhel stuff in there either
100 rm -rf debian/$(pdkms)/usr/src/$(PACKAGE)-$(DEB_UPSTREAM_VERSION)/rhel
101 # And we should also clean useless license files, which are already
102 # descriped in our debian/copyright anyway.
103 rm -f debian/$(pdkms)/usr/src/$(PACKAGE)-$(DEB_UPSTREAM_VERSION)/COPYING \
104 debian/$(pdkms)/usr/src/$(PACKAGE)-$(DEB_UPSTREAM_VERSION)/ovsdb/ovsdbmonitor/COPYING \
105 debian/$(pdkms)/usr/src/$(PACKAGE)-$(DEB_UPSTREAM_VERSION)/xenserver/LICENSE
107 install-arch: build-arch
112 $(MAKE) -C _debian DESTDIR=$(CURDIR)/debian/tmp install
113 cp debian/openvswitch-switch.template debian/openvswitch-switch/usr/share/openvswitch/switch/default.template
117 # Must not depend on anything. This is to be called by
118 # binary-arch/binary-indep
119 # in another 'make' thread.
130 dh_installman --language=C
132 dh_strip --dbg-package=openvswitch-dbg
143 binary-indep: install-indep
144 $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
145 binary-arch: install-arch
146 $(MAKE) -f debian/rules DH_OPTIONS=-s binary-common
148 binary: binary-arch binary-indep
149 .PHONY: build clean binary-indep binary-arch binary install install-indep install-arch configure
151 # This GNU make extensions disables parallel builds for the current Makefile
152 # but not for sub-Makefiles. This is appropriate here because build-arch and
153 # build-indep both invoke "make" on OVS, which can update some of the same
154 # targets in ways that conflict (e.g. both update tests/testsuite).