[b7d3cc34] | 1 | ########################### |
---|
| 2 | ## Makefile for BitlBee ## |
---|
| 3 | ## ## |
---|
| 4 | ## Copyright 2002 Lintux ## |
---|
| 5 | ########################### |
---|
| 6 | |
---|
| 7 | ### DEFINITIONS |
---|
| 8 | |
---|
| 9 | -include Makefile.settings |
---|
| 10 | |
---|
| 11 | # Program variables |
---|
[858ea01] | 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) |
---|
[a7e6ba9] | 13 | headers = bitlbee.h commands.h conf.h config.h help.h ipc.h irc.h log.h nick.h query.h set.h sock.h storage.h lib/events.h lib/ftutil.h lib/http_client.h lib/ini.h lib/json.h lib/json_util.h lib/md5.h lib/misc.h lib/proxy.h lib/sha1.h lib/ssl_client.h lib/url.h protocols/account.h protocols/bee.h protocols/ft.h protocols/nogaim.h |
---|
[84b045d] | 14 | subdirs = lib protocols |
---|
[b7d3cc34] | 15 | |
---|
[1bf9492] | 16 | ifeq ($(TARGET),i586-mingw32msvc) |
---|
[d1d6776] | 17 | objects += win32.o |
---|
[73c2dce] | 18 | LFLAGS+=-lws2_32 |
---|
| 19 | EFLAGS+=-lsecur32 |
---|
[6a72a57] | 20 | OUTFILE=bitlbee.exe |
---|
[d1d6776] | 21 | else |
---|
[4146a07] | 22 | objects += unix.o conf.o log.o |
---|
[6a72a57] | 23 | OUTFILE=bitlbee |
---|
[d1d6776] | 24 | endif |
---|
| 25 | |
---|
[b7d3cc34] | 26 | # Expansion of variables |
---|
| 27 | subdirobjs = $(foreach dir,$(subdirs),$(dir)/$(dir).o) |
---|
| 28 | |
---|
[4b53c65] | 29 | all: $(OUTFILE) $(OTR_PI) $(SKYPE_PI) doc systemd |
---|
[5155570] | 30 | ifdef SKYPE_PI |
---|
| 31 | $(MAKE) -C protocols/skype doc |
---|
| 32 | endif |
---|
[b7d3cc34] | 33 | |
---|
[4b53c65] | 34 | doc: |
---|
| 35 | $(MAKE) -C doc |
---|
| 36 | |
---|
[cdb92c5] | 37 | uninstall: uninstall-bin uninstall-doc |
---|
[b7d3cc34] | 38 | @echo -e '\nmake uninstall does not remove files in '$(DESTDIR)$(ETCDIR)', you can use make uninstall-etc to do that.\n' |
---|
| 39 | |
---|
[417002e] | 40 | install: install-bin install-doc install-plugins install-systemd |
---|
[b7d3cc34] | 41 | @if ! [ -d $(DESTDIR)$(CONFIG) ]; then echo -e '\nThe configuration directory $(DESTDIR)$(CONFIG) does not exist yet, don'\''t forget to create it!'; fi |
---|
| 42 | @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 |
---|
| 43 | @echo |
---|
| 44 | |
---|
[417002e] | 45 | .PHONY: install install-bin install-etc install-doc install-plugins install-systemd \ |
---|
[b7d3cc34] | 46 | uninstall uninstall-bin uninstall-etc uninstall-doc \ |
---|
[4b53c65] | 47 | all clean distclean tar $(subdirs) doc |
---|
[b7d3cc34] | 48 | |
---|
| 49 | Makefile.settings: |
---|
| 50 | @echo |
---|
| 51 | @echo Run ./configure to create Makefile.settings, then rerun make |
---|
| 52 | @echo |
---|
| 53 | |
---|
| 54 | clean: $(subdirs) |
---|
[c14959d] | 55 | rm -f *.o $(OUTFILE) core utils/bitlbeed init/bitlbee*.service |
---|
[66b9e86e] | 56 | $(MAKE) -C tests clean |
---|
[757e1e0] | 57 | ifdef SKYPE_PI |
---|
| 58 | $(MAKE) -C protocols/skype clean |
---|
| 59 | endif |
---|
[b7d3cc34] | 60 | |
---|
| 61 | distclean: clean $(subdirs) |
---|
[b0a89cc] | 62 | rm -rf .depend |
---|
[b3c467b] | 63 | rm -f Makefile.settings config.h bitlbee.pc |
---|
[34c0e90] | 64 | find . -name 'DEADJOE' -o -name '*.orig' -o -name '*.rej' -o -name '*~' -exec rm -f {} \; |
---|
[b0a89cc] | 65 | @# May still be present in dirs of disabled protocols. |
---|
[b41d5d2] | 66 | -find . -name .depend -exec rm -rf {} \; |
---|
[dcf0f3e] | 67 | $(MAKE) -C tests distclean |
---|
[b7d3cc34] | 68 | |
---|
[66b9e86e] | 69 | check: all |
---|
[c2fa827] | 70 | $(MAKE) -C tests |
---|
| 71 | |
---|
[66b9e86e] | 72 | gcov: check |
---|
| 73 | gcov *.c |
---|
| 74 | |
---|
[348c11b] | 75 | lcov: check |
---|
| 76 | lcov --directory . --capture --output-file bitlbee.info |
---|
| 77 | genhtml -o coverage bitlbee.info |
---|
| 78 | |
---|
[b7d3cc34] | 79 | install-doc: |
---|
| 80 | $(MAKE) -C doc install |
---|
[5155570] | 81 | ifdef SKYPE_PI |
---|
| 82 | $(MAKE) -C protocols/skype install-doc |
---|
| 83 | endif |
---|
[b7d3cc34] | 84 | |
---|
| 85 | uninstall-doc: |
---|
| 86 | $(MAKE) -C doc uninstall |
---|
[5155570] | 87 | ifdef SKYPE_PI |
---|
| 88 | $(MAKE) -C protocols/skype uninstall-doc |
---|
| 89 | endif |
---|
[b7d3cc34] | 90 | |
---|
| 91 | install-bin: |
---|
[57da960] | 92 | mkdir -p $(DESTDIR)$(SBINDIR) |
---|
[ba3506e] | 93 | $(INSTALL) -m 0755 $(OUTFILE) $(DESTDIR)$(SBINDIR)/$(OUTFILE) |
---|
[b7d3cc34] | 94 | |
---|
| 95 | uninstall-bin: |
---|
[57da960] | 96 | rm -f $(DESTDIR)$(SBINDIR)/$(OUTFILE) |
---|
[b7d3cc34] | 97 | |
---|
[cdb92c5] | 98 | install-dev: |
---|
[e506d6c] | 99 | mkdir -p $(DESTDIR)$(INCLUDEDIR) |
---|
[ba3506e] | 100 | $(INSTALL) -m 0644 config.h $(DESTDIR)$(INCLUDEDIR) |
---|
| 101 | for i in $(headers); do $(INSTALL) -m 0644 $(_SRCDIR_)$$i $(DESTDIR)$(INCLUDEDIR); done |
---|
[e506d6c] | 102 | mkdir -p $(DESTDIR)$(PCDIR) |
---|
[ba3506e] | 103 | $(INSTALL) -m 0644 bitlbee.pc $(DESTDIR)$(PCDIR) |
---|
[e506d6c] | 104 | |
---|
[cdb92c5] | 105 | uninstall-dev: |
---|
| 106 | rm -f $(foreach hdr,$(headers),$(DESTDIR)$(INCLUDEDIR)/$(hdr)) |
---|
| 107 | -rmdir $(DESTDIR)$(INCLUDEDIR) |
---|
[e506d6c] | 108 | rm -f $(DESTDIR)$(PCDIR)/bitlbee.pc |
---|
| 109 | |
---|
[b7d3cc34] | 110 | install-etc: |
---|
| 111 | mkdir -p $(DESTDIR)$(ETCDIR) |
---|
[ba3506e] | 112 | $(INSTALL) -m 0644 $(_SRCDIR_)motd.txt $(DESTDIR)$(ETCDIR)/motd.txt |
---|
| 113 | $(INSTALL) -m 0644 $(_SRCDIR_)bitlbee.conf $(DESTDIR)$(ETCDIR)/bitlbee.conf |
---|
[b7d3cc34] | 114 | |
---|
| 115 | uninstall-etc: |
---|
| 116 | rm -f $(DESTDIR)$(ETCDIR)/motd.txt |
---|
| 117 | rm -f $(DESTDIR)$(ETCDIR)/bitlbee.conf |
---|
| 118 | -rmdir $(DESTDIR)$(ETCDIR) |
---|
| 119 | |
---|
[57da960] | 120 | install-plugins: install-plugin-otr install-plugin-skype |
---|
| 121 | |
---|
| 122 | install-plugin-otr: |
---|
[858ea01] | 123 | ifdef OTR_PI |
---|
| 124 | mkdir -p $(DESTDIR)$(PLUGINDIR) |
---|
[ba3506e] | 125 | $(INSTALL) -m 0755 otr.so $(DESTDIR)$(PLUGINDIR) |
---|
[858ea01] | 126 | endif |
---|
[57da960] | 127 | |
---|
| 128 | install-plugin-skype: |
---|
[370899f] | 129 | ifdef SKYPE_PI |
---|
| 130 | mkdir -p $(DESTDIR)$(PLUGINDIR) |
---|
[ba3506e] | 131 | $(INSTALL) -m 0755 skype.so $(DESTDIR)$(PLUGINDIR) |
---|
[57da960] | 132 | mkdir -p $(DESTDIR)$(ETCDIR)/../skyped $(DESTDIR)$(BINDIR) |
---|
[ba3506e] | 133 | $(INSTALL) -m 0644 $(_SRCDIR_)protocols/skype/skyped.cnf $(DESTDIR)$(ETCDIR)/../skyped/skyped.cnf |
---|
| 134 | $(INSTALL) -m 0644 $(_SRCDIR_)protocols/skype/skyped.conf.dist $(DESTDIR)$(ETCDIR)/../skyped/skyped.conf |
---|
| 135 | $(INSTALL) -m 0755 $(_SRCDIR_)protocols/skype/skyped.py $(DESTDIR)$(BINDIR)/skyped |
---|
[cb90dc9] | 136 | $(MAKE) -C protocols/skype install-doc |
---|
[370899f] | 137 | endif |
---|
[858ea01] | 138 | |
---|
[417002e] | 139 | systemd: |
---|
| 140 | ifdef SYSTEMDSYSTEMUNITDIR |
---|
[52bba15] | 141 | sed 's|@sbindir@|$(SBINDIR)|' init/bitlbee.service.in > init/bitlbee.service |
---|
| 142 | sed 's|@sbindir@|$(SBINDIR)|' init/bitlbee@.service.in > init/bitlbee@.service |
---|
[417002e] | 143 | endif |
---|
| 144 | |
---|
| 145 | install-systemd: |
---|
| 146 | ifdef SYSTEMDSYSTEMUNITDIR |
---|
[13688ec] | 147 | ifeq ($(shell id -u),0) |
---|
[417002e] | 148 | mkdir -p $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR) |
---|
[ba3506e] | 149 | $(INSTALL) -m 0644 init/bitlbee.service $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR) |
---|
| 150 | $(INSTALL) -m 0644 init/bitlbee@.service $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR) |
---|
| 151 | $(INSTALL) -m 0644 init/bitlbee.socket $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR) |
---|
[417002e] | 152 | else |
---|
| 153 | @echo Not root, so not installing systemd files. |
---|
| 154 | endif |
---|
| 155 | endif |
---|
| 156 | |
---|
[b7d3cc34] | 157 | tar: |
---|
| 158 | fakeroot debian/rules clean || make distclean |
---|
| 159 | x=$$(basename $$(pwd)); \ |
---|
| 160 | cd ..; \ |
---|
[b0a89cc] | 161 | tar czf $$x.tar.gz --exclude=debian --exclude=.bzr* --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 |
---|
[b2b7f52] | 172 | @$(CC) $(CFLAGS) $(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) |
---|
[7281ad1] | 182 | @$(CC) $(objects) $(subdirobjs) -o $(OUTFILE) $(LDFLAGS_BITLBEE) $(LFLAGS) $(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 |
---|