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