mcast-snooping: Add Multicast Listener Discovery support
[cascardo/ovs.git] / Makefile.am
1 # Copyright (C) 2007-2015 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 AM_LDFLAGS += $(OVS_LDFLAGS)
15
16 if WIN32
17 AM_CPPFLAGS += -I $(top_srcdir)/include/windows
18 AM_CPPFLAGS += -I $(top_srcdir)/datapath-windows/include
19 AM_CPPFLAGS += $(PTHREAD_INCLUDES)
20 AM_CPPFLAGS += $(MSVC_CFLAGS)
21 AM_LDFLAGS += $(PTHREAD_LDFLAGS)
22 endif
23
24 AM_CPPFLAGS += -I $(top_srcdir)/include
25 AM_CPPFLAGS += -I $(top_builddir)/include
26 AM_CPPFLAGS += -I $(top_srcdir)/lib
27 AM_CPPFLAGS += -I $(top_builddir)/lib
28
29 AM_CPPFLAGS += $(SSL_INCLUDES)
30
31 AM_CFLAGS = -Wstrict-prototypes
32 AM_CFLAGS += $(WARNING_FLAGS)
33 AM_CFLAGS += $(OVS_CFLAGS)
34
35 if DPDK_NETDEV
36 AM_CFLAGS += -D_FILE_OFFSET_BITS=64
37 endif
38
39 if NDEBUG
40 AM_CPPFLAGS += -DNDEBUG
41 AM_CFLAGS += -fomit-frame-pointer
42 endif
43
44 if WIN32
45 psep=";"
46 else
47 psep=":"
48 endif
49 # PYTHONDONTWRITEBYTECODE=yes keeps Python from creating .pyc and .pyo
50 # files.  Creating .py[co] works OK for any given version of Open
51 # vSwitch, but it causes trouble if you switch from a version with
52 # foo/__init__.py into an (older) version with plain foo.py, since
53 # foo/__init__.pyc will cause Python to ignore foo.py.
54 run_python = \
55         PYTHONPATH=$(top_srcdir)/python$(psep)$$PYTHONPATH \
56         PYTHONDONTWRITEBYTECODE=yes $(PYTHON)
57
58 ALL_LOCAL =
59 BUILT_SOURCES =
60 CLEANFILES =
61 CLEAN_LOCAL =
62 DISTCLEANFILES =
63 PYCOV_CLEAN_FILES = build-aux/check-structs,cover
64
65 # A list of Markdown-formatted documentation that will automatically be
66 # included in the "make dist-docs" output.
67 docs = \
68         appveyor.yml \
69         CONTRIBUTING.md \
70         CodingStyle.md \
71         DESIGN.md \
72         FAQ.md \
73         INSTALL.md \
74         INSTALL.Debian.md \
75         INSTALL.Docker.md \
76         INSTALL.DPDK.md \
77         INSTALL.Fedora.md \
78         INSTALL.KVM.md \
79         INSTALL.Libvirt.md \
80         INSTALL.NetBSD.md \
81         INSTALL.RHEL.md \
82         INSTALL.SSL.md \
83         INSTALL.XenServer.md \
84         INSTALL.userspace.md \
85         INSTALL.Windows.md \
86         IntegrationGuide.md \
87         OPENFLOW-1.1+.md \
88         PORTING.md \
89         README.md \
90         README-lisp.md \
91         README-native-tunneling.md \
92         REPORTING-BUGS.md \
93         SECURITY.md \
94         TODO.md \
95         WHY-OVS.md
96 EXTRA_DIST = \
97         $(docs) \
98         NOTICE \
99         .travis.yml \
100         .travis/build.sh \
101         .travis/prepare.sh \
102         boot.sh \
103         build-aux/cccl \
104         build-aux/dist-docs \
105         build-aux/sodepends.pl \
106         build-aux/soexpand.pl \
107         build-aux/xml2nroff \
108         $(MAN_FRAGMENTS) \
109         $(MAN_ROOTS) \
110         Vagrantfile
111 bin_PROGRAMS =
112 sbin_PROGRAMS =
113 bin_SCRIPTS =
114 DIST_HOOKS =
115 dist_man_MANS =
116 dist_pkgdata_DATA =
117 dist_pkgdata_SCRIPTS =
118 dist_sbin_SCRIPTS =
119 dist_scripts_SCRIPTS =
120 dist_scripts_DATA =
121 INSTALL_DATA_LOCAL =
122 UNINSTALL_LOCAL =
123 man_MANS =
124 MAN_FRAGMENTS =
125 MAN_ROOTS =
126 noinst_DATA =
127 noinst_HEADERS =
128 lib_LTLIBRARIES =
129 noinst_man_MANS =
130 noinst_PROGRAMS =
131 noinst_SCRIPTS =
132 OVSIDL_BUILT =
133 pkgdata_DATA =
134 sbin_SCRIPTS =
135 scripts_SCRIPTS =
136 completion_SCRIPTS =
137 scripts_DATA =
138 SUFFIXES =
139 check_DATA =
140 check_SCRIPTS =
141 pkgconfig_DATA =
142
143 scriptsdir = $(pkgdatadir)/scripts
144 completiondir = $(sysconfdir)/bash_completion.d
145 pkgconfigdir = $(libdir)/pkgconfig
146
147 # This ensures that files added to EXTRA_DIST are always distributed,
148 # even if they are inside an Automake if...endif conditional block that is
149 # disabled by some particular "configure" run.  For more information, see:
150 # http://article.gmane.org/gmane.comp.sysutils.automake.general/10891
151 noinst_HEADERS += $(EXTRA_DIST)
152
153 ro_c = echo '/* -*- mode: c; buffer-read-only: t -*- */'
154 ro_shell = printf '\043 Generated automatically -- do not modify!    -*- buffer-read-only: t -*-\n'
155
156 SUFFIXES += .in
157 .in:
158         $(AM_V_GEN)$(PERL) $(srcdir)/build-aux/soexpand.pl -I$(srcdir) < $< | \
159             sed \
160                 -e 's,[@]PKIDIR[@],$(PKIDIR),g' \
161                 -e 's,[@]LOGDIR[@],$(LOGDIR),g' \
162                 -e 's,[@]DBDIR[@],$(DBDIR),g' \
163                 -e 's,[@]PERL[@],$(PERL),g' \
164                 -e 's,[@]PYTHON[@],$(PYTHON),g' \
165                 -e 's,[@]RUNDIR[@],$(RUNDIR),g' \
166                 -e 's,[@]VERSION[@],$(VERSION),g' \
167                 -e 's,[@]localstatedir[@],$(localstatedir),g' \
168                 -e 's,[@]pkgdatadir[@],$(pkgdatadir),g' \
169                 -e 's,[@]sysconfdir[@],$(sysconfdir),g' \
170                 -e 's,[@]bindir[@],$(bindir),g' \
171                 -e 's,[@]sbindir[@],$(sbindir),g' \
172                 -e 's,[@]abs_builddir[@],$(abs_builddir),g' \
173                 -e 's,[@]abs_top_srcdir[@],$(abs_top_srcdir),g' \
174             > $@.tmp
175         @if head -n 1 $@.tmp | grep '#!' > /dev/null; then \
176             chmod +x $@.tmp; \
177         fi
178         $(AM_V_at) mv $@.tmp $@
179
180 SUFFIXES += .xml
181 %: %.xml
182         $(AM_V_GEN)$(run_python) $(srcdir)/build-aux/xml2nroff $< > $@.tmp \
183                 --version=$(VERSION) \
184                 PKIDIR='$(PKIDIR)' \
185                 LOGDIR='$(LOGDIR)' \
186                 DBDIR='$(DBDIR)' \
187                 PERL='$(PERL)' \
188                 PYTHON='$(PYTHON)' \
189                 RUNDIR='$(RUNDIR)' \
190                 VERSION='$(VERSION)' \
191                 localstatedir='$(localstatedir)' \
192                 pkgdatadir='$(pkgdatadir)' \
193                 sysconfdir='$(sysconfdir)' \
194                 bindir='$(bindir)' \
195                 sbindir='$(sbindir)'
196         $(AM_v_at)mv $@.tmp $@
197
198 .PHONY: clean-pycov
199 clean-pycov:
200         cd $(srcdir) && rm -f $(PYCOV_CLEAN_FILES)
201 CLEAN_LOCAL += clean-pycov
202
203 # If we're checked out from a Git repository, make sure that every
204 # file that is in Git is distributed.
205 #
206 # We only enable this check when GNU make is in use because the
207 # Makefile in datapath/linux, needed to get the list of files to
208 # distribute, requires GNU make extensions.
209 if GNU_MAKE
210 ALL_LOCAL += dist-hook-git
211 dist-hook-git: distfiles
212         @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1; then \
213           (cd datapath && $(MAKE) distfiles);                               \
214           (cat distfiles; sed 's|^|datapath/|' datapath/distfiles) |        \
215             LC_ALL=C sort -u > all-distfiles;                               \
216           (cd $(srcdir) && git ls-files) | grep -v '\.gitignore$$' |        \
217             LC_ALL=C sort -u > all-gitfiles;                                \
218           LC_ALL=C comm -1 -3 all-distfiles all-gitfiles > missing-distfiles; \
219           if test -s missing-distfiles; then                                \
220             echo "The following files are in git but not the distribution:"; \
221             cat missing-distfiles;                                          \
222             exit 1;                                                         \
223           fi;                                                               \
224         fi
225 CLEANFILES += all-distfiles all-gitfiles missing-distfiles
226 # The following is based on commands for the Automake "distdir" target.
227 distfiles: Makefile
228         @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
229         topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
230         list='$(DISTFILES)'; \
231         for file in $$list; do echo $$file; done | \
232           sed -e "s|^$$srcdirstrip/||;t" \
233               -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t" | \
234           LC_ALL=C sort -u > $@
235 CLEANFILES += distfiles
236 endif
237 .PHONY: dist-hook-git
238
239 # Check that every .c file includes <config.h>.
240 ALL_LOCAL += config-h-check
241 config-h-check:
242         @cd $(srcdir); \
243         if test -e .git && (git --version) >/dev/null 2>&1 && \
244            git --no-pager grep -L '#include <config\.h>' `git ls-files | grep '\.c$$' | \
245                grep -vE '^datapath|^lib/sflow|^third-party|^datapath-windows'`; \
246         then \
247             echo "See above for list of violations of the rule that"; \
248             echo "every C source file must #include <config.h>."; \
249             exit 1; \
250         fi
251 .PHONY: config-h-check
252
253 # Check for printf() type modifiers that MSVC doesn't support.
254 ALL_LOCAL += printf-check
255 printf-check:
256         @cd $(srcdir); \
257         if test -e .git && (git --version) >/dev/null 2>&1 && \
258            git --no-pager grep -n -E -e '%[-+ #0-9.*]*([ztj]|hh)' --and --not -e 'ovs_scan' `git ls-files | grep '\.[ch]$$' | \
259                grep -vE '^datapath|^lib/sflow|^third-party'`; \
260         then \
261             echo "See above for list of violations of the rule that"; \
262             echo "'z', 't', 'j', 'hh' printf() type modifiers are"; \
263             echo "forbidden.  See CodingStyle.md for replacements."; \
264             exit 1; \
265         fi
266 .PHONY: printf-check
267
268 # Check that certain data structures are always declared "static".
269 ALL_LOCAL += static-check
270 static-check:
271         @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
272             git --no-pager grep -n -E '^[       ]+(struct vlog_rate_limit|pthread_once_t|struct ovsthread_once).*=' $(srcdir); \
273          then \
274             echo "See above for list of violations of the rule that "; \
275             echo "certain data structures must always be 'static'"; \
276             exit 1; \
277          fi
278 .PHONY: static-check
279
280 # Check that assert.h is not used outside a whitelist of files.
281 ALL_LOCAL += check-assert-h-usage
282 check-assert-h-usage:
283         @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
284             (cd $(srcdir) && git --no-pager grep -l -E '[<]assert.h[>]') | \
285             $(EGREP) -v '^lib/(sflow_receiver|vlog).c$$|^tests/'; \
286          then \
287             echo "Files listed above unexpectedly #include <""assert.h"">."; \
288             echo "Please use ovs_assert (from util.h) instead of assert."; \
289             exit 1; \
290          fi
291 .PHONY: check-assert-h-usage
292
293 # Check that LITTLE_ENDIAN and BIG_ENDIAN are not used unless BYTE_ORDER is
294 # also mentioned.  (<endian.h> always defines the former two constants.  They
295 # must be compared to BYTE_ORDER to get the machine's correct endianness.  But
296 # it is better to use WORDS_BIGENDIAN.)
297 ALL_LOCAL += check-endian
298 check-endian:
299         @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
300             (cd $(srcdir) && git --no-pager grep -l -E \
301              -e 'BIG_ENDIAN|LITTLE_ENDIAN' --and --not -e 'BYTE_ORDER' | \
302             $(EGREP) -v '^datapath/'); \
303          then \
304             echo "See above for list of files that misuse LITTLE""_ENDIAN"; \
305             echo "or BIG""_ENDIAN.  Please use WORDS_BIGENDIAN instead."; \
306             exit 1; \
307          fi
308 .PHONY: check-endian
309
310 ALL_LOCAL += thread-safety-check
311 thread-safety-check:
312         @cd $(srcdir); \
313         if test -e .git && (git --version) >/dev/null 2>&1 && \
314            grep -n -f build-aux/thread-safety-blacklist \
315                `git ls-files | grep '\.[ch]$$' \
316                 | $(EGREP) -v '^datapath|^lib/sflow|^third-party'` /dev/null \
317                | $(EGREP) -v ':[        ]*/?\*'; \
318         then \
319             echo "See above for list of calls to functions that are"; \
320             echo "blacklisted due to thread safety issues"; \
321             exit 1; \
322         fi
323 EXTRA_DIST += build-aux/thread-safety-blacklist
324
325 if HAVE_GROFF
326 ALL_LOCAL += manpage-check
327 manpage-check: $(man_MANS) $(dist_man_MANS) $(noinst_man_MANS)
328         @error=false; \
329         for manpage in $?; do \
330                 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; \
331                 if grep warning: $@.tmp; then error=:; fi; \
332                 rm -f $@.tmp; \
333         done; \
334         if $$error; then exit 1; else touch $@; fi
335         $(AM_V_GEN) touch -c $@
336 CLEANFILES += manpage-check
337 endif
338
339 include $(srcdir)/manpages.mk
340 $(srcdir)/manpages.mk: $(MAN_ROOTS) build-aux/sodepends.pl
341         @$(PERL) $(srcdir)/build-aux/sodepends.pl -I. -I$(srcdir) $(MAN_ROOTS) >$(@F).tmp
342         @if cmp -s $(@F).tmp $@; then \
343                 touch $@; \
344                 rm -f $(@F).tmp; \
345         else \
346                 mv $(@F).tmp $@; \
347         fi
348 CLEANFILES += manpage-dep-check
349
350 if VSTUDIO_DDK
351 ALL_LOCAL += ovsext_make
352 ovsext_make: datapath-windows/ovsext.sln
353         MSBuild.exe datapath-windows/ovsext.sln /target:Build /property:Configuration="Win8$(VSTUDIO_CONFIG)"
354         MSBuild.exe datapath-windows/ovsext.sln /target:Build /property:Configuration="Win8.1$(VSTUDIO_CONFIG)"
355
356 CLEAN_LOCAL += ovsext_clean
357 ovsext_clean: datapath-windows/ovsext.sln
358         MSBuild.exe datapath-windows/ovsext.sln /target:Clean /property:Configuration="Win8$(VSTUDIO_CONFIG)"
359         MSBuild.exe datapath-windows/ovsext.sln /target:Clean /property:Configuration="Win8.1$(VSTUDIO_CONFIG)"
360 endif
361
362 dist-hook: $(DIST_HOOKS)
363 all-local: $(ALL_LOCAL)
364 clean-local: $(CLEAN_LOCAL)
365 install-data-local: $(INSTALL_DATA_LOCAL)
366 uninstall-local: $(UNINSTALL_LOCAL)
367 .PHONY: $(DIST_HOOKS) $(CLEAN_LOCAL) $(INSTALL_DATA_LOCAL) $(UNINSTALL_LOCAL)
368
369 modules_install:
370 if LINUX_ENABLED
371         cd datapath/linux && $(MAKE) modules_install
372 endif
373
374 dist-docs:
375         VERSION=$(VERSION) $(srcdir)/build-aux/dist-docs $(srcdir) $(docs)
376 .PHONY: dist-docs
377
378 include Documentation/automake.mk
379 include m4/automake.mk
380 include lib/automake.mk
381 include ofproto/automake.mk
382 include utilities/automake.mk
383 include tests/automake.mk
384 include include/automake.mk
385 include third-party/automake.mk
386 include debian/automake.mk
387 include vswitchd/automake.mk
388 include ovsdb/automake.mk
389 include rhel/automake.mk
390 include xenserver/automake.mk
391 include python/automake.mk
392 include tutorial/automake.mk
393 include vtep/automake.mk
394 include datapath-windows/automake.mk
395 include datapath-windows/include/automake.mk
396 include windows/automake.mk
397 include ovn/automake.mk