source: Makefile @ 48b75f1

Last change on this file since 48b75f1 was a7e6ba9, checked in by Wilmer van der Gaast <wilmer@…>, at 2013-05-19T07:33:54Z

Install JSON header files.

  • Property mode set to 100644
File size: 6.2 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/json.h lib/json_util.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) 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
60
61distclean: clean $(subdirs)
62        rm -rf .depend
63        rm -f Makefile.settings config.h bitlbee.pc
64        find . -name 'DEADJOE' -o -name '*.orig' -o -name '*.rej' -o -name '*~' -exec rm -f {} \;
65        @# May still be present in dirs of disabled protocols.
66        -find . -name .depend -exec rm -rf {} \;
67        $(MAKE) -C tests distclean
68
69check: all
70        $(MAKE) -C tests
71
72gcov: check
73        gcov *.c
74
75lcov: check
76        lcov --directory . --capture --output-file bitlbee.info
77        genhtml -o coverage bitlbee.info
78
79install-doc:
80        $(MAKE) -C doc install
81ifdef SKYPE_PI
82        $(MAKE) -C protocols/skype install-doc
83endif
84
85uninstall-doc:
86        $(MAKE) -C doc uninstall
87ifdef SKYPE_PI
88        $(MAKE) -C protocols/skype uninstall-doc
89endif
90
91install-bin:
92        mkdir -p $(DESTDIR)$(SBINDIR)
93        install -m 0755 $(OUTFILE) $(DESTDIR)$(SBINDIR)/$(OUTFILE)
94
95uninstall-bin:
96        rm -f $(DESTDIR)$(SBINDIR)/$(OUTFILE)
97
98install-dev:
99        mkdir -p $(DESTDIR)$(INCLUDEDIR)
100        install -m 0644 config.h $(DESTDIR)$(INCLUDEDIR)
101        for i in $(headers); do install -m 0644 $(_SRCDIR_)$$i $(DESTDIR)$(INCLUDEDIR); done
102        mkdir -p $(DESTDIR)$(PCDIR)
103        install -m 0644 bitlbee.pc $(DESTDIR)$(PCDIR)
104
105uninstall-dev:
106        rm -f $(foreach hdr,$(headers),$(DESTDIR)$(INCLUDEDIR)/$(hdr))
107        -rmdir $(DESTDIR)$(INCLUDEDIR)
108        rm -f $(DESTDIR)$(PCDIR)/bitlbee.pc
109
110install-etc:
111        mkdir -p $(DESTDIR)$(ETCDIR)
112        install -m 0644 $(_SRCDIR_)motd.txt $(DESTDIR)$(ETCDIR)/motd.txt
113        install -m 0644 $(_SRCDIR_)bitlbee.conf $(DESTDIR)$(ETCDIR)/bitlbee.conf
114
115uninstall-etc:
116        rm -f $(DESTDIR)$(ETCDIR)/motd.txt
117        rm -f $(DESTDIR)$(ETCDIR)/bitlbee.conf
118        -rmdir $(DESTDIR)$(ETCDIR)
119
120install-plugins: install-plugin-otr install-plugin-skype
121
122install-plugin-otr:
123ifdef OTR_PI
124        mkdir -p $(DESTDIR)$(PLUGINDIR)
125        install -m 0755 otr.so $(DESTDIR)$(PLUGINDIR)
126endif
127
128install-plugin-skype:
129ifdef SKYPE_PI
130        mkdir -p $(DESTDIR)$(PLUGINDIR)
131        install -m 0755 skype.so $(DESTDIR)$(PLUGINDIR)
132        mkdir -p $(DESTDIR)$(ETCDIR)/../skyped $(DESTDIR)$(BINDIR)
133        install -m 0644 $(_SRCDIR_)protocols/skype/skyped.cnf $(DESTDIR)$(ETCDIR)/../skyped/skyped.cnf
134        install -m 0644 $(_SRCDIR_)protocols/skype/skyped.conf.dist $(DESTDIR)$(ETCDIR)/../skyped/skyped.conf
135        install -m 0755 $(_SRCDIR_)protocols/skype/skyped.py $(DESTDIR)$(BINDIR)/skyped
136        make -C protocols/skype install-doc
137endif
138
139systemd:
140ifdef SYSTEMDSYSTEMUNITDIR
141        sed 's|@sbindir@|$(SBINDIR)|' init/bitlbee.service.in > init/bitlbee.service
142        sed 's|@sbindir@|$(SBINDIR)|' init/bitlbee@.service.in > init/bitlbee@.service
143endif
144
145install-systemd:
146ifdef SYSTEMDSYSTEMUNITDIR
147ifeq ($(shell id -u),0)
148        mkdir -p $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR)
149        install -m 0644 init/bitlbee.service $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR)
150        install -m 0644 init/bitlbee@.service $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR)
151        install -m 0644 init/bitlbee.socket $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR)
152else
153        @echo Not root, so not installing systemd files.
154endif
155endif
156
157tar:
158        fakeroot debian/rules clean || make distclean
159        x=$$(basename $$(pwd)); \
160        cd ..; \
161        tar czf $$x.tar.gz --exclude=debian --exclude=.bzr* --exclude=.depend $$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) $(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) $(LFLAGS) $(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.