datapath-windows: Kernel module for HyperV.
[cascardo/ovs.git] / Makefile.am
1 # Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Nicira, Inc.
2 #
3 # Copying and distribution of this file, with or without modification,
4 # are permitted in any medium without royalty provided the copyright
5 # notice and this notice are preserved.  This file is offered as-is,
6 # without warranty of any kind.
7
8 AUTOMAKE_OPTIONS = foreign subdir-objects
9 ACLOCAL_AMFLAGS = -I m4
10 SUBDIRS = datapath
11
12 AM_CPPFLAGS = $(SSL_CFLAGS)
13 AM_LDFLAGS = $(SSL_LDFLAGS)
14
15 if WIN32
16 AM_CPPFLAGS += -I $(top_srcdir)/include/windows
17 AM_CPPFLAGS += -I $(top_srcdir)/datapath-windows/include
18 AM_CPPFLAGS += $(PTHREAD_INCLUDES)
19 AM_LDFLAGS += $(PTHREAD_LDFLAGS)
20 endif
21
22 AM_CPPFLAGS += -I $(top_srcdir)/include
23 AM_CPPFLAGS += -I $(top_srcdir)/lib
24 AM_CPPFLAGS += -I $(top_builddir)/lib
25
26 AM_CPPFLAGS += $(SSL_INCLUDES)
27
28 AM_CFLAGS = -Wstrict-prototypes
29 AM_CFLAGS += $(WARNING_FLAGS)
30
31 if NDEBUG
32 AM_CPPFLAGS += -DNDEBUG
33 AM_CFLAGS += -fomit-frame-pointer
34 endif
35
36 if WIN32
37 psep=";"
38 else
39 psep=":"
40 endif
41 # PYTHONDONTWRITEBYTECODE=yes keeps Python from creating .pyc and .pyo
42 # files.  Creating .py[co] works OK for any given version of Open
43 # vSwitch, but it causes trouble if you switch from a version with
44 # foo/__init__.py into an (older) version with plain foo.py, since
45 # foo/__init__.pyc will cause Python to ignore foo.py.
46 if INCLUDE_PYTHON_COMPAT
47 run_python = PYTHONPATH=$(top_srcdir)/python$(psep)$(top_srcdir)/python/compat$(psep)$$PYTHONPATH
48 else
49 run_python = PYTHONPATH=$(top_srcdir)/python$(psep)$$PYTHONPATH
50 endif
51 run_python += PYTHONDONTWRITEBYTECODE=yes $(PYTHON)
52
53
54 ALL_LOCAL =
55 BUILT_SOURCES =
56 CLEANFILES =
57 CLEAN_LOCAL =
58 DISTCLEANFILES =
59 PYCOV_CLEAN_FILES = build-aux/check-structs,cover
60 EXTRA_DIST = \
61         CONTRIBUTING \
62         CodingStyle \
63         DESIGN \
64         FAQ \
65         INSTALL \
66         INSTALL.Debian \
67         INSTALL.DPDK \
68         INSTALL.Fedora \
69         INSTALL.KVM \
70         INSTALL.Libvirt \
71         INSTALL.NetBSD \
72         INSTALL.RHEL \
73         INSTALL.SSL \
74         INSTALL.XenServer \
75         INSTALL.userspace \
76         INSTALL.Windows \
77         IntegrationGuide \
78         NOTICE \
79         OPENFLOW-1.1+ \
80         PORTING \
81         README-lisp \
82         REPORTING-BUGS \
83         TODO \
84         WHY-OVS \
85         boot.sh \
86         build-aux/cccl \
87         build-aux/sodepends.pl \
88         build-aux/soexpand.pl \
89         $(MAN_FRAGMENTS) \
90         $(MAN_ROOTS)
91 bin_PROGRAMS =
92 sbin_PROGRAMS =
93 bin_SCRIPTS =
94 DIST_HOOKS =
95 dist_man_MANS =
96 dist_pkgdata_DATA =
97 dist_pkgdata_SCRIPTS =
98 dist_sbin_SCRIPTS =
99 dist_scripts_SCRIPTS =
100 dist_scripts_DATA =
101 INSTALL_DATA_LOCAL =
102 UNINSTALL_LOCAL =
103 man_MANS =
104 MAN_FRAGMENTS =
105 MAN_ROOTS =
106 noinst_DATA =
107 noinst_HEADERS =
108 lib_LTLIBRARIES =
109 noinst_man_MANS =
110 noinst_PROGRAMS =
111 noinst_SCRIPTS =
112 OVSIDL_BUILT =
113 pkgdata_DATA =
114 sbin_SCRIPTS =
115 scripts_SCRIPTS =
116 scripts_DATA =
117 SUFFIXES =
118 check_DATA =
119
120 scriptsdir = $(pkgdatadir)/scripts
121
122 # This ensures that files added to EXTRA_DIST are always distributed,
123 # even if they are inside an Automake if...endif conditional block that is
124 # disabled by some particular "configure" run.  For more information, see:
125 # http://article.gmane.org/gmane.comp.sysutils.automake.general/10891
126 noinst_HEADERS += $(EXTRA_DIST)
127
128 ro_c = echo '/* -*- mode: c; buffer-read-only: t -*- */'
129 ro_shell = printf '\043 Generated automatically -- do not modify!    -*- buffer-read-only: t -*-\n'
130
131 SUFFIXES += .in
132 .in:
133         $(PERL) $(srcdir)/build-aux/soexpand.pl -I$(srcdir) < $< | \
134             sed \
135                 -e 's,[@]PKIDIR[@],$(PKIDIR),g' \
136                 -e 's,[@]LOGDIR[@],$(LOGDIR),g' \
137                 -e 's,[@]DBDIR[@],$(DBDIR),g' \
138                 -e 's,[@]PERL[@],$(PERL),g' \
139                 -e 's,[@]PYTHON[@],$(PYTHON),g' \
140                 -e 's,[@]RUNDIR[@],$(RUNDIR),g' \
141                 -e 's,[@]VERSION[@],$(VERSION),g' \
142                 -e 's,[@]localstatedir[@],$(localstatedir),g' \
143                 -e 's,[@]pkgdatadir[@],$(pkgdatadir),g' \
144                 -e 's,[@]sysconfdir[@],$(sysconfdir),g' \
145                 -e 's,[@]bindir[@],$(bindir),g' \
146                 -e 's,[@]sbindir[@],$(sbindir),g' \
147                 -e 's,[@]abs_top_srcdir[@],$(abs_top_srcdir),g' \
148             > $@.tmp
149         @if head -n 1 $@.tmp | grep '#!' > /dev/null; then \
150             chmod +x $@.tmp; \
151         fi
152         $(AM_V_GEN) mv $@.tmp $@
153
154 .PHONY: clean-pycov
155 clean-pycov:
156         cd $(srcdir) && rm -f $(PYCOV_CLEAN_FILES)
157 CLEAN_LOCAL += clean-pycov
158
159 # If we're checked out from a Git repository, make sure that every
160 # file that is in Git is distributed.
161 #
162 # We only enable this check when GNU make is in use because the
163 # Makefile in datapath/linux, needed to get the list of files to
164 # distribute, requires GNU make extensions.
165 if GNU_MAKE
166 ALL_LOCAL += dist-hook-git
167 dist-hook-git: distfiles
168         @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1; then \
169           (cd datapath && $(MAKE) distfiles);                               \
170           (cat distfiles; sed 's|^|datapath/|' datapath/distfiles) |        \
171             LC_ALL=C sort -u > all-distfiles;                               \
172           (cd $(srcdir) && git ls-files) | grep -v '\.gitignore$$' |        \
173             LC_ALL=C sort -u > all-gitfiles;                                \
174           LC_ALL=C comm -1 -3 all-distfiles all-gitfiles > missing-distfiles; \
175           if test -s missing-distfiles; then                                \
176             echo "The distribution is missing the following files:";        \
177             cat missing-distfiles;                                          \
178             exit 1;                                                         \
179           fi;                                                               \
180         fi
181 CLEANFILES += all-distfiles all-gitfiles missing-distfiles
182 # The following is based on commands for the Automake "distdir" target.
183 distfiles: Makefile
184         @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
185         topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
186         list='$(DISTFILES)'; \
187         for file in $$list; do echo $$file; done | \
188           sed -e "s|^$$srcdirstrip/||;t" \
189               -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t" | \
190           LC_ALL=C sort -u > $@
191 CLEANFILES += distfiles
192 endif
193 .PHONY: dist-hook-git
194
195 # Check that every .c file includes <config.h>.
196 ALL_LOCAL += config-h-check
197 config-h-check:
198         @cd $(srcdir); \
199         if test -e .git && (git --version) >/dev/null 2>&1 && \
200            git --no-pager grep -L '#include <config\.h>' `git ls-files | grep '\.c$$' | \
201                grep -vE '^datapath|^lib/sflow|^third-party|^datapath-windows'`; \
202         then \
203             echo "See above for list of violations of the rule that"; \
204             echo "every C source file must #include <config.h>."; \
205             exit 1; \
206         fi
207 .PHONY: config-h-check
208
209 # Check for printf() type modifiers that MSVC doesn't support.
210 ALL_LOCAL += printf-check
211 printf-check:
212         @cd $(srcdir); \
213         if test -e .git && (git --version) >/dev/null 2>&1 && \
214            git --no-pager grep -n -E -e '%[-+ #0-9.*]*([ztj]|hh)' --and --not -e 'ovs_scan' `git ls-files | grep '\.[ch]$$' | \
215                grep -vE '^datapath|^lib/sflow|^third-party'`; \
216         then \
217             echo "See above for list of violations of the rule that"; \
218             echo "'z', 't', 'j', 'hh' printf() type modifiers are"; \
219             echo "forbidden.  See CodingStyle for replacements."; \
220             exit 1; \
221         fi
222 .PHONY: printf-check
223
224 # Check that certain data structures are always declared "static".
225 ALL_LOCAL += static-check
226 static-check:
227         @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
228             git --no-pager grep -n -E '^[       ]+(struct vlog_rate_limit|pthread_once_t|struct ovsthread_once).*=' $(srcdir); \
229          then \
230             echo "See above for list of violations of the rule that "; \
231             echo "certain data structures must always be 'static'"; \
232             exit 1; \
233          fi
234 .PHONY: static-check
235
236 # Check that assert.h is not used outside a whitelist of files.
237 ALL_LOCAL += check-assert-h-usage
238 check-assert-h-usage:
239         @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
240             (cd $(srcdir) && git --no-pager grep -l -E '[<]assert.h[>]') | \
241             $(EGREP) -v '^lib/(sflow_receiver|vlog).c$$|^tests/'; \
242          then \
243             echo "Files listed above unexpectedly #include <""assert.h"">."; \
244             echo "Please use ovs_assert (from util.h) instead of assert."; \
245             exit 1; \
246          fi
247 .PHONY: check-assert-h-usage
248
249 ALL_LOCAL += thread-safety-check
250 thread-safety-check:
251         @cd $(srcdir); \
252         if test -e .git && (git --version) >/dev/null 2>&1 && \
253            grep -n -f build-aux/thread-safety-blacklist \
254                `git ls-files | grep '\.[ch]$$' \
255                 | $(EGREP) -v '^datapath|^lib/sflow|^third-party'` /dev/null \
256                | $(EGREP) -v ':[        ]*/?\*'; \
257         then \
258             echo "See above for list of calls to functions that are"; \
259             echo "blacklisted due to thread safety issues"; \
260             exit 1; \
261         fi
262 EXTRA_DIST += build-aux/thread-safety-blacklist
263
264 if HAVE_GROFF
265 ALL_LOCAL += manpage-check
266 manpage-check: $(man_MANS) $(dist_man_MANS) $(noinst_man_MANS)
267         @error=false; \
268         for manpage in $?; do \
269                 LANG=en_US.UTF-8 groff -w mac -w delim -w escape -w input -w missing -w tab -T utf8 -man -p -z $$manpage >$@.tmp 2>&1; \
270                 if grep warning: $@.tmp; then error=:; fi; \
271                 rm -f $@.tmp; \
272         done; \
273         if $$error; then exit 1; else touch $@; fi
274         $(AM_V_GEN) touch -c $@
275 CLEANFILES += manpage-check
276 endif
277
278 include $(srcdir)/manpages.mk
279 $(srcdir)/manpages.mk: $(MAN_ROOTS) build-aux/sodepends.pl
280         @$(PERL) $(srcdir)/build-aux/sodepends.pl -I. -I$(srcdir) $(MAN_ROOTS) >$(@F).tmp
281         @if cmp -s $(@F).tmp $@; then \
282                 touch $@; \
283                 rm -f $(@F).tmp; \
284         else \
285                 mv $(@F).tmp $@; \
286         fi
287 CLEANFILES += manpage-dep-check
288
289 dist-hook: $(DIST_HOOKS)
290 all-local: $(ALL_LOCAL)
291 clean-local: $(CLEAN_LOCAL)
292 install-data-local: $(INSTALL_DATA_LOCAL)
293 uninstall-local: $(UNINSTALL_LOCAL)
294 .PHONY: $(DIST_HOOKS) $(CLEAN_LOCAL) $(INSTALL_DATA_LOCAL) $(UNINSTALL_LOCAL)
295
296 modules_install:
297 if LINUX_ENABLED
298         cd datapath/linux && $(MAKE) modules_install
299 endif
300
301 include m4/automake.mk
302 include lib/automake.mk
303 include ofproto/automake.mk
304 include utilities/automake.mk
305 include tests/automake.mk
306 include include/automake.mk
307 include third-party/automake.mk
308 include debian/automake.mk
309 include vswitchd/automake.mk
310 include ovsdb/automake.mk
311 include rhel/automake.mk
312 include xenserver/automake.mk
313 include python/automake.mk
314 include python/compat/automake.mk
315 include tutorial/automake.mk
316 include vtep/automake.mk
317 include datapath-windows/automake.mk