testsuite.at: Workaround for carriage returns on windows.
[sliver-openvswitch.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
15 if WIN32
16 AM_CPPFLAGS += -I $(top_srcdir)/include/windows
17 AM_CPPFLAGS += $(PTHREAD_INCLUDES)
18 AM_LDFLAGS += $(PTHREAD_LDFLAGS)
19 endif
20
21 AM_CPPFLAGS += -I $(top_srcdir)/include
22 AM_CPPFLAGS += -I $(top_srcdir)/lib
23 AM_CPPFLAGS += -I $(top_builddir)/lib
24
25 AM_CPPFLAGS += $(SSL_INCLUDES)
26
27 AM_CFLAGS = -Wstrict-prototypes
28 AM_CFLAGS += $(WARNING_FLAGS)
29
30 if NDEBUG
31 AM_CPPFLAGS += -DNDEBUG
32 AM_CFLAGS += -fomit-frame-pointer
33 endif
34
35 if WIN32
36 psep=";"
37 else
38 psep=":"
39 endif
40 # PYTHONDONTWRITEBYTECODE=yes keeps Python from creating .pyc and .pyo
41 # files.  Creating .py[co] works OK for any given version of Open
42 # vSwitch, but it causes trouble if you switch from a version with
43 # foo/__init__.py into an (older) version with plain foo.py, since
44 # foo/__init__.pyc will cause Python to ignore foo.py.
45 if INCLUDE_PYTHON_COMPAT
46 run_python = PYTHONPATH=$(top_srcdir)/python$(psep)$(top_srcdir)/python/compat$(psep)$$PYTHONPATH
47 else
48 run_python = PYTHONPATH=$(top_srcdir)/python$(psep)$$PYTHONPATH
49 endif
50 run_python += PYTHONDONTWRITEBYTECODE=yes $(PYTHON)
51
52
53 ALL_LOCAL =
54 BUILT_SOURCES =
55 CLEANFILES =
56 CLEAN_LOCAL =
57 DISTCLEANFILES =
58 PYCOV_CLEAN_FILES = build-aux/check-structs,cover
59 EXTRA_DIST = \
60         BUILD.Windows \
61         CONTRIBUTING \
62         CodingStyle \
63         DESIGN \
64         FAQ \
65         INSTALL \
66         INSTALL.Debian \
67         INSTALL.DPDK \
68         INSTALL.Fedora \
69         INSTALL.KVM \
70         INSTALL.Libvirt \
71         INSTALL.NetBSD \
72         INSTALL.RHEL \
73         INSTALL.SSL \
74         INSTALL.XenServer \
75         INSTALL.userspace \
76         IntegrationGuide \
77         NOTICE \
78         OPENFLOW-1.1+ \
79         PORTING \
80         README-lisp \
81         REPORTING-BUGS \
82         WHY-OVS \
83         boot.sh \
84         build-aux/cccl \
85         build-aux/sodepends.pl \
86         build-aux/soexpand.pl \
87         $(MAN_FRAGMENTS) \
88         $(MAN_ROOTS)
89 bin_PROGRAMS =
90 sbin_PROGRAMS =
91 bin_SCRIPTS =
92 DIST_HOOKS =
93 dist_man_MANS =
94 dist_pkgdata_DATA =
95 dist_pkgdata_SCRIPTS =
96 dist_sbin_SCRIPTS =
97 dist_scripts_SCRIPTS =
98 dist_scripts_DATA =
99 INSTALL_DATA_LOCAL =
100 UNINSTALL_LOCAL =
101 man_MANS =
102 MAN_FRAGMENTS =
103 MAN_ROOTS =
104 noinst_DATA =
105 noinst_HEADERS =
106 lib_LTLIBRARIES =
107 noinst_man_MANS =
108 noinst_PROGRAMS =
109 noinst_SCRIPTS =
110 OVSIDL_BUILT =
111 pkgdata_DATA =
112 sbin_SCRIPTS =
113 scripts_SCRIPTS =
114 scripts_DATA =
115 SUFFIXES =
116 check_DATA =
117
118 scriptsdir = $(pkgdatadir)/scripts
119
120 # This ensures that files added to EXTRA_DIST are always distributed,
121 # even if they are inside an Automake if...endif conditional block that is
122 # disabled by some particular "configure" run.  For more information, see:
123 # http://article.gmane.org/gmane.comp.sysutils.automake.general/10891
124 noinst_HEADERS += $(EXTRA_DIST)
125
126 ro_c = echo '/* -*- mode: c; buffer-read-only: t -*- */'
127 ro_shell = printf '\043 Generated automatically -- do not modify!    -*- buffer-read-only: t -*-\n'
128
129 SUFFIXES += .in
130 .in:
131         $(PERL) $(srcdir)/build-aux/soexpand.pl -I$(srcdir) < $< | \
132             sed \
133                 -e 's,[@]PKIDIR[@],$(PKIDIR),g' \
134                 -e 's,[@]LOGDIR[@],$(LOGDIR),g' \
135                 -e 's,[@]DBDIR[@],$(DBDIR),g' \
136                 -e 's,[@]PERL[@],$(PERL),g' \
137                 -e 's,[@]PYTHON[@],$(PYTHON),g' \
138                 -e 's,[@]RUNDIR[@],$(RUNDIR),g' \
139                 -e 's,[@]VERSION[@],$(VERSION),g' \
140                 -e 's,[@]localstatedir[@],$(localstatedir),g' \
141                 -e 's,[@]pkgdatadir[@],$(pkgdatadir),g' \
142                 -e 's,[@]sysconfdir[@],$(sysconfdir),g' \
143                 -e 's,[@]bindir[@],$(bindir),g' \
144                 -e 's,[@]sbindir[@],$(sbindir),g' \
145                 -e 's,[@]abs_top_srcdir[@],$(abs_top_srcdir),g' \
146             > $@.tmp
147         @if head -n 1 $@.tmp | grep '#!' > /dev/null; then \
148             chmod +x $@.tmp; \
149         fi
150         $(AM_V_GEN) mv $@.tmp $@
151
152 .PHONY: clean-pycov
153 clean-pycov:
154         cd $(srcdir) && rm -f $(PYCOV_CLEAN_FILES)
155 CLEAN_LOCAL += clean-pycov
156
157 # If we're checked out from a Git repository, make sure that every
158 # file that is in Git is distributed.
159 #
160 # We only enable this check when GNU make is in use because the
161 # Makefile in datapath/linux, needed to get the list of files to
162 # distribute, requires GNU make extensions.
163 if GNU_MAKE
164 ALL_LOCAL += dist-hook-git
165 dist-hook-git: distfiles
166         @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1; then \
167           (cd datapath && $(MAKE) distfiles);                               \
168           (cat distfiles; sed 's|^|datapath/|' datapath/distfiles) |        \
169             LC_ALL=C sort -u > all-distfiles;                               \
170           (cd $(srcdir) && git ls-files) | grep -v '\.gitignore$$' |        \
171             LC_ALL=C sort -u > all-gitfiles;                                \
172           LC_ALL=C comm -1 -3 all-distfiles all-gitfiles > missing-distfiles; \
173           if test -s missing-distfiles; then                                \
174             echo "The distribution is missing the following files:";        \
175             cat missing-distfiles;                                          \
176             exit 1;                                                         \
177           fi;                                                               \
178         fi
179 CLEANFILES += all-distfiles all-gitfiles missing-distfiles
180 # The following is based on commands for the Automake "distdir" target.
181 distfiles: Makefile
182         @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
183         topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
184         list='$(DISTFILES)'; \
185         for file in $$list; do echo $$file; done | \
186           sed -e "s|^$$srcdirstrip/||;t" \
187               -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t" | \
188           LC_ALL=C sort -u > $@
189 CLEANFILES += distfiles
190 endif
191 .PHONY: dist-hook-git
192
193 # Check that every .c file includes <config.h>.
194 ALL_LOCAL += config-h-check
195 config-h-check:
196         @cd $(srcdir); \
197         if test -e .git && (git --version) >/dev/null 2>&1 && \
198            git --no-pager grep -L '#include <config\.h>' `git ls-files | grep '\.c$$' | \
199                grep -vE '^datapath|^lib/sflow|^third-party'`; \
200         then \
201             echo "See above for list of violations of the rule that"; \
202             echo "every C source file must #include <config.h>."; \
203             exit 1; \
204         fi
205 .PHONY: config-h-check
206
207 # Check for printf() type modifiers that MSVC doesn't support.
208 ALL_LOCAL += printf-check
209 printf-check:
210         @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
211            git --no-pager grep -n -E -e '%[-+ #0-9.*]*([ztj]|hh)' --and --not -e 'ovs_scan' `git ls-files $(srcdir) | grep '\.[ch]$$'`; \
212         then \
213             echo "See above for list of violations of the rule that"; \
214             echo "'z', 't', 'j', 'hh' printf() type modifiers are"; \
215             echo "forbidden.  See CodingStyle for replacements."; \
216             exit 1; \
217         fi
218 .PHONY: printf-check
219
220 # Check that certain data structures are always declared "static".
221 ALL_LOCAL += static-check
222 static-check:
223         @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
224             git --no-pager grep -n -E '^[       ]+(struct vlog_rate_limit|pthread_once_t|struct ovsthread_once).*=' $(srcdir); \
225          then \
226             echo "See above for list of violations of the rule that "; \
227             echo "certain data structures must always be 'static'"; \
228             exit 1; \
229          fi
230 .PHONY: static-check
231
232 # Check that assert.h is not used outside a whitelist of files.
233 ALL_LOCAL += check-assert-h-usage
234 check-assert-h-usage:
235         @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
236             (cd $(srcdir) && git --no-pager grep -l -E '[<]assert.h[>]') | \
237             $(EGREP) -v '^lib/(sflow_receiver|vlog).c$$|^tests/'; \
238          then \
239             echo "Files listed above unexpectedly #include <""assert.h"">."; \
240             echo "Please use ovs_assert (from util.h) instead of assert."; \
241             exit 1; \
242          fi
243 .PHONY: check-assert-h-usage
244
245 ALL_LOCAL += thread-safety-check
246 thread-safety-check:
247         @if test -e '$(srcdir)'/.git && (git --version) >/dev/null 2>&1 && \
248            grep -n -f '$(srcdir)'/build-aux/thread-safety-blacklist \
249                `git ls-files '$(srcdir)' | grep '\.[ch]$$' \
250                 | $(EGREP) -v '^datapath|^lib/sflow|^third-party'` /dev/null \
251                | $(EGREP) -v ':[        ]*/?\*'; \
252         then \
253             echo "See above for list of calls to functions that are"; \
254             echo "blacklisted due to thread safety issues"; \
255             exit 1; \
256         fi
257 EXTRA_DIST += build-aux/thread-safety-blacklist
258
259 if HAVE_GROFF
260 ALL_LOCAL += manpage-check
261 manpage-check: $(man_MANS) $(dist_man_MANS) $(noinst_man_MANS)
262         @error=false; \
263         for manpage in $?; do \
264                 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; \
265                 if grep warning: $@.tmp; then error=:; fi; \
266                 rm -f $@.tmp; \
267         done; \
268         if $$error; then exit 1; else touch $@; fi
269         $(AM_V_GEN) touch -c $@
270 CLEANFILES += manpage-check
271 endif
272
273 include $(srcdir)/manpages.mk
274 $(srcdir)/manpages.mk: $(MAN_ROOTS) build-aux/sodepends.pl
275         @$(PERL) $(srcdir)/build-aux/sodepends.pl -I. -I$(srcdir) $(MAN_ROOTS) >$(@F).tmp
276         @if cmp -s $(@F).tmp $@; then \
277                 touch $@; \
278                 rm -f $(@F).tmp; \
279         else \
280                 mv $(@F).tmp $@; \
281         fi
282 CLEANFILES += manpage-dep-check
283
284 dist-hook: $(DIST_HOOKS)
285 all-local: $(ALL_LOCAL)
286 clean-local: $(CLEAN_LOCAL)
287 install-data-local: $(INSTALL_DATA_LOCAL)
288 uninstall-local: $(UNINSTALL_LOCAL)
289 .PHONY: $(DIST_HOOKS) $(CLEAN_LOCAL) $(INSTALL_DATA_LOCAL) $(UNINSTALL_LOCAL)
290
291 modules_install:
292 if LINUX_ENABLED
293         cd datapath/linux && $(MAKE) modules_install
294 endif
295
296 include m4/automake.mk
297 include lib/automake.mk
298 include ofproto/automake.mk
299 include utilities/automake.mk
300 include tests/automake.mk
301 include include/automake.mk
302 include third-party/automake.mk
303 include debian/automake.mk
304 include vswitchd/automake.mk
305 include ovsdb/automake.mk
306 include rhel/automake.mk
307 include xenserver/automake.mk
308 include python/automake.mk
309 include python/compat/automake.mk
310 include tutorial/automake.mk
311 include vtep/automake.mk