[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) |
---|
[3063f81] | 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/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 |
---|
[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: |
---|
| 77 | $(MAKE) -C doc install |
---|
[5155570] | 78 | ifdef SKYPE_PI |
---|
| 79 | $(MAKE) -C protocols/skype install-doc |
---|
| 80 | endif |
---|
[b7d3cc34] | 81 | |
---|
| 82 | uninstall-doc: |
---|
| 83 | $(MAKE) -C doc uninstall |
---|
[5155570] | 84 | ifdef SKYPE_PI |
---|
| 85 | $(MAKE) -C protocols/skype uninstall-doc |
---|
| 86 | endif |
---|
[b7d3cc34] | 87 | |
---|
| 88 | install-bin: |
---|
[57da960] | 89 | mkdir -p $(DESTDIR)$(SBINDIR) |
---|
| 90 | install -m 0755 $(OUTFILE) $(DESTDIR)$(SBINDIR)/$(OUTFILE) |
---|
[b7d3cc34] | 91 | |
---|
| 92 | uninstall-bin: |
---|
[57da960] | 93 | rm -f $(DESTDIR)$(SBINDIR)/$(OUTFILE) |
---|
[b7d3cc34] | 94 | |
---|
[cdb92c5] | 95 | install-dev: |
---|
[e506d6c] | 96 | mkdir -p $(DESTDIR)$(INCLUDEDIR) |
---|
[4af3050] | 97 | install -m 0644 config.h $(DESTDIR)$(INCLUDEDIR) |
---|
[7fa5c19] | 98 | for i in $(headers); do install -m 0644 $(_SRCDIR_)$$i $(DESTDIR)$(INCLUDEDIR); done |
---|
[e506d6c] | 99 | mkdir -p $(DESTDIR)$(PCDIR) |
---|
| 100 | install -m 0644 bitlbee.pc $(DESTDIR)$(PCDIR) |
---|
| 101 | |
---|
[cdb92c5] | 102 | uninstall-dev: |
---|
| 103 | rm -f $(foreach hdr,$(headers),$(DESTDIR)$(INCLUDEDIR)/$(hdr)) |
---|
| 104 | -rmdir $(DESTDIR)$(INCLUDEDIR) |
---|
[e506d6c] | 105 | rm -f $(DESTDIR)$(PCDIR)/bitlbee.pc |
---|
| 106 | |
---|
[b7d3cc34] | 107 | install-etc: |
---|
| 108 | mkdir -p $(DESTDIR)$(ETCDIR) |
---|
[7fa5c19] | 109 | install -m 0644 $(_SRCDIR_)motd.txt $(DESTDIR)$(ETCDIR)/motd.txt |
---|
| 110 | install -m 0644 $(_SRCDIR_)bitlbee.conf $(DESTDIR)$(ETCDIR)/bitlbee.conf |
---|
[b7d3cc34] | 111 | |
---|
| 112 | uninstall-etc: |
---|
| 113 | rm -f $(DESTDIR)$(ETCDIR)/motd.txt |
---|
| 114 | rm -f $(DESTDIR)$(ETCDIR)/bitlbee.conf |
---|
| 115 | -rmdir $(DESTDIR)$(ETCDIR) |
---|
| 116 | |
---|
[57da960] | 117 | install-plugins: install-plugin-otr install-plugin-skype |
---|
| 118 | |
---|
| 119 | install-plugin-otr: |
---|
[858ea01] | 120 | ifdef OTR_PI |
---|
| 121 | mkdir -p $(DESTDIR)$(PLUGINDIR) |
---|
| 122 | install -m 0755 otr.so $(DESTDIR)$(PLUGINDIR) |
---|
| 123 | endif |
---|
[57da960] | 124 | |
---|
| 125 | install-plugin-skype: |
---|
[370899f] | 126 | ifdef SKYPE_PI |
---|
| 127 | mkdir -p $(DESTDIR)$(PLUGINDIR) |
---|
| 128 | install -m 0755 skype.so $(DESTDIR)$(PLUGINDIR) |
---|
[57da960] | 129 | mkdir -p $(DESTDIR)$(ETCDIR)/../skyped $(DESTDIR)$(BINDIR) |
---|
[7fa5c19] | 130 | install -m 0644 $(_SRCDIR_)protocols/skype/skyped.cnf $(DESTDIR)$(ETCDIR)/../skyped/skyped.cnf |
---|
| 131 | install -m 0644 $(_SRCDIR_)protocols/skype/skyped.conf.dist $(DESTDIR)$(ETCDIR)/../skyped/skyped.conf |
---|
| 132 | install -m 0755 $(_SRCDIR_)protocols/skype/skyped.py $(DESTDIR)$(BINDIR)/skyped |
---|
[57da960] | 133 | make -C protocols/skype install-doc |
---|
[370899f] | 134 | endif |
---|
[858ea01] | 135 | |
---|
[417002e] | 136 | systemd: |
---|
| 137 | ifdef SYSTEMDSYSTEMUNITDIR |
---|
[52bba15] | 138 | sed 's|@sbindir@|$(SBINDIR)|' init/bitlbee.service.in > init/bitlbee.service |
---|
| 139 | sed 's|@sbindir@|$(SBINDIR)|' init/bitlbee@.service.in > init/bitlbee@.service |
---|
[417002e] | 140 | endif |
---|
| 141 | |
---|
| 142 | install-systemd: |
---|
| 143 | ifdef SYSTEMDSYSTEMUNITDIR |
---|
[13688ec] | 144 | ifeq ($(shell id -u),0) |
---|
[417002e] | 145 | mkdir -p $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR) |
---|
| 146 | install -m 0644 init/bitlbee.service $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR) |
---|
| 147 | install -m 0644 init/bitlbee@.service $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR) |
---|
| 148 | install -m 0644 init/bitlbee.socket $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR) |
---|
| 149 | else |
---|
| 150 | @echo Not root, so not installing systemd files. |
---|
| 151 | endif |
---|
| 152 | endif |
---|
| 153 | |
---|
[b7d3cc34] | 154 | tar: |
---|
| 155 | fakeroot debian/rules clean || make distclean |
---|
| 156 | x=$$(basename $$(pwd)); \ |
---|
| 157 | cd ..; \ |
---|
[b0a89cc] | 158 | tar czf $$x.tar.gz --exclude=debian --exclude=.bzr* --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 |
---|
| 169 | @$(CC) $(CFLAGS) -fPIC -shared $< -o $@ |
---|
| 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) |
---|
[7281ad1] | 179 | @$(CC) $(objects) $(subdirobjs) -o $(OUTFILE) $(LDFLAGS_BITLBEE) $(LFLAGS) $(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 |
---|