Restore support for openssl 0.9.7 (Debian Sarge).
[wvstreams.git] / Makefile
blobc02f2e4ee4f7a69a4e1342eafac510b74e267701
1 WVSTREAMS=.
3 include wvrules.mk
5 ifdef _WIN32
6 include win32.mk
7 endif
9 %: %.subst
10 sed -e 's/#VERSION#/$(WVPACKAGE_VERSION)/g' < $< > $@
12 ifeq ("$(enable_testgui)", "no")
13 WVTESTRUN=env
14 endif
16 LIBS += $(LIBS_XPLC) -lm
19 # libwvbase: a the minimal code needed to link a wvstreams program.
21 BASEOBJS = \
22 utils/wvbuffer.o utils/wvbufferstore.o \
23 utils/wvcont.o \
24 utils/wverror.o \
25 streams/wvfdstream.o \
26 utils/wvfork.o \
27 utils/wvhash.o \
28 utils/wvhashtable.o \
29 utils/wvlinklist.o \
30 utils/wvmoniker.o \
31 utils/wvregex.o \
32 utils/wvscatterhash.o utils/wvsorter.o \
33 utils/wvattrs.o \
34 utils/wvstring.o utils/wvstringlist.o \
35 utils/wvstringmask.o \
36 utils/strutils.o \
37 utils/wvtask.o \
38 utils/wvtimeutils.o \
39 streams/wvistreamlist.o \
40 utils/wvstreamsdebugger.o \
41 streams/wvlog.o \
42 streams/wvstream.o \
43 uniconf/uniconf.o \
44 uniconf/uniconfgen.o uniconf/uniconfkey.o uniconf/uniconfroot.o \
45 uniconf/unihashtree.o \
46 uniconf/unimountgen.o \
47 uniconf/unitempgen.o \
48 utils/wvbackslash.o \
49 utils/wvencoder.o \
50 utils/wvtclstring.o \
51 utils/wvstringcache.o \
52 uniconf/uniinigen.o \
53 uniconf/unigenhack.o \
54 uniconf/unilistiter.o \
55 streams/wvfile.o \
56 streams/wvstreamclone.o \
57 streams/wvconstream.o \
58 utils/wvcrashbase.o
59 TARGETS += libwvbase.so
60 libwvbase_OBJS += $(filter-out uniconf/unigenhack.o $(WV_EXCLUDES),$(BASEOBJS))
61 libwvbase.so: $(libwvbase_OBJS) uniconf/unigenhack.o
62 libwvbase.so-LIBS += $(LIBXPLC)
65 # libwvutils: handy utility library for C++
67 TARGETS += libwvutils.so
68 TESTS += $(call tests_cc,utils/tests)
69 libwvutils_OBJS += $(filter-out $(BASEOBJS) $(TESTOBJS),$(call objects,utils))
70 libwvutils.so: $(libwvutils_OBJS) $(LIBWVBASE)
71 libwvutils.so-LIBS += -lz -lcrypt $(LIBS_PAM)
72 utils/tests/%: PRELIBS+=$(LIBWVSTREAMS)
75 # libwvstreams: stream/event handling library
77 TARGETS += libwvstreams.so
78 TARGETS += crypto/tests/ssltest ipstreams/tests/unixtest
79 TARGETS += crypto/tests/printcert
80 ifneq ("$(with_readline)", "no")
81 TARGETS += ipstreams/tests/wsd
82 ipstreams/tests/wsd-LIBS += -lreadline
83 endif
84 TESTS += $(call tests_cc,configfile/tests)
85 TESTS += $(call tests_cc,streams/tests)
86 TESTS += $(call tests_cc,ipstreams/tests)
87 TESTS += $(call tests_cc,crypto/tests)
88 TESTS += $(call tests_cc,urlget/tests)
89 TESTS += $(call tests_cc,linuxstreams/tests)
90 libwvstreams_OBJS += $(filter-out $(BASEOBJS), \
91 $(call objects,configfile crypto ipstreams \
92 $(ARCH_SUBDIRS) streams urlget))
93 libwvstreams.so: $(libwvstreams_OBJS) $(LIBWVUTILS)
94 libwvstreams.so-LIBS += -lz -lssl -lcrypto $(LIBS_PAM)
95 configfile/tests/% streams/tests/% ipstreams/tests/% crypto/tests/% \
96 urlget/tests/% linuxstreams/tests/%: PRELIBS+=$(LIBWVSTREAMS)
99 # libuniconf: unified configuration system
101 TARGETS += libuniconf.so
102 TARGETS += uniconf/daemon/uniconfd uniconf/tests/uni
103 TESTS += $(call tests_cc,uniconf/tests) uniconf/tests/uni
104 libuniconf_OBJS += $(filter-out $(BASEOBJS) uniconf/daemon/uniconfd.o, \
105 $(call objects,uniconf uniconf/daemon))
106 libuniconf.so: $(libuniconf_OBJS) $(LIBWVSTREAMS)
107 uniconf/daemon/uniconfd uniconf/tests/uni: $(LIBUNICONF)
108 uniconf/daemon/uniconfd: uniconf/daemon/uniconfd.o $(LIBUNICONF)
109 uniconf/daemon/uniconfd: uniconf/daemon/uniconfd.ini \
110 uniconf/daemon/uniconfd.8
111 uniconf/tests/%: PRELIBS+=$(LIBUNICONF)
114 # libwvdbus: C++ DBus library based on wvstreams
116 ifneq ("$(with_dbus)", "no")
117 TARGETS += libwvdbus.so
118 TARGETS += dbus/tests/wvdbus dbus/tests/wvdbusd
119 TESTS += $(call tests_cc,dbus/tests)
120 libwvdbus_OBJS += $(call objects,dbus)
121 libwvdbus.so: $(libwvdbus_OBJS) $(LIBWVSTREAMS)
122 libwvdbus.so-LIBS += $(LIBS_DBUS)
123 dbus/tests/%: PRELIBS+=$(LIBWVDBUS)
124 endif
127 # libwvqt: helper library to make WvStreams work better in Qt event loops
129 ifneq ("$(with_qt)", "no")
130 TARGETS += libwvqt.so
131 TESTS += $(patsubst %.cc,%,$(wildcard qt/tests/*.cc))
132 libwvqt_OBJS += $(call objects,qt)
133 libwvqt.so: $(libwvqt_OBJS) $(LIBWVSTREAMS)
134 libwvqt.so-LIBS += $(LIBS_QT)
135 qt/tests/%: PRELIBS+=$(LIBWVQT)
137 qt/wvqtstreamclone.o: include/wvqtstreamclone.moc
138 qt/wvqthook.o: include/wvqthook.moc
139 endif
142 # libwvstatic.a: all the wvstreams libraries in one static .a file, to make
143 # it easy to link your programs statically to wvstreams.
145 TARGETS += libwvstatic.a
146 libwvstatic.a: \
147 $(libwvbase_OBJS) \
148 $(libwvutils_OBJS) \
149 $(libwvstreams_OBJS) \
150 $(libuniconf_OBJS) \
151 $(libwvdbus_OBJS) \
152 $(libwvqt_OBJS) \
153 uniconf/unigenhack_s.o
156 # libwvtest: the WvTest tools for writing C++ unit tests
158 TARGETS += wvtestmain.o libwvtest.a
159 TESTOBJS = utils/wvtest.o
160 libwvtest.a: wvtestmain.o $(TESTOBJS)
163 # Some example programs
165 TARGETS += examples/wvgrep/wvgrep examples/wvgrep/wvegrep
166 examples/wvgrep/wvgrep: examples/wvgrep/wvgrep.o $(LIBWVSTREAMS)
167 examples/wvgrep/wvegrep: examples/wvgrep/wvgrep
168 ln -f $< $@
171 TARGETS_SO = $(filter %.so,$(TARGETS))
172 TARGETS_A = $(filter %.a,$(TARGETS))
174 all: $(filter-out $(WV_EXCLUDES), $(TARGETS))
176 TESTS += wvtestmain
177 $(addsuffix .o,$(TESTS)):
178 tests: $(TESTS)
180 test: all tests qtest
182 qtest: all wvtestmain
183 LD_LIBRARY_PATH="$(LD_LIBRARY_PATH):$(WVSTREAMS_LIB)" $(WVTESTRUN) $(MAKE) runtests
185 runtests:
186 $(VALGRIND) ./wvtestmain '$(TESTNAME)'
187 ifeq ("$(TESTNAME)", "unitest")
188 cd uniconf/tests && DAEMON=0 ./unitest.sh
189 cd uniconf/tests && DAEMON=1 ./unitest.sh
190 endif
192 wvtestmain: \
193 $(call objects, $(filter-out win32/%, \
194 $(shell find . -type d -name t -printf "%P\n"))) \
195 $(LIBWVDBUS) $(LIBUNICONF) $(LIBWVSTREAMS) $(LIBWVTEST)
197 distclean: clean
198 rm -f uniconf/daemon/uniconfd.8 uniconf/tests/uni
199 rm -f config.mk config.log config.status \
200 include/wvautoconf.h config.cache reconfigure \
201 stamp-h.in configure include/wvautoconf.h.in
202 rm -rf autom4te.cache
203 rm -f pkgconfig/*.pc
205 clean:
206 $(subdirs)
207 @rm -fv .junk $(TARGETS) uniconf/daemon/uniconfd \
208 $(TESTS) tmp*.ini uniconf/daemon/uniconfd.ini \
209 .wvtest-total \
210 $(shell find . -name '*.o' -o -name '.*.d' \
211 -o -name '*~' -o -name '*.moc')
213 clean-targets:
214 rm -fv $(TARGETS)
216 clean-tests:
217 rm -fv $(TESTS)
219 kdoc:
220 kdoc -f html -d Docs/kdoc-html --name wvstreams --strip-h-path */*.h
222 doxygen:
223 doxygen
225 .PHONY: \
226 clean distclean \
227 kdoc doxygen \
228 install install-shared install-dev uninstall \
229 tests test