1 # This Makefile.am is in the public domain 2 AM_CPPFLAGS = \ 3 -I$(top_srcdir)/src/include \ 4 -I$(top_srcdir)/src/microhttpd 5 6 AM_CFLAGS = $(HIDDEN_VISIBILITY_CFLAGS) 7 8 if HAVE_W32 9 MHD_W32_LIB = $(top_builddir)/src/platform/libplatform_interface.la 10 endif 11 12 lib_LTLIBRARIES = \ 13 libmicrohttpd.la 14 15 noinst_DATA = 16 MOSTLYCLEANFILES = 17 18 if W32_SHARED_LIB_EXP 19 W32_MHD_LIB_LDFLAGS = -Wl,--output-def,$(lt_cv_objdir)/libmicrohttpd.def -XCClinker -static-libgcc 20 noinst_DATA += $(lt_cv_objdir)/libmicrohttpd.lib $(lt_cv_objdir)/libmicrohttpd.def $(lt_cv_objdir)/libmicrohttpd.exp 21 MOSTLYCLEANFILES += $(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) 28 if 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 .. 34 else 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. 41 endif 42 else 43 W32_MHD_LIB_LDFLAGS = 44 endif 45 46 if W32_STATIC_LIB 47 noinst_DATA += $(lt_cv_objdir)/libmicrohttpd-static.lib 48 MOSTLYCLEANFILES += $(lt_cv_objdir)/libmicrohttpd-static.lib 49 50 $(lt_cv_objdir)/libmicrohttpd-static.lib: libmicrohttpd.la $(libmicrohttpd_la_OBJECTS) 51 if USE_MS_LIB_TOOL 52 $(MS_LIB_TOOL) -out:$@ $(libmicrohttpd_la_OBJECTS:.lo=.o) 53 else 54 cp $(lt_cv_objdir)/libmicrohttpd.a $@ 55 endif 56 endif 57 58 59 libmicrohttpd_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 66 libmicrohttpd_la_CPPFLAGS = \ 67 $(AM_CPPFLAGS) $(MHD_LIB_CPPFLAGS) \ 68 -DBUILDING_MHD_LIB=1 69 libmicrohttpd_la_CFLAGS = \ 70 $(AM_CFLAGS) $(MHD_LIB_CFLAGS) 71 libmicrohttpd_la_LDFLAGS = \ 72 $(MHD_LIB_LDFLAGS) \ 73 $(W32_MHD_LIB_LDFLAGS) \ 74 -version-info @LIB_VERSION_CURRENT@:@LIB_VERSION_REVISION@:@LIB_VERSION_AGE@ 75 libmicrohttpd_la_LIBADD = \ 76 $(MHD_W32_LIB) $(MHD_LIBDEPS) 77 libmicrohttpd_la_DEPENDENCIES = \ 78 $(MHD_W32_LIB) 79 80 if HAVE_W32 81 MHD_DLL_RES_SRC = microhttpd_dll_res.rc 82 MHD_DLL_RES_LO = libmicrohttpd_la-$(MHD_DLL_RES_SRC:.rc=.lo) 83 84 EXTRA_libmicrohttpd_la_DEPENDENCIES = $(MHD_DLL_RES_LO) 85 libmicrohttpd_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 103 endif 104 105 if USE_COVERAGE 106 AM_CFLAGS += --coverage 107 endif 108 109 if !HAVE_TSEARCH 110 libmicrohttpd_la_SOURCES += \ 111 tsearch.c tsearch.h 112 endif 113 114 if HAVE_POSTPROCESSOR 115 libmicrohttpd_la_SOURCES += \ 116 postprocessor.c 117 endif 118 119 if ENABLE_DAUTH 120 libmicrohttpd_la_SOURCES += \ 121 digestauth.c \ 122 md5.c md5.h 123 endif 124 125 if ENABLE_BAUTH 126 libmicrohttpd_la_SOURCES += \ 127 basicauth.c \ 128 base64.c base64.h 129 endif 130 131 if ENABLE_HTTPS 132 libmicrohttpd_la_SOURCES += \ 133 connection_https.c connection_https.h 134 endif 135 136 137 138 check_PROGRAMS = \ 139 test_daemon 140 141 if HAVE_POSTPROCESSOR 142 check_PROGRAMS += \ 143 test_postprocessor \ 144 test_postprocessor_large \ 145 test_postprocessor_amp 146 endif 147 148 TESTS = $(check_PROGRAMS) 149 150 test_daemon_SOURCES = \ 151 test_daemon.c 152 test_daemon_LDADD = \ 153 $(top_builddir)/src/microhttpd/libmicrohttpd.la 154 155 test_postprocessor_SOURCES = \ 156 test_postprocessor.c 157 test_postprocessor_CPPFLAGS = \ 158 $(AM_CPPFLAGS) $(GNUTLS_CPPFLAGS) 159 test_postprocessor_LDADD = \ 160 $(top_builddir)/src/microhttpd/libmicrohttpd.la \ 161 $(MHD_W32_LIB) 162 163 test_postprocessor_amp_SOURCES = \ 164 test_postprocessor_amp.c 165 test_postprocessor_amp_CPPFLAGS = \ 166 $(AM_CPPFLAGS) $(GNUTLS_CPPFLAGS) 167 test_postprocessor_amp_LDADD = \ 168 $(top_builddir)/src/microhttpd/libmicrohttpd.la 169 170 test_postprocessor_large_SOURCES = \ 171 test_postprocessor_large.c 172 test_postprocessor_large_CPPFLAGS = \ 173 $(AM_CPPFLAGS) $(GNUTLS_CPPFLAGS) 174 test_postprocessor_large_LDADD = \ 175 $(top_builddir)/src/microhttpd/libmicrohttpd.la \ 176 $(MHD_W32_LIB) 177