source: Makefile @ b308cf9

Last change on this file since b308cf9 was 4af3050, checked in by Wilmer van der Gaast <wilmer@…>, at 2010-05-25T22:41:52Z

install-* targets should also work now. Let's see how this works out in a deb.

  • Property mode set to 100644
File size: 3.8 KB
RevLine 
[b7d3cc34]1###########################
2## Makefile for BitlBee  ##
3##                       ##
4## Copyright 2002 Lintux ##
5###########################
6
7### DEFINITIONS
8
9-include Makefile.settings
10
11# Program variables
[ba7d16f]12objects = account.o bitlbee.o chat.o dcc.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
[4af3050]13headers = account.h bitlbee.h commands.h conf.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]14subdirs = lib protocols
[b7d3cc34]15
[1bf9492]16ifeq ($(TARGET),i586-mingw32msvc)
[d1d6776]17objects += win32.o
[73c2dce]18LFLAGS+=-lws2_32
19EFLAGS+=-lsecur32
[6a72a57]20OUTFILE=bitlbee.exe
[d1d6776]21else
[4146a07]22objects += unix.o conf.o log.o
[6a72a57]23OUTFILE=bitlbee
[d1d6776]24endif
25
[b7d3cc34]26# Expansion of variables
27subdirobjs = $(foreach dir,$(subdirs),$(dir)/$(dir).o)
28CFLAGS += -Wall
29
30all: $(OUTFILE)
[513a323]31        $(MAKE) -C doc
[b7d3cc34]32
[cdb92c5]33uninstall: 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]36install: 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
45Makefile.settings:
46        @echo
47        @echo Run ./configure to create Makefile.settings, then rerun make
48        @echo
49
50clean: $(subdirs)
[7c9db24]51        rm -f *.o $(OUTFILE) core utils/bitlbeed
[66b9e86e]52        $(MAKE) -C tests clean
[b7d3cc34]53
54distclean: 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]59check: all
[c2fa827]60        $(MAKE) -C tests
61
[66b9e86e]62gcov: check
63        gcov *.c
64
[348c11b]65lcov: check
66        lcov --directory . --capture --output-file bitlbee.info
67        genhtml -o coverage bitlbee.info
68
[b7d3cc34]69install-doc:
70        $(MAKE) -C doc install
71
72uninstall-doc:
73        $(MAKE) -C doc uninstall
74
75install-bin:
76        mkdir -p $(DESTDIR)$(BINDIR)
77        install -m 0755 $(OUTFILE) $(DESTDIR)$(BINDIR)/$(OUTFILE)
78
79uninstall-bin:
80        rm -f $(DESTDIR)$(BINDIR)/$(OUTFILE)
81
[cdb92c5]82install-dev:
[e506d6c]83        mkdir -p $(DESTDIR)$(INCLUDEDIR)
[4af3050]84        install -m 0644 config.h $(DESTDIR)$(INCLUDEDIR)
85        for i in $(headers); do install -m 0644 $(SRCDIR)$$i $(DESTDIR)$(INCLUDEDIR); done
[e506d6c]86        mkdir -p $(DESTDIR)$(PCDIR)
87        install -m 0644 bitlbee.pc $(DESTDIR)$(PCDIR)
88
[cdb92c5]89uninstall-dev:
90        rm -f $(foreach hdr,$(headers),$(DESTDIR)$(INCLUDEDIR)/$(hdr))
91        -rmdir $(DESTDIR)$(INCLUDEDIR)
[e506d6c]92        rm -f $(DESTDIR)$(PCDIR)/bitlbee.pc
93
[b7d3cc34]94install-etc:
95        mkdir -p $(DESTDIR)$(ETCDIR)
[4af3050]96        install -m 0644 $(SRCDIR)motd.txt $(DESTDIR)$(ETCDIR)/motd.txt
97        install -m 0644 $(SRCDIR)bitlbee.conf $(DESTDIR)$(ETCDIR)/bitlbee.conf
[b7d3cc34]98
99uninstall-etc:
100        rm -f $(DESTDIR)$(ETCDIR)/motd.txt
101        rm -f $(DESTDIR)$(ETCDIR)/bitlbee.conf
102        -rmdir $(DESTDIR)$(ETCDIR)
103
104tar:
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
[f60079b]113$(objects): %.o: $(SRCDIR)%.c
[b7d3cc34]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)
122ifndef DEBUG
123        @echo '*' Stripping $(OUTFILE)
124        @-$(STRIP) $(OUTFILE)
125endif
126
127ctags: 
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.
132helloworld:
133        @echo Hello World
Note: See TracBrowser for help on using the repository browser.