]> git.sesse.net Git - cubemap/blobdiff - Makefile
Use libsystemd to inform systemd accurately about when the service is up and running.
[cubemap] / Makefile
index eef4a38dd6ae4abc3da13d8ae3ff142e8f3f97c8..abadaf7fa2de44975af958092cb7ef94572de514 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2,10 +2,10 @@ CC=gcc
 CXX=g++
 INSTALL=install
 PROTOC=protoc
-CXXFLAGS=-Wall -O2 -g -pthread
-LDLIBS=-lprotobuf -pthread -lrt
+CXXFLAGS=-Wall -O2 -g -pthread $(shell getconf LFS_CFLAGS) $(shell pkg-config --cflags libsystemd)
+LDLIBS=-lprotobuf -pthread -lrt $(shell pkg-config --libs libsystemd)
 
-OBJS=main.o client.o server.o stream.o udpstream.o serverpool.o mutexlock.o input.o input_stats.o httpinput.o udpinput.o parse.o config.o markpool.o acceptor.o stats.o accesslog.o thread.o util.o log.o metacube2.o state.pb.o
+OBJS=main.o client.o server.o stream.o udpstream.o serverpool.o mutexlock.o input.o input_stats.o httpinput.o udpinput.o parse.o config.o acceptor.o stats.o accesslog.o thread.o util.o log.o metacube2.o sa_compare.o state.pb.o
 
 all: cubemap
 
@@ -35,9 +35,17 @@ install:
                $(DESTDIR)$(SYSCONFDIR) \
                $(DESTDIR)$(LOCALSTATEDIR)/lib/cubemap \
                $(DESTDIR)$(LOCALSTATEDIR)/log/cubemap \
-               $(DESTDIR)$(PREFIX)/share/munin/plugins
+               $(DESTDIR)$(PREFIX)/share/munin/plugins \
+               $(DESTDIR)$(PREFIX)/lib/systemd/system
        $(INSTALL) -m 755 -o root -g root cubemap $(DESTDIR)$(PREFIX)/bin/cubemap
        $(INSTALL) -m 755 -o root -g root munin/cubemap munin/cubemap_input $(DESTDIR)$(PREFIX)/share/munin/plugins/
+       gzip -c cubemap.1 > $(DESTDIR)$(PREFIX)/share/man/man1/cubemap.1.gz
+       sed \
+               -e "s,@prefix@,$(PREFIX),g" \
+               -e "s,@sysconfdir@,$(SYSCONFDIR),g" \
+               cubemap.service.in > $(DESTDIR)$(PREFIX)/lib/systemd/system/cubemap.service
+       # Make sure we don't overwrite an existing configuration.
+       test ! -f $(DESTDIR)$(SYSCONFDIR)/cubemap.config
        sed \
                -e "s,cubemap\.stats,$(LOCALSTATEDIR)/lib/cubemap/\0,g" \
                -e "s,cubemap-input\.stats,$(LOCALSTATEDIR)/lib/cubemap/\0,g" \
@@ -46,7 +54,6 @@ install:
                -e 's,^stream,#\0,g' \
                -e 's,^udpstream,#\0,g' \
                cubemap.config.sample > $(DESTDIR)$(SYSCONFDIR)/cubemap.config
-       gzip -c cubemap.1 > $(DESTDIR)$(PREFIX)/share/man/man1/cubemap.1.gz
 
 .PHONY: clean install
 .SUFFIXES: