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 pyirc_objs = $(libircdir)/python/irc.o \
104 $(libircdir)/python/transport.o \
105 $(libircdir)/python/state.o
107 headers = src/admin.h \
118 dep_files = $(patsubst %.o, %.d, $(objs))
120 linestack-cmd$(EXEEXT): src/linestack-cmd.o $(objs) $(LIBIRC)
122 @$(LD) $(LIBS) -lreadline -rdynamic -o $@ $^
124 ctrlproxy$(EXEEXT): src/main.o $(objs) $(LIBIRC)
126 @$(LD) $(LDFLAGS) -rdynamic -o $@ $^ $(LIBS)
128 src/settings.o: CFLAGS+=-DSYSCONFDIR=\"${sysconfdir}\"
130 daemon/main.o: CFLAGS+=-DDEFAULT_CONFIG_FILE=\"${sysconfdir}/ctrlproxyd.conf\" \
131 -DSSL_CREDENTIALS_DIR=\"${sysconfdir}/ctrlproxy/ssl\" \
132 -DPIDFILE=\"${localstatedir}/run/ctrlproxyd.pid\"
134 daemon_objs += daemon/main.o daemon/user.o daemon/client.o daemon/backend.o
136 ctrlproxyd$(EXEEXT): $(daemon_objs) $(objs) $(LIBIRC)
138 @$(LD) $(LDFLAGS) -rdynamic -o $@ $^ $(LIBS)
140 ctrlproxy-admin$(EXEEXT): src/admin-cmd.o
142 @$(LD) $(LDFLAGS) -rdynamic -o $@ $^ $(LIBS)
146 @$(CC) -I. -I$(libircdir) -Isrc $(CFLAGS) $(GCOV_CFLAGS) -c $< -o $@
149 @$(CC) -I. -I$(libircdir) -Isrc -M -MT $(<:.c=.o) $(CFLAGS) $(PYTHON_CFLAGS) $< -o $@
151 # This looks a bit weird but is here to ensure that we never try to
152 # run ./autogen.sh outside of bzr checkouts
153 ifeq ($(BZR_CHECKOUT),yes)
154 configure: autogen.sh configure.ac acinclude.m4
161 ctrlproxy.pc Makefile.settings config.h: configure Makefile.settings.in ctrlproxy.pc.in
164 install: all install-dirs install-bin install-header install-data install-pkgconfig $(EXTRA_INSTALL_TARGETS)
166 $(INSTALL) -d $(DESTDIR)$(modulesdir)
168 uninstall: uninstall-bin uninstall-header uninstall-data uninstall-pkgconfig $(patsubst install-%,uninstall-%,$(EXTRA_INSTALL_TARGETS))
170 -rm -f $(DESTDIR)$(bindir)/ctrlproxy$(EXEEXT) \
171 $(DESTDIR)$(bindir)/ctrlproxy-admin$(EXEEXT) \
172 $(DESTDIR)$(sbindir)/ctrlproxyd$(EXEEXT)
173 -rmdir $(DESTDIR)$(bindir)
174 -rmdir $(DESTDIR)$(sbindir)
175 -rmdir $(DESTDIR)$(modulesdir)
178 $(INSTALL) -d $(DESTDIR)$(bindir)
179 $(INSTALL) -d $(DESTDIR)$(sbindir)
180 $(INSTALL) $(BINS) $(DESTDIR)$(bindir)
181 $(INSTALL) $(SBINS) $(DESTDIR)$(sbindir)
184 -rm -f $(patsubst %,$(DESTDIR)$(destincludedir)/%,$(notdir $(headers) $(libirc_headers)))
185 -rmdir $(DESTDIR)$(destincludedir)
188 $(INSTALL) -d $(DESTDIR)$(destincludedir)
189 $(INSTALL) -m 0644 $(libirc_headers) $(headers) $(DESTDIR)$(destincludedir)
192 $(MAKE) -C doc PACKAGE_VERSION=$(PACKAGE_VERSION)
195 $(INSTALL) -d $(DESTDIR)$(docdir)
196 $(MAKE) -C doc install PACKAGE_VERSION=$(PACKAGE_VERSION)
199 $(MAKE) -C doc uninstall
200 -rmdir $(DESTDIR)$(docdir)
203 -rm -f $(DESTDIR)$(DEFAULT_CONFIG_DIR)/motd
204 -rm -f $(DESTDIR)$(DEFAULT_CONFIG_DIR)/config
205 -rmdir $(DESTDIR)$(DEFAULT_CONFIG_DIR)
206 -rmdir $(DESTDIR)$(sysconfdir)
209 $(INSTALL) -d $(DESTDIR)$(sysconfdir)
210 $(INSTALL) -d $(DESTDIR)$(DEFAULT_CONFIG_DIR)
211 $(INSTALL) -m 0644 motd $(DESTDIR)$(DEFAULT_CONFIG_DIR)
212 $(INSTALL) -m 0644 config.default $(DESTDIR)$(DEFAULT_CONFIG_DIR)/config
215 $(INSTALL) -d $(DESTDIR)$(libdir)/pkgconfig
216 $(INSTALL) -m 0644 ctrlproxy.pc $(DESTDIR)$(libdir)/pkgconfig
219 -rm -f $(DESTDIR)$(libdir)/pkgconfig/ctrlproxy.pc
220 -rmdir $(DESTDIR)$(libdir)/pkgconfig
223 $(GCOV) -f -p -o src/ src/*.c
226 lcov --base-directory `pwd` --directory . --capture --output-file ctrlproxy.info
227 genhtml -o coverage ctrlproxy.info
229 $(libirc_objs): CFLAGS+=-fPIC
231 $(LIBIRC_STATIC): $(libirc_objs)
235 $(LIBIRC_SHARED): $(libirc_objs)
236 $(LD) -shared $(LDFLAGS) -Wl,-soname,$(LIBIRC_SONAME) -o $@ $^
239 $(LD) -shared $(LDFLAGS) -o $@ $^
245 @echo Removing object files and executables
246 @rm -f src/*.o $(libircdir)/*.o daemon/*.o python/*.o testsuite/check ctrlproxy$(EXEEXT) testsuite/*.o *~
247 @rm -f linestack-cmd$(EXEEXT) ctrlproxy-admin$(EXEEXT)
248 @rm -f ctrlproxyd$(EXEEXT)
249 @rm -f $(LIBIRC_STATIC) $(LIBIRC_SHARED)
250 @echo Removing gcov output
251 @rm -f *.gcov *.gcno *.gcda */*.gcda */*.gcno */*.gcov
252 @echo Removing test output
258 dist: configure doc-dist distclean
261 rm -f build config.h ctrlproxy.pc *.log
262 rm -rf autom4te.cache/ config.log config.status
264 realclean:: distclean
265 @$(MAKE) -C doc clean
270 # Python specific stuff below this line
271 mods/python.o python/ctrlproxy.o: CFLAGS+=$(PYTHON_CFLAGS)
272 mods/python.o python/ctrlproxy.o: CFLAGS+=-fPIC
273 mods/libpython.so: mods/python.o python/ctrlproxy.o $(pyirc_objs)
274 mods/libpython.so: LDFLAGS+=$(PYTHON_LDFLAGS)
276 .PRECIOUS: python/irc.c python/ctrlproxy.c
278 $(pyirc_objs): CFLAGS+=$(PYTHON_CFLAGS) -fPIC
279 libirc/python/irc.$(SHLIBEXT): $(pyirc_objs) $(LIBIRC)
280 libirc/python/irc.$(SHLIBEXT): LDFLAGS+=$(PYTHON_LDFLAGS) $(LIBS)
282 ifeq ($(HAVE_PYTHON),yes)
283 all_objs += $(pyirc_objs) mods/python.o python/ctrlproxy.o
286 python:: libirc/python/irc.$(SHLIBEXT) mods/libpython.$(SHLIBEXT)
288 check-python:: libirc/python/irc.$(SHLIBEXT)
289 PYTHONPATH=libirc/python trial tests.test_irc
292 $(PYTHON) setup.py install --root="$(DESTDIR)"
295 @rm -f python/tests/*.pyc
296 @rm -f libirc/python/tests/*.pyc
297 @rm -f libirc/python/*.$(SHLIBEXT) libirc/python/*.o
298 # $(PYTHON) setup.py clean
300 # RFC compliance testing using ircdtorture
302 TEST_SERVER := localhost
305 testsuite/ctrlproxyrc.torture: testsuite/ctrlproxyrc.torture.in
306 sed -e 's/@SERVER@/$(TEST_SERVER)/;s/@PORT@/$(TEST_PORT)/;' < $< > $@
308 rfctest: testsuite/ctrlproxyrc.torture
309 @$(IRCDTORTURE) -- ./ctrlproxy -d 0 -i TEST -r $<
312 check_objs = testsuite/test-cmp.o testsuite/test-user.o \
313 testsuite/test-admin.o testsuite/test-isupport.o \
314 testsuite/test-parser.o testsuite/test-state.o \
315 testsuite/test-util.o testsuite/test-line.o \
316 testsuite/torture.o testsuite/test-linestack.o \
317 testsuite/test-client.o testsuite/test-network.o \
318 testsuite/test-tls.o testsuite/test-redirect.o \
319 testsuite/test-networkinfo.o testsuite/test-ctcp.o \
320 testsuite/test-help.o testsuite/test-nickserv.o \
321 testsuite/test-url.o testsuite/test-motd.o \
322 testsuite/test-log-subst.o testsuite/test-transport.o
324 testsuite/check: $(check_objs) $(objs) $(LIBIRC)
326 @$(CC) $(LIBS) -o $@ $^ $(CHECK_LIBS)
328 check:: testsuite/check
329 @echo Running testsuite
330 @$(DEBUGGER) ./testsuite/check $(CHECK_OPTIONS)
333 $(MAKE) check CHECK_OPTIONS=-nsv
336 $(MAKE) check-nofork DEBUGGER="gdb --args"
339 @echo Removing dependency files
342 examples:: example/libfoo.$(SHLIBEXT) example/libirc-simple
344 example/libfoo.$(SHLIBEXT): example/foo.o
345 example/foo.o: CFLAGS+=-I$(libircdir)
347 example/libirc-simple: example/irc_simple.o $(LIBIRC)
350 example/irc_simple.o: CFLAGS+=-I$(libircdir)
352 -include $(dep_files)