source: Makefile @ 49108f3

Last change on this file since 49108f3 was e199620, checked in by dequis <dx@…>, at 2017-05-18T16:12:34Z

cygwin: add a missing mkdir of libdir to the makefile

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