Make WvStreams compile with gcc 4.4.
[wvstreams.git] / Makefile
blob6f60a8ba6f98fe96d6ba56958da68548e4a09a3d
1 WVSTREAMS:=.
3 include wvrules.mk
4 include install.mk
6 ifdef _WIN32
7 include win32.mk
8 endif
10 ifdef _SOLARIS
11 RM = rm -f
12 CFLAGS += -DSOLARIS
13 CXXFLAGS += -DSOLARIS
14 else
15 ifdef _MACOS
16 CFLAGS+= -DMACOS
17 CXXFLAGS+= -DMACOS
18 WV_EXCLUDES+= linuxstreams/tests/aliastest linuxstreams/tests/ifctest linuxstreams/tests/routetest qt/tests/qtstringtest
19 TEST_SKIP_OBJS+= linuxstreams/t/%
20 else
21 RM = rm -fv
22 endif
23 endif
25 %: %.subst
26 sed -e 's/#VERSION#/$(WVPACKAGE_VERSION)/g' < $< > $@
28 ifeq ("$(enable_testgui)", "no")
29 WVTESTRUN=env
30 endif
32 LIBS += -lm
34 ifeq ($(USE_WVSTREAMS_ARGP),1)
35 utils/wvargs.o-CPPFLAGS += -Iargp
36 libwvutils.so-LIBS += -Largp -largp
38 # argp does its own dependency checking, so let's call it once per wvstreams
39 # build, in case some system dependencies have changed and argp should be
40 # recompiled
41 ARGP_TARGET=argp/libargp.list
42 TARGETS += $(ARGP_TARGET)
43 .PHONY: argp/all
44 argp/all:
45 $(MAKE) -C argp
46 # Warning! Crucial! KEEP THIS SEMICOLON HERE! Without it, if you blow away
47 # $(ARGP_TARGET), $(MAKE) will get confused.
48 $(ARGP_TARGET): argp/all;
49 else
50 ARGP_TARGET=
51 endif
54 # libwvbase: a the minimal code needed to link a wvstreams program.
56 BASEOBJS = \
57 utils/wvbuffer.o utils/wvbufferstore.o \
58 utils/wvcont.o \
59 utils/wverror.o \
60 streams/wvfdstream.o \
61 utils/wvfork.o \
62 utils/wvhash.o \
63 utils/wvhashtable.o \
64 utils/wvlinklist.o \
65 utils/wvmoniker.o \
66 utils/wvregex.o \
67 utils/wvscatterhash.o utils/wvsorter.o \
68 utils/wvattrs.o \
69 utils/wvstring.o utils/wvstringlist.o \
70 utils/wvstringmask.o \
71 utils/strutils.o \
72 utils/wvtask.o \
73 utils/wvtimeutils.o \
74 streams/wvistreamlist.o \
75 utils/wvstreamsdebugger.o \
76 streams/wvlog.o \
77 streams/wvstream.o \
78 uniconf/uniconf.o \
79 uniconf/uniconfgen.o uniconf/uniconfkey.o uniconf/uniconfroot.o \
80 uniconf/unihashtree.o \
81 uniconf/unimountgen.o \
82 uniconf/unitempgen.o \
83 utils/wvbackslash.o \
84 utils/wvencoder.o \
85 utils/wvtclstring.o \
86 utils/wvstringcache.o \
87 uniconf/uniinigen.o \
88 uniconf/unigenhack.o \
89 uniconf/unilistiter.o \
90 streams/wvfile.o \
91 streams/wvstreamclone.o \
92 streams/wvconstream.o \
93 utils/wvcrashbase.o \
94 xplc-cxx/factory.o \
95 xplc-cxx/getiface.o \
96 xplc-cxx/strtouuid.o \
97 xplc-cxx/uuidtostr.o \
98 xplc-cxx/xplc.o \
99 xplc/category.o \
100 xplc/catiter.o \
101 xplc/catmgr.o \
102 xplc/loader.o \
103 xplc/moduleloader.o \
104 xplc/modulemgr.o \
105 xplc/monikers.o \
106 xplc/new.o \
107 xplc/servmgr.o \
108 xplc/statichandler.o
110 TARGETS += libwvbase.so
111 libwvbase_OBJS += $(filter-out uniconf/unigenhack.o $(WV_EXCLUDES),$(BASEOBJS))
112 libwvbase.so: $(libwvbase_OBJS) uniconf/unigenhack.o
113 libwvbase.so-LIBS += $(LIBXPLC)
116 # libwvutils: handy utility library for C++
118 TARGETS += libwvutils.so
119 TESTS += $(call tests_cc,utils/tests)
120 libwvutils_OBJS += $(filter-out $(BASEOBJS) $(TESTOBJS),$(call objects,utils))
121 libwvutils.so: $(libwvutils_OBJS) $(LIBWVBASE) $(ARGP_TARGET)
122 ifndef _MACOS
123 libwvutils.so-LIBS += -lz -lcrypt $(LIBS_PAM)
124 else
125 libwvutils.so-LIBS += -lz $(LIBS_PAM)
126 endif
128 utils/tests/%: PRELIBS+=$(LIBWVSTREAMS)
131 # libwvstreams: stream/event handling library
133 TARGETS += libwvstreams.so
134 TARGETS += crypto/tests/ssltest ipstreams/tests/unixtest
135 TARGETS += crypto/tests/printcert
137 ifndef _MACOS
138 ifneq ("$(with_readline)", "no")
139 TARGETS += ipstreams/tests/wsd
140 ipstreams/tests/wsd-LIBS += -lreadline
141 else
142 TEST_SKIP_OBJS += ipstreams/tests/wsd
143 endif
144 else
145 TEST_SKIP_OBJS += ipstreams/tests/wsd
146 endif
148 TESTS += $(call tests_cc,configfile/tests)
149 TESTS += $(call tests_cc,streams/tests)
150 TESTS += $(call tests_cc,ipstreams/tests)
151 TESTS += $(call tests_cc,crypto/tests)
152 TESTS += $(call tests_cc,urlget/tests)
153 TESTS += $(call tests_cc,linuxstreams/tests)
154 libwvstreams_OBJS += $(filter-out $(BASEOBJS), \
155 $(call objects,configfile crypto ipstreams \
156 $(ARCH_SUBDIRS) streams urlget))
157 libwvstreams.so: $(libwvstreams_OBJS) $(LIBWVUTILS)
158 libwvstreams.so-LIBS += -lz -lssl -lcrypto $(LIBS_PAM)
159 configfile/tests/% streams/tests/% ipstreams/tests/% crypto/tests/% \
160 urlget/tests/% linuxstreams/tests/%: PRELIBS+=$(LIBWVSTREAMS)
163 # libuniconf: unified configuration system
165 TARGETS += libuniconf.so
166 TARGETS += uniconf/daemon/uniconfd uniconf/tests/uni
167 TESTS += $(call tests_cc,uniconf/tests) uniconf/tests/uni
168 libuniconf_OBJS += $(filter-out $(BASEOBJS) uniconf/daemon/uniconfd.o, \
169 $(call objects,uniconf uniconf/daemon))
170 libuniconf.so: $(libuniconf_OBJS) $(LIBWVSTREAMS)
171 uniconf/daemon/uniconfd uniconf/tests/uni: $(LIBUNICONF)
172 uniconf/daemon/uniconfd: uniconf/daemon/uniconfd.o $(LIBUNICONF)
173 uniconf/daemon/uniconfd: uniconf/daemon/uniconfd.ini \
174 uniconf/daemon/uniconfd.8
175 uniconf/tests/%: PRELIBS+=$(LIBUNICONF)
178 # libwvdbus: C++ DBus library based on wvstreams
180 ifneq ("$(with_dbus)", "no")
181 TARGETS += libwvdbus.so
182 TARGETS += dbus/tests/wvdbus dbus/tests/wvdbusd
183 TESTS += $(call tests_cc,dbus/tests)
184 libwvdbus_OBJS += $(call objects,dbus)
185 libwvdbus.so: $(libwvdbus_OBJS) $(LIBWVSTREAMS)
186 libwvdbus.so-LIBS += $(LIBS_DBUS)
187 dbus/tests/%: PRELIBS+=$(LIBWVDBUS)
188 else
189 TEST_SKIP_OBJS += dbus/t/%
190 endif
193 # libwvqt: helper library to make WvStreams work better in Qt event loops
194 # This is not made to work with MacOS, so let's not ask it to.
195 ifndef _MACOS
196 ifneq ("$(with_qt)", "no")
197 TARGETS += libwvqt.so
198 TESTS += $(patsubst %.cc,%,$(wildcard qt/tests/*.cc))
199 libwvqt_OBJS += $(call objects,qt)
200 libwvqt.so: $(libwvqt_OBJS) $(LIBWVSTREAMS)
201 libwvqt.so-LIBS += $(LIBS_QT)
202 qt/tests/%: PRELIBS+=$(LIBWVQT)
204 qt/wvqtstreamclone.o: include/wvqtstreamclone.moc
205 qt/wvqthook.o: include/wvqthook.moc
206 endif
207 endif
209 # libwvstatic.a: all the wvstreams libraries in one static .a file, to make
210 # it easy to link your programs statically to wvstreams.
212 TARGETS += libwvstatic.a
213 libwvstatic.a: \
214 $(libwvbase_OBJS) \
215 $(libwvutils_OBJS) \
216 $(libwvstreams_OBJS) \
217 $(libuniconf_OBJS) \
218 $(libwvdbus_OBJS) \
219 $(libwvqt_OBJS) \
220 uniconf/unigenhack_s.o \
221 $(ARGP_TARGET)
224 # libwvtest: the WvTest tools for writing C++ unit tests
226 TARGETS += wvtestmain.o libwvtest.a
227 TESTOBJS = utils/wvtest.o
228 libwvtest.a: wvtestmain.o $(TESTOBJS)
230 TARGETS_SO = $(filter %.so,$(TARGETS))
231 TARGETS_A = $(filter %.a,$(TARGETS))
233 all: config.mk $(filter-out $(WV_EXCLUDES), $(TARGETS))
235 TESTS += wvtestmain
237 REAL_TESTS = $(filter-out $(TEST_SKIP_OBJS), $(TESTS))
238 $(addsuffix .o,$(REAL_TESTS)):
239 tests: $(REAL_TESTS)
241 test: all tests qtest
243 qtest: all wvtestmain
244 LD_LIBRARY_PATH="$(LD_LIBRARY_PATH):$(shell pwd)" $(WVTESTRUN) $(MAKE) runtests
246 runtests:
247 $(VALGRIND) ./wvtestmain '$(TESTNAME)'
248 ifeq ("$(TESTNAME)", "")
249 cd uniconf/tests && DAEMON=0 ./unitest.sh
250 cd uniconf/tests && DAEMON=1 ./unitest.sh
251 endif
254 TEST_TARGETS = $(filter-out $(TEST_SKIP_OBJS), $(call objects, $(filter-out win32/%, \
255 $(shell find . -type d -name t | sed 's,^\./,,'))))
257 wvtestmain: $(TEST_TARGETS) $(LIBWVDBUS) $(LIBUNICONF) $(LIBWVSTREAMS) $(LIBWVTEST)
259 distclean: clean
260 rm -f uniconf/daemon/uniconfd.8 uniconf/tests/uni
261 rm -f config.mk config.log config.status \
262 include/wvautoconf.h config.cache \
263 stamp-h.in
264 rm -rf autom4te.cache
265 rm -rf argp/autom4te.cache
266 rm -rf argp/config.status argp/config.log
267 rm -rf argp/configure.lineno argp/config.h
268 rm -rf argp/Makefile argp/testsuite/Makefile
269 rm -rf argp/testsuite/ex1 argp/testsuite/ex2 argp/testsuite/ex3
270 rm -rf argp/libargp.a argp/stamp-h1
271 rm -f pkgconfig/*.pc
273 clean:
274 $(subdirs)
275 @$(RM) .junk $(TARGETS) uniconf/daemon/uniconfd \
276 $(TESTS) tmp*.ini uniconf/daemon/uniconfd.ini \
277 .wvtest-total \
278 $(shell find . -name '*.o' -o -name '.*.d' \
279 -o -name '*~' -o -name '*.moc')
281 clean-targets:
282 $(RM) $(TARGETS)
284 clean-tests:
285 $(RM) $(TESTS)
287 kdoc:
288 kdoc -f html -d Docs/kdoc-html --name wvstreams --strip-h-path */*.h
290 doxygen:
291 doxygen
293 .PHONY: \
294 clean distclean \
295 kdoc doxygen \
296 install install-shared install-dev uninstall \
297 tests test
299 debug-make:
300 @echo tests: $(TESTS)
301 @echo real_tests: $(REAL_TESTS)
302 @echo skip_tests: $(TEST_SKIP_OBJS)
303 @echo excluded_items: $(WV_EXCLUDES)
304 @echo targets: $(TARGETS)