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