diff --git a/src/Makefile b/src/Makefile index af00d80..52063b8 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,8 +1,10 @@ +PREFIX ?= /usr/local CXX ?= g++ CXXFLAGS ?= -O3 -fPIC -AR = ar +AR ?= ar +PROTOC ?= protoc all: libosmpbf.a ../include/osmpbf/fileformat.pb.h ../include/osmpbf/osmformat.pb.h @@ -13,16 +15,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 $(PREFIX)/lib + install -m 644 libosmpbf.a $(PREFIX)/lib + install -m 755 -d $(PREFIX)/include/osmpbf + install -m 644 ../include/osmpbf/osmpbf.h $(PREFIX)/include/osmpbf + install -m 644 ../include/osmpbf/fileformat.pb.h $(PREFIX)/include/osmpbf + install -m 644 ../include/osmpbf/osmformat.pb.h $(PREFIX)/include/osmpbf clean: rm -f *.pb.h *.pb.cc *.pb.o libosmpbf.a diff --git a/tools/Makefile b/tools/Makefile index f09499b..654a1c8 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -1,17 +1,20 @@ +PREFIX ?= /usr/local CXX ?= g++ CXXFLAGS ?= -g CXXFLAGS += -I../include LDFLAGS += -L../src -pthread -lz -lprotobuf-lite -losmpbf + + all: osmpbf-outline 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 $(PREFIX)/bin + install -m 644 -s osmpbf-outline $(PREFIX)/bin clean: rm -f osmpbf-outline