source: Makefile @ 7342cae

Last change on this file since 7342cae was 8ca172f, checked in by GitHub <noreply@…>, at 2022-12-04T17:09:00Z

Systemd Enhancements: Create user and directory automatically (#163)

  • configure: Simplify check for systemd, allow to request systemd support

Signed-off-by: Björn Bidar <bjorn.bidar@…>

  • configure: Add helper to be compatible with old and new systemd pc vars

Re:
https://github.com/systemd/systemd/commit/4908de44b0a0409f84a7cdc5641b114d6ce8ba03

Signed-off-by: Björn Bidar <bjorn.bidar@…>

  • systemd: Support systemd-sysusers.d

Signed-off-by: Björn Bidar <bjorn.bidar@…>

  • systemd: Define StateDirectory, create biltbee directory automatically

Signed-off-by: Björn Bidar <bjorn.bidar@…>

  • systemd: Also listen to /run/bitlbee/socket

Signed-off-by: Björn Bidar <bjorn.bidar@…>

  • systemd: Create RuntimeDirectory automatically

Signed-off-by: Björn Bidar <bjorn.bidar@…>

  • systemd: Also run regular systemd service as user

Signed-off-by: Björn Bidar <bjorn.bidar@…>

Signed-off-by: Björn Bidar <bjorn.bidar@…>

  • Property mode set to 100644
File size: 5.8 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 = bitlbee.o dcc.o help.o ipc.o irc.o irc_im.o irc_cap.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) auth.o $(AUTH_OBJS) unix.o conf.o log.o
13headers = $(wildcard $(_SRCDIR_)*.h $(_SRCDIR_)lib/*.h $(_SRCDIR_)protocols/*.h)
14subdirs = lib protocols
15
16OUTFILE = bitlbee
17
18# Expansion of variables
19subdirobjs = $(foreach dir,$(subdirs),$(dir)/$(dir).o)
20
21all: $(OUTFILE) $(OTR_PI) doc systemd
22
23doc:
24ifdef DOC
25        $(MAKE) -C doc
26endif
27
28uninstall: uninstall-bin uninstall-doc
29        @echo -e '\nmake uninstall does not remove files in '$(DESTDIR)$(ETCDIR)', you can use make uninstall-etc to do that.\n'
30
31install: install-bin install-doc install-plugins
32        @echo
33        @echo Installed successfully
34        @echo
35ifndef SYSTEMDSYSTEMUNITDIR
36        @if ! [ -d $(DESTDIR)$(CONFIG) ]; then echo -e '\nThe configuration directory $(DESTDIR)$(CONFIG) does not exist yet, don'\''t forget to create it!'; fi
37endif
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
39ifdef SYSTEMDSYSTEMUNITDIR
40        @echo If you want to start BitlBee using systemd, try \"make install-systemd\".
41endif
42        @echo To be able to compile third party plugins, run \"make install-dev\"
43        @echo
44
45.PHONY:   install   install-bin   install-etc   install-doc install-plugins install-systemd install-dev \
46        uninstall uninstall-bin uninstall-etc uninstall-doc uninstall-etc \
47        all clean distclean tar $(subdirs) doc
48
49Makefile.settings:
50        @echo
51        @echo Run ./configure to create Makefile.settings, then rerun make
52        @echo
53
54clean: $(subdirs)
55        rm -f *.o $(OUTFILE) core utils/bitlbeed init/bitlbee*.service
56        $(MAKE) -C tests clean
57
58distclean: clean $(subdirs)
59        rm -rf .depend
60        rm -f Makefile.settings config.h bitlbee.pc
61        find . -name 'DEADJOE' -o -name '*.orig' -o -name '*.rej' -o -name '*~' -exec rm -f {} \;
62        @# May still be present in dirs of disabled protocols.
63        -find . -name .depend -exec rm -rf {} \;
64        $(MAKE) -C tests distclean
65
66check: all
67        $(MAKE) -C tests
68
69gcov: check
70        gcov *.c
71
72lcov: check
73        lcov --directory . --capture --output-file bitlbee.info
74        genhtml -o coverage bitlbee.info
75
76install-doc:
77ifdef DOC
78        $(MAKE) -C doc install
79endif
80
81uninstall-doc:
82ifdef DOC
83        $(MAKE) -C doc uninstall
84endif
85
86install-bin:
87        mkdir -p $(DESTDIR)$(SBINDIR)
88        $(INSTALL) -m 0755 $(OUTFILE) $(DESTDIR)$(SBINDIR)/$(OUTFILE)
89ifdef IMPLIB
90        # import library for cygwin
91        mkdir -p $(DESTDIR)$(LIBDIR)
92        $(INSTALL) -m 0644 $(IMPLIB) $(DESTDIR)$(LIBDIR)/$(IMPLIB)
93endif
94
95uninstall-bin:
96        rm -f $(DESTDIR)$(SBINDIR)/$(OUTFILE)
97ifdef IMPLIB
98        rm -f $(DESTDIR)$(LIBDIR)/$(IMPLIB)
99endif
100
101install-dev:
102        mkdir -p $(DESTDIR)$(INCLUDEDIR)
103        $(INSTALL) -m 0644 config.h $(DESTDIR)$(INCLUDEDIR)
104        for i in $(headers); do $(INSTALL) -m 0644 $$i $(DESTDIR)$(INCLUDEDIR); done
105        mkdir -p $(DESTDIR)$(PCDIR)
106        $(INSTALL) -m 0644 bitlbee.pc $(DESTDIR)$(PCDIR)
107
108uninstall-dev:
109        rm -f $(foreach hdr,$(headers),$(DESTDIR)$(INCLUDEDIR)/$(hdr))
110        -rmdir $(DESTDIR)$(INCLUDEDIR)
111        rm -f $(DESTDIR)$(PCDIR)/bitlbee.pc
112
113install-etc:
114        mkdir -p $(DESTDIR)$(ETCDIR)
115        $(INSTALL) -m 0644 $(_SRCDIR_)motd.txt $(DESTDIR)$(ETCDIR)/motd.txt
116        $(INSTALL) -m 0644 $(_SRCDIR_)bitlbee.conf $(DESTDIR)$(ETCDIR)/bitlbee.conf
117
118uninstall-etc:
119        rm -f $(DESTDIR)$(ETCDIR)/motd.txt
120        rm -f $(DESTDIR)$(ETCDIR)/bitlbee.conf
121        -rmdir $(DESTDIR)$(ETCDIR)
122
123install-plugins: install-plugin-otr
124
125install-plugin-otr:
126ifdef OTR_PI
127        mkdir -p $(DESTDIR)$(PLUGINDIR)
128        $(INSTALL) -m 0755 otr.so $(DESTDIR)$(PLUGINDIR)
129endif
130
131systemd:
132ifdef SYSTEMDSYSTEMUNITDIR
133        mkdir -p init
134        sed 's|@sbindir@|$(SBINDIR)|' $(_SRCDIR_)init/bitlbee.service.in > init/bitlbee.service
135        sed 's|@sbindir@|$(SBINDIR)|' $(_SRCDIR_)init/bitlbee@.service.in > init/bitlbee@.service
136endif
137
138install-systemd: systemd
139ifdef SYSTEMDSYSTEMUNITDIR
140        mkdir -p $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR)
141        $(INSTALL) -m 0644 init/bitlbee.service $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR)
142        $(INSTALL) -m 0644 init/bitlbee@.service $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR)
143        $(INSTALL) -m 0644 $(_SRCDIR_)init/bitlbee.socket $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR)
144else
145        @echo SYSTEMDSYSTEMUNITDIR not set, not installing systemd unit files.
146endif
147
148ifdef SYSUSERSDIR
149        $(INSTALL) -Dm644 init/bitlbee.sysusers $(DESTDIR)/$(SYSUSERSDIR)/bitlbee.conf
150else
151        @echo SYSUSERSDIR not set, not install sysusers.d files
152endif
153
154tar:
155        fakeroot debian/rules clean || make distclean
156        x=$$(basename $$(pwd)); \
157        cd ..; \
158        tar czf $$x.tar.gz --exclude=debian --exclude=.git* --exclude=.depend $$x
159
160$(subdirs):
161        $(MAKE) -C $@ $(MAKECMDGOALS)
162
163$(OTR_PI): %.so: $(_SRCDIR_)%.c
164        @echo '*' Building plugin $@
165        $(VERBOSE) $(CC) $(CFLAGS) -fPIC -shared $(LDFLAGS) $< -o $@ $(OTRFLAGS)
166
167$(objects): %.o: $(_SRCDIR_)%.c
168        @echo '*' Compiling $<
169        $(VERBOSE) $(CC) -c $(CFLAGS) $(CFLAGS_BITLBEE) $< -o $@
170
171$(objects): Makefile Makefile.settings config.h
172
173$(OUTFILE): $(objects) $(subdirs)
174        @echo '*' Linking $(OUTFILE)
175        $(VERBOSE) $(CC) $(objects) $(subdirobjs) -o $(OUTFILE) $(LDFLAGS_BITLBEE) $(LDFLAGS) $(EFLAGS)
176ifneq ($(firstword $(STRIP)), \#)
177        @echo '*' Stripping $(OUTFILE)
178        $(VERBOSE) -$(STRIP) $(OUTFILE)
179endif
180
181ctags: 
182        ctags `find . -name "*.c"` `find . -name "*.h"`
183
184# Using this as a bogus Make target to test if a GNU-compatible version of
185# make is available.
186helloworld:
187        @echo Hello World
188
189# Check if we can load the helpfile. (This fails if some article is >1KB.)
190# If print returns a NULL pointer, the file is unusable.
191testhelp: doc
192        gdb --eval-command='b main' --eval-command='r' \
193            --eval-command='print help_init(&global->helpfile, "doc/user-guide/help.txt")' \
194            $(OUTFILE) < /dev/null
195
196-include .depend/*.d
197# DO NOT DELETE
Note: See TracBrowser for help on using the repository browser.