source: Makefile @ 54b2a36

Last change on this file since 54b2a36 was 54b2a36, checked in by dequis <dx@…>, at 2017-05-13T20:38:35Z

cygwin: Export a "libbitlbee.dll.a" to allow plugins to link to it

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