source: Makefile @ 417002e

Last change on this file since 417002e was 417002e, checked in by Wilmer van der Gaast <wilmer@…>, at 2011-03-18T00:57:14Z

systemd stuff (bug #738)

  • Property mode set to 100644
File size: 4.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
[858ea01]12objects = 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 $(OTR_BI) query.o root_commands.o set.o storage.o $(STORAGE_OBJS)
[3063f81]13headers = 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]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)
28
[417002e]29all: $(OUTFILE) $(OTR_PI) systemd
[513a323]30        $(MAKE) -C doc
[b7d3cc34]31
[cdb92c5]32uninstall: 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
[417002e]35install: install-bin install-doc install-plugins install-systemd
[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
[417002e]40.PHONY:   install   install-bin   install-etc   install-doc install-plugins install-systemd \
[b7d3cc34]41        uninstall uninstall-bin uninstall-etc uninstall-doc \
42        all clean distclean tar $(subdirs)
43
44Makefile.settings:
45        @echo
46        @echo Run ./configure to create Makefile.settings, then rerun make
47        @echo
48
49clean: $(subdirs)
[7c9db24]50        rm -f *.o $(OUTFILE) core utils/bitlbeed
[66b9e86e]51        $(MAKE) -C tests clean
[b7d3cc34]52
53distclean: clean $(subdirs)
[b0a89cc]54        rm -rf .depend
[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 {} \;
[b0a89cc]57        @# May still be present in dirs of disabled protocols.
[b41d5d2]58        -find . -name .depend -exec rm -rf {} \;
[dcf0f3e]59        $(MAKE) -C tests distclean
[b7d3cc34]60
[66b9e86e]61check: all
[c2fa827]62        $(MAKE) -C tests
63
[66b9e86e]64gcov: check
65        gcov *.c
66
[348c11b]67lcov: check
68        lcov --directory . --capture --output-file bitlbee.info
69        genhtml -o coverage bitlbee.info
70
[b7d3cc34]71install-doc:
72        $(MAKE) -C doc install
73
74uninstall-doc:
75        $(MAKE) -C doc uninstall
76
77install-bin:
78        mkdir -p $(DESTDIR)$(BINDIR)
79        install -m 0755 $(OUTFILE) $(DESTDIR)$(BINDIR)/$(OUTFILE)
80
81uninstall-bin:
82        rm -f $(DESTDIR)$(BINDIR)/$(OUTFILE)
83
[cdb92c5]84install-dev:
[e506d6c]85        mkdir -p $(DESTDIR)$(INCLUDEDIR)
[4af3050]86        install -m 0644 config.h $(DESTDIR)$(INCLUDEDIR)
87        for i in $(headers); do install -m 0644 $(SRCDIR)$$i $(DESTDIR)$(INCLUDEDIR); done
[e506d6c]88        mkdir -p $(DESTDIR)$(PCDIR)
89        install -m 0644 bitlbee.pc $(DESTDIR)$(PCDIR)
90
[cdb92c5]91uninstall-dev:
92        rm -f $(foreach hdr,$(headers),$(DESTDIR)$(INCLUDEDIR)/$(hdr))
93        -rmdir $(DESTDIR)$(INCLUDEDIR)
[e506d6c]94        rm -f $(DESTDIR)$(PCDIR)/bitlbee.pc
95
[b7d3cc34]96install-etc:
97        mkdir -p $(DESTDIR)$(ETCDIR)
[4af3050]98        install -m 0644 $(SRCDIR)motd.txt $(DESTDIR)$(ETCDIR)/motd.txt
99        install -m 0644 $(SRCDIR)bitlbee.conf $(DESTDIR)$(ETCDIR)/bitlbee.conf
[b7d3cc34]100
101uninstall-etc:
102        rm -f $(DESTDIR)$(ETCDIR)/motd.txt
103        rm -f $(DESTDIR)$(ETCDIR)/bitlbee.conf
104        -rmdir $(DESTDIR)$(ETCDIR)
105
[858ea01]106install-plugins:
107ifdef OTR_PI
108        mkdir -p $(DESTDIR)$(PLUGINDIR)
109        install -m 0755 otr.so $(DESTDIR)$(PLUGINDIR)
110endif
111
[417002e]112systemd:
113ifdef SYSTEMDSYSTEMUNITDIR
114        sed 's|@sbindir@|$(BINDIR)|' init/bitlbee.service.in > init/bitlbee.service
115        sed 's|@sbindir@|$(BINDIR)|' init/bitlbee@.service.in > init/bitlbee@.service
116endif
117
118install-systemd:
119ifdef SYSTEMDSYSTEMUNITDIR
120ifeq ($(USER),root)
121        mkdir -p $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR)
122        install -m 0644 init/bitlbee.service $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR)
123        install -m 0644 init/bitlbee@.service $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR)
124        install -m 0644 init/bitlbee.socket $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR)
125else
126        @echo Not root, so not installing systemd files.
127endif
128endif
129
[b7d3cc34]130tar:
131        fakeroot debian/rules clean || make distclean
132        x=$$(basename $$(pwd)); \
133        cd ..; \
[b0a89cc]134        tar czf $$x.tar.gz --exclude=debian --exclude=.bzr* --exclude=.depend $$x
[b7d3cc34]135
136$(subdirs):
137        @$(MAKE) -C $@ $(MAKECMDGOALS)
138
[858ea01]139$(OTR_PI): %.so: $(SRCDIR)%.c
140        @echo '*' Building plugin $@
141        @$(CC) $(CFLAGS) $(OTRFLAGS) -fPIC -shared $< -o $@
142
[f60079b]143$(objects): %.o: $(SRCDIR)%.c
[b7d3cc34]144        @echo '*' Compiling $<
145        @$(CC) -c $(CFLAGS) $< -o $@
146
147$(objects): Makefile Makefile.settings config.h
148
149$(OUTFILE): $(objects) $(subdirs)
150        @echo '*' Linking $(OUTFILE)
151        @$(CC) $(objects) $(subdirobjs) -o $(OUTFILE) $(LFLAGS) $(EFLAGS)
152ifndef DEBUG
153        @echo '*' Stripping $(OUTFILE)
154        @-$(STRIP) $(OUTFILE)
155endif
156
157ctags: 
158        ctags `find . -name "*.c"` `find . -name "*.h"`
[4fca1db]159
160# Using this as a bogus Make target to test if a GNU-compatible version of
161# make is available.
162helloworld:
163        @echo Hello World
[b0a89cc]164
165-include .depend/*.d
Note: See TracBrowser for help on using the repository browser.