]> git.proxmox.com Git - ovs.git/blob - Makefile.am
Makefile.am: Avoid include/ depending on lib/.
[ovs.git] / Makefile.am
1 # Copyright (C) 2007-2016 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 AM_LDFLAGS += $(MSVC64_LDFLAGS)
23 endif
24
25 AM_CPPFLAGS += -I $(top_srcdir)/include
26 AM_CPPFLAGS += -I $(top_builddir)/include
27 AM_CPPFLAGS += -I $(top_srcdir)/lib
28 AM_CPPFLAGS += -I $(top_builddir)/lib
29
30 AM_CPPFLAGS += $(SSL_INCLUDES)
31
32 AM_CFLAGS = -Wstrict-prototypes
33 AM_CFLAGS += $(WARNING_FLAGS)
34 AM_CFLAGS += $(OVS_CFLAGS)
35
36 if DPDK_NETDEV
37 AM_CFLAGS += -D_FILE_OFFSET_BITS=64
38 endif
39
40 if NDEBUG
41 AM_CPPFLAGS += -DNDEBUG
42 AM_CFLAGS += -fomit-frame-pointer
43 endif
44
45 if WIN32
46 psep=";"
47 else
48 psep=":"
49 endif
50 # PYTHONDONTWRITEBYTECODE=yes keeps Python from creating .pyc and .pyo
51 # files. Creating .py[co] works OK for any given version of Open
52 # vSwitch, but it causes trouble if you switch from a version with
53 # foo/__init__.py into an (older) version with plain foo.py, since
54 # foo/__init__.pyc will cause Python to ignore foo.py.
55 run_python = \
56 PYTHONPATH=$(top_srcdir)/python$(psep)$$PYTHONPATH \
57 PYTHONDONTWRITEBYTECODE=yes $(PYTHON)
58
59 ALL_LOCAL =
60 BUILT_SOURCES =
61 CLEANFILES =
62 CLEAN_LOCAL =
63 DISTCLEANFILES =
64 PYCOV_CLEAN_FILES = build-aux/check-structs,cover
65
66 EXTRA_DIST = \
67 AUTHORS.rst \
68 CONTRIBUTING.rst \
69 MAINTAINERS.rst \
70 README.rst \
71 NOTICE \
72 .travis.yml \
73 .travis/linux-build.sh \
74 .travis/linux-prepare.sh \
75 .travis/osx-build.sh \
76 .travis/osx-prepare.sh \
77 appveyor.yml \
78 boot.sh \
79 build-aux/cccl \
80 build-aux/cksum-schema-check \
81 build-aux/calculate-schema-cksum \
82 build-aux/dist-docs \
83 build-aux/sodepends.pl \
84 build-aux/soexpand.pl \
85 build-aux/xml2nroff \
86 $(MAN_FRAGMENTS) \
87 $(MAN_ROOTS) \
88 Vagrantfile \
89 Vagrantfile-FreeBSD \
90 .mailmap
91 bin_PROGRAMS =
92 sbin_PROGRAMS =
93 bin_SCRIPTS =
94 DIST_HOOKS =
95 dist_man_MANS =
96 dist_pkgdata_DATA =
97 dist_pkgdata_SCRIPTS =
98 dist_sbin_SCRIPTS =
99 dist_scripts_SCRIPTS =
100 dist_scripts_DATA =
101 INSTALL_DATA_LOCAL =
102 UNINSTALL_LOCAL =
103 man_MANS =
104 MAN_FRAGMENTS =
105 MAN_ROOTS =
106 noinst_DATA =
107 noinst_HEADERS =
108 lib_LTLIBRARIES =
109 noinst_man_MANS =
110 noinst_PROGRAMS =
111 noinst_SCRIPTS =
112 OVSIDL_BUILT =
113 pkgdata_DATA =
114 sbin_SCRIPTS =
115 scripts_SCRIPTS =
116 completion_SCRIPTS =
117 scripts_DATA =
118 SUFFIXES =
119 check_DATA =
120 check_SCRIPTS =
121 pkgconfig_DATA =
122 FLAKE8_PYFILES =
123
124 scriptsdir = $(pkgdatadir)/scripts
125 completiondir = $(sysconfdir)/bash_completion.d
126 pkgconfigdir = $(libdir)/pkgconfig
127
128 # This ensures that files added to EXTRA_DIST are always distributed,
129 # even if they are inside an Automake if...endif conditional block that is
130 # disabled by some particular "configure" run. For more information, see:
131 # http://article.gmane.org/gmane.comp.sysutils.automake.general/10891
132 noinst_HEADERS += $(EXTRA_DIST)
133
134 ro_c = echo '/* -*- mode: c; buffer-read-only: t -*- */'
135 ro_shell = printf '\043 Generated automatically -- do not modify! -*- buffer-read-only: t -*-\n'
136
137 SUFFIXES += .in
138 .in:
139 $(AM_V_GEN)$(PERL) $(srcdir)/build-aux/soexpand.pl -I$(srcdir) < $< | \
140 sed \
141 -e 's,[@]PKIDIR[@],$(PKIDIR),g' \
142 -e 's,[@]LOGDIR[@],$(LOGDIR),g' \
143 -e 's,[@]DBDIR[@],$(DBDIR),g' \
144 -e 's,[@]PERL[@],$(PERL),g' \
145 -e 's,[@]PYTHON[@],$(PYTHON),g' \
146 -e 's,[@]RUNDIR[@],$(RUNDIR),g' \
147 -e 's,[@]VERSION[@],$(VERSION),g' \
148 -e 's,[@]localstatedir[@],$(localstatedir),g' \
149 -e 's,[@]pkgdatadir[@],$(pkgdatadir),g' \
150 -e 's,[@]sysconfdir[@],$(sysconfdir),g' \
151 -e 's,[@]bindir[@],$(bindir),g' \
152 -e 's,[@]sbindir[@],$(sbindir),g' \
153 -e 's,[@]abs_builddir[@],$(abs_builddir),g' \
154 -e 's,[@]abs_top_srcdir[@],$(abs_top_srcdir),g' \
155 > $@.tmp
156 @if head -n 1 $@.tmp | grep '#!' > /dev/null; then \
157 chmod +x $@.tmp; \
158 fi
159 $(AM_V_at) mv $@.tmp $@
160
161 SUFFIXES += .xml
162 %: %.xml
163 $(AM_V_GEN)$(run_python) $(srcdir)/build-aux/xml2nroff $< > $@.tmp \
164 -I $(srcdir) \
165 --version=$(VERSION) \
166 PKIDIR='$(PKIDIR)' \
167 LOGDIR='$(LOGDIR)' \
168 DBDIR='$(DBDIR)' \
169 PERL='$(PERL)' \
170 PYTHON='$(PYTHON)' \
171 RUNDIR='$(RUNDIR)' \
172 VERSION='$(VERSION)' \
173 localstatedir='$(localstatedir)' \
174 pkgdatadir='$(pkgdatadir)' \
175 sysconfdir='$(sysconfdir)' \
176 bindir='$(bindir)' \
177 sbindir='$(sbindir)'
178 $(AM_v_at)mv $@.tmp $@
179
180 clean-pycov:
181 cd $(srcdir) && rm -f $(PYCOV_CLEAN_FILES)
182 CLEAN_LOCAL += clean-pycov
183 .PHONY: clean-pycov
184
185 # If we're checked out from a Git repository, make sure that every
186 # file that is in Git is distributed.
187 #
188 # We only enable this check when GNU make is in use because the
189 # Makefile in datapath/linux, needed to get the list of files to
190 # distribute, requires GNU make extensions.
191 if GNU_MAKE
192 ALL_LOCAL += dist-hook-git
193 dist-hook-git: distfiles
194 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1; then \
195 (cd datapath && $(MAKE) distfiles); \
196 (cat distfiles; sed 's|^|datapath/|' datapath/distfiles) | \
197 LC_ALL=C sort -u > all-distfiles; \
198 (cd $(srcdir) && git ls-files) | grep -v '\.gitignore$$' | \
199 LC_ALL=C sort -u > all-gitfiles; \
200 LC_ALL=C comm -1 -3 all-distfiles all-gitfiles > missing-distfiles; \
201 if test -s missing-distfiles; then \
202 echo "The following files are in git but not the distribution:"; \
203 cat missing-distfiles; \
204 exit 1; \
205 fi; \
206 fi
207 CLEANFILES += all-distfiles all-gitfiles missing-distfiles
208 # The following is based on commands for the Automake "distdir" target.
209 distfiles: Makefile
210 @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
211 topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
212 list='$(DISTFILES)'; \
213 for file in $$list; do echo $$file; done | \
214 sed -e "s|^$$srcdirstrip/||;t" \
215 -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t" | \
216 LC_ALL=C sort -u > $@
217 CLEANFILES += distfiles
218 endif
219 .PHONY: dist-hook-git
220
221 # Check that every .c file includes <config.h>.
222 ALL_LOCAL += config-h-check
223 config-h-check:
224 @cd $(srcdir); \
225 if test -e .git && (git --version) >/dev/null 2>&1 && \
226 git --no-pager grep -L '#include <config\.h>' `git ls-files | grep '\.c$$' | \
227 grep -vE '^datapath|^lib/sflow|^third-party|^datapath-windows|^python'`; \
228 then \
229 echo "See above for list of violations of the rule that"; \
230 echo "every C source file must #include <config.h>."; \
231 exit 1; \
232 fi
233 if grep '#include' $(srcdir)/include/openvswitch/*.h | \
234 grep -vE '(<.*>)|("openvswitch)|("openflow)'; \
235 then \
236 echo "See above for list of violations of the rule that"; \
237 echo "public openvswitch header file should not include internal library."; \
238 exit 1; \
239 fi
240 .PHONY: config-h-check
241
242 # Check for printf() type modifiers that MSVC doesn't support.
243 ALL_LOCAL += printf-check
244 printf-check:
245 @cd $(srcdir); \
246 if test -e .git && (git --version) >/dev/null 2>&1 && \
247 git --no-pager grep -n -E -e '%[-+ #0-9.*]*([ztj]|hh)' --and --not -e 'ovs_scan' `git ls-files | grep '\.[ch]$$' | \
248 grep -vE '^datapath|^lib/sflow|^third-party'`; \
249 then \
250 echo "See above for list of violations of the rule that"; \
251 echo "'z', 't', 'j', 'hh' printf() type modifiers are"; \
252 echo "forbidden. See CodingStyle.rst for replacements."; \
253 exit 1; \
254 fi
255 .PHONY: printf-check
256
257 # Check that certain data structures are always declared "static".
258 ALL_LOCAL += static-check
259 static-check:
260 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
261 git --no-pager grep -n -E '^[ ]+(struct vlog_rate_limit|pthread_once_t|struct ovsthread_once).*=' $(srcdir); \
262 then \
263 echo "See above for list of violations of the rule that "; \
264 echo "certain data structures must always be 'static'"; \
265 exit 1; \
266 fi
267 .PHONY: static-check
268
269 # Check that assert.h is not used outside a whitelist of files.
270 ALL_LOCAL += check-assert-h-usage
271 check-assert-h-usage:
272 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
273 (cd $(srcdir) && git --no-pager grep -l -E '[<]assert.h[>]') | \
274 $(EGREP) -v '^lib/(sflow_receiver|vlog).c$$|^tests/'; \
275 then \
276 echo "Files listed above unexpectedly #include <""assert.h"">."; \
277 echo "Please use ovs_assert (from util.h) instead of assert."; \
278 exit 1; \
279 fi
280 .PHONY: check-assert-h-usage
281
282 # Check that LITTLE_ENDIAN and BIG_ENDIAN are not used unless BYTE_ORDER is
283 # also mentioned. (<endian.h> always defines the former two constants. They
284 # must be compared to BYTE_ORDER to get the machine's correct endianness. But
285 # it is better to use WORDS_BIGENDIAN.)
286 ALL_LOCAL += check-endian
287 check-endian:
288 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
289 (cd $(srcdir) && git --no-pager grep -l -E \
290 -e 'BIG_ENDIAN|LITTLE_ENDIAN' --and --not -e 'BYTE_ORDER' | \
291 $(EGREP) -v '^datapath/'); \
292 then \
293 echo "See above for list of files that misuse LITTLE""_ENDIAN"; \
294 echo "or BIG""_ENDIAN. Please use WORDS_BIGENDIAN instead."; \
295 exit 1; \
296 fi
297 .PHONY: check-endian
298
299 ALL_LOCAL += thread-safety-check
300 thread-safety-check:
301 @cd $(srcdir); \
302 if test -e .git && (git --version) >/dev/null 2>&1 && \
303 grep -n -f build-aux/thread-safety-blacklist \
304 `git ls-files | grep '\.[ch]$$' \
305 | $(EGREP) -v '^datapath|^lib/sflow|^third-party'` /dev/null \
306 | $(EGREP) -v ':[ ]*/?\*'; \
307 then \
308 echo "See above for list of calls to functions that are"; \
309 echo "blacklisted due to thread safety issues"; \
310 exit 1; \
311 fi
312 EXTRA_DIST += build-aux/thread-safety-blacklist
313 .PHONY: thread-safety-check
314
315 if HAVE_GROFF
316 ALL_LOCAL += manpage-check
317 manpage-check: $(man_MANS) $(dist_man_MANS) $(noinst_man_MANS)
318 @error=false; \
319 for manpage in $?; do \
320 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; \
321 if grep warning: $@.tmp; then error=:; fi; \
322 rm -f $@.tmp; \
323 done; \
324 if $$error; then exit 1; else touch $@; fi
325 $(AM_V_GEN) touch -c $@
326 CLEANFILES += manpage-check
327 endif
328
329 if HAVE_FLAKE8
330 ALL_LOCAL += flake8-check
331 # http://flake8.readthedocs.org/en/latest/warnings.html
332 # All warnings explicitly selected or ignored should be listed below.
333 #
334 # E***, W*** -- warnings from pep8
335 # E121 continuation line under-indented for hanging indent (only from flake8 v2.0)
336 # E123 closing bracket does not match indentation of opening bracket's line
337 # E125 continuation line with same indent as next logical line (only from flake8 v2.0)
338 # E126 continuation line over-indented for hanging indent
339 # E127 continuation line over-indented for visual indent
340 # E128 continuation line under-indented for visual indent
341 # E129 visually indented line with same indent as next logical line
342 # E131 continuation line unaligned for hanging indent
343 # W503 line break before binary operator
344 # F*** -- warnings native to flake8
345 # F811 redefinition of unused <name> from line <N> (only from flake8 v2.0)
346 # D*** -- warnings from flake8-docstrings plugin
347 # H*** -- warnings from flake8 hacking plugin (custom style checks beyond PEP8)
348 # H231 Python 3.x incompatible 'except x,y:' construct
349 # H232 Python 3.x incompatible octal 077 should be written as 0o77
350 # H233 Python 3.x incompatible use of print operator
351 # H238 old style class declaration, use new style (inherit from `object`)
352 FLAKE8_SELECT = H231,H232,H233,H238
353 FLAKE8_IGNORE = E121,E123,E125,E126,E127,E128,E129,E131,W503,F811,D,H
354 flake8-check: $(FLAKE8_PYFILES)
355 $(AM_V_GEN) \
356 src='$^' && \
357 flake8 $$src --select=$(FLAKE8_SELECT) $(FLAKE8_FLAGS) && \
358 flake8 $$src --ignore=$(FLAKE8_IGNORE) $(FLAKE8_FLAGS) && \
359 touch $@
360 endif
361 CLEANFILES += flake8-check
362
363 include $(srcdir)/manpages.mk
364 $(srcdir)/manpages.mk: $(MAN_ROOTS) build-aux/sodepends.pl
365 @$(PERL) $(srcdir)/build-aux/sodepends.pl -I. -I$(srcdir) $(MAN_ROOTS) >$(@F).tmp
366 @if cmp -s $(@F).tmp $@; then \
367 touch $@; \
368 rm -f $(@F).tmp; \
369 else \
370 mv $(@F).tmp $@; \
371 fi
372 CLEANFILES += manpage-dep-check
373
374 if VSTUDIO_DDK
375 ALL_LOCAL += ovsext
376 ovsext: datapath-windows/ovsext.sln $(srcdir)/datapath-windows/include/OvsDpInterface.h
377 MSBuild.exe //maxcpucount datapath-windows/ovsext.sln /target:Build /property:Configuration="Win8$(VSTUDIO_CONFIG)" /property:Version="$(PACKAGE_VERSION)"
378 MSBuild.exe //maxcpucount datapath-windows/ovsext.sln /target:Build /property:Configuration="Win8.1$(VSTUDIO_CONFIG)" /property:Version="$(PACKAGE_VERSION)"
379
380 CLEAN_LOCAL += ovsext_clean
381 ovsext_clean: datapath-windows/ovsext.sln
382 MSBuild.exe //maxcpucount datapath-windows/ovsext.sln /target:Clean /property:Configuration="Win8$(VSTUDIO_CONFIG)" /property:Version="$(PACKAGE_VERSION)"
383 MSBuild.exe //maxcpucount datapath-windows/ovsext.sln /target:Clean /property:Configuration="Win8.1$(VSTUDIO_CONFIG)" /property:Version="$(PACKAGE_VERSION)"
384 endif
385 .PHONY: ovsext
386
387 clang-analyze: clean
388 @which clang scan-build >/dev/null 2>&1 || \
389 (echo "Unable to find clang/scan-build, Install clang,clang-analyzer packages"; exit 1)
390 @$(MKDIR_P) "$(srcdir)/tests/clang-analyzer-results"
391 @scan-build -o $(srcdir)/tests/clang-analyzer-results --use-cc=$(CC) $(MAKE)
392 .PHONY: clang-analyze
393
394 dist-hook: $(DIST_HOOKS)
395 all-local: $(ALL_LOCAL)
396 clean-local: $(CLEAN_LOCAL)
397 install-data-local: $(INSTALL_DATA_LOCAL)
398 uninstall-local: $(UNINSTALL_LOCAL)
399 .PHONY: $(DIST_HOOKS) $(CLEAN_LOCAL) $(INSTALL_DATA_LOCAL) $(UNINSTALL_LOCAL)
400
401 modules_install:
402 if LINUX_ENABLED
403 cd datapath/linux && $(MAKE) modules_install
404 endif
405
406 dist-docs:
407 VERSION=$(VERSION) MAKE='$(MAKE)' $(srcdir)/build-aux/dist-docs $(srcdir) $(docs)
408 .PHONY: dist-docs
409
410 include Documentation/automake.mk
411 include m4/automake.mk
412 include lib/automake.mk
413 include ofproto/automake.mk
414 include utilities/automake.mk
415 include tests/automake.mk
416 include include/automake.mk
417 include third-party/automake.mk
418 include debian/automake.mk
419 include vswitchd/automake.mk
420 include ovsdb/automake.mk
421 include rhel/automake.mk
422 include xenserver/automake.mk
423 include python/automake.mk
424 include tutorial/automake.mk
425 include vtep/automake.mk
426 include datapath-windows/automake.mk
427 include datapath-windows/include/automake.mk
428 include windows/automake.mk
429 include ovn/automake.mk
430 include selinux/automake.mk
431 include build-aux/automake.mk