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