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