diff --git a/src/Makefile b/src/Makefile index 16c3e97..efff2bd 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,7 +1,9 @@ -CXX = g++ -CXXFLAGS = -O3 -AR = ar +DESTDIR ?= /usr/local +CXX ?= g++ +CXXFLAGS ?= -O3 +AR ?= ar +PROTOC ?= protoc all: libosmpbf.a ../include/osmpbf/fileformat.pb.h ../include/osmpbf/osmformat.pb.h @@ -12,16 +14,16 @@ libosmpbf.a: fileformat.pb.o osmformat.pb.o $(CXX) $(CXXFLAGS) -c -o $@ $< %.pb.cc ../include/osmpbf/%.pb.h: %.proto - protoc --proto_path=. --cpp_out=. $< + $(PROTOC) --proto_path=. --cpp_out=. $< cp *.pb.h ../include/osmpbf/ install: - install -m 755 -g root -o root -d $(DESTDIR)/usr/lib - install -m 644 -g root -o root libosmpbf.a $(DESTDIR)/usr/lib - install -m 755 -g root -o root -d $(DESTDIR)/usr/include/osmpbf - install -m 644 -g root -o root ../include/osmpbf/osmpbf.h $(DESTDIR)/usr/include/osmpbf - install -m 644 -g root -o root ../include/osmpbf/fileformat.pb.h $(DESTDIR)/usr/include/osmpbf - install -m 644 -g root -o root ../include/osmpbf/osmformat.pb.h $(DESTDIR)/usr/include/osmpbf + install -m 755 -d $(DESTDIR)/usr/lib + install -m 644 libosmpbf.a $(DESTDIR)/usr/lib + install -m 755 -d $(DESTDIR)/usr/include/osmpbf + install -m 644 ../include/osmpbf/osmpbf.h $(DESTDIR)/usr/include/osmpbf + install -m 644 ../include/osmpbf/fileformat.pb.h $(DESTDIR)/usr/include/osmpbf + install -m 644 ../include/osmpbf/osmformat.pb.h $(DESTDIR)/usr/include/osmpbf clean: rm -f *.pb.h *.pb.cc *.pb.o libosmpbf.a diff --git a/tools/Makefile b/tools/Makefile index b9fc26b..f175577 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -1,7 +1,8 @@ -CXX = g++ -CXXFLAGS = -g -I../include -LDFLAGS = -L../src -lpthread -lz -lprotobuf-lite -losmpbf +DESTDIR ?= /usr/local +CXX ?= g++ +CXXFLAGS ?= -g -I../include +LDFLAGS ?= -L../src -lpthread -lz -lprotobuf-lite -losmpbf all: osmpbf-outline @@ -9,8 +10,8 @@ osmpbf-outline: osmpbf-outline.cpp $(CXX) $(CXXFLAGS) -o $@ $< $(LDFLAGS) install: - install -m 755 -g root -o root -d $(DESTDIR)/usr/bin - install -m 644 -g root -o root -s osmpbf-outline $(DESTDIR)/usr/bin + install -m 755 -d $(DESTDIR)/usr/bin + install -m 644 -s osmpbf-outline $(DESTDIR)/usr/bin clean: rm -f osmpbf-outline