source: Makefile @ 71f87ba

Last change on this file since 71f87ba 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
RevLine 
[b7d3cc34]1###########################
2## Makefile for BitlBee  ##
3##                       ##
4## Copyright 2002 Lintux ##
5###########################
6
7### DEFINITIONS
8
9-include Makefile.settings
10
11# Program variables
[e252d8c]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
[ebe2c5e]13headers = $(wildcard $(_SRCDIR_)*.h $(_SRCDIR_)lib/*.h $(_SRCDIR_)protocols/*.h)
[84b045d]14subdirs = lib protocols
[b7d3cc34]15
[e252d8c]16OUTFILE = bitlbee
[d1d6776]17
[b7d3cc34]18# Expansion of variables
19subdirobjs = $(foreach dir,$(subdirs),$(dir)/$(dir).o)
20
[4b53c65]21all: $(OUTFILE) $(OTR_PI) $(SKYPE_PI) doc systemd
[5155570]22ifdef SKYPE_PI
23        $(MAKE) -C protocols/skype doc
24endif
[b7d3cc34]25
[4b53c65]26doc:
[a85a8ab]27ifdef DOC
[4b53c65]28        $(MAKE) -C doc
[a85a8ab]29endif
[4b53c65]30
[cdb92c5]31uninstall: uninstall-bin uninstall-doc
[b7d3cc34]32        @echo -e '\nmake uninstall does not remove files in '$(DESTDIR)$(ETCDIR)', you can use make uninstall-etc to do that.\n'
33
[c564e25]34install: install-bin install-doc install-plugins
[b7d3cc34]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
[c564e25]37ifdef SYSTEMDSYSTEMUNITDIR
38        @echo If you want to start BitlBee using systemd, try \"make install-systemd\".
39endif
[b7d3cc34]40        @echo
41
[417002e]42.PHONY:   install   install-bin   install-etc   install-doc install-plugins install-systemd \
[b7d3cc34]43        uninstall uninstall-bin uninstall-etc uninstall-doc \
[4b53c65]44        all clean distclean tar $(subdirs) doc
[b7d3cc34]45
46Makefile.settings:
47        @echo
48        @echo Run ./configure to create Makefile.settings, then rerun make
49        @echo
50
51clean: $(subdirs)
[c14959d]52        rm -f *.o $(OUTFILE) core utils/bitlbeed init/bitlbee*.service
[66b9e86e]53        $(MAKE) -C tests clean
[757e1e0]54ifdef SKYPE_PI
55        $(MAKE) -C protocols/skype clean
56endif
[b7d3cc34]57
58distclean: clean $(subdirs)
[b0a89cc]59        rm -rf .depend
[b3c467b]60        rm -f Makefile.settings config.h bitlbee.pc
[34c0e90]61        find . -name 'DEADJOE' -o -name '*.orig' -o -name '*.rej' -o -name '*~' -exec rm -f {} \;
[b0a89cc]62        @# May still be present in dirs of disabled protocols.
[b41d5d2]63        -find . -name .depend -exec rm -rf {} \;
[dcf0f3e]64        $(MAKE) -C tests distclean
[b7d3cc34]65
[66b9e86e]66check: all
[c2fa827]67        $(MAKE) -C tests
68
[66b9e86e]69gcov: check
70        gcov *.c
71
[348c11b]72lcov: check
73        lcov --directory . --capture --output-file bitlbee.info
74        genhtml -o coverage bitlbee.info
75
[b7d3cc34]76install-doc:
[a85a8ab]77ifdef DOC
[b7d3cc34]78        $(MAKE) -C doc install
[a85a8ab]79endif
[5155570]80ifdef SKYPE_PI
81        $(MAKE) -C protocols/skype install-doc
82endif
[b7d3cc34]83
84uninstall-doc:
[a85a8ab]85ifdef DOC
[b7d3cc34]86        $(MAKE) -C doc uninstall
[a85a8ab]87endif
[5155570]88ifdef SKYPE_PI
89        $(MAKE) -C protocols/skype uninstall-doc
90endif
[b7d3cc34]91
92install-bin:
[57da960]93        mkdir -p $(DESTDIR)$(SBINDIR)
[ba3506e]94        $(INSTALL) -m 0755 $(OUTFILE) $(DESTDIR)$(SBINDIR)/$(OUTFILE)
[b7d3cc34]95
96uninstall-bin:
[57da960]97        rm -f $(DESTDIR)$(SBINDIR)/$(OUTFILE)
[b7d3cc34]98
[cdb92c5]99install-dev:
[e506d6c]100        mkdir -p $(DESTDIR)$(INCLUDEDIR)
[ba3506e]101        $(INSTALL) -m 0644 config.h $(DESTDIR)$(INCLUDEDIR)
[ebe2c5e]102        for i in $(headers); do $(INSTALL) -m 0644 $$i $(DESTDIR)$(INCLUDEDIR); done
[e506d6c]103        mkdir -p $(DESTDIR)$(PCDIR)
[ba3506e]104        $(INSTALL) -m 0644 bitlbee.pc $(DESTDIR)$(PCDIR)
[e506d6c]105
[cdb92c5]106uninstall-dev:
107        rm -f $(foreach hdr,$(headers),$(DESTDIR)$(INCLUDEDIR)/$(hdr))
108        -rmdir $(DESTDIR)$(INCLUDEDIR)
[e506d6c]109        rm -f $(DESTDIR)$(PCDIR)/bitlbee.pc
110
[b7d3cc34]111install-etc:
112        mkdir -p $(DESTDIR)$(ETCDIR)
[ba3506e]113        $(INSTALL) -m 0644 $(_SRCDIR_)motd.txt $(DESTDIR)$(ETCDIR)/motd.txt
114        $(INSTALL) -m 0644 $(_SRCDIR_)bitlbee.conf $(DESTDIR)$(ETCDIR)/bitlbee.conf
[b7d3cc34]115
116uninstall-etc:
117        rm -f $(DESTDIR)$(ETCDIR)/motd.txt
118        rm -f $(DESTDIR)$(ETCDIR)/bitlbee.conf
119        -rmdir $(DESTDIR)$(ETCDIR)
120
[57da960]121install-plugins: install-plugin-otr install-plugin-skype
122
123install-plugin-otr:
[858ea01]124ifdef OTR_PI
125        mkdir -p $(DESTDIR)$(PLUGINDIR)
[ba3506e]126        $(INSTALL) -m 0755 otr.so $(DESTDIR)$(PLUGINDIR)
[858ea01]127endif
[57da960]128
129install-plugin-skype:
[370899f]130ifdef SKYPE_PI
131        mkdir -p $(DESTDIR)$(PLUGINDIR)
[ba3506e]132        $(INSTALL) -m 0755 skype.so $(DESTDIR)$(PLUGINDIR)
[57da960]133        mkdir -p $(DESTDIR)$(ETCDIR)/../skyped $(DESTDIR)$(BINDIR)
[ba3506e]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
[cb90dc9]137        $(MAKE) -C protocols/skype install-doc
[370899f]138endif
[858ea01]139
[417002e]140systemd:
141ifdef SYSTEMDSYSTEMUNITDIR
[0edb57f]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
[417002e]145endif
146
[a6c59bb]147install-systemd: systemd
[417002e]148ifdef SYSTEMDSYSTEMUNITDIR
149        mkdir -p $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR)
[ba3506e]150        $(INSTALL) -m 0644 init/bitlbee.service $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR)
151        $(INSTALL) -m 0644 init/bitlbee@.service $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR)
[0edb57f]152        $(INSTALL) -m 0644 $(_SRCDIR_)init/bitlbee.socket $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR)
[417002e]153else
[ebe2c5e]154        @echo SYSTEMDSYSTEMUNITDIR not set, not installing systemd unit files.
[417002e]155endif
156
[b7d3cc34]157tar:
158        fakeroot debian/rules clean || make distclean
159        x=$$(basename $$(pwd)); \
160        cd ..; \
[e26aa72]161        tar czf $$x.tar.gz --exclude-from=.gitignore $$x
[b7d3cc34]162
163$(subdirs):
164        @$(MAKE) -C $@ $(MAKECMDGOALS)
165
[7fa5c19]166$(OTR_PI): %.so: $(_SRCDIR_)%.c
[858ea01]167        @echo '*' Building plugin $@
[9fc017d]168        @$(CC) $(CFLAGS) -fPIC -shared $(LDFLAGS) $< -o $@ $(OTRFLAGS)
[858ea01]169
[7fa5c19]170$(SKYPE_PI): $(_SRCDIR_)protocols/skype/skype.c
[370899f]171        @echo '*' Building plugin skype
[d203495]172        @$(CC) $(CFLAGS) $(LDFLAGS) $(SKYPEFLAGS) $< -o $@
[370899f]173
[7fa5c19]174$(objects): %.o: $(_SRCDIR_)%.c
[b7d3cc34]175        @echo '*' Compiling $<
[7281ad1]176        @$(CC) -c $(CFLAGS) $(CFLAGS_BITLBEE) $< -o $@
[b7d3cc34]177
178$(objects): Makefile Makefile.settings config.h
179
180$(OUTFILE): $(objects) $(subdirs)
181        @echo '*' Linking $(OUTFILE)
[d203495]182        @$(CC) $(objects) $(subdirobjs) -o $(OUTFILE) $(LDFLAGS_BITLBEE) $(LDFLAGS) $(EFLAGS)
[b7d3cc34]183ifndef DEBUG
184        @echo '*' Stripping $(OUTFILE)
185        @-$(STRIP) $(OUTFILE)
186endif
187
188ctags: 
189        ctags `find . -name "*.c"` `find . -name "*.h"`
[4fca1db]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
[b0a89cc]195
[4b53c65]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
[b0a89cc]203-include .depend/*.d
[a0c6fc5]204# DO NOT DELETE
Note: See TracBrowser for help on using the repository browser.