source: Makefile @ 934dddf3

Last change on this file since 934dddf3 was 6a72a57, checked in by Jelmer Vernooij <jelmer@…>, at 2008-06-10T03:43:46Z

Move OUTFILE determination to Makefile rather than configure.

  • Property mode set to 100644
File size: 3.7 KB
Line 
1###########################
2## Makefile for BitlBee  ##
3##                       ##
4## Copyright 2002 Lintux ##
5###########################
6
7### DEFINITIONS
8
9-include Makefile.settings
10
11# Program variables
12objects = account.o bitlbee.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
13headers = account.h bitlbee.h commands.h conf.h config.h crypting.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/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
14subdirs = lib protocols
15
16ifeq ($(TARGET),i586-mingw32msvc)
17objects += win32.o
18LFLAGS+=-lws2_32
19EFLAGS+=-lsecur32
20OUTFILE=bitlbee.exe
21else
22objects += unix.o conf.o log.o
23OUTFILE=bitlbee
24endif
25
26# Expansion of variables
27subdirobjs = $(foreach dir,$(subdirs),$(dir)/$(dir).o)
28CFLAGS += -Wall
29
30all: $(OUTFILE)
31        $(MAKE) -C doc
32
33uninstall: uninstall-bin uninstall-doc
34        @echo -e '\nmake uninstall does not remove files in '$(DESTDIR)$(ETCDIR)', you can use make uninstall-etc to do that.\n'
35
36install: install-bin install-doc
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)
51        rm -f *.o $(OUTFILE) core utils/bitlbeed encode decode
52        $(MAKE) -C tests clean
53
54distclean: clean $(subdirs)
55        rm -f Makefile.settings config.h bitlbee.pc
56        find . -name 'DEADJOE' -o -name '*.orig' -o -name '*.rej' -o -name '*~' -exec rm -f {} \;
57        $(MAKE) -C tests distclean
58
59check: all
60        $(MAKE) -C tests
61
62gcov: check
63        gcov *.c
64
65lcov: check
66        lcov --directory . --capture --output-file bitlbee.info
67        genhtml -o coverage bitlbee.info
68
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
82install-dev:
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
88uninstall-dev:
89        rm -f $(foreach hdr,$(headers),$(DESTDIR)$(INCLUDEDIR)/$(hdr))
90        -rmdir $(DESTDIR)$(INCLUDEDIR)
91        rm -f $(DESTDIR)$(PCDIR)/bitlbee.pc
92
93install-etc:
94        mkdir -p $(DESTDIR)$(ETCDIR)
95        install -m 0644 motd.txt $(DESTDIR)$(ETCDIR)/motd.txt
96        install -m 0644 bitlbee.conf $(DESTDIR)$(ETCDIR)/bitlbee.conf
97
98uninstall-etc:
99        rm -f $(DESTDIR)$(ETCDIR)/motd.txt
100        rm -f $(DESTDIR)$(ETCDIR)/bitlbee.conf
101        -rmdir $(DESTDIR)$(ETCDIR)
102
103tar:
104        fakeroot debian/rules clean || make distclean
105        x=$$(basename $$(pwd)); \
106        cd ..; \
107        tar czf $$x.tar.gz --exclude=debian --exclude=.bzr $$x
108
109$(subdirs):
110        @$(MAKE) -C $@ $(MAKECMDGOALS)
111
112$(objects): %.o: %.c
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)
121ifndef DEBUG
122        @echo '*' Stripping $(OUTFILE)
123        @-$(STRIP) $(OUTFILE)
124endif
125
126encode: crypting.c
127        $(CC) crypting.c lib/md5.c $(CFLAGS) -o encode -DCRYPTING_MAIN $(CFLAGS) $(EFLAGS) $(LFLAGS)
128
129decode: encode
130        cp encode decode
131
132ctags: 
133        ctags `find . -name "*.c"` `find . -name "*.h"`
Note: See TracBrowser for help on using the repository browser.