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