source: Makefile @ e88fe7da

Last change on this file since e88fe7da was d304445, checked in by dequis <dx@…>, at 2015-05-28T18:14:09Z

Makefile: don't call 'doc' target of skype...

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