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 .PHONY: all clean distclean install install-bin install-dirs install-doc install-data install-pkgconfig
25 all:: $(BINS) $(SBINS)
27 ifeq ($(HAVE_PYTHON),yes)
38 include $(libircdir)/Makefile
69 headers = src/admin.h \
79 dep_files = $(patsubst %.o, %.d, $(objs))
81 ctrlproxy$(EXEEXT): src/main.o $(objs) $(LIBIRC)
82 @echo Linking $@: $(LD) $(LDFLAGS) -rdynamic -o $@ $^ $(LIBS)
83 @$(LD) $(LDFLAGS) -rdynamic -o $@ $^ $(LIBS)
85 src/settings.o: CFLAGS+=-DSYSCONFDIR=\"${sysconfdir}\"
87 daemon/main.o: CFLAGS+=-DDEFAULT_CONFIG_FILE=\"${sysconfdir}/ctrlproxyd.conf\" \
88 -DSSL_CREDENTIALS_DIR=\"${sysconfdir}/ctrlproxy/ssl\" \
89 -DPIDFILE=\"${localstatedir}/run/ctrlproxyd.pid\"
91 daemon_objs += daemon/main.o daemon/user.o daemon/client.o daemon/backend.o
93 ctrlproxyd$(EXEEXT): $(daemon_objs) $(objs) $(LIBIRC)
95 @$(LD) $(LDFLAGS) -rdynamic -o $@ $^ $(LIBS)
97 ctrlproxy-admin$(EXEEXT): src/admin-cmd.o
99 @$(LD) $(LDFLAGS) -rdynamic -o $@ $^ $(LIBS)
103 @$(CC) -I. -I$(libircdir) -Isrc $(CFLAGS) $(GCOV_CFLAGS) -c $< -o $@
106 @$(CC) -I. -I$(libircdir) -Isrc -M -MT $(<:.c=.o) $(CFLAGS) $(PYTHON_CFLAGS) $< -o $@
108 # This looks a bit weird but is here to ensure that we never try to
109 # run ./autogen.sh outside of bzr checkouts
110 ifeq ($(BZR_CHECKOUT),yes)
111 configure: autogen.sh configure.ac acinclude.m4
118 ctrlproxy.pc Makefile.settings config.h: configure Makefile.settings.in ctrlproxy.pc.in
121 install: all install-dirs install-bin install-header install-data install-pkgconfig $(EXTRA_INSTALL_TARGETS)
123 $(INSTALL) -d $(DESTDIR)$(modulesdir)
125 uninstall: uninstall-bin uninstall-header uninstall-data uninstall-pkgconfig $(patsubst install-%,uninstall-%,$(EXTRA_INSTALL_TARGETS))
127 -rm -f $(DESTDIR)$(bindir)/ctrlproxy$(EXEEXT) \
128 $(DESTDIR)$(bindir)/ctrlproxy-admin$(EXEEXT) \
129 $(DESTDIR)$(sbindir)/ctrlproxyd$(EXEEXT)
130 -rmdir $(DESTDIR)$(bindir)
131 -rmdir $(DESTDIR)$(sbindir)
132 -rmdir $(DESTDIR)$(modulesdir)
135 $(INSTALL) -d $(DESTDIR)$(bindir)
136 $(INSTALL) -d $(DESTDIR)$(sbindir)
137 $(INSTALL) $(BINS) $(DESTDIR)$(bindir)
138 $(INSTALL) $(SBINS) $(DESTDIR)$(sbindir)
141 -rm -f $(patsubst %,$(DESTDIR)$(destincludedir)/%,$(notdir $(headers) $(libirc_headers)))
142 -rmdir $(DESTDIR)$(destincludedir)
145 $(INSTALL) -d $(DESTDIR)$(destincludedir)
146 $(INSTALL) -m 0644 $(libirc_headers) $(headers) $(DESTDIR)$(destincludedir)
149 $(MAKE) -C doc PACKAGE_VERSION=$(PACKAGE_VERSION)
152 $(INSTALL) -d $(DESTDIR)$(docdir)
153 $(MAKE) -C doc install PACKAGE_VERSION=$(PACKAGE_VERSION)
156 $(MAKE) -C doc uninstall
157 -rmdir $(DESTDIR)$(docdir)
160 -rm -f $(DESTDIR)$(DEFAULT_CONFIG_DIR)/motd
161 -rm -f $(DESTDIR)$(DEFAULT_CONFIG_DIR)/config
162 -rmdir $(DESTDIR)$(DEFAULT_CONFIG_DIR)
163 -rmdir $(DESTDIR)$(sysconfdir)
166 $(INSTALL) -d $(DESTDIR)$(sysconfdir)
167 $(INSTALL) -d $(DESTDIR)$(DEFAULT_CONFIG_DIR)
168 $(INSTALL) -m 0644 motd $(DESTDIR)$(DEFAULT_CONFIG_DIR)
169 $(INSTALL) -m 0644 config.default $(DESTDIR)$(DEFAULT_CONFIG_DIR)/config
172 $(INSTALL) -d $(DESTDIR)$(libdir)/pkgconfig
173 $(INSTALL) -m 0644 ctrlproxy.pc $(DESTDIR)$(libdir)/pkgconfig
176 -rm -f $(DESTDIR)$(libdir)/pkgconfig/ctrlproxy.pc
177 -rmdir $(DESTDIR)$(libdir)/pkgconfig
180 $(GCOV) -f -p -o src/ src/*.c
183 lcov --base-directory `pwd` --directory . --capture --output-file ctrlproxy.info
184 genhtml -o coverage ctrlproxy.info
188 @$(LD) -shared $(LDFLAGS) -o $@ $^
194 @echo Removing object files and executables
195 @rm -f src/*.o daemon/*.o python/*.o testsuite/check ctrlproxy$(EXEEXT) testsuite/*.o *~
196 @rm -f ctrlproxy-admin$(EXEEXT)
197 @rm -f ctrlproxyd$(EXEEXT)
198 @rm -f mods/*.$(SHLIBEXT) mods/*.o
199 @echo Removing gcov output
200 @rm -f *.gcov *.gcno *.gcda */*.gcda */*.gcno */*.gcov
201 @echo Removing test output
207 dist: configure doc-dist distclean
210 rm -f build config.h ctrlproxy.pc *.log
211 rm -rf autom4te.cache/ config.log config.status
213 realclean:: distclean
214 @$(MAKE) -C doc clean
219 # Python specific stuff below this line
220 mods/python.o python/ctrlproxy.o: CFLAGS+=$(PYTHON_CFLAGS)
221 mods/python.o python/ctrlproxy.o: CFLAGS+=-fPIC
222 mods/libpython.so: mods/python.o python/ctrlproxy.o $(pyirc_objs)
223 mods/libpython.so: LDFLAGS+=$(PYTHON_LDFLAGS)
225 ifeq ($(HAVE_PYTHON),yes)
226 all_objs += $(pyirc_objs) mods/python.o python/ctrlproxy.o
229 python:: mods/libpython.$(SHLIBEXT)
232 $(PYTHON) setup.py install --root="$(DESTDIR)"
235 @rm -f python/tests/*.pyc
236 # $(PYTHON) setup.py clean
238 # RFC compliance testing using ircdtorture
240 TEST_SERVER := localhost
243 testsuite/ctrlproxyrc.torture: testsuite/ctrlproxyrc.torture.in
244 sed -e 's/@SERVER@/$(TEST_SERVER)/;s/@PORT@/$(TEST_PORT)/;' < $< > $@
246 rfctest: testsuite/ctrlproxyrc.torture
247 @$(IRCDTORTURE) -- ./ctrlproxy -d 0 -i TEST -r $<
250 check_objs = testsuite/test-cmp.o testsuite/test-user.o \
251 testsuite/test-admin.o testsuite/test-isupport.o \
252 testsuite/test-parser.o testsuite/test-state.o \
253 testsuite/test-util.o testsuite/test-line.o \
254 testsuite/torture.o testsuite/test-linestack.o \
255 testsuite/test-client.o testsuite/test-network.o \
256 testsuite/test-tls.o testsuite/test-redirect.o \
257 testsuite/test-networkinfo.o testsuite/test-ctcp.o \
258 testsuite/test-help.o testsuite/test-nickserv.o \
259 testsuite/test-url.o testsuite/test-motd.o \
260 testsuite/test-log-subst.o testsuite/test-transport.o
262 testsuite/check: $(check_objs) $(objs) $(LIBIRC)
264 @$(CC) $(LIBS) -o $@ $^ $(CHECK_LIBS)
266 check:: testsuite/check
267 @echo Running testsuite
268 @$(DEBUGGER) ./testsuite/check $(CHECK_OPTIONS)
271 $(MAKE) check CHECK_OPTIONS=-nsv
274 $(MAKE) check-nofork DEBUGGER="gdb --args"
277 @echo Removing dependency files
280 examples:: example/libfoo.$(SHLIBEXT) example/libirc-simple
282 example/libfoo.$(SHLIBEXT): example/foo.o
283 example/foo.o: CFLAGS+=-I$(libircdir)
285 example/libirc-simple: example/irc_simple.o $(LIBIRC)
289 example/irc_simple.o: CFLAGS+=-I$(libircdir)
291 -include $(dep_files)