[b7d3cc34] | 1 | ########################### |
---|
| 2 | ## Makefile for BitlBee ## |
---|
| 3 | ## ## |
---|
| 4 | ## Copyright 2002 Lintux ## |
---|
| 5 | ########################### |
---|
| 6 | |
---|
| 7 | ### DEFINITIONS |
---|
| 8 | |
---|
| 9 | -include Makefile.settings |
---|
| 10 | |
---|
| 11 | # Program variables |
---|
[21c87a7] | 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 query.o root_commands.o set.o storage.o $(STORAGE_OBJS) |
---|
[3063f81] | 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 |
---|
[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 |
---|
[4146a07] | 22 | objects += unix.o conf.o log.o |
---|
[6a72a57] | 23 | OUTFILE=bitlbee |
---|
[d1d6776] | 24 | endif |
---|
| 25 | |
---|
[b7d3cc34] | 26 | # Expansion of variables |
---|
| 27 | subdirobjs = $(foreach dir,$(subdirs),$(dir)/$(dir).o) |
---|
| 28 | |
---|
| 29 | all: $(OUTFILE) |
---|
[513a323] | 30 | $(MAKE) -C doc |
---|
[b7d3cc34] | 31 | |
---|
[cdb92c5] | 32 | uninstall: uninstall-bin uninstall-doc |
---|
[b7d3cc34] | 33 | @echo -e '\nmake uninstall does not remove files in '$(DESTDIR)$(ETCDIR)', you can use make uninstall-etc to do that.\n' |
---|
| 34 | |
---|
[cdb92c5] | 35 | install: install-bin install-doc |
---|
[b7d3cc34] | 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 \ |
---|
| 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) |
---|
[7c9db24] | 50 | rm -f *.o $(OUTFILE) core utils/bitlbeed |
---|
[66b9e86e] | 51 | $(MAKE) -C tests clean |
---|
[b7d3cc34] | 52 | |
---|
| 53 | distclean: clean $(subdirs) |
---|
[b3c467b] | 54 | rm -f Makefile.settings config.h bitlbee.pc |
---|
[34c0e90] | 55 | find . -name 'DEADJOE' -o -name '*.orig' -o -name '*.rej' -o -name '*~' -exec rm -f {} \; |
---|
[dcf0f3e] | 56 | $(MAKE) -C tests distclean |
---|
[b7d3cc34] | 57 | |
---|
[66b9e86e] | 58 | check: all |
---|
[c2fa827] | 59 | $(MAKE) -C tests |
---|
| 60 | |
---|
[66b9e86e] | 61 | gcov: check |
---|
| 62 | gcov *.c |
---|
| 63 | |
---|
[348c11b] | 64 | lcov: check |
---|
| 65 | lcov --directory . --capture --output-file bitlbee.info |
---|
| 66 | genhtml -o coverage bitlbee.info |
---|
| 67 | |
---|
[b7d3cc34] | 68 | install-doc: |
---|
| 69 | $(MAKE) -C doc install |
---|
| 70 | |
---|
| 71 | uninstall-doc: |
---|
| 72 | $(MAKE) -C doc uninstall |
---|
| 73 | |
---|
| 74 | install-bin: |
---|
| 75 | mkdir -p $(DESTDIR)$(BINDIR) |
---|
| 76 | install -m 0755 $(OUTFILE) $(DESTDIR)$(BINDIR)/$(OUTFILE) |
---|
| 77 | |
---|
| 78 | uninstall-bin: |
---|
| 79 | rm -f $(DESTDIR)$(BINDIR)/$(OUTFILE) |
---|
| 80 | |
---|
[cdb92c5] | 81 | install-dev: |
---|
[e506d6c] | 82 | mkdir -p $(DESTDIR)$(INCLUDEDIR) |
---|
[4af3050] | 83 | install -m 0644 config.h $(DESTDIR)$(INCLUDEDIR) |
---|
| 84 | for i in $(headers); do install -m 0644 $(SRCDIR)$$i $(DESTDIR)$(INCLUDEDIR); done |
---|
[e506d6c] | 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) |
---|
[4af3050] | 95 | install -m 0644 $(SRCDIR)motd.txt $(DESTDIR)$(ETCDIR)/motd.txt |
---|
| 96 | install -m 0644 $(SRCDIR)bitlbee.conf $(DESTDIR)$(ETCDIR)/bitlbee.conf |
---|
[b7d3cc34] | 97 | |
---|
| 98 | uninstall-etc: |
---|
| 99 | rm -f $(DESTDIR)$(ETCDIR)/motd.txt |
---|
| 100 | rm -f $(DESTDIR)$(ETCDIR)/bitlbee.conf |
---|
| 101 | -rmdir $(DESTDIR)$(ETCDIR) |
---|
| 102 | |
---|
| 103 | tar: |
---|
| 104 | fakeroot debian/rules clean || make distclean |
---|
| 105 | x=$$(basename $$(pwd)); \ |
---|
| 106 | cd ..; \ |
---|
[9ebee7a] | 107 | tar czf $$x.tar.gz --exclude=debian --exclude=.bzr* $$x |
---|
[b7d3cc34] | 108 | |
---|
| 109 | $(subdirs): |
---|
| 110 | @$(MAKE) -C $@ $(MAKECMDGOALS) |
---|
| 111 | |
---|
[f60079b] | 112 | $(objects): %.o: $(SRCDIR)%.c |
---|
[b7d3cc34] | 113 | @echo '*' Compiling $< |
---|
| 114 | @$(CC) -c $(CFLAGS) $< -o $@ |
---|
| 115 | |
---|
| 116 | $(objects): Makefile Makefile.settings config.h |
---|
| 117 | |
---|
| 118 | $(OUTFILE): $(objects) $(subdirs) |
---|
| 119 | @echo '*' Linking $(OUTFILE) |
---|
| 120 | @$(CC) $(objects) $(subdirobjs) -o $(OUTFILE) $(LFLAGS) $(EFLAGS) |
---|
| 121 | ifndef DEBUG |
---|
| 122 | @echo '*' Stripping $(OUTFILE) |
---|
| 123 | @-$(STRIP) $(OUTFILE) |
---|
| 124 | endif |
---|
| 125 | |
---|
| 126 | ctags: |
---|
| 127 | ctags `find . -name "*.c"` `find . -name "*.h"` |
---|
[4fca1db] | 128 | |
---|
| 129 | # Using this as a bogus Make target to test if a GNU-compatible version of |
---|
| 130 | # make is available. |
---|
| 131 | helloworld: |
---|
| 132 | @echo Hello World |
---|