• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# This Makefile.am is in the public domain
2AM_CPPFLAGS = \
3  -I$(top_srcdir)/src/include \
4  -I$(top_srcdir)/src/microhttpd
5
6AM_CFLAGS = $(HIDDEN_VISIBILITY_CFLAGS)
7
8if HAVE_W32
9MHD_W32_LIB = $(top_builddir)/src/platform/libplatform_interface.la
10endif
11
12lib_LTLIBRARIES = \
13  libmicrohttpd.la
14
15noinst_DATA =
16MOSTLYCLEANFILES =
17
18if W32_SHARED_LIB_EXP
19W32_MHD_LIB_LDFLAGS = -Wl,--output-def,$(lt_cv_objdir)/libmicrohttpd.def -XCClinker -static-libgcc
20noinst_DATA += $(lt_cv_objdir)/libmicrohttpd.lib $(lt_cv_objdir)/libmicrohttpd.def $(lt_cv_objdir)/libmicrohttpd.exp
21MOSTLYCLEANFILES += $(lt_cv_objdir)/libmicrohttpd.lib $(lt_cv_objdir)/libmicrohttpd.def $(lt_cv_objdir)/libmicrohttpd.exp
22
23$(lt_cv_objdir)/libmicrohttpd.def: libmicrohttpd.la
24
25$(lt_cv_objdir)/libmicrohttpd.exp: $(lt_cv_objdir)/libmicrohttpd.lib
26
27$(lt_cv_objdir)/libmicrohttpd.lib: $(lt_cv_objdir)/libmicrohttpd.def libmicrohttpd.la $(libmicrohttpd_la_OBJECTS)
28if USE_MS_LIB_TOOL
29	@echo Creating $@ and libmicrohttpd.exp by $(MS_LIB_TOOL)... && \
30	dll_name=`$(EGREP) -o dlname=\'.+\' libmicrohttpd.la` && \
31	dll_name=$${dll_name#*\'} && dll_name=$${dll_name%\'} && test -n "$$dll_name" && \
32	echo Creating $$dll_name by $(MS_LIB_TOOL).. && cd "$(lt_cv_objdir)" && \
33	$(MS_LIB_TOOL) -def:libmicrohttpd.def -name:$$dll_name -out:libmicrohttpd.lib $(libmicrohttpd_la_OBJECTS:.lo=.o) && cd ..
34else
35	@echo Creating $@ and libmicrohttpd.exp by $(DLLTOOL)... && \
36	dll_name=`$(EGREP) -o dlname=\'.+\' libmicrohttpd.la` && \
37	dll_name=$${dll_name#*\'} && dll_name=$${dll_name%\'} && test -n "$$dll_name" && \
38	echo Creating $$dll_name by $(DLLTOOL).. && cd "$(lt_cv_objdir)" && \
39	$(DLLTOOL) -d ./libmicrohttpd.def -D $$dll_name -l libmicrohttpd.lib $(libmicrohttpd_la_OBJECTS:.lo=.o) -e ./libmicrohttpd.exp && cd .. &&\
40	echo Created libmicrohttpd.exp and libmicrohttpd.lib.
41endif
42else
43  W32_MHD_LIB_LDFLAGS =
44endif
45
46if W32_STATIC_LIB
47noinst_DATA += $(lt_cv_objdir)/libmicrohttpd-static.lib
48MOSTLYCLEANFILES += $(lt_cv_objdir)/libmicrohttpd-static.lib
49
50$(lt_cv_objdir)/libmicrohttpd-static.lib: libmicrohttpd.la $(libmicrohttpd_la_OBJECTS)
51if USE_MS_LIB_TOOL
52	$(MS_LIB_TOOL) -out:$@ $(libmicrohttpd_la_OBJECTS:.lo=.o)
53else
54	cp $(lt_cv_objdir)/libmicrohttpd.a $@
55endif
56endif
57
58
59libmicrohttpd_la_SOURCES = \
60  connection.c connection.h \
61  reason_phrase.c reason_phrase.h \
62  daemon.c  \
63  internal.c internal.h \
64  memorypool.c memorypool.h \
65  response.c response.h
66libmicrohttpd_la_CPPFLAGS = \
67  $(AM_CPPFLAGS) $(MHD_LIB_CPPFLAGS) \
68  -DBUILDING_MHD_LIB=1
69libmicrohttpd_la_CFLAGS = \
70  $(AM_CFLAGS) $(MHD_LIB_CFLAGS)
71libmicrohttpd_la_LDFLAGS = \
72  $(MHD_LIB_LDFLAGS) \
73  $(W32_MHD_LIB_LDFLAGS) \
74  -version-info @LIB_VERSION_CURRENT@:@LIB_VERSION_REVISION@:@LIB_VERSION_AGE@
75libmicrohttpd_la_LIBADD = \
76  $(MHD_W32_LIB) $(MHD_LIBDEPS)
77libmicrohttpd_la_DEPENDENCIES = \
78  $(MHD_W32_LIB)
79
80if HAVE_W32
81MHD_DLL_RES_SRC = microhttpd_dll_res.rc
82MHD_DLL_RES_LO = libmicrohttpd_la-$(MHD_DLL_RES_SRC:.rc=.lo)
83
84EXTRA_libmicrohttpd_la_DEPENDENCIES = $(MHD_DLL_RES_LO)
85libmicrohttpd_la_LIBADD += $(MHD_DLL_RES_LO)
86
87# General rule is not required, but keep it just in case
88.rc.lo:
89	$(LIBTOOL) $(AM_V_lt) --tag=RC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(RC) $(RCFLAGS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $< -o $@
90
91# To add dll resource only to .dll file and exclude it form static
92# lib, a little trick was used. Allow libtool to create file.lo,
93# file.o and .libs/file.lo, .libs/file.o files, then overwrite file.o
94# by empty object generated from empty c-file. Later libtool will
95# use .libs/file.o for shared lib and empty file.o for static lib.
96# This implementation is based on trick found in liblzma.
97# Note: windres does not understand '-isystem' flag, so all
98# possible '-isystem' flags are replaced by simple '-I' flags.
99$(MHD_DLL_RES_LO): $(MHD_DLL_RES_SRC)
100	RC_CPP_FLAGS=" $(DEFAULT_INCLUDES) $(INCLUDES) $(libmicrohttpd_la_CPPFLAGS) $(CPPFLAGS) " && \
101	$(LIBTOOL) $(AM_V_lt) --tag=RC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(RC) $(RCFLAGS) $(DEFS) $${RC_CPP_FLAGS// -isystem / -I } $< -o $@ && \
102	echo > $@-empty.c && $(CC) $(AM_CFLAGS) $(CFLAGS) -c $@-empty.c -o $(@:.lo=.o) && rm -f $@-empty.c
103endif
104
105if USE_COVERAGE
106  AM_CFLAGS += --coverage
107endif
108
109if !HAVE_TSEARCH
110libmicrohttpd_la_SOURCES += \
111  tsearch.c tsearch.h
112endif
113
114if HAVE_POSTPROCESSOR
115libmicrohttpd_la_SOURCES += \
116  postprocessor.c
117endif
118
119if ENABLE_DAUTH
120libmicrohttpd_la_SOURCES += \
121  digestauth.c \
122  md5.c md5.h
123endif
124
125if ENABLE_BAUTH
126libmicrohttpd_la_SOURCES += \
127  basicauth.c \
128  base64.c base64.h
129endif
130
131if ENABLE_HTTPS
132libmicrohttpd_la_SOURCES += \
133  connection_https.c connection_https.h
134endif
135
136
137
138check_PROGRAMS = \
139  test_daemon
140
141if HAVE_POSTPROCESSOR
142check_PROGRAMS += \
143  test_postprocessor \
144  test_postprocessor_large \
145  test_postprocessor_amp
146endif
147
148TESTS = $(check_PROGRAMS)
149
150test_daemon_SOURCES = \
151  test_daemon.c
152test_daemon_LDADD = \
153  $(top_builddir)/src/microhttpd/libmicrohttpd.la
154
155test_postprocessor_SOURCES = \
156  test_postprocessor.c
157test_postprocessor_CPPFLAGS = \
158  $(AM_CPPFLAGS) $(GNUTLS_CPPFLAGS)
159test_postprocessor_LDADD = \
160  $(top_builddir)/src/microhttpd/libmicrohttpd.la \
161  $(MHD_W32_LIB)
162
163test_postprocessor_amp_SOURCES = \
164  test_postprocessor_amp.c
165test_postprocessor_amp_CPPFLAGS = \
166  $(AM_CPPFLAGS) $(GNUTLS_CPPFLAGS)
167test_postprocessor_amp_LDADD = \
168  $(top_builddir)/src/microhttpd/libmicrohttpd.la
169
170test_postprocessor_large_SOURCES = \
171  test_postprocessor_large.c
172test_postprocessor_large_CPPFLAGS = \
173  $(AM_CPPFLAGS) $(GNUTLS_CPPFLAGS)
174test_postprocessor_large_LDADD = \
175  $(top_builddir)/src/microhttpd/libmicrohttpd.la \
176  $(MHD_W32_LIB)
177