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