source: Makefile @ 830864d

Last change on this file since 830864d was a85a8ab, checked in by dequis <dx@…>, at 2015-02-23T04:50:32Z

Add --doc= configure option to disable helpfile generation

It will get disabled automatically if the deps (xmlto and xsltproc)
are missing

Also added checks for asciidoc (a2x) for the skype plugin, which needs
it for the skyped man page, and will also get that disabled if --doc=0
is passed or if asciidoc isn't installed.

This should keep those ugly deps under control for now.

I'd like to replace them at some point with something less dumb.

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