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
13 # Official build number. Leave set to 0 if not an official build.
17 pdkms=openvswitch-datapath-dkms
18 DEB_UPSTREAM_VERSION=$(shell dpkg-parsechangelog | sed -rne 's,^Version: ([0-9]:)*([^-]+).*,\2,p')
19 srcfiles := $(filter-out debian, $(wildcard * .[^.]*))
21 ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
22 PARALLEL = -j$(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
26 MAKEFLAGS += $(PARALLEL)
28 ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
34 ifeq ($(BUILD_NUMBER),0)
37 BUILD_NUMBER_OPTION = --with-build-number=$(BUILD_NUMBER)
40 configure: configure-stamp
43 test -e configure || ./boot.sh
44 test -d _debian || mkdir _debian
45 echo $(DEB_BUILD_OPTIONS)
49 ../configure --prefix=/usr --localstatedir=/var --enable-ssl \
50 --sysconfdir=/etc $(BUILD_NUMBER_OPTION) \
51 CFLAGS="$(CFLAGS)" $(DATAPATH_CONFIGURE_OPTS))
55 build: build-arch build-indep
57 build-arch: build-arch-stamp
58 build-arch-stamp: configure-stamp
60 ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
61 if $(MAKE) -C _debian check TESTSUITEFLAGS='$(PARALLEL)'; then :; \
63 cat _debian/tests/testsuite.log; \
69 build-indep: build-indep-stamp
70 build-indep-stamp: configure-stamp
71 $(MAKE) -C _debian dist distdir=openvswitch
77 rm -f build-arch-stamp build-indep-stamp configure-stamp
79 [ ! -f Makefile ] || $(MAKE) distclean
81 rm -f python/ovs/*.pyc python/ovs/db/*.pyc
83 install: install-indep install-arch
84 install-indep: build-indep
89 $(MAKE) -C _debian DESTDIR=$(CURDIR)/debian/tmp install
91 sed 's/^BUILD_NUMBER = .*/BUILD_NUMBER = $(BUILD_NUMBER)/' \
92 < debian/rules.modules \
93 > debian/openvswitch-datapath-source/usr/src/modules/openvswitch-datapath/debian/rules
94 chmod 755 debian/openvswitch-datapath-source/usr/src/modules/openvswitch-datapath/debian/rules
95 cd debian/openvswitch-datapath-source/usr/src && tar -c modules | bzip2 -9 > openvswitch-datapath.tar.bz2 && rm -rf modules
99 dh_installdirs -p$(pdkms) usr/src/$(PACKAGE)-$(DEB_UPSTREAM_VERSION)
102 cd debian/$(pdkms)/usr/src/$(PACKAGE)-$(DEB_UPSTREAM_VERSION) && tar xvzf $(CURDIR)/_debian/openvswitch.tar.gz && mv openvswitch/* . && rmdir openvswitch
104 # Prepare dkms.conf from the dkms.conf.in template
105 sed "s/__VERSION__/$(DEB_UPSTREAM_VERSION)/g" debian/dkms.conf.in > debian/$(pdkms)/usr/src/$(PACKAGE)-$(DEB_UPSTREAM_VERSION)/dkms.conf
107 # We don't need the debian folder in there, just upstream sources...
108 rm -rf debian/$(pdkms)/usr/src/$(PACKAGE)-$(DEB_UPSTREAM_VERSION)/debian
109 # We don't need the rhel stuff in there either
110 rm -rf debian/$(pdkms)/usr/src/$(PACKAGE)-$(DEB_UPSTREAM_VERSION)/rhel
111 # And we should also clean useless license files, which are already
112 # descriped in our debian/copyright anyway.
113 rm -f debian/$(pdkms)/usr/src/$(PACKAGE)-$(DEB_UPSTREAM_VERSION)/COPYING \
114 debian/$(pdkms)/usr/src/$(PACKAGE)-$(DEB_UPSTREAM_VERSION)/ovsdb/ovsdbmonitor/COPYING \
115 debian/$(pdkms)/usr/src/$(PACKAGE)-$(DEB_UPSTREAM_VERSION)/xenserver/LICENSE
117 install-arch: build-arch
122 $(MAKE) -C _debian DESTDIR=$(CURDIR)/debian/tmp install
123 cp debian/openvswitch-switch.template debian/openvswitch-switch/usr/share/openvswitch/switch/default.template
126 # Must not depend on anything. This is to be called by
127 # binary-arch/binary-indep
128 # in another 'make' thread.
139 dh_installman --language=C
141 dh_strip --dbg-package=openvswitch-dbg
152 binary-indep: install-indep
153 $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
154 binary-arch: install-arch
155 $(MAKE) -f debian/rules DH_OPTIONS=-s binary-common
157 binary: binary-arch binary-indep
158 .PHONY: build clean binary-indep binary-arch binary install install-indep install-arch configure
160 # This GNU make extensions disables parallel builds for the current Makefile
161 # but not for sub-Makefiles. This is appropriate here because build-arch and
162 # build-indep both invoke "make" on OVS, which can update some of the same
163 # targets in ways that conflict (e.g. both update tests/testsuite).