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