Provide an install target in the Makefile.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Fri, 16 Aug 2013 09:44:51 +0000 (11:44 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Fri, 16 Aug 2013 09:44:51 +0000 (11:44 +0200)
Based on a patch from Philipp Kern.

Makefile

index f08d8c0..3552fe4 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,6 @@
 CC=gcc
 CXX=g++
+INSTALL=install
 PROTOC=protoc
 CXXFLAGS=-Wall -O2 -g -pthread
 LDLIBS=-lprotobuf -pthread
@@ -24,5 +25,18 @@ DEPS=$(OBJS:.o=.d)
 clean:
        $(RM) cubemap $(OBJS) $(DEPS) state.pb.h state.pb.cc
 
-.PHONY: clean
+PREFIX=/usr
+install:
+       $(INSTALL) -m 755 -o root -g root -d $(DESTDIR)$(PREFIX)/bin $(DESTDIR)/etc $(DESTDIR)/var/lib/cubemap $(DESTDIR)/var/log/cubemap
+       $(INSTALL) -m 755 -o root -g root cubemap $(DESTDIR)$(PREFIX)/bin/cubemap
+       sed \
+               -e 's,cubemap\.stats,/var/lib/cubemap/\0,g' \
+               -e 's,cubemap-input\.stats,/var/lib/cubemap/\0,g' \
+               -e 's,access\.log,/var/log/cubemap/\0,g' \
+               -e 's,cubemap\.log,/var/log/cubemap/\0,g' \
+               -e 's,^stream,#\0,g' \
+               -e 's,^udpstream,#\0,g' \
+               cubemap.config.sample > $(DESTDIR)/etc/cubemap.config
+
+.PHONY: clean install
 .SUFFIXES: