]> git.sesse.net Git - cubemap/blobdiff - Makefile
Use libsystemd to inform systemd accurately about when the service is up and running.
[cubemap] / Makefile
index 1234f796017a1c1ce3520c62ba27a6c03c99a2c0..abadaf7fa2de44975af958092cb7ef94572de514 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2,10 +2,10 @@ CC=gcc
 CXX=g++
 INSTALL=install
 PROTOC=protoc
-CXXFLAGS=-Wall -O2 -g -pthread $(shell getconf LFS_CFLAGS)
-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 sa_compare.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
 
@@ -39,6 +39,13 @@ install:
                $(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" \
@@ -47,11 +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
-       sed \
-               -e "s,@prefix@,$(PREFIX),g" \
-               -e "s,@sysconfdir@,$(SYSCONFDIR),g" \
-               cubemap.service.in > $(DESTDIR)$(PREFIX)/lib/systemd/system/cubemap.service
 
 .PHONY: clean install
 .SUFFIXES: