fa3cea85e6fff4a9d72ec414bf4a4cb8a4af9cd2
[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 DATAPATH_CONFIGURE_OPTS = --enable-snat
31
32 # Official build number.  Leave set to 0 if not an official build.
33 BUILD_NUMBER = 0
34
35 configure: configure-stamp
36 configure-stamp:
37         dh_testdir
38         test -e configure || ./boot.sh
39         test -d _debian || mkdir _debian
40         cd _debian && ( \
41                 test -e Makefile || \
42                 ../configure --prefix=/usr --localstatedir=/var --enable-ssl \
43                         --with-build-number=$(BUILD_NUMBER) \
44                         $(DATAPATH_CONFIGURE_OPTS))
45         $(ext_configure)
46         touch configure-stamp
47
48 #Architecture 
49 build: build-arch build-indep
50
51 build-arch: build-arch-stamp
52 build-arch-stamp: configure-stamp 
53         $(MAKE) -C _debian
54         $(ext_build_arch)
55         touch $@
56
57 build-indep: build-indep-stamp
58 build-indep-stamp: configure-stamp 
59         $(MAKE) -C _debian dist distdir=openflow
60         $(ext_build_indep)
61         touch $@
62
63 clean:
64         dh_testdir
65         dh_testroot
66         rm -f build-arch-stamp build-indep-stamp configure-stamp
67         rm -rf _debian
68         [ ! -f Makefile ] || $(MAKE) distclean
69         $(ext_clean)
70         dh_clean 
71         debconf-updatepo
72
73 MAJOR=$(shell echo $(KVERS) | sed -e 's/\(...\).*/\1/')
74 ifeq ($(MAJOR),2.6)
75 KO=k
76 l2x=l26
77 dpdir=datapath/linux-2.6
78 else
79 KO=
80 l2x=l24
81 dpdir=datapath/linux-2.4
82 endif
83
84 kdist_clean:
85         dh_clean
86         rm -rf openflow
87
88 kdist_config: prep-deb-files
89
90 binary-modules: DSTDIR = $(CURDIR)/debian/$(PKGNAME)/lib/modules/$(KVERS)
91 binary-modules: prep-deb-files
92         dh_testdir
93         dh_testroot
94         dh_clean -k
95         tar xzf openflow.tar.gz
96         cd openflow && ./configure --with-$(l2x)=$(KSRC) $(DATAPATH_CONFIGURE_OPTS) --with-build-number=$(BUILD_NUMBER)
97         cd openflow && $(MAKE) -C $(dpdir)
98         install -d -m755 $(DSTDIR)
99         install -m644 openflow/$(dpdir)/*_mod.$(KO)o $(DSTDIR)/
100         dh_installdocs
101         dh_installchangelogs
102         dh_compress
103         dh_fixperms
104         dh_installdeb
105         dh_gencontrol
106         dh_md5sums
107         dh_builddeb --destdir=$(DEB_DESTDIR)
108
109 install: install-indep install-arch
110 install-indep: build-indep
111         dh_testdir
112         dh_testroot
113         dh_clean -k -i 
114         dh_installdirs -i
115         dh_install -i
116         cd debian/openflow-datapath-source/usr/src && tar -c modules | bzip2 -9 > openflow-datapath.tar.bz2 && rm -rf modules
117         install -m644 debian/openflow-pki-server.apache2 debian/openflow-pki-server/etc/apache2/sites-available/openflow-pki
118         install -m1777 -d debian/corekeeper/var/log/core
119         $(ext_install_indep)
120
121 install-arch: build-arch
122         dh_testdir
123         dh_testroot
124         dh_clean -k -s 
125         dh_installdirs -s
126         $(MAKE) -C _debian DESTDIR=$(CURDIR)/debian/openflow install
127         cp debian/openflow-switch-config.overrides debian/openflow-switch-config/usr/share/lintian/overrides/openflow-switch-config
128         dh_install -s
129         $(ext_install_arch)
130
131 # Must not depend on anything. This is to be called by
132 # binary-arch/binary-indep
133 # in another 'make' thread.
134 binary-common:
135         dh_testdir
136         dh_testroot
137         dh_installchangelogs 
138         dh_installdocs
139         dh_installexamples
140         dh_installdebconf
141         dh_installlogrotate
142         dh_installinit
143         dh_installcron
144         dh_installman
145         dh_link
146         dh_strip --dbg-package=openflow-dbg
147         dh_compress 
148         dh_fixperms -X var/log/core
149         dh_perl
150         dh_makeshlibs
151         dh_installdeb
152         dh_shlibdeps
153         dh_gencontrol
154         dh_md5sums
155         dh_builddeb
156 binary-indep: install-indep
157         $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
158 binary-arch: install-arch
159         $(MAKE) -f debian/rules DH_OPTIONS=-s binary-common
160
161 binary: binary-arch binary-indep
162 .PHONY: build clean binary-indep binary-arch binary install install-indep install-arch configure