[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 | |
---|
[370899f] | 29 | all: $(OUTFILE) $(OTR_PI) $(SKYPE_PI) systemd |
---|
[513a323] | 30 | $(MAKE) -C doc |
---|
[5155570] | 31 | ifdef SKYPE_PI |
---|
| 32 | $(MAKE) -C protocols/skype doc |
---|
| 33 | endif |
---|
[b7d3cc34] | 34 | |
---|
[cdb92c5] | 35 | uninstall: uninstall-bin uninstall-doc |
---|
[b7d3cc34] | 36 | @echo -e '\nmake uninstall does not remove files in '$(DESTDIR)$(ETCDIR)', you can use make uninstall-etc to do that.\n' |
---|
| 37 | |
---|
[417002e] | 38 | install: install-bin install-doc install-plugins install-systemd |
---|
[b7d3cc34] | 39 | @if ! [ -d $(DESTDIR)$(CONFIG) ]; then echo -e '\nThe configuration directory $(DESTDIR)$(CONFIG) does not exist yet, don'\''t forget to create it!'; fi |
---|
| 40 | @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 |
---|
| 41 | @echo |
---|
| 42 | |
---|
[417002e] | 43 | .PHONY: install install-bin install-etc install-doc install-plugins install-systemd \ |
---|
[b7d3cc34] | 44 | uninstall uninstall-bin uninstall-etc uninstall-doc \ |
---|
| 45 | all clean distclean tar $(subdirs) |
---|
| 46 | |
---|
| 47 | Makefile.settings: |
---|
| 48 | @echo |
---|
| 49 | @echo Run ./configure to create Makefile.settings, then rerun make |
---|
| 50 | @echo |
---|
| 51 | |
---|
| 52 | clean: $(subdirs) |
---|
[c14959d] | 53 | rm -f *.o $(OUTFILE) core utils/bitlbeed init/bitlbee*.service |
---|
[66b9e86e] | 54 | $(MAKE) -C tests clean |
---|
[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) |
---|
| 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: |
---|
[e506d6c] | 94 | mkdir -p $(DESTDIR)$(INCLUDEDIR) |
---|
[4af3050] | 95 | install -m 0644 config.h $(DESTDIR)$(INCLUDEDIR) |
---|
| 96 | for i in $(headers); do install -m 0644 $(SRCDIR)$$i $(DESTDIR)$(INCLUDEDIR); done |
---|
[e506d6c] | 97 | mkdir -p $(DESTDIR)$(PCDIR) |
---|
| 98 | install -m 0644 bitlbee.pc $(DESTDIR)$(PCDIR) |
---|
| 99 | |
---|
[cdb92c5] | 100 | uninstall-dev: |
---|
| 101 | rm -f $(foreach hdr,$(headers),$(DESTDIR)$(INCLUDEDIR)/$(hdr)) |
---|
| 102 | -rmdir $(DESTDIR)$(INCLUDEDIR) |
---|
[e506d6c] | 103 | rm -f $(DESTDIR)$(PCDIR)/bitlbee.pc |
---|
| 104 | |
---|
[b7d3cc34] | 105 | install-etc: |
---|
| 106 | mkdir -p $(DESTDIR)$(ETCDIR) |
---|
[4af3050] | 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) |
---|
| 120 | install -m 0755 otr.so $(DESTDIR)$(PLUGINDIR) |
---|
| 121 | endif |
---|
[57da960] | 122 | |
---|
| 123 | install-plugin-skype: |
---|
[370899f] | 124 | ifdef SKYPE_PI |
---|
| 125 | mkdir -p $(DESTDIR)$(PLUGINDIR) |
---|
| 126 | install -m 0755 skype.so $(DESTDIR)$(PLUGINDIR) |
---|
[57da960] | 127 | mkdir -p $(DESTDIR)$(ETCDIR)/../skyped $(DESTDIR)$(BINDIR) |
---|
[b5a5938] | 128 | install -m 0644 $(SRCDIR)protocols/skype/skyped.cnf $(DESTDIR)$(ETCDIR)/../skyped/skyped.cnf |
---|
[e4fc493] | 129 | install -m 0644 $(SRCDIR)protocols/skype/skyped.conf.dist $(DESTDIR)$(ETCDIR)/../skyped/skyped.conf |
---|
[b5a5938] | 130 | install -m 0755 $(SRCDIR)protocols/skype/skyped.py $(DESTDIR)$(BINDIR)/skyped |
---|
[57da960] | 131 | make -C protocols/skype install-doc |
---|
[370899f] | 132 | endif |
---|
[858ea01] | 133 | |
---|
[417002e] | 134 | systemd: |
---|
| 135 | ifdef SYSTEMDSYSTEMUNITDIR |
---|
| 136 | sed 's|@sbindir@|$(BINDIR)|' init/bitlbee.service.in > init/bitlbee.service |
---|
| 137 | sed 's|@sbindir@|$(BINDIR)|' init/bitlbee@.service.in > init/bitlbee@.service |
---|
| 138 | endif |
---|
| 139 | |
---|
| 140 | install-systemd: |
---|
| 141 | ifdef SYSTEMDSYSTEMUNITDIR |
---|
[13688ec] | 142 | ifeq ($(shell id -u),0) |
---|
[417002e] | 143 | mkdir -p $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR) |
---|
| 144 | install -m 0644 init/bitlbee.service $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR) |
---|
| 145 | install -m 0644 init/bitlbee@.service $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR) |
---|
| 146 | install -m 0644 init/bitlbee.socket $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR) |
---|
| 147 | else |
---|
| 148 | @echo Not root, so not installing systemd files. |
---|
| 149 | endif |
---|
| 150 | endif |
---|
| 151 | |
---|
[b7d3cc34] | 152 | tar: |
---|
| 153 | fakeroot debian/rules clean || make distclean |
---|
| 154 | x=$$(basename $$(pwd)); \ |
---|
| 155 | cd ..; \ |
---|
[b0a89cc] | 156 | tar czf $$x.tar.gz --exclude=debian --exclude=.bzr* --exclude=.depend $$x |
---|
[b7d3cc34] | 157 | |
---|
| 158 | $(subdirs): |
---|
| 159 | @$(MAKE) -C $@ $(MAKECMDGOALS) |
---|
| 160 | |
---|
[858ea01] | 161 | $(OTR_PI): %.so: $(SRCDIR)%.c |
---|
| 162 | @echo '*' Building plugin $@ |
---|
[9fc017d] | 163 | @$(CC) $(CFLAGS) -fPIC -shared $(LDFLAGS) $< -o $@ $(OTRFLAGS) |
---|
[858ea01] | 164 | |
---|
[370899f] | 165 | $(SKYPE_PI): $(SRCDIR)protocols/skype/skype.c |
---|
| 166 | @echo '*' Building plugin skype |
---|
| 167 | @$(CC) $(CFLAGS) -fPIC -shared $< -o $@ |
---|
| 168 | |
---|
[f60079b] | 169 | $(objects): %.o: $(SRCDIR)%.c |
---|
[b7d3cc34] | 170 | @echo '*' Compiling $< |
---|
| 171 | @$(CC) -c $(CFLAGS) $< -o $@ |
---|
| 172 | |
---|
| 173 | $(objects): Makefile Makefile.settings config.h |
---|
| 174 | |
---|
| 175 | $(OUTFILE): $(objects) $(subdirs) |
---|
| 176 | @echo '*' Linking $(OUTFILE) |
---|
| 177 | @$(CC) $(objects) $(subdirobjs) -o $(OUTFILE) $(LFLAGS) $(EFLAGS) |
---|
| 178 | ifndef DEBUG |
---|
| 179 | @echo '*' Stripping $(OUTFILE) |
---|
| 180 | @-$(STRIP) $(OUTFILE) |
---|
| 181 | endif |
---|
| 182 | |
---|
| 183 | ctags: |
---|
| 184 | ctags `find . -name "*.c"` `find . -name "*.h"` |
---|
[4fca1db] | 185 | |
---|
| 186 | # Using this as a bogus Make target to test if a GNU-compatible version of |
---|
| 187 | # make is available. |
---|
| 188 | helloworld: |
---|
| 189 | @echo Hello World |
---|
[b0a89cc] | 190 | |
---|
| 191 | -include .depend/*.d |
---|
[a0c6fc5] | 192 | # DO NOT DELETE |
---|