[b7d3cc34] | 1 | ########################### |
---|
| 2 | ## Makefile for BitlBee ## |
---|
| 3 | ## ## |
---|
| 4 | ## Copyright 2002 Lintux ## |
---|
| 5 | ########################### |
---|
| 6 | |
---|
| 7 | ### DEFINITIONS |
---|
| 8 | |
---|
| 9 | -include Makefile.settings |
---|
| 10 | |
---|
| 11 | # Program variables |
---|
[ad9feec] | 12 | objects = account.o bitlbee.o chat.o crypting.o help.o ipc.o irc.o irc_commands.o nick.o query.o root_commands.o set.o storage.o $(STORAGE_OBJS) user.o |
---|
[764c7d1] | 13 | headers = account.h bitlbee.h commands.h conf.h config.h crypting.h help.h ipc.h irc.h log.h nick.h otr.h query.h set.h sock.h storage.h user.h lib/events.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/nogaim.h |
---|
[84b045d] | 14 | subdirs = lib protocols |
---|
[b7d3cc34] | 15 | |
---|
[1bf9492] | 16 | ifeq ($(TARGET),i586-mingw32msvc) |
---|
[d1d6776] | 17 | objects += win32.o |
---|
[73c2dce] | 18 | LFLAGS+=-lws2_32 |
---|
| 19 | EFLAGS+=-lsecur32 |
---|
[6a72a57] | 20 | OUTFILE=bitlbee.exe |
---|
[d1d6776] | 21 | else |
---|
[6738a67] | 22 | objects += unix.o conf.o log.o otr.o |
---|
[6a72a57] | 23 | OUTFILE=bitlbee |
---|
[d1d6776] | 24 | endif |
---|
| 25 | |
---|
[b7d3cc34] | 26 | # Expansion of variables |
---|
| 27 | subdirobjs = $(foreach dir,$(subdirs),$(dir)/$(dir).o) |
---|
| 28 | CFLAGS += -Wall |
---|
| 29 | |
---|
| 30 | all: $(OUTFILE) |
---|
[513a323] | 31 | $(MAKE) -C doc |
---|
[b7d3cc34] | 32 | |
---|
[cdb92c5] | 33 | uninstall: uninstall-bin uninstall-doc |
---|
[b7d3cc34] | 34 | @echo -e '\nmake uninstall does not remove files in '$(DESTDIR)$(ETCDIR)', you can use make uninstall-etc to do that.\n' |
---|
| 35 | |
---|
[cdb92c5] | 36 | install: install-bin install-doc |
---|
[b7d3cc34] | 37 | @if ! [ -d $(DESTDIR)$(CONFIG) ]; then echo -e '\nThe configuration directory $(DESTDIR)$(CONFIG) does not exist yet, don'\''t forget to create it!'; fi |
---|
| 38 | @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 |
---|
| 39 | @echo |
---|
| 40 | |
---|
| 41 | .PHONY: install install-bin install-etc install-doc \ |
---|
| 42 | uninstall uninstall-bin uninstall-etc uninstall-doc \ |
---|
| 43 | all clean distclean tar $(subdirs) |
---|
| 44 | |
---|
| 45 | Makefile.settings: |
---|
| 46 | @echo |
---|
| 47 | @echo Run ./configure to create Makefile.settings, then rerun make |
---|
| 48 | @echo |
---|
| 49 | |
---|
| 50 | clean: $(subdirs) |
---|
[7c9db24] | 51 | rm -f *.o $(OUTFILE) core utils/bitlbeed |
---|
[66b9e86e] | 52 | $(MAKE) -C tests clean |
---|
[b7d3cc34] | 53 | |
---|
| 54 | distclean: clean $(subdirs) |
---|
[b3c467b] | 55 | rm -f Makefile.settings config.h bitlbee.pc |
---|
[34c0e90] | 56 | find . -name 'DEADJOE' -o -name '*.orig' -o -name '*.rej' -o -name '*~' -exec rm -f {} \; |
---|
[dcf0f3e] | 57 | $(MAKE) -C tests distclean |
---|
[b7d3cc34] | 58 | |
---|
[66b9e86e] | 59 | check: all |
---|
[c2fa827] | 60 | $(MAKE) -C tests |
---|
| 61 | |
---|
[66b9e86e] | 62 | gcov: check |
---|
| 63 | gcov *.c |
---|
| 64 | |
---|
[348c11b] | 65 | lcov: check |
---|
| 66 | lcov --directory . --capture --output-file bitlbee.info |
---|
| 67 | genhtml -o coverage bitlbee.info |
---|
| 68 | |
---|
[b7d3cc34] | 69 | install-doc: |
---|
| 70 | $(MAKE) -C doc install |
---|
| 71 | |
---|
| 72 | uninstall-doc: |
---|
| 73 | $(MAKE) -C doc uninstall |
---|
| 74 | |
---|
| 75 | install-bin: |
---|
| 76 | mkdir -p $(DESTDIR)$(BINDIR) |
---|
| 77 | install -m 0755 $(OUTFILE) $(DESTDIR)$(BINDIR)/$(OUTFILE) |
---|
| 78 | |
---|
| 79 | uninstall-bin: |
---|
| 80 | rm -f $(DESTDIR)$(BINDIR)/$(OUTFILE) |
---|
| 81 | |
---|
[cdb92c5] | 82 | install-dev: |
---|
[e506d6c] | 83 | mkdir -p $(DESTDIR)$(INCLUDEDIR) |
---|
| 84 | install -m 0644 $(headers) $(DESTDIR)$(INCLUDEDIR) |
---|
| 85 | mkdir -p $(DESTDIR)$(PCDIR) |
---|
| 86 | install -m 0644 bitlbee.pc $(DESTDIR)$(PCDIR) |
---|
| 87 | |
---|
[cdb92c5] | 88 | uninstall-dev: |
---|
| 89 | rm -f $(foreach hdr,$(headers),$(DESTDIR)$(INCLUDEDIR)/$(hdr)) |
---|
| 90 | -rmdir $(DESTDIR)$(INCLUDEDIR) |
---|
[e506d6c] | 91 | rm -f $(DESTDIR)$(PCDIR)/bitlbee.pc |
---|
| 92 | |
---|
[b7d3cc34] | 93 | install-etc: |
---|
| 94 | mkdir -p $(DESTDIR)$(ETCDIR) |
---|
| 95 | install -m 0644 motd.txt $(DESTDIR)$(ETCDIR)/motd.txt |
---|
[8961950] | 96 | install -m 0644 welcome.txt $(DESTDIR)$(ETCDIR)/welcome.txt |
---|
[b7d3cc34] | 97 | install -m 0644 bitlbee.conf $(DESTDIR)$(ETCDIR)/bitlbee.conf |
---|
| 98 | |
---|
| 99 | uninstall-etc: |
---|
| 100 | rm -f $(DESTDIR)$(ETCDIR)/motd.txt |
---|
[8961950] | 101 | rm -f $(DESTDIR)$(ETCDIR)/welcome.txt |
---|
[b7d3cc34] | 102 | rm -f $(DESTDIR)$(ETCDIR)/bitlbee.conf |
---|
| 103 | -rmdir $(DESTDIR)$(ETCDIR) |
---|
| 104 | |
---|
| 105 | tar: |
---|
| 106 | fakeroot debian/rules clean || make distclean |
---|
| 107 | x=$$(basename $$(pwd)); \ |
---|
| 108 | cd ..; \ |
---|
[823de9d] | 109 | tar czf $$x.tar.gz --exclude=debian --exclude=.bzr* $$x |
---|
[b7d3cc34] | 110 | |
---|
| 111 | $(subdirs): |
---|
| 112 | @$(MAKE) -C $@ $(MAKECMDGOALS) |
---|
| 113 | |
---|
| 114 | $(objects): %.o: %.c |
---|
| 115 | @echo '*' Compiling $< |
---|
| 116 | @$(CC) -c $(CFLAGS) $< -o $@ |
---|
| 117 | |
---|
| 118 | $(objects): Makefile Makefile.settings config.h |
---|
| 119 | |
---|
| 120 | $(OUTFILE): $(objects) $(subdirs) |
---|
| 121 | @echo '*' Linking $(OUTFILE) |
---|
| 122 | @$(CC) $(objects) $(subdirobjs) -o $(OUTFILE) $(LFLAGS) $(EFLAGS) |
---|
| 123 | ifndef DEBUG |
---|
| 124 | @echo '*' Stripping $(OUTFILE) |
---|
| 125 | @-$(STRIP) $(OUTFILE) |
---|
| 126 | endif |
---|
| 127 | |
---|
| 128 | ctags: |
---|
| 129 | ctags `find . -name "*.c"` `find . -name "*.h"` |
---|