1 | ########################### |
---|
2 | ## Makefile for BitlBee ## |
---|
3 | ## ## |
---|
4 | ## Copyright 2002 Lintux ## |
---|
5 | ########################### |
---|
6 | |
---|
7 | ### DEFINITIONS |
---|
8 | |
---|
9 | -include Makefile.settings |
---|
10 | |
---|
11 | # Program variables |
---|
12 | objects = 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) |
---|
13 | headers = 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/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 |
---|
14 | subdirs = lib protocols |
---|
15 | |
---|
16 | ifeq ($(TARGET),i586-mingw32msvc) |
---|
17 | objects += win32.o |
---|
18 | LFLAGS+=-lws2_32 |
---|
19 | EFLAGS+=-lsecur32 |
---|
20 | OUTFILE=bitlbee.exe |
---|
21 | else |
---|
22 | objects += unix.o conf.o log.o |
---|
23 | OUTFILE=bitlbee |
---|
24 | endif |
---|
25 | |
---|
26 | # Expansion of variables |
---|
27 | subdirobjs = $(foreach dir,$(subdirs),$(dir)/$(dir).o) |
---|
28 | |
---|
29 | all: $(OUTFILE) $(OTR_PI) $(SKYPE_PI) systemd |
---|
30 | $(MAKE) -C doc |
---|
31 | ifdef SKYPE_PI |
---|
32 | $(MAKE) -C protocols/skype doc |
---|
33 | endif |
---|
34 | |
---|
35 | uninstall: uninstall-bin uninstall-doc |
---|
36 | @echo -e '\nmake uninstall does not remove files in '$(DESTDIR)$(ETCDIR)', you can use make uninstall-etc to do that.\n' |
---|
37 | |
---|
38 | install: install-bin install-doc install-plugins install-systemd |
---|
39 | @if ! [ -d $(DESTDIR)$(CONFIG) ]; then echo -e '\nThe configuration directory $(DESTDIR)$(CONFIG) does not exist yet, don'\''t forget to create it!'; fi |
---|
40 | @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 |
---|
41 | @echo |
---|
42 | |
---|
43 | .PHONY: install install-bin install-etc install-doc install-plugins install-systemd \ |
---|
44 | uninstall uninstall-bin uninstall-etc uninstall-doc \ |
---|
45 | all clean distclean tar $(subdirs) |
---|
46 | |
---|
47 | Makefile.settings: |
---|
48 | @echo |
---|
49 | @echo Run ./configure to create Makefile.settings, then rerun make |
---|
50 | @echo |
---|
51 | |
---|
52 | clean: $(subdirs) |
---|
53 | rm -f *.o $(OUTFILE) core utils/bitlbeed init/bitlbee*.service |
---|
54 | $(MAKE) -C tests clean |
---|
55 | |
---|
56 | distclean: clean $(subdirs) |
---|
57 | rm -rf .depend |
---|
58 | rm -f Makefile.settings config.h bitlbee.pc |
---|
59 | find . -name 'DEADJOE' -o -name '*.orig' -o -name '*.rej' -o -name '*~' -exec rm -f {} \; |
---|
60 | @# May still be present in dirs of disabled protocols. |
---|
61 | -find . -name .depend -exec rm -rf {} \; |
---|
62 | $(MAKE) -C tests distclean |
---|
63 | |
---|
64 | check: all |
---|
65 | $(MAKE) -C tests |
---|
66 | |
---|
67 | gcov: check |
---|
68 | gcov *.c |
---|
69 | |
---|
70 | lcov: check |
---|
71 | lcov --directory . --capture --output-file bitlbee.info |
---|
72 | genhtml -o coverage bitlbee.info |
---|
73 | |
---|
74 | install-doc: |
---|
75 | $(MAKE) -C doc install |
---|
76 | ifdef SKYPE_PI |
---|
77 | $(MAKE) -C protocols/skype install-doc |
---|
78 | endif |
---|
79 | |
---|
80 | uninstall-doc: |
---|
81 | $(MAKE) -C doc uninstall |
---|
82 | ifdef SKYPE_PI |
---|
83 | $(MAKE) -C protocols/skype uninstall-doc |
---|
84 | endif |
---|
85 | |
---|
86 | install-bin: |
---|
87 | mkdir -p $(DESTDIR)$(BINDIR) |
---|
88 | install -m 0755 $(OUTFILE) $(DESTDIR)$(BINDIR)/$(OUTFILE) |
---|
89 | |
---|
90 | uninstall-bin: |
---|
91 | rm -f $(DESTDIR)$(BINDIR)/$(OUTFILE) |
---|
92 | |
---|
93 | install-dev: |
---|
94 | mkdir -p $(DESTDIR)$(INCLUDEDIR) |
---|
95 | install -m 0644 config.h $(DESTDIR)$(INCLUDEDIR) |
---|
96 | for i in $(headers); do install -m 0644 $(SRCDIR)$$i $(DESTDIR)$(INCLUDEDIR); done |
---|
97 | mkdir -p $(DESTDIR)$(PCDIR) |
---|
98 | install -m 0644 bitlbee.pc $(DESTDIR)$(PCDIR) |
---|
99 | |
---|
100 | uninstall-dev: |
---|
101 | rm -f $(foreach hdr,$(headers),$(DESTDIR)$(INCLUDEDIR)/$(hdr)) |
---|
102 | -rmdir $(DESTDIR)$(INCLUDEDIR) |
---|
103 | rm -f $(DESTDIR)$(PCDIR)/bitlbee.pc |
---|
104 | |
---|
105 | install-etc: |
---|
106 | mkdir -p $(DESTDIR)$(ETCDIR) |
---|
107 | install -m 0644 $(SRCDIR)motd.txt $(DESTDIR)$(ETCDIR)/motd.txt |
---|
108 | install -m 0644 $(SRCDIR)bitlbee.conf $(DESTDIR)$(ETCDIR)/bitlbee.conf |
---|
109 | |
---|
110 | uninstall-etc: |
---|
111 | rm -f $(DESTDIR)$(ETCDIR)/motd.txt |
---|
112 | rm -f $(DESTDIR)$(ETCDIR)/bitlbee.conf |
---|
113 | -rmdir $(DESTDIR)$(ETCDIR) |
---|
114 | |
---|
115 | install-plugins: |
---|
116 | ifdef OTR_PI |
---|
117 | mkdir -p $(DESTDIR)$(PLUGINDIR) |
---|
118 | install -m 0755 otr.so $(DESTDIR)$(PLUGINDIR) |
---|
119 | endif |
---|
120 | ifdef SKYPE_PI |
---|
121 | mkdir -p $(DESTDIR)$(PLUGINDIR) |
---|
122 | install -m 0755 skype.so $(DESTDIR)$(PLUGINDIR) |
---|
123 | mkdir -p $(DESTDIR)$(ETCDIR)/../skyped |
---|
124 | install -m 0644 $(SRCDIR)protocols/skype/skyped.cnf $(DESTDIR)$(ETCDIR)/../skyped/skyped.cnf |
---|
125 | install -m 0644 $(SRCDIR)protocols/skype/skyped.conf $(DESTDIR)$(ETCDIR)/../skyped/skyped.conf |
---|
126 | install -m 0755 $(SRCDIR)protocols/skype/skyped.py $(DESTDIR)$(BINDIR)/skyped |
---|
127 | endif |
---|
128 | |
---|
129 | systemd: |
---|
130 | ifdef SYSTEMDSYSTEMUNITDIR |
---|
131 | sed 's|@sbindir@|$(BINDIR)|' init/bitlbee.service.in > init/bitlbee.service |
---|
132 | sed 's|@sbindir@|$(BINDIR)|' init/bitlbee@.service.in > init/bitlbee@.service |
---|
133 | endif |
---|
134 | |
---|
135 | install-systemd: |
---|
136 | ifdef SYSTEMDSYSTEMUNITDIR |
---|
137 | ifeq ($(shell id -u),0) |
---|
138 | mkdir -p $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR) |
---|
139 | install -m 0644 init/bitlbee.service $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR) |
---|
140 | install -m 0644 init/bitlbee@.service $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR) |
---|
141 | install -m 0644 init/bitlbee.socket $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR) |
---|
142 | else |
---|
143 | @echo Not root, so not installing systemd files. |
---|
144 | endif |
---|
145 | endif |
---|
146 | |
---|
147 | tar: |
---|
148 | fakeroot debian/rules clean || make distclean |
---|
149 | x=$$(basename $$(pwd)); \ |
---|
150 | cd ..; \ |
---|
151 | tar czf $$x.tar.gz --exclude=debian --exclude=.bzr* --exclude=.depend $$x |
---|
152 | |
---|
153 | $(subdirs): |
---|
154 | @$(MAKE) -C $@ $(MAKECMDGOALS) |
---|
155 | |
---|
156 | $(OTR_PI): %.so: $(SRCDIR)%.c |
---|
157 | @echo '*' Building plugin $@ |
---|
158 | @$(CC) $(CFLAGS) $(OTRFLAGS) -fPIC -shared $(LDFLAGS) $< -o $@ |
---|
159 | |
---|
160 | $(SKYPE_PI): $(SRCDIR)protocols/skype/skype.c |
---|
161 | @echo '*' Building plugin skype |
---|
162 | @$(CC) $(CFLAGS) -fPIC -shared $< -o $@ |
---|
163 | |
---|
164 | $(objects): %.o: $(SRCDIR)%.c |
---|
165 | @echo '*' Compiling $< |
---|
166 | @$(CC) -c $(CFLAGS) $< -o $@ |
---|
167 | |
---|
168 | $(objects): Makefile Makefile.settings config.h |
---|
169 | |
---|
170 | $(OUTFILE): $(objects) $(subdirs) |
---|
171 | @echo '*' Linking $(OUTFILE) |
---|
172 | @$(CC) $(objects) $(subdirobjs) -o $(OUTFILE) $(LFLAGS) $(EFLAGS) |
---|
173 | ifndef DEBUG |
---|
174 | @echo '*' Stripping $(OUTFILE) |
---|
175 | @-$(STRIP) $(OUTFILE) |
---|
176 | endif |
---|
177 | |
---|
178 | ctags: |
---|
179 | ctags `find . -name "*.c"` `find . -name "*.h"` |
---|
180 | |
---|
181 | # Using this as a bogus Make target to test if a GNU-compatible version of |
---|
182 | # make is available. |
---|
183 | helloworld: |
---|
184 | @echo Hello World |
---|
185 | |
---|
186 | -include .depend/*.d |
---|