debian: Tolerate varying locations of vswitch-idl.ovsschema.
[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 # Official build number.  Leave set to 0 if not an official build.
14 BUILD_NUMBER = 0
15
16 ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
17 NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
18 MAKEFLAGS += -j$(NUMJOBS)
19 endif
20
21 ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
22 CFLAGS += -O0
23 else
24 CFLAGS += -O2
25 endif
26
27 configure: configure-stamp
28 configure-stamp:
29         dh_testdir
30         test -e configure || ./boot.sh
31         test -d _debian || mkdir _debian
32         echo $$CC
33         cd _debian && ( \
34                 test -e Makefile || \
35                 ../configure --prefix=/usr --localstatedir=/var --enable-ssl \
36                         --with-build-number=$(BUILD_NUMBER) \
37                         CFLAGS="$(CFLAGS)" $(DATAPATH_CONFIGURE_OPTS))
38         touch configure-stamp
39
40 #Architecture 
41 build: build-arch build-indep
42
43 build-arch: build-arch-stamp
44 build-arch-stamp: configure-stamp 
45         $(MAKE) -C _debian
46 ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
47         $(MAKE) -C _debian check
48 endif
49         touch $@
50
51 build-indep: build-indep-stamp
52 build-indep-stamp: configure-stamp 
53         $(MAKE) -C _debian dist distdir=openvswitch
54         touch $@
55
56 clean:
57         dh_testdir
58         dh_testroot
59         rm -f build-arch-stamp build-indep-stamp configure-stamp
60         rm -rf _debian
61         [ ! -f Makefile ] || $(MAKE) distclean
62         dh_clean 
63         debconf-updatepo
64
65 install: install-indep install-arch
66 install-indep: build-indep
67         dh_testdir
68         dh_testroot
69         dh_clean -k -i 
70         dh_installdirs -i
71         dh_install -i
72         sed 's/^BUILD_NUMBER = .*/BUILD_NUMBER = $(BUILD_NUMBER)/' \
73                 < debian/rules.modules \
74                 > debian/openvswitch-datapath-source/usr/src/modules/openvswitch-datapath/debian/rules
75         chmod 755 debian/openvswitch-datapath-source/usr/src/modules/openvswitch-datapath/debian/rules
76         cd debian/openvswitch-datapath-source/usr/src && tar -c modules | bzip2 -9 > openvswitch-datapath.tar.bz2 && rm -rf modules
77         install -m644 debian/openvswitch-pki-server.apache2 debian/openvswitch-pki-server/etc/apache2/sites-available/openvswitch-pki
78         install -m1777 -d debian/corekeeper/var/log/core
79
80 install-arch: build-arch
81         dh_testdir
82         dh_testroot
83         dh_clean -k -s 
84         dh_installdirs -s
85         $(MAKE) -C _debian DESTDIR=$(CURDIR)/debian/openvswitch install
86         cp debian/openvswitch-switch-config.overrides debian/openvswitch-switch-config/usr/share/lintian/overrides/openvswitch-switch-config
87         cp debian/openvswitch-switch.template debian/openvswitch-switch/usr/share/openvswitch/switch/default.template
88         @# If we are working from a "make dist" tarball then make sure that
89         @# the ovsschema file is available in the build directory.
90         test -e _debian/vswitchd/vswitch-idl.ovsschema || \
91                 cp vswitchd/vswitch-idl.ovsschema _debian/vswitchd/vswitch-idl.ovsschema
92         dh_install -s
93         env TERMINFO=debian/openvswitch-switchui/usr/share/terminfo tic -x extras/ezio/ezio3.ti
94
95 # Must not depend on anything. This is to be called by
96 # binary-arch/binary-indep
97 # in another 'make' thread.
98 binary-common:
99         dh_testdir
100         dh_testroot
101         dh_installchangelogs 
102         dh_installdocs
103         dh_installexamples
104         dh_installdebconf
105         dh_installlogrotate
106         dh_installinit
107         dh_installcron
108         dh_installman
109         dh_link
110         dh_strip --dbg-package=openvswitch-dbg
111         dh_compress 
112         dh_fixperms -X var/log/core
113         dh_perl
114         dh_makeshlibs
115         dh_installdeb
116         dh_shlibdeps
117         dh_gencontrol
118         dh_md5sums
119         dh_builddeb
120 binary-indep: install-indep
121         $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
122 binary-arch: install-arch
123         $(MAKE) -f debian/rules DH_OPTIONS=-s binary-common
124
125 binary: binary-arch binary-indep
126 .PHONY: build clean binary-indep binary-arch binary install install-indep install-arch configure