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