1 | ########################### |
---|
2 | ## Makefile for BitlBee ## |
---|
3 | ## ## |
---|
4 | ## Copyright 2002 Lintux ## |
---|
5 | ########################### |
---|
6 | |
---|
7 | ### DEFINITIONS |
---|
8 | |
---|
9 | -include Makefile.settings |
---|
10 | |
---|
11 | # Program variables |
---|
12 | objects = bitlbee.o dcc.o help.o ipc.o irc.o irc_im.o irc_channel.o irc_commands.o irc_send.o irc_user.o irc_util.o nick.o $(OTR_BI) query.o root_commands.o set.o storage.o $(STORAGE_OBJS) unix.o conf.o log.o |
---|
13 | headers = $(wildcard $(_SRCDIR_)*.h $(_SRCDIR_)lib/*.h $(_SRCDIR_)protocols/*.h) |
---|
14 | subdirs = lib protocols |
---|
15 | |
---|
16 | OUTFILE = bitlbee |
---|
17 | |
---|
18 | # Expansion of variables |
---|
19 | subdirobjs = $(foreach dir,$(subdirs),$(dir)/$(dir).o) |
---|
20 | |
---|
21 | all: $(OUTFILE) $(OTR_PI) $(SKYPE_PI) doc systemd |
---|
22 | |
---|
23 | doc: |
---|
24 | ifdef DOC |
---|
25 | $(MAKE) -C doc |
---|
26 | endif |
---|
27 | |
---|
28 | uninstall: uninstall-bin uninstall-doc |
---|
29 | @echo -e '\nmake uninstall does not remove files in '$(DESTDIR)$(ETCDIR)', you can use make uninstall-etc to do that.\n' |
---|
30 | |
---|
31 | install: install-bin install-doc install-plugins |
---|
32 | @echo |
---|
33 | @echo Installed successfully |
---|
34 | @echo |
---|
35 | @if ! [ -d $(DESTDIR)$(CONFIG) ]; then echo -e '\nThe configuration directory $(DESTDIR)$(CONFIG) does not exist yet, don'\''t forget to create it!'; fi |
---|
36 | @if ! [ -e $(DESTDIR)$(ETCDIR)/bitlbee.conf ]; then echo -e '\nNo files are installed in '$(DESTDIR)$(ETCDIR)' by make install. Run make install-etc to do that.'; fi |
---|
37 | ifdef SYSTEMDSYSTEMUNITDIR |
---|
38 | @echo If you want to start BitlBee using systemd, try \"make install-systemd\". |
---|
39 | endif |
---|
40 | @echo To be able to compile third party plugins, run \"make install-dev\" |
---|
41 | @echo |
---|
42 | |
---|
43 | .PHONY: install install-bin install-etc install-doc install-plugins install-systemd install-dev \ |
---|
44 | uninstall uninstall-bin uninstall-etc uninstall-doc uninstall-etc \ |
---|
45 | all clean distclean tar $(subdirs) doc |
---|
46 | |
---|
47 | Makefile.settings: |
---|
48 | @echo |
---|
49 | @echo Run ./configure to create Makefile.settings, then rerun make |
---|
50 | @echo |
---|
51 | |
---|
52 | clean: $(subdirs) |
---|
53 | rm -f *.o $(OUTFILE) core utils/bitlbeed init/bitlbee*.service |
---|
54 | $(MAKE) -C tests clean |
---|
55 | ifdef SKYPE_PI |
---|
56 | $(MAKE) -C protocols/skype clean |
---|
57 | endif |
---|
58 | |
---|
59 | distclean: clean $(subdirs) |
---|
60 | rm -rf .depend |
---|
61 | rm -f Makefile.settings config.h bitlbee.pc |
---|
62 | find . -name 'DEADJOE' -o -name '*.orig' -o -name '*.rej' -o -name '*~' -exec rm -f {} \; |
---|
63 | @# May still be present in dirs of disabled protocols. |
---|
64 | -find . -name .depend -exec rm -rf {} \; |
---|
65 | $(MAKE) -C tests distclean |
---|
66 | |
---|
67 | check: all |
---|
68 | $(MAKE) -C tests |
---|
69 | |
---|
70 | gcov: check |
---|
71 | gcov *.c |
---|
72 | |
---|
73 | lcov: check |
---|
74 | lcov --directory . --capture --output-file bitlbee.info |
---|
75 | genhtml -o coverage bitlbee.info |
---|
76 | |
---|
77 | install-doc: |
---|
78 | ifdef DOC |
---|
79 | $(MAKE) -C doc install |
---|
80 | endif |
---|
81 | ifdef SKYPE_PI |
---|
82 | $(MAKE) -C protocols/skype install-doc |
---|
83 | endif |
---|
84 | |
---|
85 | uninstall-doc: |
---|
86 | ifdef DOC |
---|
87 | $(MAKE) -C doc uninstall |
---|
88 | endif |
---|
89 | ifdef SKYPE_PI |
---|
90 | $(MAKE) -C protocols/skype uninstall-doc |
---|
91 | endif |
---|
92 | |
---|
93 | install-bin: |
---|
94 | mkdir -p $(DESTDIR)$(SBINDIR) |
---|
95 | $(INSTALL) -m 0755 $(OUTFILE) $(DESTDIR)$(SBINDIR)/$(OUTFILE) |
---|
96 | |
---|
97 | uninstall-bin: |
---|
98 | rm -f $(DESTDIR)$(SBINDIR)/$(OUTFILE) |
---|
99 | |
---|
100 | install-dev: |
---|
101 | mkdir -p $(DESTDIR)$(INCLUDEDIR) |
---|
102 | $(INSTALL) -m 0644 config.h $(DESTDIR)$(INCLUDEDIR) |
---|
103 | for i in $(headers); do $(INSTALL) -m 0644 $$i $(DESTDIR)$(INCLUDEDIR); done |
---|
104 | mkdir -p $(DESTDIR)$(PCDIR) |
---|
105 | $(INSTALL) -m 0644 bitlbee.pc $(DESTDIR)$(PCDIR) |
---|
106 | |
---|
107 | uninstall-dev: |
---|
108 | rm -f $(foreach hdr,$(headers),$(DESTDIR)$(INCLUDEDIR)/$(hdr)) |
---|
109 | -rmdir $(DESTDIR)$(INCLUDEDIR) |
---|
110 | rm -f $(DESTDIR)$(PCDIR)/bitlbee.pc |
---|
111 | |
---|
112 | install-etc: |
---|
113 | mkdir -p $(DESTDIR)$(ETCDIR) |
---|
114 | $(INSTALL) -m 0644 $(_SRCDIR_)motd.txt $(DESTDIR)$(ETCDIR)/motd.txt |
---|
115 | $(INSTALL) -m 0644 $(_SRCDIR_)bitlbee.conf $(DESTDIR)$(ETCDIR)/bitlbee.conf |
---|
116 | |
---|
117 | uninstall-etc: |
---|
118 | rm -f $(DESTDIR)$(ETCDIR)/motd.txt |
---|
119 | rm -f $(DESTDIR)$(ETCDIR)/bitlbee.conf |
---|
120 | -rmdir $(DESTDIR)$(ETCDIR) |
---|
121 | |
---|
122 | install-plugins: install-plugin-otr install-plugin-skype |
---|
123 | |
---|
124 | install-plugin-otr: |
---|
125 | ifdef OTR_PI |
---|
126 | mkdir -p $(DESTDIR)$(PLUGINDIR) |
---|
127 | $(INSTALL) -m 0755 otr.so $(DESTDIR)$(PLUGINDIR) |
---|
128 | endif |
---|
129 | |
---|
130 | install-plugin-skype: |
---|
131 | ifdef SKYPE_PI |
---|
132 | mkdir -p $(DESTDIR)$(PLUGINDIR) |
---|
133 | $(INSTALL) -m 0755 skype.so $(DESTDIR)$(PLUGINDIR) |
---|
134 | mkdir -p $(DESTDIR)$(ETCDIR)/../skyped $(DESTDIR)$(BINDIR) |
---|
135 | $(INSTALL) -m 0644 $(_SRCDIR_)protocols/skype/skyped.cnf $(DESTDIR)$(ETCDIR)/../skyped/skyped.cnf |
---|
136 | $(INSTALL) -m 0644 $(_SRCDIR_)protocols/skype/skyped.conf.dist $(DESTDIR)$(ETCDIR)/../skyped/skyped.conf |
---|
137 | $(INSTALL) -m 0755 $(_SRCDIR_)protocols/skype/skyped.py $(DESTDIR)$(BINDIR)/skyped |
---|
138 | $(MAKE) -C protocols/skype install-doc |
---|
139 | endif |
---|
140 | |
---|
141 | systemd: |
---|
142 | ifdef SYSTEMDSYSTEMUNITDIR |
---|
143 | mkdir -p init |
---|
144 | sed 's|@sbindir@|$(SBINDIR)|' $(_SRCDIR_)init/bitlbee.service.in > init/bitlbee.service |
---|
145 | sed 's|@sbindir@|$(SBINDIR)|' $(_SRCDIR_)init/bitlbee@.service.in > init/bitlbee@.service |
---|
146 | endif |
---|
147 | |
---|
148 | install-systemd: systemd |
---|
149 | ifdef SYSTEMDSYSTEMUNITDIR |
---|
150 | mkdir -p $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR) |
---|
151 | $(INSTALL) -m 0644 init/bitlbee.service $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR) |
---|
152 | $(INSTALL) -m 0644 init/bitlbee@.service $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR) |
---|
153 | $(INSTALL) -m 0644 $(_SRCDIR_)init/bitlbee.socket $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR) |
---|
154 | else |
---|
155 | @echo SYSTEMDSYSTEMUNITDIR not set, not installing systemd unit files. |
---|
156 | endif |
---|
157 | |
---|
158 | tar: |
---|
159 | fakeroot debian/rules clean || make distclean |
---|
160 | x=$$(basename $$(pwd)); \ |
---|
161 | cd ..; \ |
---|
162 | tar czf $$x.tar.gz --exclude=debian --exclude=.git* --exclude=.depend $$x |
---|
163 | |
---|
164 | $(subdirs): |
---|
165 | @$(MAKE) -C $@ $(MAKECMDGOALS) |
---|
166 | |
---|
167 | $(OTR_PI): %.so: $(_SRCDIR_)%.c |
---|
168 | @echo '*' Building plugin $@ |
---|
169 | @$(CC) $(CFLAGS) -fPIC -shared $(LDFLAGS) $< -o $@ $(OTRFLAGS) |
---|
170 | |
---|
171 | $(SKYPE_PI): $(_SRCDIR_)protocols/skype/skype.c |
---|
172 | @echo '*' Building plugin skype |
---|
173 | @$(CC) $(CFLAGS) $(LDFLAGS) $(SKYPEFLAGS) $< -o $@ |
---|
174 | |
---|
175 | $(objects): %.o: $(_SRCDIR_)%.c |
---|
176 | @echo '*' Compiling $< |
---|
177 | @$(CC) -c $(CFLAGS) $(CFLAGS_BITLBEE) $< -o $@ |
---|
178 | |
---|
179 | $(objects): Makefile Makefile.settings config.h |
---|
180 | |
---|
181 | $(OUTFILE): $(objects) $(subdirs) |
---|
182 | @echo '*' Linking $(OUTFILE) |
---|
183 | @$(CC) $(objects) $(subdirobjs) -o $(OUTFILE) $(LDFLAGS_BITLBEE) $(LDFLAGS) $(EFLAGS) |
---|
184 | ifndef DEBUG |
---|
185 | @echo '*' Stripping $(OUTFILE) |
---|
186 | @-$(STRIP) $(OUTFILE) |
---|
187 | endif |
---|
188 | |
---|
189 | ctags: |
---|
190 | ctags `find . -name "*.c"` `find . -name "*.h"` |
---|
191 | |
---|
192 | # Using this as a bogus Make target to test if a GNU-compatible version of |
---|
193 | # make is available. |
---|
194 | helloworld: |
---|
195 | @echo Hello World |
---|
196 | |
---|
197 | # Check if we can load the helpfile. (This fails if some article is >1KB.) |
---|
198 | # If print returns a NULL pointer, the file is unusable. |
---|
199 | testhelp: doc |
---|
200 | gdb --eval-command='b main' --eval-command='r' \ |
---|
201 | --eval-command='print help_init(&global->helpfile, "doc/user-guide/help.txt")' \ |
---|
202 | $(OUTFILE) < /dev/null |
---|
203 | |
---|
204 | -include .depend/*.d |
---|
205 | # DO NOT DELETE |
---|