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