CC=gcc CXX=g++ INSTALL=install PROTOC=protoc CXXFLAGS=-Wall -O2 -g -pthread $(shell getconf LFS_CFLAGS) LDLIBS=-lprotobuf -pthread -lrt 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 %.pb.cc %.pb.h : %.proto $(PROTOC) --cpp_out=. $< %.o: %.cpp state.pb.h $(CXX) -MMD -MP $(CPPFLAGS) $(CXXFLAGS) -o $@ -c $< %.pb.o: %.pb.cc $(CXX) -MMD -MP $(CPPFLAGS) $(CXXFLAGS) -o $@ -c $< cubemap: $(OBJS) $(CXX) -o cubemap $(OBJS) $(LDLIBS) $(LDFLAGS) DEPS=$(OBJS:.o=.d) -include $(DEPS) clean: $(RM) cubemap $(OBJS) $(DEPS) state.pb.h state.pb.cc PREFIX=/usr/local SYSCONFDIR=/etc LOCALSTATEDIR=/var install: $(INSTALL) -m 755 -o root -g root -d \ $(DESTDIR)$(PREFIX)/bin \ $(DESTDIR)$(PREFIX)/share/man/man1 \ $(DESTDIR)$(SYSCONFDIR) \ $(DESTDIR)$(LOCALSTATEDIR)/lib/cubemap \ $(DESTDIR)$(LOCALSTATEDIR)/log/cubemap \ $(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" \ -e "s,access\.log,$(LOCALSTATEDIR)/log/cubemap/\0,g" \ -e "s,cubemap\.log,$(LOCALSTATEDIR)/log/cubemap/\0,g" \ -e 's,^stream,#\0,g' \ -e 's,^udpstream,#\0,g' \ cubemap.config.sample > $(DESTDIR)$(SYSCONFDIR)/cubemap.config .PHONY: clean install .SUFFIXES: