source: Makefile @ 0075527

Last change on this file since 0075527 was 0075527, checked in by Nick Murdoch <nick@…>, at 2013-03-17T13:38:14Z

Add existing git project files, and modify bitlbee's build script to build the plugin.

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