]> git.proxmox.com Git - mirror_ovs.git/blob - Makefile.am
3d2165f9f4017bb3dd82d32549475aa494afc758
[mirror_ovs.git] / Makefile.am
1 # Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 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 CodingStyle \
51 DESIGN \
52 FAQ \
53 INSTALL \
54 INSTALL.Debian \
55 INSTALL.Fedora \
56 INSTALL.KVM \
57 INSTALL.Libvirt \
58 INSTALL.RHEL \
59 INSTALL.SSL \
60 INSTALL.XenServer \
61 INSTALL.userspace \
62 IntegrationGuide \
63 NOTICE \
64 OPENFLOW-1.1+ \
65 PORTING \
66 README-OFTest \
67 README-gcov \
68 README-lisp \
69 REPORTING-BUGS \
70 SubmittingPatches \
71 WHY-OVS \
72 boot.sh \
73 build-aux/cccl \
74 build-aux/sodepends.pl \
75 build-aux/soexpand.pl \
76 $(MAN_FRAGMENTS) \
77 $(MAN_ROOTS)
78 bin_PROGRAMS =
79 sbin_PROGRAMS =
80 bin_SCRIPTS =
81 DIST_HOOKS =
82 dist_man_MANS =
83 dist_pkgdata_DATA =
84 dist_pkgdata_SCRIPTS =
85 dist_sbin_SCRIPTS =
86 dist_scripts_SCRIPTS =
87 dist_scripts_DATA =
88 INSTALL_DATA_LOCAL =
89 UNINSTALL_LOCAL =
90 man_MANS =
91 MAN_FRAGMENTS =
92 MAN_ROOTS =
93 noinst_DATA =
94 noinst_HEADERS =
95 noinst_LIBRARIES =
96 noinst_man_MANS =
97 noinst_PROGRAMS =
98 noinst_SCRIPTS =
99 OVSIDL_BUILT =
100 pkgdata_DATA =
101 sbin_SCRIPTS =
102 scripts_SCRIPTS =
103 scripts_DATA =
104 SUFFIXES =
105 check_DATA =
106
107 scriptsdir = $(pkgdatadir)/scripts
108
109 # This ensures that files added to EXTRA_DIST are always distributed,
110 # even if they are inside an Automake if...endif conditional block that is
111 # disabled by some particular "configure" run. For more information, see:
112 # http://article.gmane.org/gmane.comp.sysutils.automake.general/10891
113 noinst_HEADERS += $(EXTRA_DIST)
114
115 ro_c = echo '/* -*- mode: c; buffer-read-only: t -*- */'
116 ro_shell = printf '\043 Generated automatically -- do not modify! -*- buffer-read-only: t -*-\n'
117
118 SUFFIXES += .in
119 .in:
120 $(PERL) $(srcdir)/build-aux/soexpand.pl -I$(srcdir) < $< | \
121 sed \
122 -e 's,[@]PKIDIR[@],$(PKIDIR),g' \
123 -e 's,[@]LOGDIR[@],$(LOGDIR),g' \
124 -e 's,[@]DBDIR[@],$(DBDIR),g' \
125 -e 's,[@]PERL[@],$(PERL),g' \
126 -e 's,[@]PYTHON[@],$(PYTHON),g' \
127 -e 's,[@]RUNDIR[@],$(RUNDIR),g' \
128 -e 's,[@]VERSION[@],$(VERSION),g' \
129 -e 's,[@]localstatedir[@],$(localstatedir),g' \
130 -e 's,[@]pkgdatadir[@],$(pkgdatadir),g' \
131 -e 's,[@]sysconfdir[@],$(sysconfdir),g' \
132 -e 's,[@]bindir[@],$(bindir),g' \
133 -e 's,[@]sbindir[@],$(sbindir),g' \
134 -e 's,[@]abs_top_srcdir[@],$(abs_top_srcdir),g' \
135 -e 's,[@]ovsdbmonitordir[@],$(ovsdbmonitordir),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 that certain data structures are always declared "static".
198 ALL_LOCAL += static-check
199 static-check:
200 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
201 git --no-pager grep -n -E '^[ ]+(struct vlog_rate_limit|pthread_once_t|struct ovsthread_once).*=' $(srcdir); \
202 then \
203 echo "See above for list of violations of the rule that "; \
204 echo "certain data structures must always be 'static'"; \
205 exit 1; \
206 fi
207 .PHONY: static-check
208
209 # Check that assert.h is not used outside a whitelist of files.
210 ALL_LOCAL += check-assert-h-usage
211 check-assert-h-usage:
212 @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
213 (cd $(srcdir) && git --no-pager grep -l -E '[<]assert.h[>]') | \
214 $(EGREP) -v '^lib/(sflow_receiver|vlog).c$$|^tests/'; \
215 then \
216 echo "Files listed above unexpectedly #include <""assert.h"">."; \
217 echo "Please use ovs_assert (from util.h) instead of assert."; \
218 exit 1; \
219 fi
220 .PHONY: check-assert-h-usage
221
222 ALL_LOCAL += thread-safety-check
223 thread-safety-check:
224 @if test -e '$(srcdir)'/.git && (git --version) >/dev/null 2>&1 && \
225 grep -n -f '$(srcdir)'/build-aux/thread-safety-blacklist \
226 `git ls-files '$(srcdir)' | grep '\.[ch]$$' \
227 | $(EGREP) -v '^datapath|^lib/sflow|^third-party'` \
228 | $(EGREP) -v ':[ ]*/?\*'; \
229 then \
230 echo "See above for list of calls to functions that are"; \
231 echo "blacklisted due to thread safety issues"; \
232 exit 1; \
233 fi
234 EXTRA_DIST += build-aux/thread-safety-blacklist
235
236 if HAVE_GROFF
237 ALL_LOCAL += manpage-check
238 manpage-check: $(man_MANS) $(dist_man_MANS) $(noinst_man_MANS)
239 @error=false; \
240 for manpage in $?; do \
241 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; \
242 if grep warning: $@.tmp; then error=:; fi; \
243 rm -f $@.tmp; \
244 done; \
245 if $$error; then exit 1; else echo touch $@; touch $@; fi
246 CLEANFILES += manpage-check
247 endif
248
249 include $(srcdir)/manpages.mk
250 $(srcdir)/manpages.mk: $(MAN_ROOTS) build-aux/sodepends.pl
251 @$(PERL) $(srcdir)/build-aux/sodepends.pl -I. -I$(srcdir) $(MAN_ROOTS) >$(@F).tmp
252 @if cmp -s $(@F).tmp $@; then \
253 touch $@; \
254 rm -f $(@F).tmp; \
255 else \
256 mv $(@F).tmp $@; \
257 fi
258 CLEANFILES += manpage-dep-check
259
260 dist-hook: $(DIST_HOOKS)
261 all-local: $(ALL_LOCAL)
262 clean-local: $(CLEAN_LOCAL)
263 install-data-local: $(INSTALL_DATA_LOCAL)
264 uninstall-local: $(UNINSTALL_LOCAL)
265 .PHONY: $(DIST_HOOKS) $(CLEAN_LOCAL) $(INSTALL_DATA_LOCAL) $(UNINSTALL_LOCAL)
266
267 modules_install:
268 if LINUX_ENABLED
269 cd datapath/linux && $(MAKE) modules_install
270 endif
271
272 include lib/automake.mk
273 include ofproto/automake.mk
274 include utilities/automake.mk
275 include tests/automake.mk
276 include include/automake.mk
277 include third-party/automake.mk
278 include debian/automake.mk
279 include vswitchd/automake.mk
280 include ovsdb/automake.mk
281 include rhel/automake.mk
282 include xenserver/automake.mk
283 include python/automake.mk
284 include python/compat/automake.mk
285 include tutorial/automake.mk
286 include vtep/automake.mk