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