source: Makefile @ 1bf9492

Last change on this file since 1bf9492 was 1bf9492, checked in by Jelmer Vernooij <jelmer@…>, at 2008-06-09T02:18:34Z

Use system lib directories and pkg-config directory from target when specified.

  • Property mode set to 100644
File size: 3.6 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
18else
19objects += unix.o conf.o log.o
20endif
21
22# Expansion of variables
23subdirobjs = $(foreach dir,$(subdirs),$(dir)/$(dir).o)
24CFLAGS += -Wall
25
26all: $(OUTFILE)
27        $(MAKE) -C doc
28
29uninstall: uninstall-bin uninstall-doc
30        @echo -e '\nmake uninstall does not remove files in '$(DESTDIR)$(ETCDIR)', you can use make uninstall-etc to do that.\n'
31
32install: install-bin install-doc
33        @if ! [ -d $(DESTDIR)$(CONFIG) ]; then echo -e '\nThe configuration directory $(DESTDIR)$(CONFIG) does not exist yet, don'\''t forget to create it!'; fi
34        @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
35        @echo
36
37.PHONY:   install   install-bin   install-etc   install-doc \
38        uninstall uninstall-bin uninstall-etc uninstall-doc \
39        all clean distclean tar $(subdirs)
40
41Makefile.settings:
42        @echo
43        @echo Run ./configure to create Makefile.settings, then rerun make
44        @echo
45
46clean: $(subdirs)
47        rm -f *.o $(OUTFILE) core utils/bitlbeed encode decode
48        $(MAKE) -C tests clean
49
50distclean: clean $(subdirs)
51        rm -f Makefile.settings config.h bitlbee.pc
52        find . -name 'DEADJOE' -o -name '*.orig' -o -name '*.rej' -o -name '*~' -exec rm -f {} \;
53        $(MAKE) -C tests distclean
54
55check: all
56        $(MAKE) -C tests
57
58gcov: check
59        gcov *.c
60
61lcov: check
62        lcov --directory . --capture --output-file bitlbee.info
63        genhtml -o coverage bitlbee.info
64
65install-doc:
66        $(MAKE) -C doc install
67
68uninstall-doc:
69        $(MAKE) -C doc uninstall
70
71install-bin:
72        mkdir -p $(DESTDIR)$(BINDIR)
73        install -m 0755 $(OUTFILE) $(DESTDIR)$(BINDIR)/$(OUTFILE)
74
75uninstall-bin:
76        rm -f $(DESTDIR)$(BINDIR)/$(OUTFILE)
77
78install-dev:
79        mkdir -p $(DESTDIR)$(INCLUDEDIR)
80        install -m 0644 $(headers) $(DESTDIR)$(INCLUDEDIR)
81        mkdir -p $(DESTDIR)$(PCDIR)
82        install -m 0644 bitlbee.pc $(DESTDIR)$(PCDIR)
83
84uninstall-dev:
85        rm -f $(foreach hdr,$(headers),$(DESTDIR)$(INCLUDEDIR)/$(hdr))
86        -rmdir $(DESTDIR)$(INCLUDEDIR)
87        rm -f $(DESTDIR)$(PCDIR)/bitlbee.pc
88
89install-etc:
90        mkdir -p $(DESTDIR)$(ETCDIR)
91        install -m 0644 motd.txt $(DESTDIR)$(ETCDIR)/motd.txt
92        install -m 0644 bitlbee.conf $(DESTDIR)$(ETCDIR)/bitlbee.conf
93
94uninstall-etc:
95        rm -f $(DESTDIR)$(ETCDIR)/motd.txt
96        rm -f $(DESTDIR)$(ETCDIR)/bitlbee.conf
97        -rmdir $(DESTDIR)$(ETCDIR)
98
99tar:
100        fakeroot debian/rules clean || make distclean
101        x=$$(basename $$(pwd)); \
102        cd ..; \
103        tar czf $$x.tar.gz --exclude=debian --exclude=.bzr $$x
104
105$(subdirs):
106        @$(MAKE) -C $@ $(MAKECMDGOALS)
107
108$(objects): %.o: %.c
109        @echo '*' Compiling $<
110        @$(CC) -c $(CFLAGS) $< -o $@
111
112$(objects): Makefile Makefile.settings config.h
113
114$(OUTFILE): $(objects) $(subdirs)
115        @echo '*' Linking $(OUTFILE)
116        @$(CC) $(objects) $(subdirobjs) -o $(OUTFILE) $(LFLAGS) $(EFLAGS)
117ifndef DEBUG
118        @echo '*' Stripping $(OUTFILE)
119        @-$(STRIP) $(OUTFILE)
120endif
121
122encode: crypting.c
123        $(CC) crypting.c lib/md5.c $(CFLAGS) -o encode -DCRYPTING_MAIN $(CFLAGS) $(EFLAGS) $(LFLAGS)
124
125decode: encode
126        cp encode decode
127
128ctags: 
129        ctags `find . -name "*.c"` `find . -name "*.h"`
Note: See TracBrowser for help on using the repository browser.