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