File: Makefile

package info (click to toggle)
ctrlproxy 3.0.7-1
  • links: PTS
  • area: main
  • in suites: lenny, squeeze
  • size: 1,668 kB
  • ctags: 2,045
  • sloc: ansic: 15,358; sh: 2,805; xml: 1,078; python: 346; makefile: 302; perl: 18
file content (279 lines) | stat: -rw-r--r-- 7,304 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
# Makefile for ctrlproxy
# Copyright (C) 2002-2008 Jelmer Vernooij <jelmer@samba.org>
# NOTE: This file is *NOT* autogenerated.

include Makefile.settings

BINS += ctrlproxy$(EXEEXT)

GCOV = gcov

ifeq ($(WITH_GCOV),1)
CFLAGS += --coverage
LIBS += --coverage
endif

LIBS += $(GNUTLS_LIBS)
CFLAGS += $(GNUTLS_CFLAGS)

CFLAGS+=-DHAVE_CONFIG_H -DSHAREDIR=\"$(cdatadir)\" -DDEFAULT_CONFIG_DIR=\"$(DEFAULT_CONFIG_DIR)\" -DHELPFILE=\"$(HELPFILE)\"
CFLAGS+=-ansi -Wall -DMODULESDIR=\"$(modulesdir)\" -DSTRICT_MEMORY_ALLOCS=

LIBIRC_STATIC = libirc.a
LIBIRC = $(LIBIRC_STATIC)

LIBIRC_SHARED = libirc.$(SHLIBEXT).$(PACKAGE_VERSION)
LIBIRC_SOVERSION = 1.0
LIBIRC_SONAME = libirc.$(SHLIBEXT).$(LIBIRC_SOVERSION)

.PHONY: all clean distclean install install-bin install-dirs install-doc install-data install-pkgconfig

all: $(BINS)

experimental:: all ctrlproxyd$(EXEEXT)

doxygen:
	doxygen

lib_objs = \
	   lib/state.o \
	   lib/client.o \
	   lib/transport.o \
	   lib/line.o \
	   lib/isupport.o \
	   lib/connection.o \
	   lib/url.o \
	   lib/util.o \
	   lib/listener.o

objs = src/posix.o \
	   src/cache.o \
	   src/util.o \
	   src/hooks.o \
	   src/linestack.o \
	   src/plugins.o \
	   src/settings.o \
	   src/log.o \
	   src/client.o \
	   src/redirect.o \
	   src/gen_config.o \
	   src/repl.o \
	   src/linestack_file.o \
	   src/ctcp_redirect.o \
	   src/ctcp.o \
	   src/motd.o \
	   src/nickserv.o \
	   src/keyfile.o \
	   src/admin.o \
	   src/user.o \
	   src/pipes.o \
	   src/help.o \
	   src/repl_backends.o \
	   src/listener.o \
	   src/log_support.o \
	   src/log_custom.o \
	   src/log_subst.o \
	   src/auto_away.o \
	   src/network.o \
	   $(SSL_OBJS)

lib_headers = \
		  lib/state.h \
		  lib/client.h \
		  lib/line.h \
		  lib/isupport.h \
		  lib/irc.h \
		  lib/connection.h \
		  lib/url.h \
		  lib/listener.h

headers = src/admin.h \
		  src/ctcp.h \
		  src/ctrlproxy.h \
		  src/hooks.h \
		  src/linestack.h \
		  src/log_support.h \
		  src/repl.h \
		  src/settings.h \
		  src/ssl.h \
		  src/log.h
dep_files = $(patsubst %.o, %.d, $(objs))

linestack-cmd$(EXEEXT): src/linestack-cmd.o $(objs) $(LIBIRC)
	@echo Linking $@
	@$(LD) $(LIBS) -lreadline -rdynamic -o $@ $^

ctrlproxy$(EXEEXT): src/main.o $(objs) $(LIBIRC)
	@echo Linking $@
	@$(LD) $(LDFLAGS) -rdynamic -o $@ $^ $(LIBS)

ctrlproxyd$(EXEEXT): daemon/main.o $(objs) $(LIBIRC)
	@echo Linking $@
	@$(LD) $(LDFLAGS) -rdynamic -o $@ $^ $(LIBS)

ctrlproxy-admin$(EXEEXT): src/admin-cmd.o
	@echo Linking $@
	@$(LD) $(LDFLAGS) -rdynamic -o $@ $^ $(LIBS)

%.o: %.c
	@echo Compiling $<
	@$(CC) -I. -Ilib -Isrc $(CFLAGS) $(GCOV_CFLAGS) -c $< -o $@

%.d: %.c config.h
	@$(CC) -I. -Ilib -Isrc -M -MT $(<:.c=.o) $(CFLAGS) $< -o $@

# This looks a bit weird but is here to ensure that we never try to 
# run ./autogen.sh outside of bzr checkouts
ifeq ($(BZR_CHECKOUT),yes)
configure: autogen.sh configure.ac acinclude.m4
	./$<
else
configure:
	./autogen.sh
endif

ctrlproxy.pc Makefile.settings config.h: configure Makefile.settings.in ctrlproxy.pc.in
	./$<

install: all install-dirs install-bin install-header install-data install-pkgconfig $(EXTRA_INSTALL_TARGETS)
install-dirs:
	$(INSTALL) -d $(DESTDIR)$(modulesdir)

uninstall: uninstall-bin uninstall-header uninstall-data uninstall-pkgconfig $(patsubst install-%,uninstall-%,$(EXTRA_INSTALL_TARGETS))
uninstall-bin:
	-rm -f $(DESTDIR)$(bindir)/ctrlproxy$(EXEEXT) \
		   $(DESTDIR)$(bindir)/ctrlproxy-admin$(EXEEXT)
	-rmdir $(DESTDIR)$(bindir)
	-rmdir $(DESTDIR)$(modulesdir)

install-bin:
	$(INSTALL) -d $(DESTDIR)$(bindir)
	$(INSTALL) $(BINS) $(DESTDIR)$(bindir)

uninstall-header:
	-rm -f $(patsubst %,$(DESTDIR)$(destincludedir)/%,$(notdir $(headers) $(lib_headers)))
	-rmdir $(DESTDIR)$(destincludedir)

install-header::
	$(INSTALL) -d $(DESTDIR)$(destincludedir)
	$(INSTALL) -m 0644 $(lib_headers) $(headers) $(DESTDIR)$(destincludedir)

doc::
	$(MAKE) -C doc PACKAGE_VERSION=$(PACKAGE_VERSION)

install-doc:: doc
	$(INSTALL) -d $(DESTDIR)$(docdir)
	$(MAKE) -C doc install PACKAGE_VERSION=$(PACKAGE_VERSION)

uninstall-doc: 
	$(MAKE) -C doc uninstall
	-rmdir $(DESTDIR)$(docdir)

uninstall-data::
	-rm -f $(DESTDIR)$(cdatadir)/motd
	-rm -f $(DESTDIR)$(DEFAULT_CONFIG_DIR)/config
	-rm -f $(DESTDIR)$(DEFAULT_CONFIG_DIR)/networks/admin
	-rmdir $(DESTDIR)$(DEFAULT_CONFIG_DIR)/networks
	-rmdir $(DESTDIR)$(DEFAULT_CONFIG_DIR)
	-rmdir $(DESTDIR)$(cdatadir)

install-data:
	$(INSTALL) -d $(DESTDIR)$(cdatadir)
	$(INSTALL) -m 0644 motd $(DESTDIR)$(cdatadir)
	$(INSTALL) -d $(DESTDIR)$(DEFAULT_CONFIG_DIR)
	$(INSTALL) -d $(DESTDIR)$(DEFAULT_CONFIG_DIR)/networks
	$(INSTALL) -m 0644 config.default $(DESTDIR)$(DEFAULT_CONFIG_DIR)/config
	$(INSTALL) -m 0644 config.admin $(DESTDIR)$(DEFAULT_CONFIG_DIR)/networks/admin

install-pkgconfig:
	$(INSTALL) -d $(DESTDIR)$(libdir)/pkgconfig
	$(INSTALL) -m 0644 ctrlproxy.pc $(DESTDIR)$(libdir)/pkgconfig

uninstall-pkgconfig:
	-rm -f $(DESTDIR)$(libdir)/pkgconfig/ctrlproxy.pc
	-rmdir $(DESTDIR)$(libdir)/pkgconfig

gcov: check
	$(GCOV) -f -p -o src/ src/*.c 

lcov:
	lcov --base-directory `pwd` --directory . --capture --output-file ctrlproxy.info
	genhtml -o coverage ctrlproxy.info

$(LIBIRC_STATIC): $(lib_objs)
	@echo Linking $@
	@ar -rcs $@ $^

$(LIBIRC_SHARED): $(lib_objs)
	$(LD) -shared $(LDFLAGS) -Wl,-soname,$(LIBIRC_SONAME) -o $@ $^

cscope.out::
	cscope -b -R

clean::
	@echo Removing dependency files
	@rm -f $(dep_files)
	@echo Removing object files and executables
	@rm -f src/*.o lib/*.o testsuite/check ctrlproxy$(EXEEXT) testsuite/*.o *~
	@rm -f linestack-cmd$(EXEEXT) ctrlproxy-admin$(EXEEXT)
	@rm -f ctrlproxyd$(EXEEXT)
	@rm -f $(LIBIRC_STATIC) $(LIBIRC_SHARED)
	@echo Removing gcov output
	@rm -f *.gcov *.gcno *.gcda  */*.gcda */*.gcno */*.gcov
	@echo Removing test output
	@rm -rf test-*

doc-dist:: configure
	$(MAKE) -C doc dist

dist: configure doc-dist distclean

distclean:: clean 
	rm -f build config.h ctrlproxy.pc *.log
	rm -rf autom4te.cache/ config.log config.status

realclean:: distclean
	@$(MAKE) -C doc clean

ctags:
	ctags -R .

# RFC compliance testing using ircdtorture

TEST_SERVER := localhost
TEST_PORT := 6667

testsuite/ctrlproxyrc.torture: testsuite/ctrlproxyrc.torture.in
	sed -e 's/@SERVER@/$(TEST_SERVER)/;s/@PORT@/$(TEST_PORT)/;' < $< > $@

rfctest: testsuite/ctrlproxyrc.torture
	@$(IRCDTORTURE) -- ./ctrlproxy -d 0 -i TEST -r $<

# Unit tests
check_objs = testsuite/test-cmp.o testsuite/test-user.o \
			 testsuite/test-admin.o testsuite/test-isupport.o \
			 testsuite/test-parser.o testsuite/test-state.o \
			 testsuite/test-util.o testsuite/test-line.o \
			 testsuite/torture.o testsuite/test-linestack.o \
			 testsuite/test-client.o testsuite/test-network.o \
			 testsuite/test-tls.o testsuite/test-redirect.o \
			 testsuite/test-networkinfo.o testsuite/test-ctcp.o \
			 testsuite/test-help.o testsuite/test-nickserv.o \
			 testsuite/test-url.o testsuite/test-motd.o \
			 testsuite/test-log-subst.o testsuite/test-transport.o

testsuite/check: $(check_objs) $(objs) $(LIBIRC)
	@echo Linking $@
	@$(CC) $(LIBS) -o $@ $^ $(CHECK_LIBS)

check:: testsuite/check
	@echo Running testsuite
	@$(DEBUGGER) ./testsuite/check $(CHECK_OPTIONS)

check-nofork:: 
	$(MAKE) check CHECK_OPTIONS=-nsv

check-gdb: 
	$(MAKE) check-nofork DEBUGGER="gdb --args"

-include $(dep_files)