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