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