forked from fredrikwidlund/libreactor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.am
158 lines (125 loc) · 4.57 KB
/
Makefile.am
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
AUTOMAKE_OPTIONS = subdir-objects
ACLOCAL_AMFLAGS = -I m4
AM_CFLAGS = -std=gnu11 -flto -fuse-linker-plugin -I$(srcdir)/src
SOURCE_FILES = \
src/picohttpparser/picohttpparser.c \
src/reactor/reactor.c \
src/reactor/reactor_assert.c \
src/reactor/reactor_vector.c \
src/reactor/reactor_utility.c \
src/reactor/reactor_user.c \
src/reactor/reactor_core.c \
src/reactor/reactor_stats.c \
src/reactor/reactor_fd.c \
src/reactor/reactor_timer.c \
src/reactor/reactor_pool.c \
src/reactor/reactor_resolver.c \
src/reactor/reactor_net.c \
src/reactor/reactor_stream.c \
src/reactor/reactor_http.c \
src/reactor/reactor_couch.c \
src/reactor/reactor_server.c
HEADER_FILES = \
src/picohttpparser/picohttpparser.h \
src/reactor/reactor.h \
src/reactor/reactor_assert.h \
src/reactor/reactor_vector.h \
src/reactor/reactor_utility.h \
src/reactor/reactor_user.h \
src/reactor/reactor_core.h \
src/reactor/reactor_stats.h \
src/reactor/reactor_fd.h \
src/reactor/reactor_timer.h \
src/reactor/reactor_pool.h \
src/reactor/reactor_resolver.h \
src/reactor/reactor_net.h \
src/reactor/reactor_stream.h \
src/reactor/reactor_http.h \
src/reactor/reactor_couch.h \
src/reactor/reactor_server.h
lib_LTLIBRARIES = libreactor.la
libreactor_la_SOURCES = $(SOURCE_FILES) $(HEADER_FILES)
libreactor_la_LDFLAGS = -static -ldynamic
headerfilesdir = $(includedir)/reactor
headerfiles_HEADERS = $(HEADER_FILES)
mainheaderdir = $(includedir)
mainheader_HEADERS = src/reactor.h
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libreactor.pc
bin_PROGRAMS = \
example/example \
example/producer \
example/resolver \
example/tcp \
example/tcpd \
example/http \
example/couch \
example/httpd \
example/server \
example/hello
example_example_LDFLAGS = -pthread
example_example_LDADD = libreactor.la -ldynamic
example_producer_LDFLAGS = -pthread
example_producer_LDADD = libreactor.la -ldynamic
example_resolver_LDFLAGS = -pthread
example_resolver_LDADD = libreactor.la -ldynamic
example_tcp_LDFLAGS = -pthread
example_tcp_LDADD = libreactor.la -ldynamic
example_tcpd_LDFLAGS = -pthread
example_tcpd_LDADD = libreactor.la -ldynamic
example_http_LDFLAGS = -pthread
example_http_LDADD = libreactor.la -ldynamic
example_httpd_LDFLAGS = -pthread
example_httpd_LDADD = libreactor.la -ldynamic
example_couch_LDFLAGS = -pthread
example_couch_LDADD = libreactor.la -ldynamic -ljansson
example_server_LDFLAGS = -pthread
example_server_LDADD = libreactor.la -ldynamic -ljansson
example_hello_LDFLAGS = -pthread
example_hello_LDADD = libreactor.la -ldynamic -ljansson
MAINTAINERCLEANFILES = aclocal.m4 config.h.in configure Makefile.in libreactor-?.?.?.tar.gz
maintainer-clean-local:
rm -rf autotools m4 libreactor-?.?.?
CLEANFILES = {.,test/,src/reactor/,src/picohttpparser}/*.{gcno,gcda,gcov}
### unit tests ###
CHECK_CFLAGS = -std=gnu11 -O0 -g -ftest-coverage -fprofile-arcs -I$(srcdir)/src -DGCOV_BUILD
CHECK_LDADD = -L. libreactor_test.a -lcmocka -ldynamic
CHECK_LDFLAGS_EXTRA = -pthread -Wl,--wrap=abort
check_LIBRARIES = libreactor_test.a
libreactor_test_a_CFLAGS = $(CHECK_CFLAGS)
libreactor_test_a_SOURCES = $(SOURCE_FILES) $(HEADER_FILES)
check_PROGRAMS =
check_PROGRAMS += test/reactor
test_reactor_CFLAGS = $(CHECK_CFLAGS)
test_reactor_LDADD = $(CHECK_LDADD)
test_reactor_LDFLAGS = $(CHECK_LDFLAGS_EXTRA)
test_reactor_SOURCES = test/reactor.c test/mock.c
check_PROGRAMS += test/reactor_assert
test_reactor_assert_CFLAGS = $(CHECK_CFLAGS)
test_reactor_assert_LDADD = $(CHECK_LDADD)
test_reactor_assert_LDFLAGS = $(CHECK_LDFLAGS_EXTRA)
test_reactor_assert_SOURCES = test/reactor_assert.c test/mock.c
check_PROGRAMS += test/reactor_core
test_reactor_core_CFLAGS = $(CHECK_CFLAGS)
test_reactor_core_LDADD = $(CHECK_LDADD)
test_reactor_core_LDFLAGS = $(CHECK_LDFLAGS_EXTRA)
test_reactor_core_SOURCES = test/reactor_core.c test/mock.c
check_PROGRAMS += test/reactor_pool
test_reactor_pool_CFLAGS = $(CHECK_CFLAGS)
test_reactor_pool_LDADD = $(CHECK_LDADD)
test_reactor_pool_LDFLAGS = $(CHECK_LDFLAGS_EXTRA)
test_reactor_pool_SOURCES = test/reactor_pool.c test/mock.c
check_PROGRAMS += test/reactor_resolver
test_reactor_resolver_CFLAGS = $(CHECK_CFLAGS)
test_reactor_resolver_LDADD = $(CHECK_LDADD)
test_reactor_resolver_LDFLAGS = $(CHECK_LDFLAGS_EXTRA)
test_reactor_resolver_SOURCES = test/reactor_resolver.c test/mock.c
dist_noinst_SCRIPTS = test/valgrind.sh test/coverage.sh Dockerfile
TESTS = $(check_PROGRAMS) test/valgrind.sh test/coverage.sh
hello:
docker build -t reactor-sdk .
docker run --rm -v ${PWD}/example:/example reactor-sdk \
gcc -Wall -Wpedantic -flto -O2 -pthread -static -no-pie \
example/hello.c -o example/hello \
-lreactor -ldynamic
strip example/hello