]> git.proxmox.com Git - ovs.git/blob - Makefile.am
ofp-util: Generalize functions for parsing OF1.3+ properties.
[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
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 $(PERL) $(srcdir)/build-aux/soexpand.pl -I$(srcdir) < $< | \
133 sed \
134 -e 's,[@]PKIDIR[@],$(PKIDIR),g' \
135 -e 's,[@]LOGDIR[@],$(LOGDIR),g' \
136 -e 's,[@]DBDIR[@],$(DBDIR),g' \
137 -e 's,[@]PERL[@],$(PERL),g' \
138 -e 's,[@]PYTHON[@],$(PYTHON),g' \
139 -e 's,[@]RUNDIR[@],$(RUNDIR),g' \
140 -e 's,[@]VERSION[@],$(VERSION),g' \
141 -e 's,[@]localstatedir[@],$(localstatedir),g' \
142 -e 's,[@]pkgdatadir[@],$(pkgdatadir),g' \
143 -e 's,[@]sysconfdir[@],$(sysconfdir),g' \
144 -e 's,[@]bindir[@],$(bindir),g' \
145 -e 's,[@]sbindir[@],$(sbindir),g' \
146 -e 's,[@]abs_top_srcdir[@],$(abs_top_srcdir),g' \
147 > $@.tmp
148 @if head -n 1 $@.tmp | grep '#!' > /dev/null; then \
149 chmod +x $@.tmp; \
150 fi
151 $(AM_V_GEN) mv $@.tmp $@
152
153 .PHONY: clean-pycov
154 clean-pycov:
155 cd $(srcdir) && rm -f $(PYCOV_CLEAN_FILES)
156 CLEAN_LOCAL += clean-pycov
157
158 # If we're checked out from a Git repository, make sure that every
159 # file that is in Git is distributed.
160 #
161 # We only enable this check when GNU make is in use because the
162 # Makefile in datapath/linux, needed to get the list of files to
163 # distribute, requires GNU make extensions.
164 if GNU_MAKE
165 ALL_LOCAL += dist-hook-git
166 dist-hook-git: distfiles
167 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1; then \
168 (cd datapath && $(MAKE) distfiles); \
169 (cat distfiles; sed 's|^|datapath/|' datapath/distfiles) | \
170 LC_ALL=C sort -u > all-distfiles; \
171 (cd $(srcdir) && git ls-files) | grep -v '\.gitignore$$' | \
172 LC_ALL=C sort -u > all-gitfiles; \
173 LC_ALL=C comm -1 -3 all-distfiles all-gitfiles > missing-distfiles; \
174 if test -s missing-distfiles; then \
175 echo "The distribution is missing the following files:"; \
176 cat missing-distfiles; \
177 exit 1; \
178 fi; \
179 fi
180 CLEANFILES += all-distfiles all-gitfiles missing-distfiles
181 # The following is based on commands for the Automake "distdir" target.
182 distfiles: Makefile
183 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
184 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
185 list='$(DISTFILES)'; \
186 for file in $$list; do echo $$file; done | \
187 sed -e "s|^$$srcdirstrip/||;t" \
188 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t" | \
189 LC_ALL=C sort -u > $@
190 CLEANFILES += distfiles
191 endif
192 .PHONY: dist-hook-git
193
194 # Check that every .c file includes <config.h>.
195 ALL_LOCAL += config-h-check
196 config-h-check:
197 @cd $(srcdir); \
198 if test -e .git && (git --version) >/dev/null 2>&1 && \
199 git --no-pager grep -L '#include <config\.h>' `git ls-files | grep '\.c$$' | \
200 grep -vE '^datapath|^lib/sflow|^third-party'`; \
201 then \
202 echo "See above for list of violations of the rule that"; \
203 echo "every C source file must #include <config.h>."; \
204 exit 1; \
205 fi
206 .PHONY: config-h-check
207
208 # Check for printf() type modifiers that MSVC doesn't support.
209 ALL_LOCAL += printf-check
210 printf-check:
211 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
212 git --no-pager grep -n -E -e '%[-+ #0-9.*]*([ztj]|hh)' --and --not -e 'ovs_scan' `git ls-files $(srcdir) | grep '\.[ch]$$'`; \
213 then \
214 echo "See above for list of violations of the rule that"; \
215 echo "'z', 't', 'j', 'hh' printf() type modifiers are"; \
216 echo "forbidden. See CodingStyle for replacements."; \
217 exit 1; \
218 fi
219 .PHONY: printf-check
220
221 # Check that certain data structures are always declared "static".
222 ALL_LOCAL += static-check
223 static-check:
224 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
225 git --no-pager grep -n -E '^[ ]+(struct vlog_rate_limit|pthread_once_t|struct ovsthread_once).*=' $(srcdir); \
226 then \
227 echo "See above for list of violations of the rule that "; \
228 echo "certain data structures must always be 'static'"; \
229 exit 1; \
230 fi
231 .PHONY: static-check
232
233 # Check that assert.h is not used outside a whitelist of files.
234 ALL_LOCAL += check-assert-h-usage
235 check-assert-h-usage:
236 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
237 (cd $(srcdir) && git --no-pager grep -l -E '[<]assert.h[>]') | \
238 $(EGREP) -v '^lib/(sflow_receiver|vlog).c$$|^tests/'; \
239 then \
240 echo "Files listed above unexpectedly #include <""assert.h"">."; \
241 echo "Please use ovs_assert (from util.h) instead of assert."; \
242 exit 1; \
243 fi
244 .PHONY: check-assert-h-usage
245
246 ALL_LOCAL += thread-safety-check
247 thread-safety-check:
248 @if test -e '$(srcdir)'/.git && (git --version) >/dev/null 2>&1 && \
249 grep -n -f '$(srcdir)'/build-aux/thread-safety-blacklist \
250 `git ls-files '$(srcdir)' | grep '\.[ch]$$' \
251 | $(EGREP) -v '^datapath|^lib/sflow|^third-party'` /dev/null \
252 | $(EGREP) -v ':[ ]*/?\*'; \
253 then \
254 echo "See above for list of calls to functions that are"; \
255 echo "blacklisted due to thread safety issues"; \
256 exit 1; \
257 fi
258 EXTRA_DIST += build-aux/thread-safety-blacklist
259
260 if HAVE_GROFF
261 ALL_LOCAL += manpage-check
262 manpage-check: $(man_MANS) $(dist_man_MANS) $(noinst_man_MANS)
263 @error=false; \
264 for manpage in $?; do \
265 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; \
266 if grep warning: $@.tmp; then error=:; fi; \
267 rm -f $@.tmp; \
268 done; \
269 if $$error; then exit 1; else touch $@; fi
270 $(AM_V_GEN) touch -c $@
271 CLEANFILES += manpage-check
272 endif
273
274 include $(srcdir)/manpages.mk
275 $(srcdir)/manpages.mk: $(MAN_ROOTS) build-aux/sodepends.pl
276 @$(PERL) $(srcdir)/build-aux/sodepends.pl -I. -I$(srcdir) $(MAN_ROOTS) >$(@F).tmp
277 @if cmp -s $(@F).tmp $@; then \
278 touch $@; \
279 rm -f $(@F).tmp; \
280 else \
281 mv $(@F).tmp $@; \
282 fi
283 CLEANFILES += manpage-dep-check
284
285 dist-hook: $(DIST_HOOKS)
286 all-local: $(ALL_LOCAL)
287 clean-local: $(CLEAN_LOCAL)
288 install-data-local: $(INSTALL_DATA_LOCAL)
289 uninstall-local: $(UNINSTALL_LOCAL)
290 .PHONY: $(DIST_HOOKS) $(CLEAN_LOCAL) $(INSTALL_DATA_LOCAL) $(UNINSTALL_LOCAL)
291
292 modules_install:
293 if LINUX_ENABLED
294 cd datapath/linux && $(MAKE) modules_install
295 endif
296
297 include m4/automake.mk
298 include lib/automake.mk
299 include ofproto/automake.mk
300 include utilities/automake.mk
301 include tests/automake.mk
302 include include/automake.mk
303 include third-party/automake.mk
304 include debian/automake.mk
305 include vswitchd/automake.mk
306 include ovsdb/automake.mk
307 include rhel/automake.mk
308 include xenserver/automake.mk
309 include python/automake.mk
310 include python/compat/automake.mk
311 include tutorial/automake.mk
312 include vtep/automake.mk