source: Makefile @ d2394be

Last change on this file since d2394be 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
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
[8e6ecfe]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
[ebe2c5e]13headers = $(wildcard $(_SRCDIR_)*.h $(_SRCDIR_)lib/*.h $(_SRCDIR_)protocols/*.h)
[84b045d]14subdirs = lib protocols
[b7d3cc34]15
[e252d8c]16OUTFILE = bitlbee
[d1d6776]17
[b7d3cc34]18# Expansion of variables
19subdirobjs = $(foreach dir,$(subdirs),$(dir)/$(dir).o)
20
[a949b43]21all: $(OUTFILE) $(OTR_PI) doc systemd
[b7d3cc34]22
[4b53c65]23doc:
[a85a8ab]24ifdef DOC
[4b53c65]25        $(MAKE) -C doc
[a85a8ab]26endif
[4b53c65]27
[cdb92c5]28uninstall: uninstall-bin uninstall-doc
[b7d3cc34]29        @echo -e '\nmake uninstall does not remove files in '$(DESTDIR)$(ETCDIR)', you can use make uninstall-etc to do that.\n'
30
[c564e25]31install: install-bin install-doc install-plugins
[3e6cdb6]32        @echo
33        @echo Installed successfully
34        @echo
[8ca172f]35ifndef SYSTEMDSYSTEMUNITDIR
[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
[8ca172f]37endif
[b7d3cc34]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
[c564e25]39ifdef SYSTEMDSYSTEMUNITDIR
40        @echo If you want to start BitlBee using systemd, try \"make install-systemd\".
41endif
[3e6cdb6]42        @echo To be able to compile third party plugins, run \"make install-dev\"
[b7d3cc34]43        @echo
44
[3e6cdb6]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 \
[4b53c65]47        all clean distclean tar $(subdirs) doc
[b7d3cc34]48
49Makefile.settings:
50        @echo
51        @echo Run ./configure to create Makefile.settings, then rerun make
52        @echo
53
54clean: $(subdirs)
[c14959d]55        rm -f *.o $(OUTFILE) core utils/bitlbeed init/bitlbee*.service
[66b9e86e]56        $(MAKE) -C tests clean
[b7d3cc34]57
58distclean: clean $(subdirs)
[b0a89cc]59        rm -rf .depend
[b3c467b]60        rm -f Makefile.settings config.h bitlbee.pc
[34c0e90]61        find . -name 'DEADJOE' -o -name '*.orig' -o -name '*.rej' -o -name '*~' -exec rm -f {} \;
[b0a89cc]62        @# May still be present in dirs of disabled protocols.
[b41d5d2]63        -find . -name .depend -exec rm -rf {} \;
[dcf0f3e]64        $(MAKE) -C tests distclean
[b7d3cc34]65
[66b9e86e]66check: all
[c2fa827]67        $(MAKE) -C tests
68
[66b9e86e]69gcov: check
70        gcov *.c
71
[348c11b]72lcov: check
73        lcov --directory . --capture --output-file bitlbee.info
74        genhtml -o coverage bitlbee.info
75
[b7d3cc34]76install-doc:
[a85a8ab]77ifdef DOC
[b7d3cc34]78        $(MAKE) -C doc install
[a85a8ab]79endif
[b7d3cc34]80
81uninstall-doc:
[a85a8ab]82ifdef DOC
[b7d3cc34]83        $(MAKE) -C doc uninstall
[a85a8ab]84endif
[b7d3cc34]85
86install-bin:
[57da960]87        mkdir -p $(DESTDIR)$(SBINDIR)
[ba3506e]88        $(INSTALL) -m 0755 $(OUTFILE) $(DESTDIR)$(SBINDIR)/$(OUTFILE)
[54b2a36]89ifdef IMPLIB
90        # import library for cygwin
[e199620]91        mkdir -p $(DESTDIR)$(LIBDIR)
[54b2a36]92        $(INSTALL) -m 0644 $(IMPLIB) $(DESTDIR)$(LIBDIR)/$(IMPLIB)
93endif
[b7d3cc34]94
95uninstall-bin:
[57da960]96        rm -f $(DESTDIR)$(SBINDIR)/$(OUTFILE)
[54b2a36]97ifdef IMPLIB
98        rm -f $(DESTDIR)$(LIBDIR)/$(IMPLIB)
99endif
[b7d3cc34]100
[cdb92c5]101install-dev:
[e506d6c]102        mkdir -p $(DESTDIR)$(INCLUDEDIR)
[ba3506e]103        $(INSTALL) -m 0644 config.h $(DESTDIR)$(INCLUDEDIR)
[ebe2c5e]104        for i in $(headers); do $(INSTALL) -m 0644 $$i $(DESTDIR)$(INCLUDEDIR); done
[e506d6c]105        mkdir -p $(DESTDIR)$(PCDIR)
[ba3506e]106        $(INSTALL) -m 0644 bitlbee.pc $(DESTDIR)$(PCDIR)
[e506d6c]107
[cdb92c5]108uninstall-dev:
109        rm -f $(foreach hdr,$(headers),$(DESTDIR)$(INCLUDEDIR)/$(hdr))
110        -rmdir $(DESTDIR)$(INCLUDEDIR)
[e506d6c]111        rm -f $(DESTDIR)$(PCDIR)/bitlbee.pc
112
[b7d3cc34]113install-etc:
114        mkdir -p $(DESTDIR)$(ETCDIR)
[ba3506e]115        $(INSTALL) -m 0644 $(_SRCDIR_)motd.txt $(DESTDIR)$(ETCDIR)/motd.txt
116        $(INSTALL) -m 0644 $(_SRCDIR_)bitlbee.conf $(DESTDIR)$(ETCDIR)/bitlbee.conf
[b7d3cc34]117
118uninstall-etc:
119        rm -f $(DESTDIR)$(ETCDIR)/motd.txt
120        rm -f $(DESTDIR)$(ETCDIR)/bitlbee.conf
121        -rmdir $(DESTDIR)$(ETCDIR)
122
[a949b43]123install-plugins: install-plugin-otr
[57da960]124
125install-plugin-otr:
[858ea01]126ifdef OTR_PI
127        mkdir -p $(DESTDIR)$(PLUGINDIR)
[ba3506e]128        $(INSTALL) -m 0755 otr.so $(DESTDIR)$(PLUGINDIR)
[858ea01]129endif
[57da960]130
[417002e]131systemd:
132ifdef SYSTEMDSYSTEMUNITDIR
[0edb57f]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
[417002e]136endif
137
[a6c59bb]138install-systemd: systemd
[417002e]139ifdef SYSTEMDSYSTEMUNITDIR
140        mkdir -p $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR)
[ba3506e]141        $(INSTALL) -m 0644 init/bitlbee.service $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR)
142        $(INSTALL) -m 0644 init/bitlbee@.service $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR)
[0edb57f]143        $(INSTALL) -m 0644 $(_SRCDIR_)init/bitlbee.socket $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR)
[417002e]144else
[ebe2c5e]145        @echo SYSTEMDSYSTEMUNITDIR not set, not installing systemd unit files.
[417002e]146endif
147
[8ca172f]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
[b7d3cc34]154tar:
155        fakeroot debian/rules clean || make distclean
156        x=$$(basename $$(pwd)); \
157        cd ..; \
[61d21e5b]158        tar czf $$x.tar.gz --exclude=debian --exclude=.git* --exclude=.depend $$x
[b7d3cc34]159
160$(subdirs):
[65d0dfd]161        $(MAKE) -C $@ $(MAKECMDGOALS)
[b7d3cc34]162
[7fa5c19]163$(OTR_PI): %.so: $(_SRCDIR_)%.c
[858ea01]164        @echo '*' Building plugin $@
[65d0dfd]165        $(VERBOSE) $(CC) $(CFLAGS) -fPIC -shared $(LDFLAGS) $< -o $@ $(OTRFLAGS)
[858ea01]166
[7fa5c19]167$(objects): %.o: $(_SRCDIR_)%.c
[b7d3cc34]168        @echo '*' Compiling $<
[65d0dfd]169        $(VERBOSE) $(CC) -c $(CFLAGS) $(CFLAGS_BITLBEE) $< -o $@
[b7d3cc34]170
171$(objects): Makefile Makefile.settings config.h
172
173$(OUTFILE): $(objects) $(subdirs)
174        @echo '*' Linking $(OUTFILE)
[65d0dfd]175        $(VERBOSE) $(CC) $(objects) $(subdirobjs) -o $(OUTFILE) $(LDFLAGS_BITLBEE) $(LDFLAGS) $(EFLAGS)
[2a1c27f]176ifneq ($(firstword $(STRIP)), \#)
[b7d3cc34]177        @echo '*' Stripping $(OUTFILE)
[65d0dfd]178        $(VERBOSE) -$(STRIP) $(OUTFILE)
[b7d3cc34]179endif
180
181ctags: 
182        ctags `find . -name "*.c"` `find . -name "*.h"`
[4fca1db]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
[b0a89cc]188
[4b53c65]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
[b0a89cc]196-include .depend/*.d
[a0c6fc5]197# DO NOT DELETE
Note: See TracBrowser for help on using the repository browser.