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