1#
2# Copyright (c) 2015 Martin Sustrik  All rights reserved.
3# Copyright (c) 2013 Luca Barbato
4#
5# Permission is hereby granted, free of charge, to any person obtaining a copy
6# of this software and associated documentation files (the "Software"),
7# to deal in the Software without restriction, including without limitation
8# the rights to use, copy, modify, merge, publish, distribute, sublicense,
9# and/or sell copies of the Software, and to permit persons to whom
10# the Software is furnished to do so, subject to the following conditions:
11#
12# The above copyright notice and this permission notice shall be included
13# in all copies or substantial portions of the Software.
14#
15# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21# IN THE SOFTWARE.
22
23ACLOCAL_AMFLAGS = -I m4
24
25################################################################################
26#  mill library                                                                #
27################################################################################
28
29millincludedir = $(includedir)
30millinclude_HEADERS = libmill.h
31
32lib_LTLIBRARIES = libmill.la
33
34libmill_la_SOURCES = \
35    chan.h \
36    chan.c \
37    cr.h \
38    cr.c \
39    debug.h \
40    debug.c \
41    ip.h \
42    ip.c \
43    list.h \
44    list.c \
45    mfork.c \
46    poller.h \
47    poller.c \
48    slist.h \
49    slist.c \
50    stack.h \
51    stack.c \
52    tcp.c \
53    timer.h \
54    timer.c \
55    udp.c \
56    unix.c \
57    utils.h \
58    poll.inc \
59    epoll.inc \
60    kqueue.inc \
61    dns/dns.h \
62    dns/dns.c \
63    file.c \
64    ssl.c
65
66pkgconfigdir = $(libdir)/pkgconfig
67pkgconfig_DATA = libmill.pc
68
69libmill_la_LDFLAGS = -no-undefined -version-info @MILL_LIBTOOL_VERSION@
70
71# Turn the source fortification in glibc off - otherwise it would panic
72# because of the stack pointer black magic in 'go' macro.
73libmill_la_CFLAGS = \
74    -fvisibility=hidden\
75    -DMILL_EXPORTS \
76    -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
77
78################################################################################
79#  automated tests                                                             #
80################################################################################
81
82noinst_PROGRAMS =
83
84check_PROGRAMS = \
85    tests/example\
86    tests/go\
87    tests/cls\
88    tests/chan\
89    tests/choose\
90    tests/sleep\
91    tests/fdwait\
92    tests/tcp\
93    tests/udp\
94    tests/unix\
95    tests/signals\
96    tests/overload\
97    tests/ip\
98    tests/file\
99    tests/mfork1\
100    tests/mfork2\
101    tests/mfork3\
102    tests/ssl
103
104EXTRA_DIST = \
105    tests/cert.pem \
106    tests/key.pem
107
108LDADD = libmill.la
109
110TESTS = $(check_PROGRAMS)
111
112################################################################################
113#  performance tests                                                           #
114################################################################################
115
116noinst_PROGRAMS += \
117    perf/go\
118    perf/ctxswitch\
119    perf/chan\
120    perf/chs\
121    perf/chr\
122    perf/whispers\
123    perf/c10k
124
125################################################################################
126#  tutorial                                                                    #
127################################################################################
128
129noinst_PROGRAMS += \
130    tutorial/step1 \
131    tutorial/step2 \
132    tutorial/step3 \
133    tutorial/step4 \
134    tutorial/step5 \
135    tutorial/step6 \
136    tutorial/step7 \
137    tutorial/step8
138
139################################################################################
140#  additional packaging-related stuff                                          #
141################################################################################
142
143#  Generate ChangeLog file from git.
144#  Also, there's no git availabe when building from the source package and
145#  thus no way to obtain package version. Therefore, package version is
146#  saved into a file when building a source package.
147dist-hook:
148	@if test -d "$(srcdir)/.git"; \
149	then \
150		echo Creating ChangeLog; \
151		cd "$(top_srcdir)"; \
152		(echo '# Generated by Makefile. Do not edit.'; echo; \
153		  ./missing --run git log --decorate ) > ChangeLog.tmp; \
154		mv -f ChangeLog.tmp $(top_distdir)/ChangeLog; \
155		rm -f ChangeLog.tmp; \
156    else \
157        cp -f ChangeLog $(top_distdir)/ChangeLog || \
158        echo Failed to generate ChangeLog >&2; \
159	fi; \
160	$(srcdir)/package_version.sh > $(distdir)/.version
161
162EXTRA_DIST += \
163    ./abi_version.sh \
164    ./package_version.sh \
165    ./CMakeLists.txt
166
167distclean-local:
168	-rm -f config.h
169
170