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