Ok - I think this has all of the bits working necessary to compile WvStreams
[wvstreams.git] / Makefile
blob381bfc252848812af2b837bdf45730ff00a8c4b2
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 else
19 RM = rm -fv
20 endif
21 endif
23 %: %.subst
24 sed -e 's/#VERSION#/$(WVPACKAGE_VERSION)/g' < $< > $@
26 ifeq ("$(enable_testgui)", "no")
27 WVTESTRUN=env
28 endif
30 LIBS += -lm
32 ifeq ($(USE_WVSTREAMS_ARGP),1)
33 utils/wvargs.o-CPPFLAGS += -Iargp
34 libwvutils.so-LIBS += -Largp -largp
36 # argp does its own dependency checking, so let's call it once per wvstreams
37 # build, in case some system dependencies have changed and argp should be
38 # recompiled
39 ARGP_TARGET=argp/libargp.list
40 TARGETS += $(ARGP_TARGET)
41 .PHONY: argp/all
42 argp/all:
43 $(MAKE) -C argp
44 # Warning! Crucial! KEEP THIS SEMICOLON HERE! Without it, if you blow away
45 # $(ARGP_TARGET), $(MAKE) will get confused.
46 $(ARGP_TARGET): argp/all;
47 else
48 ARGP_TARGET=
49 endif
52 # libwvbase: a the minimal code needed to link a wvstreams program.
54 BASEOBJS = \
55 utils/wvbuffer.o utils/wvbufferstore.o \
56 utils/wvcont.o \
57 utils/wverror.o \
58 streams/wvfdstream.o \
59 utils/wvfork.o \
60 utils/wvhash.o \
61 utils/wvhashtable.o \
62 utils/wvlinklist.o \
63 utils/wvmoniker.o \
64 utils/wvregex.o \
65 utils/wvscatterhash.o utils/wvsorter.o \
66 utils/wvattrs.o \
67 utils/wvstring.o utils/wvstringlist.o \
68 utils/wvstringmask.o \
69 utils/strutils.o \
70 utils/wvtask.o \
71 utils/wvtimeutils.o \
72 streams/wvistreamlist.o \
73 utils/wvstreamsdebugger.o \
74 streams/wvlog.o \
75 streams/wvstream.o \
76 uniconf/uniconf.o \
77 uniconf/uniconfgen.o uniconf/uniconfkey.o uniconf/uniconfroot.o \
78 uniconf/unihashtree.o \
79 uniconf/unimountgen.o \
80 uniconf/unitempgen.o \
81 utils/wvbackslash.o \
82 utils/wvencoder.o \
83 utils/wvtclstring.o \
84 utils/wvstringcache.o \
85 uniconf/uniinigen.o \
86 uniconf/unigenhack.o \
87 uniconf/unilistiter.o \
88 streams/wvfile.o \
89 streams/wvstreamclone.o \
90 streams/wvconstream.o \
91 utils/wvcrashbase.o \
92 xplc-cxx/factory.o \
93 xplc-cxx/getiface.o \
94 xplc-cxx/strtouuid.o \
95 xplc-cxx/uuidtostr.o \
96 xplc-cxx/xplc.o \
97 xplc/category.o \
98 xplc/catiter.o \
99 xplc/catmgr.o \
100 xplc/loader.o \
101 xplc/moduleloader.o \
102 xplc/modulemgr.o \
103 xplc/monikers.o \
104 xplc/new.o \
105 xplc/servmgr.o \
106 xplc/statichandler.o
108 TARGETS += libwvbase.so
109 libwvbase_OBJS += $(filter-out uniconf/unigenhack.o $(WV_EXCLUDES),$(BASEOBJS))
110 libwvbase.so: $(libwvbase_OBJS) uniconf/unigenhack.o
111 libwvbase.so-LIBS += $(LIBXPLC)
114 # libwvutils: handy utility library for C++
116 TARGETS += libwvutils.so
117 TESTS += $(call tests_cc,utils/tests)
118 libwvutils_OBJS += $(filter-out $(BASEOBJS) $(TESTOBJS),$(call objects,utils))
119 libwvutils.so: $(libwvutils_OBJS) $(LIBWVBASE) $(ARGP_TARGET)
120 ifndef _MACOS
121 libwvutils.so-LIBS += -lz -lcrypt $(LIBS_PAM)
122 else
123 libwvutils.so-LIBS += -lz $(LIBS_PAM)
124 endif
126 utils/tests/%: PRELIBS+=$(LIBWVSTREAMS)
129 # libwvstreams: stream/event handling library
131 TARGETS += libwvstreams.so
132 TARGETS += crypto/tests/ssltest ipstreams/tests/unixtest
133 TARGETS += crypto/tests/printcert
135 ifndef _MACOS
136 ifneq ("$(with_readline)", "no")
137 TARGETS += ipstreams/tests/wsd
138 ipstreams/tests/wsd-LIBS += -lreadline
139 else
140 TEST_SKIP_OBJS += ipstreams/tests/wsd
141 endif
142 else
143 TEST_SKIP_OBJS += ipstreams/tests/wsd
144 endif
146 TESTS += $(call tests_cc,configfile/tests)
147 TESTS += $(call tests_cc,streams/tests)
148 TESTS += $(call tests_cc,ipstreams/tests)
149 TESTS += $(call tests_cc,crypto/tests)
150 TESTS += $(call tests_cc,urlget/tests)
151 TESTS += $(call tests_cc,linuxstreams/tests)
152 libwvstreams_OBJS += $(filter-out $(BASEOBJS), \
153 $(call objects,configfile crypto ipstreams \
154 $(ARCH_SUBDIRS) streams urlget))
155 libwvstreams.so: $(libwvstreams_OBJS) $(LIBWVUTILS)
156 libwvstreams.so-LIBS += -lz -lssl -lcrypto $(LIBS_PAM)
157 configfile/tests/% streams/tests/% ipstreams/tests/% crypto/tests/% \
158 urlget/tests/% linuxstreams/tests/%: PRELIBS+=$(LIBWVSTREAMS)
161 # libuniconf: unified configuration system
163 TARGETS += libuniconf.so
164 TARGETS += uniconf/daemon/uniconfd uniconf/tests/uni
165 TESTS += $(call tests_cc,uniconf/tests) uniconf/tests/uni
166 libuniconf_OBJS += $(filter-out $(BASEOBJS) uniconf/daemon/uniconfd.o, \
167 $(call objects,uniconf uniconf/daemon))
168 libuniconf.so: $(libuniconf_OBJS) $(LIBWVSTREAMS)
169 uniconf/daemon/uniconfd uniconf/tests/uni: $(LIBUNICONF)
170 uniconf/daemon/uniconfd: uniconf/daemon/uniconfd.o $(LIBUNICONF)
171 uniconf/daemon/uniconfd: uniconf/daemon/uniconfd.ini \
172 uniconf/daemon/uniconfd.8
173 uniconf/tests/%: PRELIBS+=$(LIBUNICONF)
176 # libwvdbus: C++ DBus library based on wvstreams
178 ifneq ("$(with_dbus)", "no")
179 TARGETS += libwvdbus.so
180 TARGETS += dbus/tests/wvdbus dbus/tests/wvdbusd
181 TESTS += $(call tests_cc,dbus/tests)
182 libwvdbus_OBJS += $(call objects,dbus)
183 libwvdbus.so: $(libwvdbus_OBJS) $(LIBWVSTREAMS)
184 libwvdbus.so-LIBS += $(LIBS_DBUS)
185 dbus/tests/%: PRELIBS+=$(LIBWVDBUS)
186 else
187 TEST_SKIP_OBJS += dbus/t/%
188 endif
191 # libwvqt: helper library to make WvStreams work better in Qt event loops
193 ifneq ("$(with_qt)", "no")
194 TARGETS += libwvqt.so
195 TESTS += $(patsubst %.cc,%,$(wildcard qt/tests/*.cc))
196 libwvqt_OBJS += $(call objects,qt)
197 libwvqt.so: $(libwvqt_OBJS) $(LIBWVSTREAMS)
198 libwvqt.so-LIBS += $(LIBS_QT)
199 qt/tests/%: PRELIBS+=$(LIBWVQT)
201 qt/wvqtstreamclone.o: include/wvqtstreamclone.moc
202 qt/wvqthook.o: include/wvqthook.moc
203 endif
206 # libwvstatic.a: all the wvstreams libraries in one static .a file, to make
207 # it easy to link your programs statically to wvstreams.
209 TARGETS += libwvstatic.a
210 libwvstatic.a: \
211 $(libwvbase_OBJS) \
212 $(libwvutils_OBJS) \
213 $(libwvstreams_OBJS) \
214 $(libuniconf_OBJS) \
215 $(libwvdbus_OBJS) \
216 $(libwvqt_OBJS) \
217 uniconf/unigenhack_s.o \
218 $(ARGP_TARGET)
221 # libwvtest: the WvTest tools for writing C++ unit tests
223 TARGETS += wvtestmain.o libwvtest.a
224 TESTOBJS = utils/wvtest.o
225 libwvtest.a: wvtestmain.o $(TESTOBJS)
227 TARGETS_SO = $(filter %.so,$(TARGETS))
228 TARGETS_A = $(filter %.a,$(TARGETS))
230 all: config.mk $(filter-out $(WV_EXCLUDES), $(TARGETS))
232 TESTS += wvtestmain
234 REAL_TESTS = $(filter-out $(TEST_SKIP_OBJS), $(TESTS))
235 $(addsuffix .o,$(REAL_TESTS)):
236 tests: $(REAL_TESTS)
238 test: all tests qtest
240 qtest: all wvtestmain
241 LD_LIBRARY_PATH="$(LD_LIBRARY_PATH):$(shell pwd)" $(WVTESTRUN) $(MAKE) runtests
243 runtests:
244 $(VALGRIND) ./wvtestmain '$(TESTNAME)'
245 ifeq ("$(TESTNAME)", "")
246 cd uniconf/tests && DAEMON=0 ./unitest.sh
247 cd uniconf/tests && DAEMON=1 ./unitest.sh
248 endif
251 ifndef _MACOS
252 TEST_TARGETS = $(filter-out $(TEST_SKIP_OBJS), $(call objects, $(filter-out win32/%, \
253 $(shell find . -type d -name t -printf "%P\n"))))
254 else
255 TEST_TARGETS = $(filter-out $(TEST_SKIP_OBJS), $(call objects, $(filter-out win32/%, \
256 $(shell find . -type d -name t -print))))
257 endif
259 wvtestmain: $(TEST_TARGETS) $(LIBWVDBUS) $(LIBUNICONF) $(LIBWVSTREAMS) $(LIBWVTEST)
261 distclean: clean
262 rm -f uniconf/daemon/uniconfd.8 uniconf/tests/uni
263 rm -f config.mk config.log config.status \
264 include/wvautoconf.h config.cache \
265 stamp-h.in
266 rm -rf autom4te.cache
267 rm -rf argp/autom4te.cache
268 rm -rf argp/config.status argp/config.log
269 rm -rf argp/configure.lineno argp/config.h
270 rm -rf argp/Makefile argp/testsuite/Makefile
271 rm -rf argp/testsuite/ex1 argp/testsuite/ex2 argp/testsuite/ex3
272 rm -rf argp/libargp.a argp/stamp-h1
273 rm -f pkgconfig/*.pc
275 clean:
276 $(subdirs)
277 @$(RM) .junk $(TARGETS) uniconf/daemon/uniconfd \
278 $(TESTS) tmp*.ini uniconf/daemon/uniconfd.ini \
279 .wvtest-total \
280 $(shell find . -name '*.o' -o -name '.*.d' \
281 -o -name '*~' -o -name '*.moc')
283 clean-targets:
284 $(RM) $(TARGETS)
286 clean-tests:
287 $(RM) $(TESTS)
289 kdoc:
290 kdoc -f html -d Docs/kdoc-html --name wvstreams --strip-h-path */*.h
292 doxygen:
293 doxygen
295 .PHONY: \
296 clean distclean \
297 kdoc doxygen \
298 install install-shared install-dev uninstall \
299 tests test