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