xref: /freebsd/contrib/libevent/Makefile.am (revision 257e70f1d5ee61037c8c59b116538d3b6b1427a2)
1# Makefile.am for libevent
2# Copyright 2000-2007 Niels Provos
3# Copyright 2007-2012 Niels Provos and Nick Mathewson
4#
5# See LICENSE for copying information.
6
7# 'foreign' means that we're not enforcing GNU package rules strictly.
8# '1.13' means that we need automake 1.13 or later (and we do).
9AUTOMAKE_OPTIONS = foreign 1.13 subdir-objects
10
11ACLOCAL_AMFLAGS = -I m4
12
13# This is the "Release" of the Libevent ABI.  It takes precedence over
14# the VERSION_INFO, so that two versions of Libevent with the same
15# "Release" are never binary-compatible.
16#
17# This number incremented once for the 2.0 release candidate, and
18# will increment for each series until we revise our interfaces enough
19# that we can seriously expect ABI compatibility between series.
20#
21RELEASE = -release 2.1
22
23# This is the version info for the libevent binary API.  It has three
24# numbers:
25#   Current  -- the number of the binary API that we're implementing
26#   Revision -- which iteration of the implementation of the binary
27#               API are we supplying?
28#   Age      -- How many previous binary API versions do we also
29#               support?
30#
31# To increment a VERSION_INFO (current:revision:age):
32#    If the ABI didn't change:
33#        Return (current:revision+1:age)
34#    If the ABI changed, but it's backward-compatible:
35#        Return (current+1:0:age+1)
36#    If the ABI changed and it isn't backward-compatible:
37#        Return (current+1:0:0)
38#
39# Once an RC is out, DO NOT MAKE ANY ABI-BREAKING CHANGES IN THAT SERIES
40# UNLESS YOU REALLY REALLY HAVE TO.
41VERSION_INFO = 7:1:0
42
43# History:          RELEASE    VERSION_INFO
44#  2.0.1-alpha --     2.0        1:0:0
45#  2.0.2-alpha --                2:0:0
46#  2.0.3-alpha --                2:0:0  (should have incremented; didn't.)
47#  2.0.4-alpha --                3:0:0
48#  2.0.5-beta  --                4:0:0
49#  2.0.6-rc    --     2.0        2:0:0
50#  2.0.7-rc    --     2.0        3:0:1
51#  2.0.8-rc    --     2.0        4:0:2
52#  2.0.9-rc    --     2.0        5:0:0 (ABI changed slightly)
53#  2.0.10-stable--    2.0        5:1:0 (No ABI change)
54#  2.0.11-stable--    2.0        6:0:1 (ABI changed, backward-compatible)
55#  2.0.12-stable--    2.0        6:1:1 (No ABI change)
56#  2.0.13-stable--    2.0        6:2:1 (No ABI change)
57#  2.0.14-stable--    2.0        6:3:1 (No ABI change)
58#  2.0.15-stable--    2.0        6:3:1 (Forgot to update :( )
59#  2.0.16-stable--    2.0        6:4:1 (No ABI change)
60#  2.0.17-stable--    2.0        6:5:1 (No ABI change)
61#  2.0.18-stable--    2.0        6:6:1 (No ABI change)
62#  2.0.19-stable--    2.0        6:7:1 (No ABI change)
63#  2.0.20-stable--    2.0        6:8:1 (No ABI change)
64#  2.0.21-stable--    2.0        6:9:1 (No ABI change)
65#
66# For Libevent 2.1:
67#  2.1.1-alpha --     2.1        1:0:0
68#  2.1.2-alpha --     2.1        1:0:0 (should have been 2:0:1)
69#  2.1.3-alpha --     2.1        3:0:0 (ABI changed slightly)
70#  2.1.4-alpha --     2.1        4:0:0 (ABI changed slightly)
71#  2.1.5-beta  --     2.1        5:0:0 (ABI changed slightly)
72#  2.1.6-beta  --     2.1        6:0:0 (ABI changed slightly)
73#  2.1.7-beta  --     2.1        6:1:0 (ABI changed slightly)
74#  2.1.8-stable--     2.1        6:2:0 (No ABI change)
75#  2.1.9-beta--       2.1        6:3:0 (No ABI change)
76#  2.1.10-stable--    2.1        6:4:0 (No ABI change, WRONG)
77#  2.1.11-stable--    2.1        7:0:0 (ABI changed)
78#  2.1.12-stable--    2.1        7:1:0 (No ABI change)
79
80# ABI version history for this package effectively restarts every time
81# we change RELEASE.  Version 1.4.x had RELEASE of 1.4.
82#
83# Ideally, we would not be using RELEASE at all; instead we could just
84# use the VERSION_INFO field to label our backward-incompatible ABI
85# changes, and those would be few and far between.  Unfortunately,
86# Libevent still exposes far too many volatile structures in its
87# headers, so we pretty much have to assume that most development
88# series will break ABI compatibility.  For now, it's simplest just to
89# keep incrementing the RELEASE between series and resetting VERSION_INFO.
90#
91# Eventually, when we get to the point where the structures in the
92# headers are all non-changing (or not there at all!), we can shift to
93# a more normal worldview where backward-incompatible ABI changes are
94# nice and rare.  For the next couple of years, though, 'struct event'
95# is user-visible, and so we can pretty much guarantee that release
96# series won't be binary-compatible.
97
98if INSTALL_LIBEVENT
99dist_bin_SCRIPTS = event_rpcgen.py
100endif
101
102pkgconfigdir=$(libdir)/pkgconfig
103LIBEVENT_PKGCONFIG=libevent.pc libevent_core.pc libevent_extra.pc
104
105# These sources are conditionally added by configure.ac or conditionally
106# included from other files.
107PLATFORM_DEPENDENT_SRC = \
108	arc4random.c \
109	epoll_sub.c
110
111CMAKE_FILES = \
112	cmake/AddCompilerFlags.cmake \
113	cmake/AddEventLibrary.cmake \
114	cmake/CheckConstExists.cmake \
115	cmake/CheckFileOffsetBits.c \
116	cmake/CheckFileOffsetBits.cmake \
117	cmake/CheckFunctionKeywords.cmake \
118	cmake/CheckPrototypeDefinition.c.in \
119	cmake/CheckPrototypeDefinition.cmake \
120	cmake/CheckWorkingKqueue.cmake \
121	cmake/CodeCoverage.cmake \
122	cmake/COPYING-CMAKE-SCRIPTS \
123	cmake/Copyright.txt \
124	cmake/LibeventConfig.cmake.in \
125	cmake/LibeventConfigVersion.cmake.in \
126	cmake/Macros.cmake \
127	cmake/Uninstall.cmake.in \
128	cmake/UseDoxygen.cmake \
129	cmake/VersionViaGit.cmake \
130	event-config.h.cmake \
131	evconfig-private.h.cmake \
132	CMakeLists.txt
133
134EXTRA_DIST = \
135	ChangeLog-1.4 \
136	ChangeLog-2.0 \
137	Doxyfile \
138	LICENSE \
139	Makefile.nmake test/Makefile.nmake \
140	autogen.sh \
141	event_rpcgen.py \
142	libevent.pc.in \
143	make-event-config.sed \
144	whatsnew-2.0.txt \
145	whatsnew-2.1.txt \
146	README.md \
147	$(CMAKE_FILES) \
148	$(PLATFORM_DEPENDENT_SRC)
149
150LIBEVENT_LIBS_LA = libevent.la libevent_core.la libevent_extra.la
151if PTHREADS
152LIBEVENT_LIBS_LA += libevent_pthreads.la
153LIBEVENT_PKGCONFIG += libevent_pthreads.pc
154endif
155if OPENSSL
156LIBEVENT_LIBS_LA += libevent_openssl.la
157LIBEVENT_PKGCONFIG += libevent_openssl.pc
158endif
159
160if INSTALL_LIBEVENT
161lib_LTLIBRARIES = $(LIBEVENT_LIBS_LA)
162pkgconfig_DATA = $(LIBEVENT_PKGCONFIG)
163else
164noinst_LTLIBRARIES =  $(LIBEVENT_LIBS_LA)
165endif
166
167EXTRA_SOURCE=
168noinst_HEADERS=
169noinst_PROGRAMS=
170EXTRA_PROGRAMS=
171CLEANFILES=
172DISTCLEANFILES=
173BUILT_SOURCES =
174include include/include.am
175include sample/include.am
176include test/include.am
177
178if BUILD_WIN32
179
180SYS_CORE_LIBS = -liphlpapi
181SYS_LIBS = -lws2_32 -lshell32 -ladvapi32
182SYS_SRC = win32select.c buffer_iocp.c event_iocp.c \
183	bufferevent_async.c
184SYS_INCLUDES = -IWIN32-Code -IWIN32-Code/nmake
185
186if THREADS
187SYS_SRC += evthread_win32.c
188endif
189
190else
191
192SYS_CORE_LIBS =
193SYS_LIBS =
194SYS_SRC =
195SYS_INCLUDES =
196
197endif
198
199if STRLCPY_IMPL
200SYS_SRC += strlcpy.c
201endif
202if SELECT_BACKEND
203SYS_SRC += select.c
204endif
205if POLL_BACKEND
206SYS_SRC += poll.c
207endif
208if DEVPOLL_BACKEND
209SYS_SRC += devpoll.c
210endif
211if KQUEUE_BACKEND
212SYS_SRC += kqueue.c
213endif
214if EPOLL_BACKEND
215SYS_SRC += epoll.c
216endif
217if EVPORT_BACKEND
218SYS_SRC += evport.c
219endif
220if SIGNAL_SUPPORT
221SYS_SRC += signal.c
222endif
223
224BUILT_SOURCES += include/event2/event-config.h
225
226include/event2/event-config.h: config.h make-event-config.sed
227	$(AM_V_GEN)test -d include/event2 || $(MKDIR_P) include/event2
228	$(AM_V_at)$(SED) -f $(srcdir)/make-event-config.sed < config.h > $@T
229	$(AM_V_at)mv -f $@T $@
230
231CORE_SRC =					\
232	buffer.c				\
233	bufferevent.c				\
234	bufferevent_filter.c			\
235	bufferevent_pair.c			\
236	bufferevent_ratelim.c			\
237	bufferevent_sock.c			\
238	event.c					\
239	evmap.c					\
240	evthread.c				\
241	evutil.c				\
242	evutil_rand.c				\
243	evutil_time.c				\
244	listener.c				\
245	log.c					\
246	$(SYS_SRC)
247
248EXTRAS_SRC =					\
249	evdns.c					\
250	event_tagging.c				\
251	evrpc.c					\
252	http.c
253
254if BUILD_WITH_NO_UNDEFINED
255NO_UNDEFINED = -no-undefined
256MAYBE_CORE = libevent_core.la
257else
258NO_UNDEFINED =
259MAYBE_CORE =
260endif
261
262AM_CFLAGS = $(LIBEVENT_CFLAGS)
263AM_CPPFLAGS = -I$(srcdir)/compat -I./include -I$(srcdir)/include $(SYS_INCLUDES) $(LIBEVENT_CPPFLAGS)
264AM_LDFLAGS = $(LIBEVENT_LDFLAGS)
265
266GENERIC_LDFLAGS = -version-info $(VERSION_INFO) $(RELEASE) $(NO_UNDEFINED) $(AM_LDFLAGS)
267
268libevent_la_SOURCES = $(CORE_SRC) $(EXTRAS_SRC)
269libevent_la_LIBADD = @LTLIBOBJS@ $(SYS_LIBS) $(SYS_CORE_LIBS)
270libevent_la_LDFLAGS = $(GENERIC_LDFLAGS)
271
272libevent_core_la_SOURCES = $(CORE_SRC)
273libevent_core_la_LIBADD = @LTLIBOBJS@ $(SYS_LIBS) $(SYS_CORE_LIBS)
274libevent_core_la_LDFLAGS = $(GENERIC_LDFLAGS)
275
276if PTHREADS
277libevent_pthreads_la_SOURCES = evthread_pthread.c
278libevent_pthreads_la_LIBADD = $(MAYBE_CORE)
279libevent_pthreads_la_LDFLAGS = $(GENERIC_LDFLAGS)
280endif
281
282libevent_extra_la_SOURCES = $(EXTRAS_SRC)
283libevent_extra_la_LIBADD = $(MAYBE_CORE) $(SYS_LIBS)
284libevent_extra_la_LDFLAGS = $(GENERIC_LDFLAGS)
285
286if OPENSSL
287libevent_openssl_la_SOURCES = bufferevent_openssl.c
288libevent_openssl_la_LIBADD = $(MAYBE_CORE) $(OPENSSL_LIBS)
289libevent_openssl_la_LDFLAGS = $(GENERIC_LDFLAGS)
290libevent_openssl_la_CPPFLAGS = $(AM_CPPFLAGS) $(OPENSSL_INCS)
291endif
292
293noinst_HEADERS +=				\
294	WIN32-Code/nmake/evconfig-private.h	\
295	WIN32-Code/nmake/event2/event-config.h	\
296	WIN32-Code/getopt.h			\
297	WIN32-Code/getopt.c			\
298	WIN32-Code/getopt_long.c	\
299	WIN32-Code/tree.h			\
300	bufferevent-internal.h		\
301	changelist-internal.h		\
302	compat/sys/queue.h			\
303	defer-internal.h			\
304	epolltable-internal.h		\
305	evbuffer-internal.h			\
306	event-internal.h			\
307	evmap-internal.h			\
308	evrpc-internal.h			\
309	evsignal-internal.h			\
310	evthread-internal.h			\
311	ht-internal.h				\
312	http-internal.h				\
313	iocp-internal.h				\
314	ipv6-internal.h				\
315	kqueue-internal.h			\
316	log-internal.h				\
317	minheap-internal.h			\
318	mm-internal.h				\
319	ratelim-internal.h			\
320	ratelim-internal.h			\
321	strlcpy-internal.h			\
322	time-internal.h				\
323	util-internal.h				\
324	openssl-compat.h
325
326EVENT1_HDRS = \
327	include/evdns.h \
328	include/event.h \
329	include/evhttp.h \
330	include/evrpc.h \
331	include/evutil.h
332
333if INSTALL_LIBEVENT
334include_HEADERS = $(EVENT1_HDRS)
335else
336noinst_HEADERS += $(EVENT1_HDRS)
337endif
338
339verify: check
340
341include doxygen.am
342
343DISTCLEANFILES += *~ libevent.pc libevent_core.pc libevent_extra.pc ./include/event2/event-config.h
344
345