Ugh. Found out unitest.sh wasn't running as part of 'make test'.
[wvstreams.git] / Makefile
blobe7bf7bd407ee36985bf45d0c23003bb919dbd392
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 else
84 TEST_SKIP_OBJS += ipstreams/tests/wsd
85 endif
86 TESTS += $(call tests_cc,configfile/tests)
87 TESTS += $(call tests_cc,streams/tests)
88 TESTS += $(call tests_cc,ipstreams/tests)
89 TESTS += $(call tests_cc,crypto/tests)
90 TESTS += $(call tests_cc,urlget/tests)
91 TESTS += $(call tests_cc,linuxstreams/tests)
92 libwvstreams_OBJS += $(filter-out $(BASEOBJS), \
93 $(call objects,configfile crypto ipstreams \
94 $(ARCH_SUBDIRS) streams urlget))
95 libwvstreams.so: $(libwvstreams_OBJS) $(LIBWVUTILS)
96 libwvstreams.so-LIBS += -lz -lssl -lcrypto $(LIBS_PAM)
97 configfile/tests/% streams/tests/% ipstreams/tests/% crypto/tests/% \
98 urlget/tests/% linuxstreams/tests/%: PRELIBS+=$(LIBWVSTREAMS)
101 # libuniconf: unified configuration system
103 TARGETS += libuniconf.so
104 TARGETS += uniconf/daemon/uniconfd uniconf/tests/uni
105 TESTS += $(call tests_cc,uniconf/tests) uniconf/tests/uni
106 libuniconf_OBJS += $(filter-out $(BASEOBJS) uniconf/daemon/uniconfd.o, \
107 $(call objects,uniconf uniconf/daemon))
108 libuniconf.so: $(libuniconf_OBJS) $(LIBWVSTREAMS)
109 uniconf/daemon/uniconfd uniconf/tests/uni: $(LIBUNICONF)
110 uniconf/daemon/uniconfd: uniconf/daemon/uniconfd.o $(LIBUNICONF)
111 uniconf/daemon/uniconfd: uniconf/daemon/uniconfd.ini \
112 uniconf/daemon/uniconfd.8
113 uniconf/tests/%: PRELIBS+=$(LIBUNICONF)
116 # libwvdbus: C++ DBus library based on wvstreams
118 ifneq ("$(with_dbus)", "no")
119 TARGETS += libwvdbus.so
120 TARGETS += dbus/tests/wvdbus dbus/tests/wvdbusd
121 TESTS += $(call tests_cc,dbus/tests)
122 libwvdbus_OBJS += $(call objects,dbus)
123 libwvdbus.so: $(libwvdbus_OBJS) $(LIBWVSTREAMS)
124 libwvdbus.so-LIBS += $(LIBS_DBUS)
125 dbus/tests/%: PRELIBS+=$(LIBWVDBUS)
126 else
127 TEST_SKIP_OBJS += dbus/t/%
128 endif
131 # libwvqt: helper library to make WvStreams work better in Qt event loops
133 ifneq ("$(with_qt)", "no")
134 TARGETS += libwvqt.so
135 TESTS += $(patsubst %.cc,%,$(wildcard qt/tests/*.cc))
136 libwvqt_OBJS += $(call objects,qt)
137 libwvqt.so: $(libwvqt_OBJS) $(LIBWVSTREAMS)
138 libwvqt.so-LIBS += $(LIBS_QT)
139 qt/tests/%: PRELIBS+=$(LIBWVQT)
141 qt/wvqtstreamclone.o: include/wvqtstreamclone.moc
142 qt/wvqthook.o: include/wvqthook.moc
143 endif
146 # libwvstatic.a: all the wvstreams libraries in one static .a file, to make
147 # it easy to link your programs statically to wvstreams.
149 TARGETS += libwvstatic.a
150 libwvstatic.a: \
151 $(libwvbase_OBJS) \
152 $(libwvutils_OBJS) \
153 $(libwvstreams_OBJS) \
154 $(libuniconf_OBJS) \
155 $(libwvdbus_OBJS) \
156 $(libwvqt_OBJS) \
157 uniconf/unigenhack_s.o
160 # libwvtest: the WvTest tools for writing C++ unit tests
162 TARGETS += wvtestmain.o libwvtest.a
163 TESTOBJS = utils/wvtest.o
164 libwvtest.a: wvtestmain.o $(TESTOBJS)
167 # Some example programs
169 TARGETS += examples/wvgrep/wvgrep examples/wvgrep/wvegrep
170 examples/wvgrep/wvgrep: examples/wvgrep/wvgrep.o $(LIBWVSTREAMS)
171 examples/wvgrep/wvegrep: examples/wvgrep/wvgrep
172 ln -f $< $@
175 TARGETS_SO = $(filter %.so,$(TARGETS))
176 TARGETS_A = $(filter %.a,$(TARGETS))
178 all: $(filter-out $(WV_EXCLUDES), $(TARGETS))
180 TESTS += wvtestmain
182 REAL_TESTS = $(filter-out $(TEST_SKIP_OBJS), $(TESTS))
183 $(addsuffix .o,$(REAL_TESTS)):
184 tests: $(REAL_TESTS)
186 test: all tests qtest
188 qtest: all wvtestmain
189 LD_LIBRARY_PATH="$(LD_LIBRARY_PATH):$(WVSTREAMS_LIB)" $(WVTESTRUN) $(MAKE) runtests
191 runtests:
192 $(VALGRIND) ./wvtestmain '$(TESTNAME)'
193 ifeq ("$(TESTNAME)", "")
194 cd uniconf/tests && DAEMON=0 ./unitest.sh
195 cd uniconf/tests && DAEMON=1 ./unitest.sh
196 endif
198 wvtestmain: \
199 $(filter-out $(TEST_SKIP_OBJS), $(call objects, $(filter-out win32/%, \
200 $(shell find . -type d -name t -printf "%P\n")))) \
201 $(LIBWVDBUS) $(LIBUNICONF) $(LIBWVSTREAMS) $(LIBWVTEST)
203 distclean: clean
204 rm -f uniconf/daemon/uniconfd.8 uniconf/tests/uni
205 rm -f config.mk config.log config.status \
206 include/wvautoconf.h config.cache reconfigure \
207 stamp-h.in configure include/wvautoconf.h.in
208 rm -rf autom4te.cache
209 rm -f pkgconfig/*.pc
211 clean:
212 $(subdirs)
213 @rm -fv .junk $(TARGETS) uniconf/daemon/uniconfd \
214 $(TESTS) tmp*.ini uniconf/daemon/uniconfd.ini \
215 .wvtest-total \
216 $(shell find . -name '*.o' -o -name '.*.d' \
217 -o -name '*~' -o -name '*.moc')
219 clean-targets:
220 rm -fv $(TARGETS)
222 clean-tests:
223 rm -fv $(TESTS)
225 kdoc:
226 kdoc -f html -d Docs/kdoc-html --name wvstreams --strip-h-path */*.h
228 doxygen:
229 doxygen
231 .PHONY: \
232 clean distclean \
233 kdoc doxygen \
234 install install-shared install-dev uninstall \
235 tests test