Fix openflow-datapath-source bugs added in "Simplify debian/rules..." commit.
[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 # Uncomment this to turn on verbose mode.
14 #export DH_VERBOSE=1
15
16 # This has to be exported to make some magic below work.
17 export DH_OPTIONS
18
19 # prefix of the target package name
20 PACKAGE=openflow-datapath-module
21 # modifieable for experiments or debugging m-a
22 MA_DIR ?= /usr/share/modass
23 # load generic variable handling
24 -include $(MA_DIR)/include/generic.make
25 # load default rules
26 -include $(MA_DIR)/include/common-rules.make
27
28 -include debian/rules.ext
29
30 configure: configure-stamp
31 configure-stamp:
32         dh_testdir
33         test -e configure || ./boot.sh
34         test -d _debian || mkdir _debian
35         cd _debian && ( \
36                 test -e Makefile || \
37                 ../configure --prefix=/usr --localstatedir=/var --enable-ssl \
38                         --enable-snat)
39         $(ext_configure)
40         touch configure-stamp
41
42 #Architecture 
43 build: build-arch build-indep
44
45 build-arch: build-arch-stamp
46 build-arch-stamp: configure-stamp 
47         $(MAKE) -C _debian
48         $(ext_build_arch)
49         touch $@
50
51 build-indep: build-indep-stamp
52 build-indep-stamp: configure-stamp 
53         $(MAKE) -C _debian dist distdir=openflow
54         $(ext_build_indep)
55         touch $@
56
57 clean:
58         dh_testdir
59         dh_testroot
60         rm -f build-arch-stamp build-indep-stamp configure-stamp
61         rm -rf _debian
62         [ ! -f Makefile ] || $(MAKE) distclean
63         $(ext_clean)
64         dh_clean 
65         debconf-updatepo
66
67 MAJOR=$(shell echo $(KVERS) | sed -e 's/\(...\).*/\1/')
68 ifeq ($(MAJOR),2.6)
69 KO=k
70 l2x=l26
71 dpdir=datapath/linux-2.6
72 else
73 KO=
74 l2x=l24
75 dpdir=datapath/linux-2.4
76 endif
77
78 kdist_clean:
79         dh_clean
80         rm -rf openflow
81
82 kdist_config: prep-deb-files
83
84 binary-modules: DSTDIR = $(CURDIR)/debian/$(PKGNAME)/lib/modules/$(KVERS)
85 binary-modules: prep-deb-files
86         dh_testdir
87         dh_testroot
88         dh_clean -k
89         tar xzf openflow.tar.gz
90         cd openflow && ./configure --with-$(l2x)=$(KSRC)
91         cd openflow && $(MAKE) -C $(dpdir)
92         install -d -m755 $(DSTDIR)
93         install -m644 openflow/$(dpdir)/*_mod.$(KO)o $(DSTDIR)/
94         dh_installdocs
95         dh_installchangelogs
96         dh_compress
97         dh_fixperms
98         dh_installdeb
99         dh_gencontrol -- -v$(VERSION)
100         dh_md5sums
101         dh_builddeb --destdir=$(DEB_DESTDIR)
102
103 install: install-indep install-arch
104 install-indep: build-indep
105         dh_testdir
106         dh_testroot
107         dh_clean -k -i 
108         dh_installdirs -i
109         dh_install -i
110         cd debian/openflow-datapath-source/usr/src && tar -c modules | bzip2 -9 > openflow-datapath.tar.bz2 && rm -rf modules
111         install -m644 debian/openflow-pki-server.apache2 debian/openflow-pki-server/etc/apache2/sites-available/openflow-pki
112         $(ext_install_indep)
113
114 install-arch: build-arch
115         dh_testdir
116         dh_testroot
117         dh_clean -k -s 
118         dh_installdirs -s
119         $(MAKE) -C _debian DESTDIR=$(CURDIR)/debian/openflow install
120         cp debian/openflow-switch-config.overrides debian/openflow-switch-config/usr/share/lintian/overrides/openflow-switch-config
121         dh_install -s
122         $(ext_install_arch)
123
124 # Must not depend on anything. This is to be called by
125 # binary-arch/binary-indep
126 # in another 'make' thread.
127 binary-common:
128         dh_testdir
129         dh_testroot
130         dh_installchangelogs 
131         dh_installdocs
132         dh_installexamples
133         dh_installdebconf
134 #       dh_installlogrotate
135         dh_installinit
136         dh_installman
137         dh_link
138         dh_strip
139         dh_compress 
140         dh_fixperms
141         dh_perl
142         dh_makeshlibs
143         dh_installdeb
144         dh_shlibdeps
145         dh_gencontrol
146         dh_md5sums
147         dh_builddeb
148 binary-indep: install-indep
149         $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
150 binary-arch: install-arch
151         $(MAKE) -f debian/rules DH_OPTIONS=-s binary-common
152
153 binary: binary-arch binary-indep
154 .PHONY: build clean binary-indep binary-arch binary install install-indep install-arch configure