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