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_cap.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) auth.o $(AUTH_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) 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 | ifndef SYSTEMDSYSTEMUNITDIR |
---|
36 | @if ! [ -d $(DESTDIR)$(CONFIG) ]; then echo -e '\nThe configuration directory $(DESTDIR)$(CONFIG) does not exist yet, don'\''t forget to create it!'; fi |
---|
37 | endif |
---|
38 | @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 |
---|
39 | ifdef SYSTEMDSYSTEMUNITDIR |
---|
40 | @echo If you want to start BitlBee using systemd, try \"make install-systemd\". |
---|
41 | endif |
---|
42 | @echo To be able to compile third party plugins, run \"make install-dev\" |
---|
43 | @echo |
---|
44 | |
---|
45 | .PHONY: install install-bin install-etc install-doc install-plugins install-systemd install-dev \ |
---|
46 | uninstall uninstall-bin uninstall-etc uninstall-doc uninstall-etc \ |
---|
47 | all clean distclean tar $(subdirs) doc |
---|
48 | |
---|
49 | Makefile.settings: |
---|
50 | @echo |
---|
51 | @echo Run ./configure to create Makefile.settings, then rerun make |
---|
52 | @echo |
---|
53 | |
---|
54 | clean: $(subdirs) |
---|
55 | rm -f *.o $(OUTFILE) core utils/bitlbeed init/bitlbee*.service |
---|
56 | $(MAKE) -C tests clean |
---|
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 | |
---|
81 | uninstall-doc: |
---|
82 | ifdef DOC |
---|
83 | $(MAKE) -C doc uninstall |
---|
84 | endif |
---|
85 | |
---|
86 | install-bin: |
---|
87 | mkdir -p $(DESTDIR)$(SBINDIR) |
---|
88 | $(INSTALL) -m 0755 $(OUTFILE) $(DESTDIR)$(SBINDIR)/$(OUTFILE) |
---|
89 | ifdef IMPLIB |
---|
90 | # import library for cygwin |
---|
91 | mkdir -p $(DESTDIR)$(LIBDIR) |
---|
92 | $(INSTALL) -m 0644 $(IMPLIB) $(DESTDIR)$(LIBDIR)/$(IMPLIB) |
---|
93 | endif |
---|
94 | |
---|
95 | uninstall-bin: |
---|
96 | rm -f $(DESTDIR)$(SBINDIR)/$(OUTFILE) |
---|
97 | ifdef IMPLIB |
---|
98 | rm -f $(DESTDIR)$(LIBDIR)/$(IMPLIB) |
---|
99 | endif |
---|
100 | |
---|
101 | install-dev: |
---|
102 | mkdir -p $(DESTDIR)$(INCLUDEDIR) |
---|
103 | $(INSTALL) -m 0644 config.h $(DESTDIR)$(INCLUDEDIR) |
---|
104 | for i in $(headers); do $(INSTALL) -m 0644 $$i $(DESTDIR)$(INCLUDEDIR); done |
---|
105 | mkdir -p $(DESTDIR)$(PCDIR) |
---|
106 | $(INSTALL) -m 0644 bitlbee.pc $(DESTDIR)$(PCDIR) |
---|
107 | |
---|
108 | uninstall-dev: |
---|
109 | rm -f $(foreach hdr,$(headers),$(DESTDIR)$(INCLUDEDIR)/$(hdr)) |
---|
110 | -rmdir $(DESTDIR)$(INCLUDEDIR) |
---|
111 | rm -f $(DESTDIR)$(PCDIR)/bitlbee.pc |
---|
112 | |
---|
113 | install-etc: |
---|
114 | mkdir -p $(DESTDIR)$(ETCDIR) |
---|
115 | $(INSTALL) -m 0644 $(_SRCDIR_)motd.txt $(DESTDIR)$(ETCDIR)/motd.txt |
---|
116 | $(INSTALL) -m 0644 $(_SRCDIR_)bitlbee.conf $(DESTDIR)$(ETCDIR)/bitlbee.conf |
---|
117 | |
---|
118 | uninstall-etc: |
---|
119 | rm -f $(DESTDIR)$(ETCDIR)/motd.txt |
---|
120 | rm -f $(DESTDIR)$(ETCDIR)/bitlbee.conf |
---|
121 | -rmdir $(DESTDIR)$(ETCDIR) |
---|
122 | |
---|
123 | install-plugins: install-plugin-otr |
---|
124 | |
---|
125 | install-plugin-otr: |
---|
126 | ifdef OTR_PI |
---|
127 | mkdir -p $(DESTDIR)$(PLUGINDIR) |
---|
128 | $(INSTALL) -m 0755 otr.so $(DESTDIR)$(PLUGINDIR) |
---|
129 | endif |
---|
130 | |
---|
131 | systemd: |
---|
132 | ifdef SYSTEMDSYSTEMUNITDIR |
---|
133 | mkdir -p init |
---|
134 | sed 's|@sbindir@|$(SBINDIR)|' $(_SRCDIR_)init/bitlbee.service.in > init/bitlbee.service |
---|
135 | sed 's|@sbindir@|$(SBINDIR)|' $(_SRCDIR_)init/bitlbee@.service.in > init/bitlbee@.service |
---|
136 | endif |
---|
137 | |
---|
138 | install-systemd: systemd |
---|
139 | ifdef SYSTEMDSYSTEMUNITDIR |
---|
140 | mkdir -p $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR) |
---|
141 | $(INSTALL) -m 0644 init/bitlbee.service $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR) |
---|
142 | $(INSTALL) -m 0644 init/bitlbee@.service $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR) |
---|
143 | $(INSTALL) -m 0644 $(_SRCDIR_)init/bitlbee.socket $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR) |
---|
144 | else |
---|
145 | @echo SYSTEMDSYSTEMUNITDIR not set, not installing systemd unit files. |
---|
146 | endif |
---|
147 | |
---|
148 | ifdef SYSUSERSDIR |
---|
149 | $(INSTALL) -Dm644 init/bitlbee.sysusers $(DESTDIR)/$(SYSUSERSDIR)/bitlbee.conf |
---|
150 | else |
---|
151 | @echo SYSUSERSDIR not set, not install sysusers.d files |
---|
152 | endif |
---|
153 | |
---|
154 | tar: |
---|
155 | fakeroot debian/rules clean || make distclean |
---|
156 | x=$$(basename $$(pwd)); \ |
---|
157 | cd ..; \ |
---|
158 | tar czf $$x.tar.gz --exclude=debian --exclude=.git* --exclude=.depend $$x |
---|
159 | |
---|
160 | $(subdirs): |
---|
161 | $(MAKE) -C $@ $(MAKECMDGOALS) |
---|
162 | |
---|
163 | $(OTR_PI): %.so: $(_SRCDIR_)%.c |
---|
164 | @echo '*' Building plugin $@ |
---|
165 | $(VERBOSE) $(CC) $(CFLAGS) -fPIC -shared $(LDFLAGS) $< -o $@ $(OTRFLAGS) |
---|
166 | |
---|
167 | $(objects): %.o: $(_SRCDIR_)%.c |
---|
168 | @echo '*' Compiling $< |
---|
169 | $(VERBOSE) $(CC) -c $(CFLAGS) $(CFLAGS_BITLBEE) $< -o $@ |
---|
170 | |
---|
171 | $(objects): Makefile Makefile.settings config.h |
---|
172 | |
---|
173 | $(OUTFILE): $(objects) $(subdirs) |
---|
174 | @echo '*' Linking $(OUTFILE) |
---|
175 | $(VERBOSE) $(CC) $(objects) $(subdirobjs) -o $(OUTFILE) $(LDFLAGS_BITLBEE) $(LDFLAGS) $(EFLAGS) |
---|
176 | ifneq ($(firstword $(STRIP)), \#) |
---|
177 | @echo '*' Stripping $(OUTFILE) |
---|
178 | $(VERBOSE) -$(STRIP) $(OUTFILE) |
---|
179 | endif |
---|
180 | |
---|
181 | ctags: |
---|
182 | ctags `find . -name "*.c"` `find . -name "*.h"` |
---|
183 | |
---|
184 | # Using this as a bogus Make target to test if a GNU-compatible version of |
---|
185 | # make is available. |
---|
186 | helloworld: |
---|
187 | @echo Hello World |
---|
188 | |
---|
189 | # Check if we can load the helpfile. (This fails if some article is >1KB.) |
---|
190 | # If print returns a NULL pointer, the file is unusable. |
---|
191 | testhelp: doc |
---|
192 | gdb --eval-command='b main' --eval-command='r' \ |
---|
193 | --eval-command='print help_init(&global->helpfile, "doc/user-guide/help.txt")' \ |
---|
194 | $(OUTFILE) < /dev/null |
---|
195 | |
---|
196 | -include .depend/*.d |
---|
197 | # DO NOT DELETE |
---|