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