configure: remove code for generating 'reconfigure' script.
[wvstreams.git] / Makefile
blob039c493d16d721bf684c60c4bdb11a9913cb8691
1 WVSTREAMS=.
2 WVSTREAMS_SRC= # Clear WVSTREAMS_SRC so wvrules.mk uses its WVSTREAMS_foo
3 VPATH=$(libdir)
4 include wvrules.mk
5 override enable_efence=no
7 ifneq (${_WIN32},)
8 $(error "Use 'make -f Makefile-win32' instead!")
9 endif
11 export WVSTREAMS
13 XPATH=include
15 include vars.mk
17 SUBDIRS =
19 all: runconfigure xplc $(TARGETS)
21 .PHONY: xplc xplc/clean install-xplc
22 xplc:
23 xplc/clean:
24 install-xplc:
26 ifeq ("$(build_xplc)", "yes")
28 xplc:
29 $(MAKE) -C xplc
31 xplc/clean:
32 $(MAKE) -C xplc clean
34 install-xplc: xplc
35 $(INSTALL) -d $(DESTDIR)$(includedir)/wvstreams/xplc
36 $(INSTALL_DATA) $(wildcard xplc/include/xplc/*.h) $(DESTDIR)$(includedir)/wvstreams/xplc
37 $(INSTALL) -d $(DESTDIR)$(libdir)
38 $(INSTALL_DATA) xplc/libxplc-cxx.a $(DESTDIR)$(libdir)
40 endif
42 .PHONY: clean depend dust kdoc doxygen install install-shared install-dev install-xplc uninstall tests dishes dist distclean realclean test
44 # FIXME: little trick to ensure that the wvautoconf.h.in file is there
45 .PHONY: dist-hack-clean
46 dist-hack-clean:
47 @rm -f stamp-h.in
49 export AM_CFLAGS
50 AM_CFLAGS=-fPIC
52 # Comment this assignment out for a release.
53 ifdef PKGSNAPSHOT
54 SNAPDATE=+$(shell date +%Y%m%d)
55 endif
57 dist-hook: dist-hack-clean configure
58 @rm -rf autom4te.cache
59 @if test -d .xplc; then \
60 echo '--> Preparing XPLC for dist...'; \
61 $(MAKE) -C .xplc clean patch && \
62 cp -Lpr .xplc/build/xplc .; \
65 runconfigure: config.mk include/wvautoconf.h
67 ifndef CONFIGURING
68 configure=$(error Please run the "configure" script)
69 else
70 configure:=
71 endif
73 config.mk: configure config.mk.in
74 $(call configure)
76 include/wvautoconf.h: include/wvautoconf.h.in
77 $(call configure)
79 # FIXME: there is some confusion here
80 ifdef WE_ARE_DIST
81 aclocal.m4: acinclude.m4
82 $(warning "$@" is old, please run "aclocal")
84 configure: configure.ac config.mk.in include/wvautoconf.h.in aclocal.m4
85 $(warning "$@" is old, please run "autoconf")
87 include/wvautoconf.h.in: configure.ac aclocal.m4
88 $(warning "$@" is old, please run "autoheader")
89 else
90 aclocal.m4: acinclude.m4
91 aclocal
92 @touch $@
94 configure: configure.ac include/wvautoconf.h.in aclocal.m4
95 autoconf
96 @rm -f config.mk include/wvautoconf.h
97 @touch $@
99 include/wvautoconf.h.in: configure.ac aclocal.m4
100 autoheader
101 @touch $@
102 endif
104 ifeq ($(VERBOSE),)
105 define wild_clean
106 @list=`echo $(wildcard $(1))`; \
107 test -z "$${list}" || sh -c "rm -rf $${list}"
108 endef
109 else
110 define wild_clean
111 @list=`echo $(wildcard $(1))`; \
112 test -z "$${list}" || sh -cx "rm -rf $${list}"
113 endef
114 endif
116 realclean: distclean
117 $(call wild_clean,$(REALCLEAN))
120 distclean: clean
121 $(call wild_clean,$(DISTCLEAN))
122 @rm -rf autom4te.cache
123 @rm -f pkgconfig/*.pc
124 @rm -f .xplc
126 clean: depend dust xplc/clean
127 $(subdirs)
128 $(call wild_clean,$(TARGETS) uniconf/daemon/uniconfd \
129 $(GARBAGE) $(TESTS) tmp.ini \
130 $(shell find . -name '*.o' -o -name '*.moc'))
132 depend:
133 $(call wild_clean,$(shell find . -name '.*.d'))
135 dust:
136 $(call wild_clean,$(shell find . -name 'core' -o -name '*~' -o -name '.#*') $(wildcard *.d))
138 kdoc:
139 kdoc -f html -d Docs/kdoc-html --name wvstreams --strip-h-path */*.h
141 doxygen:
142 doxygen
144 ifeq ("$(with_readline)", "no")
145 install: install-shared install-dev install-xplc install-uniconfd
146 else
147 install: install-shared install-dev install-xplc install-uniconfd install-wsd
148 endif
150 install-shared: $(TARGETS_SO)
151 $(INSTALL) -d $(DESTDIR)$(libdir)
152 for i in $(TARGETS_SO); do \
153 $(INSTALL_PROGRAM) $$i.$(SO_VERSION) $(DESTDIR)$(libdir)/ ; \
154 done
155 $(INSTALL) -d $(DESTDIR)$(sysconfdir)
156 $(INSTALL_DATA) uniconf/daemon/uniconf.conf $(DESTDIR)$(sysconfdir)/
158 install-dev: $(TARGETS_SO) $(TARGETS_A)
159 $(INSTALL) -d $(DESTDIR)$(includedir)/wvstreams
160 $(INSTALL_DATA) $(wildcard include/*.h) $(DESTDIR)$(includedir)/wvstreams
161 $(INSTALL) -d $(DESTDIR)$(libdir)
162 for i in $(TARGETS_A); do \
163 $(INSTALL_DATA) $$i $(DESTDIR)$(libdir); \
164 done
165 cd $(DESTDIR)$(libdir) && for i in $(TARGETS_SO); do \
166 rm -f $$i; \
167 $(LN_S) $$i.$(SO_VERSION) $$i; \
168 done
169 $(INSTALL) -d $(DESTDIR)$(libdir)/pkgconfig
170 $(INSTALL_DATA) $(filter-out %-uninstalled.pc, $(wildcard pkgconfig/*.pc)) $(DESTDIR)$(libdir)/pkgconfig
171 $(INSTALL) -d $(DESTDIR)$(bindir)
172 $(INSTALL) wvtesthelper wvtestmeter $(DESTDIR)$(bindir)
173 $(INSTALL) -d $(DESTDIR)$(libdir)/valgrind
174 $(INSTALL) wvstreams.supp $(DESTDIR)$(libdir)/valgrind
176 uniconfd: uniconf/daemon/uniconfd uniconf/daemon/uniconfd.ini \
177 uniconf/daemon/uniconfd.8
179 install-uniconfd: uniconfd uniconf/tests/uni uniconf/tests/uni.8
180 $(INSTALL) -d $(DESTDIR)$(bindir)
181 $(INSTALL_PROGRAM) uniconf/tests/uni $(DESTDIR)$(bindir)/
182 $(INSTALL) -d $(DESTDIR)$(sbindir)
183 $(INSTALL_PROGRAM) uniconf/daemon/uniconfd $(DESTDIR)$(sbindir)/
184 $(INSTALL) -d $(DESTDIR)$(localstatedir)/lib/uniconf
185 touch $(DESTDIR)$(localstatedir)/lib/uniconf/uniconfd.ini
186 $(INSTALL) -d $(DESTDIR)$(mandir)/man8
187 $(INSTALL_DATA) uniconf/daemon/uniconfd.8 $(DESTDIR)$(mandir)/man8
188 $(INSTALL_DATA) uniconf/tests/uni.8 $(DESTDIR)$(mandir)/man8
190 install-wsd: ipstreams/tests/wsd
191 $(INSTALL) -d $(DESTDIR)$(bindir)
192 $(INSTALL_PROGRAM) ipstreams/tests/wsd $(DESTDIR)$(bindir)/
194 uninstall:
195 $(tbd)
197 $(TESTS): $(LIBUNICONF) $(LIBWVTEST) $(LIBWVDBUS)
198 $(addsuffix .o,$(TESTS)):
199 tests: $(TESTS)
201 include $(filter-out xplc%,$(wildcard */rules.mk */*/rules.mk)) /dev/null
203 -include $(shell find . -name '.*.d') /dev/null
205 test: runconfigure all tests qtest
207 qtest: runconfigure all wvtestmain
208 LD_LIBRARY_PATH="$(LD_LIBRARY_PATH):$(WVSTREAMS_LIB)" $(WVTESTRUN) $(MAKE) runtests
210 runtests:
211 $(VALGRIND) ./wvtestmain '$(TESTNAME)'
212 ifeq ("$(TESTNAME)", "unitest")
213 cd uniconf/tests && DAEMON=0 ./unitest.sh
214 cd uniconf/tests && DAEMON=1 ./unitest.sh
215 endif
217 wvtestmain: \
218 $(call objects, $(filter-out ./Win32WvStreams/%, \
219 $(shell find . -type d -name t))) \
220 $(LIBWVDBUS) $(LIBUNICONF) $(LIBWVSTREAMS) $(LIBWVTEST)