1 # Makefile for ctrlproxy
2 # Copyright (C) 2002-2009 Jelmer Vernooij <jelmer@samba.org>
3 # NOTE: This file is *NOT* autogenerated.
5 include Makefile.settings
7 BINS += ctrlproxy$(EXEEXT)
8 SBINS += ctrlproxyd$(EXEEXT)
17 LIBS += $(GNUTLS_LIBS)
18 CFLAGS += $(GNUTLS_CFLAGS)
20 CFLAGS+=-DHAVE_CONFIG_H -DDEFAULT_CONFIG_DIR=\"$(DEFAULT_CONFIG_DIR)\" -DHELPFILE=\"$(HELPFILE)\"
21 CFLAGS+=-ansi -Wall -DMODULESDIR=\"$(modulesdir)\" -DSTRICT_MEMORY_ALLOCS=
23 LIBIRC_STATIC = libirc.a
24 LIBIRC = $(LIBIRC_STATIC)
26 LIBIRC_SHARED = libirc.$(SHLIBEXT).$(PACKAGE_VERSION)
27 LIBIRC_SOVERSION = 1.0
28 LIBIRC_SONAME = libirc.$(SHLIBEXT).$(LIBIRC_SOVERSION)
30 .PHONY: all clean distclean install install-bin install-dirs install-doc install-data install-pkgconfig
32 all:: $(BINS) $(SBINS)
34 ifeq ($(HAVE_PYTHON),yes)
58 src/linestack_file.o \
78 $(libircdir)/state.o \
79 $(libircdir)/client.o \
80 $(libircdir)/transport.o \
81 $(libircdir)/transport_ioc.o \
83 $(libircdir)/isupport.o \
84 $(libircdir)/connection.o \
85 $(libircdir)/redirect.o \
88 $(libircdir)/listener.o \
92 $(libircdir)/state.h \
93 $(libircdir)/client.h \
95 $(libircdir)/isupport.h \
97 $(libircdir)/connection.h \
98 $(libircdir)/redirect.h \
100 $(libircdir)/listener.h \
103 headers = src/admin.h \
114 dep_files = $(patsubst %.o, %.d, $(objs))
116 linestack-cmd$(EXEEXT): src/linestack-cmd.o $(objs) $(LIBIRC)
118 @$(LD) $(LIBS) -lreadline -rdynamic -o $@ $^
120 ctrlproxy$(EXEEXT): src/main.o $(objs) $(LIBIRC)
122 @$(LD) $(LDFLAGS) -rdynamic -o $@ $^ $(LIBS)
124 src/settings.o: CFLAGS+=-DSYSCONFDIR=\"${sysconfdir}\"
126 daemon/main.o: CFLAGS+=-DDEFAULT_CONFIG_FILE=\"${sysconfdir}/ctrlproxyd.conf\" \
127 -DSSL_CREDENTIALS_DIR=\"${sysconfdir}/ctrlproxy/ssl\" \
128 -DPIDFILE=\"${localstatedir}/run/ctrlproxyd.pid\"
130 daemon_objs += daemon/main.o daemon/user.o daemon/client.o daemon/backend.o
132 ctrlproxyd$(EXEEXT): $(daemon_objs) $(objs) $(LIBIRC)
134 @$(LD) $(LDFLAGS) -rdynamic -o $@ $^ $(LIBS)
136 ctrlproxy-admin$(EXEEXT): src/admin-cmd.o
138 @$(LD) $(LDFLAGS) -rdynamic -o $@ $^ $(LIBS)
142 @$(CC) -I. -I$(libircdir) -Isrc $(CFLAGS) $(GCOV_CFLAGS) -c $< -o $@
145 @$(CC) -I. -I$(libircdir) -Isrc -M -MT $(<:.c=.o) $(CFLAGS) $(PYTHON_CFLAGS) $< -o $@
147 # This looks a bit weird but is here to ensure that we never try to
148 # run ./autogen.sh outside of bzr checkouts
149 ifeq ($(BZR_CHECKOUT),yes)
150 configure: autogen.sh configure.ac acinclude.m4
157 ctrlproxy.pc Makefile.settings config.h: configure Makefile.settings.in ctrlproxy.pc.in
160 install: all install-dirs install-bin install-header install-data install-pkgconfig $(EXTRA_INSTALL_TARGETS)
162 $(INSTALL) -d $(DESTDIR)$(modulesdir)
164 uninstall: uninstall-bin uninstall-header uninstall-data uninstall-pkgconfig $(patsubst install-%,uninstall-%,$(EXTRA_INSTALL_TARGETS))
166 -rm -f $(DESTDIR)$(bindir)/ctrlproxy$(EXEEXT) \
167 $(DESTDIR)$(bindir)/ctrlproxy-admin$(EXEEXT) \
168 $(DESTDIR)$(sbindir)/ctrlproxyd$(EXEEXT)
169 -rmdir $(DESTDIR)$(bindir)
170 -rmdir $(DESTDIR)$(sbindir)
171 -rmdir $(DESTDIR)$(modulesdir)
174 $(INSTALL) -d $(DESTDIR)$(bindir)
175 $(INSTALL) -d $(DESTDIR)$(sbindir)
176 $(INSTALL) $(BINS) $(DESTDIR)$(bindir)
177 $(INSTALL) $(SBINS) $(DESTDIR)$(sbindir)
180 -rm -f $(patsubst %,$(DESTDIR)$(destincludedir)/%,$(notdir $(headers) $(libirc_headers)))
181 -rmdir $(DESTDIR)$(destincludedir)
184 $(INSTALL) -d $(DESTDIR)$(destincludedir)
185 $(INSTALL) -m 0644 $(libirc_headers) $(headers) $(DESTDIR)$(destincludedir)
188 $(MAKE) -C doc PACKAGE_VERSION=$(PACKAGE_VERSION)
191 $(INSTALL) -d $(DESTDIR)$(docdir)
192 $(MAKE) -C doc install PACKAGE_VERSION=$(PACKAGE_VERSION)
195 $(MAKE) -C doc uninstall
196 -rmdir $(DESTDIR)$(docdir)
199 -rm -f $(DESTDIR)$(DEFAULT_CONFIG_DIR)/motd
200 -rm -f $(DESTDIR)$(DEFAULT_CONFIG_DIR)/config
201 -rmdir $(DESTDIR)$(DEFAULT_CONFIG_DIR)
202 -rmdir $(DESTDIR)$(sysconfdir)
205 $(INSTALL) -d $(DESTDIR)$(sysconfdir)
206 $(INSTALL) -d $(DESTDIR)$(DEFAULT_CONFIG_DIR)
207 $(INSTALL) -m 0644 motd $(DESTDIR)$(DEFAULT_CONFIG_DIR)
208 $(INSTALL) -m 0644 config.default $(DESTDIR)$(DEFAULT_CONFIG_DIR)/config
211 $(INSTALL) -d $(DESTDIR)$(libdir)/pkgconfig
212 $(INSTALL) -m 0644 ctrlproxy.pc $(DESTDIR)$(libdir)/pkgconfig
215 -rm -f $(DESTDIR)$(libdir)/pkgconfig/ctrlproxy.pc
216 -rmdir $(DESTDIR)$(libdir)/pkgconfig
219 $(GCOV) -f -p -o src/ src/*.c
222 lcov --base-directory `pwd` --directory . --capture --output-file ctrlproxy.info
223 genhtml -o coverage ctrlproxy.info
225 $(libirc_objs): CFLAGS+=-fPIC
227 $(LIBIRC_STATIC): $(libirc_objs)
231 $(LIBIRC_SHARED): $(libirc_objs)
232 $(LD) -shared $(LDFLAGS) -Wl,-soname,$(LIBIRC_SONAME) -o $@ $^
235 $(LD) -shared $(LDFLAGS) -o $@ $^
241 @echo Removing object files and executables
242 @rm -f src/*.o $(libircdir)/*.o daemon/*.o python/*.o testsuite/check ctrlproxy$(EXEEXT) testsuite/*.o *~
243 @rm -f linestack-cmd$(EXEEXT) ctrlproxy-admin$(EXEEXT)
244 @rm -f ctrlproxyd$(EXEEXT)
245 @rm -f $(LIBIRC_STATIC) $(LIBIRC_SHARED)
246 @echo Removing gcov output
247 @rm -f *.gcov *.gcno *.gcda */*.gcda */*.gcno */*.gcov
248 @echo Removing test output
254 dist: configure doc-dist distclean
257 rm -f build config.h ctrlproxy.pc *.log
258 rm -rf autom4te.cache/ config.log config.status
260 realclean:: distclean
261 @$(MAKE) -C doc clean
266 # Python specific stuff below this line
267 mods/python.o python/ctrlproxy.o: CFLAGS+=$(PYTHON_CFLAGS)
268 mods/python.o python/ctrlproxy.o: CFLAGS+=-fPIC
269 mods/libpython.so: mods/python.o python/ctrlproxy.o libirc/python/irc.o
270 mods/libpython.so: LDFLAGS+=$(PYTHON_LDFLAGS)
272 .PRECIOUS: python/irc.c python/ctrlproxy.c
274 libirc/python/irc.o: CFLAGS+=$(PYTHON_CFLAGS) -fPIC
275 python/irc.$(SHLIBEXT): libirc/python/irc.o $(LIBIRC)
276 python/irc.$(SHLIBEXT): LDFLAGS+=$(PYTHON_LDFLAGS) $(LIBS)
278 ifeq ($(HAVE_PYTHON),yes)
279 all_objs += libirc/python/irc.o mods/python.o python/ctrlproxy.o
282 python:: python/irc.$(SHLIBEXT) mods/libpython.$(SHLIBEXT)
284 check-python:: python/irc.$(SHLIBEXT)
285 PYTHONPATH=python trial tests.test_irc
288 $(PYTHON) setup.py install --root="$(DESTDIR)"
291 @rm -f python/tests/*.pyc
292 # $(PYTHON) setup.py clean
294 # RFC compliance testing using ircdtorture
296 TEST_SERVER := localhost
299 testsuite/ctrlproxyrc.torture: testsuite/ctrlproxyrc.torture.in
300 sed -e 's/@SERVER@/$(TEST_SERVER)/;s/@PORT@/$(TEST_PORT)/;' < $< > $@
302 rfctest: testsuite/ctrlproxyrc.torture
303 @$(IRCDTORTURE) -- ./ctrlproxy -d 0 -i TEST -r $<
306 check_objs = testsuite/test-cmp.o testsuite/test-user.o \
307 testsuite/test-admin.o testsuite/test-isupport.o \
308 testsuite/test-parser.o testsuite/test-state.o \
309 testsuite/test-util.o testsuite/test-line.o \
310 testsuite/torture.o testsuite/test-linestack.o \
311 testsuite/test-client.o testsuite/test-network.o \
312 testsuite/test-tls.o testsuite/test-redirect.o \
313 testsuite/test-networkinfo.o testsuite/test-ctcp.o \
314 testsuite/test-help.o testsuite/test-nickserv.o \
315 testsuite/test-url.o testsuite/test-motd.o \
316 testsuite/test-log-subst.o testsuite/test-transport.o
318 testsuite/check: $(check_objs) $(objs) $(LIBIRC)
320 @$(CC) $(LIBS) -o $@ $^ $(CHECK_LIBS)
322 check:: testsuite/check
323 @echo Running testsuite
324 @$(DEBUGGER) ./testsuite/check $(CHECK_OPTIONS)
327 $(MAKE) check CHECK_OPTIONS=-nsv
330 $(MAKE) check-nofork DEBUGGER="gdb --args"
333 @echo Removing dependency files
336 examples:: example/libfoo.$(SHLIBEXT) example/libirc-simple
338 example/libfoo.$(SHLIBEXT): example/foo.o
339 example/foo.o: CFLAGS+=-I$(libircdir)
341 example/libirc-simple: example/irc_simple.o $(LIBIRC)
344 example/irc_simple.o: CFLAGS+=-I$(libircdir)
346 -include $(dep_files)