[b7d3cc34] | 1 | ########################### |
---|
| 2 | ## Makefile for BitlBee ## |
---|
| 3 | ## ## |
---|
| 4 | ## Copyright 2002 Lintux ## |
---|
| 5 | ########################### |
---|
| 6 | |
---|
| 7 | ### DEFINITIONS |
---|
| 8 | |
---|
| 9 | -include Makefile.settings |
---|
| 10 | |
---|
| 11 | # Program variables |
---|
[e252d8c] | 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 |
---|
[ebe2c5e] | 13 | headers = $(wildcard $(_SRCDIR_)*.h $(_SRCDIR_)lib/*.h $(_SRCDIR_)protocols/*.h) |
---|
[84b045d] | 14 | subdirs = lib protocols |
---|
[b7d3cc34] | 15 | |
---|
[e252d8c] | 16 | OUTFILE = bitlbee |
---|
[d1d6776] | 17 | |
---|
[b7d3cc34] | 18 | # Expansion of variables |
---|
| 19 | subdirobjs = $(foreach dir,$(subdirs),$(dir)/$(dir).o) |
---|
| 20 | |
---|
[4b53c65] | 21 | all: $(OUTFILE) $(OTR_PI) $(SKYPE_PI) doc systemd |
---|
[5155570] | 22 | ifdef SKYPE_PI |
---|
| 23 | $(MAKE) -C protocols/skype doc |
---|
| 24 | endif |
---|
[b7d3cc34] | 25 | |
---|
[4b53c65] | 26 | doc: |
---|
[a85a8ab] | 27 | ifdef DOC |
---|
[4b53c65] | 28 | $(MAKE) -C doc |
---|
[a85a8ab] | 29 | endif |
---|
[4b53c65] | 30 | |
---|
[cdb92c5] | 31 | uninstall: uninstall-bin uninstall-doc |
---|
[b7d3cc34] | 32 | @echo -e '\nmake uninstall does not remove files in '$(DESTDIR)$(ETCDIR)', you can use make uninstall-etc to do that.\n' |
---|
| 33 | |
---|
[c564e25] | 34 | install: install-bin install-doc install-plugins |
---|
[b7d3cc34] | 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 |
---|
[c564e25] | 37 | ifdef SYSTEMDSYSTEMUNITDIR |
---|
| 38 | @echo If you want to start BitlBee using systemd, try \"make install-systemd\". |
---|
| 39 | endif |
---|
[b7d3cc34] | 40 | @echo |
---|
| 41 | |
---|
[417002e] | 42 | .PHONY: install install-bin install-etc install-doc install-plugins install-systemd \ |
---|
[b7d3cc34] | 43 | uninstall uninstall-bin uninstall-etc uninstall-doc \ |
---|
[4b53c65] | 44 | all clean distclean tar $(subdirs) doc |
---|
[b7d3cc34] | 45 | |
---|
| 46 | Makefile.settings: |
---|
| 47 | @echo |
---|
| 48 | @echo Run ./configure to create Makefile.settings, then rerun make |
---|
| 49 | @echo |
---|
| 50 | |
---|
| 51 | clean: $(subdirs) |
---|
[c14959d] | 52 | rm -f *.o $(OUTFILE) core utils/bitlbeed init/bitlbee*.service |
---|
[66b9e86e] | 53 | $(MAKE) -C tests clean |
---|
[757e1e0] | 54 | ifdef SKYPE_PI |
---|
| 55 | $(MAKE) -C protocols/skype clean |
---|
| 56 | endif |
---|
[b7d3cc34] | 57 | |
---|
| 58 | distclean: clean $(subdirs) |
---|
[b0a89cc] | 59 | rm -rf .depend |
---|
[b3c467b] | 60 | rm -f Makefile.settings config.h bitlbee.pc |
---|
[34c0e90] | 61 | find . -name 'DEADJOE' -o -name '*.orig' -o -name '*.rej' -o -name '*~' -exec rm -f {} \; |
---|
[b0a89cc] | 62 | @# May still be present in dirs of disabled protocols. |
---|
[b41d5d2] | 63 | -find . -name .depend -exec rm -rf {} \; |
---|
[dcf0f3e] | 64 | $(MAKE) -C tests distclean |
---|
[b7d3cc34] | 65 | |
---|
[66b9e86e] | 66 | check: all |
---|
[c2fa827] | 67 | $(MAKE) -C tests |
---|
| 68 | |
---|
[66b9e86e] | 69 | gcov: check |
---|
| 70 | gcov *.c |
---|
| 71 | |
---|
[348c11b] | 72 | lcov: check |
---|
| 73 | lcov --directory . --capture --output-file bitlbee.info |
---|
| 74 | genhtml -o coverage bitlbee.info |
---|
| 75 | |
---|
[b7d3cc34] | 76 | install-doc: |
---|
[a85a8ab] | 77 | ifdef DOC |
---|
[b7d3cc34] | 78 | $(MAKE) -C doc install |
---|
[a85a8ab] | 79 | endif |
---|
[5155570] | 80 | ifdef SKYPE_PI |
---|
| 81 | $(MAKE) -C protocols/skype install-doc |
---|
| 82 | endif |
---|
[b7d3cc34] | 83 | |
---|
| 84 | uninstall-doc: |
---|
[a85a8ab] | 85 | ifdef DOC |
---|
[b7d3cc34] | 86 | $(MAKE) -C doc uninstall |
---|
[a85a8ab] | 87 | endif |
---|
[5155570] | 88 | ifdef SKYPE_PI |
---|
| 89 | $(MAKE) -C protocols/skype uninstall-doc |
---|
| 90 | endif |
---|
[b7d3cc34] | 91 | |
---|
| 92 | install-bin: |
---|
[57da960] | 93 | mkdir -p $(DESTDIR)$(SBINDIR) |
---|
[ba3506e] | 94 | $(INSTALL) -m 0755 $(OUTFILE) $(DESTDIR)$(SBINDIR)/$(OUTFILE) |
---|
[b7d3cc34] | 95 | |
---|
| 96 | uninstall-bin: |
---|
[57da960] | 97 | rm -f $(DESTDIR)$(SBINDIR)/$(OUTFILE) |
---|
[b7d3cc34] | 98 | |
---|
[cdb92c5] | 99 | install-dev: |
---|
[e506d6c] | 100 | mkdir -p $(DESTDIR)$(INCLUDEDIR) |
---|
[ba3506e] | 101 | $(INSTALL) -m 0644 config.h $(DESTDIR)$(INCLUDEDIR) |
---|
[ebe2c5e] | 102 | for i in $(headers); do $(INSTALL) -m 0644 $$i $(DESTDIR)$(INCLUDEDIR); done |
---|
[e506d6c] | 103 | mkdir -p $(DESTDIR)$(PCDIR) |
---|
[ba3506e] | 104 | $(INSTALL) -m 0644 bitlbee.pc $(DESTDIR)$(PCDIR) |
---|
[e506d6c] | 105 | |
---|
[cdb92c5] | 106 | uninstall-dev: |
---|
| 107 | rm -f $(foreach hdr,$(headers),$(DESTDIR)$(INCLUDEDIR)/$(hdr)) |
---|
| 108 | -rmdir $(DESTDIR)$(INCLUDEDIR) |
---|
[e506d6c] | 109 | rm -f $(DESTDIR)$(PCDIR)/bitlbee.pc |
---|
| 110 | |
---|
[b7d3cc34] | 111 | install-etc: |
---|
| 112 | mkdir -p $(DESTDIR)$(ETCDIR) |
---|
[ba3506e] | 113 | $(INSTALL) -m 0644 $(_SRCDIR_)motd.txt $(DESTDIR)$(ETCDIR)/motd.txt |
---|
| 114 | $(INSTALL) -m 0644 $(_SRCDIR_)bitlbee.conf $(DESTDIR)$(ETCDIR)/bitlbee.conf |
---|
[b7d3cc34] | 115 | |
---|
| 116 | uninstall-etc: |
---|
| 117 | rm -f $(DESTDIR)$(ETCDIR)/motd.txt |
---|
| 118 | rm -f $(DESTDIR)$(ETCDIR)/bitlbee.conf |
---|
| 119 | -rmdir $(DESTDIR)$(ETCDIR) |
---|
| 120 | |
---|
[57da960] | 121 | install-plugins: install-plugin-otr install-plugin-skype |
---|
| 122 | |
---|
| 123 | install-plugin-otr: |
---|
[858ea01] | 124 | ifdef OTR_PI |
---|
| 125 | mkdir -p $(DESTDIR)$(PLUGINDIR) |
---|
[ba3506e] | 126 | $(INSTALL) -m 0755 otr.so $(DESTDIR)$(PLUGINDIR) |
---|
[858ea01] | 127 | endif |
---|
[57da960] | 128 | |
---|
| 129 | install-plugin-skype: |
---|
[370899f] | 130 | ifdef SKYPE_PI |
---|
| 131 | mkdir -p $(DESTDIR)$(PLUGINDIR) |
---|
[ba3506e] | 132 | $(INSTALL) -m 0755 skype.so $(DESTDIR)$(PLUGINDIR) |
---|
[57da960] | 133 | mkdir -p $(DESTDIR)$(ETCDIR)/../skyped $(DESTDIR)$(BINDIR) |
---|
[ba3506e] | 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 |
---|
[cb90dc9] | 137 | $(MAKE) -C protocols/skype install-doc |
---|
[370899f] | 138 | endif |
---|
[858ea01] | 139 | |
---|
[417002e] | 140 | systemd: |
---|
| 141 | ifdef SYSTEMDSYSTEMUNITDIR |
---|
[0edb57f] | 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 |
---|
[417002e] | 145 | endif |
---|
| 146 | |
---|
[a6c59bb] | 147 | install-systemd: systemd |
---|
[417002e] | 148 | ifdef SYSTEMDSYSTEMUNITDIR |
---|
| 149 | mkdir -p $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR) |
---|
[ba3506e] | 150 | $(INSTALL) -m 0644 init/bitlbee.service $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR) |
---|
| 151 | $(INSTALL) -m 0644 init/bitlbee@.service $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR) |
---|
[0edb57f] | 152 | $(INSTALL) -m 0644 $(_SRCDIR_)init/bitlbee.socket $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR) |
---|
[417002e] | 153 | else |
---|
[ebe2c5e] | 154 | @echo SYSTEMDSYSTEMUNITDIR not set, not installing systemd unit files. |
---|
[417002e] | 155 | endif |
---|
| 156 | |
---|
[b7d3cc34] | 157 | tar: |
---|
| 158 | fakeroot debian/rules clean || make distclean |
---|
| 159 | x=$$(basename $$(pwd)); \ |
---|
| 160 | cd ..; \ |
---|
[61d21e5b] | 161 | tar czf $$x.tar.gz --exclude=debian --exclude=.git* --exclude=.depend $$x |
---|
[b7d3cc34] | 162 | |
---|
| 163 | $(subdirs): |
---|
| 164 | @$(MAKE) -C $@ $(MAKECMDGOALS) |
---|
| 165 | |
---|
[7fa5c19] | 166 | $(OTR_PI): %.so: $(_SRCDIR_)%.c |
---|
[858ea01] | 167 | @echo '*' Building plugin $@ |
---|
[9fc017d] | 168 | @$(CC) $(CFLAGS) -fPIC -shared $(LDFLAGS) $< -o $@ $(OTRFLAGS) |
---|
[858ea01] | 169 | |
---|
[7fa5c19] | 170 | $(SKYPE_PI): $(_SRCDIR_)protocols/skype/skype.c |
---|
[370899f] | 171 | @echo '*' Building plugin skype |
---|
[d203495] | 172 | @$(CC) $(CFLAGS) $(LDFLAGS) $(SKYPEFLAGS) $< -o $@ |
---|
[370899f] | 173 | |
---|
[7fa5c19] | 174 | $(objects): %.o: $(_SRCDIR_)%.c |
---|
[b7d3cc34] | 175 | @echo '*' Compiling $< |
---|
[7281ad1] | 176 | @$(CC) -c $(CFLAGS) $(CFLAGS_BITLBEE) $< -o $@ |
---|
[b7d3cc34] | 177 | |
---|
| 178 | $(objects): Makefile Makefile.settings config.h |
---|
| 179 | |
---|
| 180 | $(OUTFILE): $(objects) $(subdirs) |
---|
| 181 | @echo '*' Linking $(OUTFILE) |
---|
[d203495] | 182 | @$(CC) $(objects) $(subdirobjs) -o $(OUTFILE) $(LDFLAGS_BITLBEE) $(LDFLAGS) $(EFLAGS) |
---|
[b7d3cc34] | 183 | ifndef DEBUG |
---|
| 184 | @echo '*' Stripping $(OUTFILE) |
---|
| 185 | @-$(STRIP) $(OUTFILE) |
---|
| 186 | endif |
---|
| 187 | |
---|
| 188 | ctags: |
---|
| 189 | ctags `find . -name "*.c"` `find . -name "*.h"` |
---|
[4fca1db] | 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 |
---|
[b0a89cc] | 195 | |
---|
[4b53c65] | 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 | |
---|
[b0a89cc] | 203 | -include .depend/*.d |
---|
[a0c6fc5] | 204 | # DO NOT DELETE |
---|