aboutsummaryrefslogtreecommitdiff
path: root/src/microhttpd/Makefile.am
blob: 5292593f2c7173194de591a1143812951505b6fa (plain) (blame)
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
# This Makefile.am is in the public domain
AM_CPPFLAGS = \
  -I$(top_srcdir)/src/include \
  -I$(top_srcdir)/src/microhttpd

AM_CFLAGS = $(HIDDEN_VISIBILITY_CFLAGS)

lib_LTLIBRARIES = \
  libmicrohttpd.la

noinst_DATA =
MOSTLYCLEANFILES =

if W32_SHARED_LIB_EXP
W32_MHD_LIB_LDFLAGS = -Wl,--output-def,$(lt_cv_objdir)/libmicrohttpd.def -XCClinker -static-libgcc
noinst_DATA += $(lt_cv_objdir)/libmicrohttpd.lib $(lt_cv_objdir)/libmicrohttpd.def $(lt_cv_objdir)/libmicrohttpd.exp
MOSTLYCLEANFILES += $(lt_cv_objdir)/libmicrohttpd.lib $(lt_cv_objdir)/libmicrohttpd.def $(lt_cv_objdir)/libmicrohttpd.exp

$(lt_cv_objdir)/libmicrohttpd.def: libmicrohttpd.la

$(lt_cv_objdir)/libmicrohttpd.exp: $(lt_cv_objdir)/libmicrohttpd.lib

$(lt_cv_objdir)/libmicrohttpd.lib: $(lt_cv_objdir)/libmicrohttpd.def libmicrohttpd.la $(libmicrohttpd_la_OBJECTS)
if USE_MS_LIB_TOOL
	@echo Creating $@ and libmicrohttpd.exp by $(MS_LIB_TOOL)... && \
	dll_name=`$(EGREP) -o dlname=\'.+\' libmicrohttpd.la` && \
	dll_name=$${dll_name#*\'} && dll_name=$${dll_name%\'} && test -n "$$dll_name" && \
	echo Creating $$dll_name by $(MS_LIB_TOOL).. && cd "$(lt_cv_objdir)" && \
	$(MS_LIB_TOOL) -def:libmicrohttpd.def -name:$$dll_name -out:libmicrohttpd.lib $(libmicrohttpd_la_OBJECTS:.lo=.o) && cd ..
else
	@echo Creating $@ and libmicrohttpd.exp by $(DLLTOOL)... && \
	dll_name=`$(EGREP) -o dlname=\'.+\' libmicrohttpd.la` && \
	dll_name=$${dll_name#*\'} && dll_name=$${dll_name%\'} && test -n "$$dll_name" && \
	echo Creating $$dll_name by $(DLLTOOL).. && cd "$(lt_cv_objdir)" && \
	$(DLLTOOL) -d ./libmicrohttpd.def -D $$dll_name -l libmicrohttpd.lib $(libmicrohttpd_la_OBJECTS:.lo=.o) -e ./libmicrohttpd.exp && cd .. &&\
	echo Created libmicrohttpd.exp and libmicrohttpd.lib.
endif
else
  W32_MHD_LIB_LDFLAGS =
endif

if W32_STATIC_LIB
noinst_DATA += $(lt_cv_objdir)/libmicrohttpd-static.lib
MOSTLYCLEANFILES += $(lt_cv_objdir)/libmicrohttpd-static.lib

$(lt_cv_objdir)/libmicrohttpd-static.lib: libmicrohttpd.la $(libmicrohttpd_la_OBJECTS)
if USE_MS_LIB_TOOL
	$(MS_LIB_TOOL) -out:$@ $(libmicrohttpd_la_OBJECTS:.lo=.o)
else
	cp $(lt_cv_objdir)/libmicrohttpd.a $@
endif
endif


libmicrohttpd_la_SOURCES = \
  connection.c connection.h \
  reason_phrase.c \
  daemon.c  \
  internal.c internal.h \
  memorypool.c memorypool.h \
  mhd_mono_clock.c mhd_mono_clock.h \
  mhd_limits.h mhd_byteorder.h \
  sysfdsetsize.c sysfdsetsize.h \
  mhd_str.c mhd_str.h \
  mhd_send.h mhd_send.c \
  mhd_assert.h \
  mhd_sockets.c mhd_sockets.h \
  mhd_itc.c mhd_itc.h mhd_itc_types.h \
  mhd_compat.c mhd_compat.h \
  response.c response.h

if USE_POSIX_THREADS
libmicrohttpd_la_SOURCES += \
  mhd_threads.c mhd_threads.h \
  mhd_locks.h
endif
if USE_W32_THREADS
libmicrohttpd_la_SOURCES += \
  mhd_threads.c mhd_threads.h \
  mhd_locks.h
endif

libmicrohttpd_la_CPPFLAGS = \
  $(AM_CPPFLAGS) $(MHD_LIB_CPPFLAGS) $(MHD_TLS_LIB_CPPFLAGS) \
  -DBUILDING_MHD_LIB=1
libmicrohttpd_la_CFLAGS = \
  $(AM_CFLAGS) $(MHD_LIB_CFLAGS) $(MHD_TLS_LIB_CFLAGS)
libmicrohttpd_la_LDFLAGS = \
  $(MHD_LIB_LDFLAGS) $(MHD_TLS_LIB_LDFLAGS) \
  $(W32_MHD_LIB_LDFLAGS) \
  -version-info @LIB_VERSION_CURRENT@:@LIB_VERSION_REVISION@:@LIB_VERSION_AGE@
libmicrohttpd_la_LIBADD = \
  $(MHD_LIBDEPS) $(MHD_TLS_LIBDEPS)

if HAVE_W32
MHD_DLL_RES_SRC = microhttpd_dll_res.rc
MHD_DLL_RES_LO = libmicrohttpd_la-$(MHD_DLL_RES_SRC:.rc=.lo)

EXTRA_libmicrohttpd_la_DEPENDENCIES = $(MHD_DLL_RES_LO)
libmicrohttpd_la_LIBADD += $(MHD_DLL_RES_LO)

# General rule is not required, but keep it just in case
.rc.lo:
	$(LIBTOOL) $(AM_V_lt) --tag=RC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(RC) $(RCFLAGS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $< -o $@

# To add dll resource only to .dll file and exclude it form static
# lib, a little trick was used. Allow libtool to create file.lo,
# file.o and .libs/file.lo, .libs/file.o files, then overwrite file.o
# by empty object generated from empty c-file. Later libtool will
# use .libs/file.o for shared lib and empty file.o for static lib.
# This implementation is based on trick found in liblzma.
# Note: windres does not understand '-isystem' flag, so all
# possible '-isystem' flags are replaced by simple '-I' flags.
$(MHD_DLL_RES_LO): $(MHD_DLL_RES_SRC)
	RC_CPP_FLAGS=" $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) " && \
	$(LIBTOOL) $(AM_V_lt) --tag=RC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(RC) $(RCFLAGS) $(DEFS) $${RC_CPP_FLAGS// -isystem / -I } $< -o $@ && \
	echo > $@-empty.c && $(CC) $(AM_CFLAGS) $(CFLAGS) -c $@-empty.c -o $(@:.lo=.o) && rm -f $@-empty.c
endif

if USE_COVERAGE
  AM_CFLAGS += --coverage
endif

if !MHD_HAVE_TSEARCH
libmicrohttpd_la_SOURCES += \
  tsearch.c tsearch.h
endif

if HAVE_POSTPROCESSOR
libmicrohttpd_la_SOURCES += \
  postprocessor.c
endif

if ENABLE_DAUTH
libmicrohttpd_la_SOURCES += \
  digestauth.c \
  mhd_bithelpers.h \
  md5.c md5.h \
  sha256.c sha256.h
endif

if ENABLE_BAUTH
libmicrohttpd_la_SOURCES += \
  basicauth.c \
  base64.c base64.h
endif

if ENABLE_HTTPS
libmicrohttpd_la_SOURCES += \
  connection_https.c connection_https.h
endif

.NOTPARALLEL:

check_PROGRAMS = \
  test_str_compare \
  test_str_to_value \
  test_str_token \
  test_http_reasons \
  test_md5 \
  test_sha256 \
  test_start_stop \
  test_daemon \
  test_postprocessor_md \
  test_options

if HAVE_POSIX_THREADS
if ENABLE_UPGRADE
if USE_POSIX_THREADS
  check_PROGRAMS += test_upgrade test_upgrade_large
endif
if USE_W32_THREADS
  check_PROGRAMS += test_upgrade test_upgrade_large
endif
if ENABLE_HTTPS
if USE_POSIX_THREADS
check_PROGRAMS += test_upgrade_tls test_upgrade_large_tls
endif
if USE_W32_THREADS
check_PROGRAMS += test_upgrade_tls test_upgrade_large_tls
endif
endif
endif
endif

if HAVE_POSTPROCESSOR
check_PROGRAMS += \
  test_postprocessor \
  test_postprocessor_large \
  test_postprocessor_amp
endif

TESTS = $(check_PROGRAMS)

# Do not test trigger of select by shutdown of listen socket
# on Cygwin as this ability is deliberately ignored on Cygwin
# to improve compatibility with core OS.
if !CYGWIN_TARGET
if HAVE_POSIX_THREADS
if HAVE_LISTEN_SHUTDOWN
check_PROGRAMS += \
  test_shutdown_select \
  test_shutdown_poll
else
check_PROGRAMS += \
  test_shutdown_select_ignore \
  test_shutdown_poll_ignore
endif
endif
endif

test_start_stop_SOURCES = \
  test_start_stop.c
test_start_stop_LDADD = \
  $(top_builddir)/src/microhttpd/libmicrohttpd.la

test_daemon_SOURCES = \
  test_daemon.c
test_daemon_LDADD = \
  $(top_builddir)/src/microhttpd/libmicrohttpd.la

test_upgrade_SOURCES = \
  test_upgrade.c test_helpers.h mhd_sockets.h
test_upgrade_CPPFLAGS = \
  $(AM_CPPFLAGS) $(MHD_TLS_LIB_CPPFLAGS)
test_upgrade_CFLAGS = \
  $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(MHD_TLS_LIB_CFLAGS)
test_upgrade_LDFLAGS = \
  $(MHD_TLS_LIB_LDFLAGS)
test_upgrade_LDADD = \
  $(top_builddir)/src/microhttpd/libmicrohttpd.la \
  $(MHD_TLS_LIB_LDFLAGS) $(MHD_TLS_LIBDEPS) \
  $(PTHREAD_LIBS)

test_upgrade_large_SOURCES = \
  test_upgrade_large.c test_helpers.h mhd_sockets.h mhd_sockets.c mhd_itc.h mhd_itc_types.h mhd_itc.c
test_upgrade_large_CPPFLAGS = \
  $(AM_CPPFLAGS) $(MHD_TLS_LIB_CPPFLAGS)
test_upgrade_large_CFLAGS = \
  $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(MHD_TLS_LIB_CFLAGS)
test_upgrade_large_LDFLAGS = \
  $(MHD_TLS_LIB_LDFLAGS)
test_upgrade_large_LDADD = \
  $(top_builddir)/src/microhttpd/libmicrohttpd.la \
  $(MHD_TLS_LIB_LDFLAGS) $(MHD_TLS_LIBDEPS) \
  $(PTHREAD_LIBS)

test_upgrade_tls_SOURCES = \
  test_upgrade.c test_helpers.h mhd_sockets.h
test_upgrade_tls_CPPFLAGS = \
  $(AM_CPPFLAGS) $(MHD_TLS_LIB_CPPFLAGS)
test_upgrade_tls_CFLAGS = \
  $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(MHD_TLS_LIB_CFLAGS)
test_upgrade_tls_LDFLAGS = \
  $(MHD_TLS_LIB_LDFLAGS)
test_upgrade_tls_LDADD = \
  $(top_builddir)/src/microhttpd/libmicrohttpd.la \
  $(MHD_TLS_LIB_LDFLAGS) $(MHD_TLS_LIBDEPS) \
  $(PTHREAD_LIBS)

test_upgrade_large_tls_SOURCES = \
  test_upgrade_large.c test_helpers.h mhd_sockets.h mhd_sockets.c mhd_itc.h mhd_itc_types.h mhd_itc.c
test_upgrade_large_tls_CPPFLAGS = \
  $(AM_CPPFLAGS) $(MHD_TLS_LIB_CPPFLAGS)
test_upgrade_large_tls_CFLAGS = \
  $(AM_CFLAGS) $(PTHREAD_CFLAGS) $(MHD_TLS_LIB_CFLAGS)
test_upgrade_large_tls_LDFLAGS = \
  $(MHD_TLS_LIB_LDFLAGS)
test_upgrade_large_tls_LDADD = \
  $(top_builddir)/src/microhttpd/libmicrohttpd.la \
  $(MHD_TLS_LIB_LDFLAGS) $(MHD_TLS_LIBDEPS) \
  $(PTHREAD_LIBS)

test_postprocessor_SOURCES = \
  test_postprocessor.c
test_postprocessor_CPPFLAGS = \
  $(AM_CPPFLAGS) $(MHD_TLS_LIB_CPPFLAGS)
test_postprocessor_CFLAGS = \
  $(AM_CFLAGS) $(MHD_TLS_LIB_CFLAGS)
test_postprocessor_LDADD = \
  $(top_builddir)/src/microhttpd/libmicrohttpd.la

test_postprocessor_amp_SOURCES = \
  test_postprocessor_amp.c
test_postprocessor_amp_CPPFLAGS = \
  $(AM_CPPFLAGS) $(MHD_TLS_LIB_CPPFLAGS)
test_postprocessor_amp_CFLAGS = \
  $(AM_CFLAGS) $(MHD_TLS_LIB_CFLAGS)
test_postprocessor_amp_LDADD = \
  $(top_builddir)/src/microhttpd/libmicrohttpd.la

test_postprocessor_large_SOURCES = \
  test_postprocessor_large.c
test_postprocessor_large_CPPFLAGS = \
  $(AM_CPPFLAGS) $(MHD_TLS_LIB_CPPFLAGS)
test_postprocessor_large_CFLAGS = \
  $(AM_CFLAGS) $(MHD_TLS_LIB_CFLAGS)
test_postprocessor_large_LDADD = \
  $(top_builddir)/src/microhttpd/libmicrohttpd.la

test_shutdown_select_SOURCES = \
  test_shutdown_select.c
if USE_POSIX_THREADS
test_shutdown_select_CFLAGS = \
  $(AM_CFLAGS) $(PTHREAD_CFLAGS)
test_shutdown_select_LDADD = \
  $(PTHREAD_LIBS)
endif

test_shutdown_poll_SOURCES = \
  test_shutdown_select.c mhd_threads.h
if USE_POSIX_THREADS
test_shutdown_poll_CFLAGS = \
  $(AM_CFLAGS) $(PTHREAD_CFLAGS)
test_shutdown_poll_LDADD = \
  $(PTHREAD_LIBS)
endif

test_shutdown_select_ignore_SOURCES = \
  test_shutdown_select.c
if USE_POSIX_THREADS
test_shutdown_select_ignore_CFLAGS = \
  $(AM_CFLAGS) $(PTHREAD_CFLAGS)
test_shutdown_select_ignore_LDADD = \
  $(PTHREAD_LIBS)
endif

test_shutdown_poll_ignore_SOURCES = \
  test_shutdown_select.c mhd_threads.h
if USE_POSIX_THREADS
test_shutdown_poll_ignore_CFLAGS = \
  $(AM_CFLAGS) $(PTHREAD_CFLAGS)
test_shutdown_poll_ignore_LDADD = \
  $(PTHREAD_LIBS)
endif

test_str_compare_SOURCES = \
  test_str.c test_helpers.h mhd_str.c

test_str_to_value_SOURCES = \
  test_str.c test_helpers.h mhd_str.c

test_str_token_SOURCES = \
  test_str_token.c mhd_str.c

test_postprocessor_md_SOURCES = \
  test_postprocessor_md.c

test_http_reasons_SOURCES = \
  test_http_reasons.c \
  reason_phrase.c mhd_str.c mhd_str.h

test_md5_SOURCES = \
  test_md5.c test_helpers.h \
  md5.c md5.h mhd_bithelpers.h

test_sha256_SOURCES = \
  test_sha256.c test_helpers.h \
  sha256.c sha256.h mhd_bithelpers.h

test_options_SOURCES = \
  test_options.c
test_options_LDADD = \
  $(top_builddir)/src/microhttpd/libmicrohttpd.la