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 = account.o bitlbee.o commands.o crypting.o help.o ini.o irc.o nick.o query.o set.o url.o user.o debug.o log.o |
---|
13 | subdirs = protocols |
---|
14 | |
---|
15 | ifeq ($(ARCH),Windows) |
---|
16 | objects += win32.o |
---|
17 | else |
---|
18 | objects += unix.o conf.o |
---|
19 | endif |
---|
20 | |
---|
21 | # Expansion of variables |
---|
22 | subdirobjs = $(foreach dir,$(subdirs),$(dir)/$(dir).o) |
---|
23 | CFLAGS += -Wall |
---|
24 | |
---|
25 | all: $(OUTFILE) |
---|
26 | |
---|
27 | uninstall: uninstall-bin uninstall-doc |
---|
28 | @echo -e '\nmake uninstall does not remove files in '$(DESTDIR)$(ETCDIR)', you can use make uninstall-etc to do that.\n' |
---|
29 | |
---|
30 | install: install-bin install-doc |
---|
31 | @if ! [ -d $(DESTDIR)$(CONFIG) ]; then echo -e '\nThe configuration directory $(DESTDIR)$(CONFIG) does not exist yet, don'\''t forget to create it!'; fi |
---|
32 | @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 |
---|
33 | @echo |
---|
34 | |
---|
35 | .PHONY: install install-bin install-etc install-doc \ |
---|
36 | uninstall uninstall-bin uninstall-etc uninstall-doc \ |
---|
37 | all clean distclean tar $(subdirs) |
---|
38 | |
---|
39 | Makefile.settings: |
---|
40 | @echo |
---|
41 | @echo Run ./configure to create Makefile.settings, then rerun make |
---|
42 | @echo |
---|
43 | |
---|
44 | clean: $(subdirs) |
---|
45 | rm -f *.o $(OUTFILE) core utils/bitlbeed encode decode |
---|
46 | |
---|
47 | distclean: clean $(subdirs) |
---|
48 | rm -f Makefile.settings config.h |
---|
49 | find . -name 'DEADJOE' -o -name '*.orig' -o -name '*.rej' -o -name '*~' | xargs rm -f |
---|
50 | |
---|
51 | install-doc: |
---|
52 | $(MAKE) -C doc install |
---|
53 | |
---|
54 | uninstall-doc: |
---|
55 | $(MAKE) -C doc uninstall |
---|
56 | |
---|
57 | install-bin: |
---|
58 | mkdir -p $(DESTDIR)$(BINDIR) |
---|
59 | install -m 0755 $(OUTFILE) $(DESTDIR)$(BINDIR)/$(OUTFILE) |
---|
60 | |
---|
61 | uninstall-bin: |
---|
62 | rm -f $(DESTDIR)$(BINDIR)/$(OUTFILE) |
---|
63 | |
---|
64 | install-etc: |
---|
65 | mkdir -p $(DESTDIR)$(ETCDIR) |
---|
66 | install -m 0644 motd.txt $(DESTDIR)$(ETCDIR)/motd.txt |
---|
67 | install -m 0644 bitlbee.conf $(DESTDIR)$(ETCDIR)/bitlbee.conf |
---|
68 | |
---|
69 | uninstall-etc: |
---|
70 | rm -f $(DESTDIR)$(ETCDIR)/motd.txt |
---|
71 | rm -f $(DESTDIR)$(ETCDIR)/bitlbee.conf |
---|
72 | -rmdir $(DESTDIR)$(ETCDIR) |
---|
73 | |
---|
74 | tar: |
---|
75 | fakeroot debian/rules clean || make distclean |
---|
76 | x=$$(basename $$(pwd)); \ |
---|
77 | cd ..; \ |
---|
78 | tar czf $$x.tar.gz --exclude=debian --exclude=.bzr $$x |
---|
79 | |
---|
80 | $(subdirs): |
---|
81 | @$(MAKE) -C $@ $(MAKECMDGOALS) |
---|
82 | |
---|
83 | $(objects): %.o: %.c |
---|
84 | @echo '*' Compiling $< |
---|
85 | @$(CC) -c $(CFLAGS) $< -o $@ |
---|
86 | |
---|
87 | $(objects): Makefile Makefile.settings config.h |
---|
88 | |
---|
89 | $(OUTFILE): $(objects) $(subdirs) |
---|
90 | @echo '*' Linking $(OUTFILE) |
---|
91 | @$(CC) $(objects) $(subdirobjs) -o $(OUTFILE) $(LFLAGS) $(EFLAGS) |
---|
92 | ifndef DEBUG |
---|
93 | @echo '*' Stripping $(OUTFILE) |
---|
94 | @-$(STRIP) $(OUTFILE) |
---|
95 | endif |
---|
96 | |
---|
97 | encode: crypting.c |
---|
98 | $(CC) crypting.c protocols/md5.c $(CFLAGS) -o encode -DCRYPTING_MAIN $(CFLAGS) $(EFLAGS) $(LFLAGS) |
---|
99 | |
---|
100 | decode: encode |
---|
101 | cp encode decode |
---|
102 | |
---|
103 | ctags: |
---|
104 | ctags `find . -name "*.c"` `find . -name "*.h"` |
---|