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