Skip to content

Commit

Permalink
Build and install a shared library
Browse files Browse the repository at this point in the history
  • Loading branch information
tomhughes committed Jul 22, 2015
1 parent 4edb4f0 commit cfea70c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,21 @@ CXX ?= g++
CXXFLAGS ?= -O3
AR ?= ar
PROTOC ?= protoc
SONAME ?= libosmpbf.so.1
VERSION ?= 1.3.3

CXXFLAGS += -Wall -Wextra -pedantic -Wredundant-decls -Wdisabled-optimization -Wctor-dtor-privacy -Wnon-virtual-dtor -Woverloaded-virtual -Wsign-promo -Wno-long-long

.PHONY: clean install

all: libosmpbf.a ../include/osmpbf/fileformat.pb.h ../include/osmpbf/osmformat.pb.h
all: libosmpbf.a libosmpbf.so ../include/osmpbf/fileformat.pb.h ../include/osmpbf/osmformat.pb.h

libosmpbf.a: fileformat.pb.o osmformat.pb.o
$(AR) -cr $@ fileformat.pb.o osmformat.pb.o

libosmpbf.so: fileformat.pb.o osmformat.pb.o
$(CXX) -shared -Wl,-soname,$(SONAME) -o $@ fileformat.pb.o osmformat.pb.o

%.pb.o: %.pb.cc
$(CXX) $(CXXFLAGS) -fPIC -c -o $@ $<

Expand All @@ -26,6 +31,9 @@ libosmpbf.a: fileformat.pb.o osmformat.pb.o
install:
install -m 755 -d $(DESTDIR)$(LIBDIR)
install -m 644 libosmpbf.a $(DESTDIR)$(LIBDIR)
install -m 755 libosmpbf.so $(DESTDIR)$(LIBDIR)/libosmpbf.so.$(VERSION)
ln -s libosmpbf.so.$(VERSION) $(DESTDIR)$(LIBDIR)/$(SONAME)
ln -s libosmpbf.so.$(VERSION) $(DESTDIR)$(LIBDIR)/libosmpbf.so
install -m 755 -d $(DESTDIR)$(PREFIX)/include/osmpbf
install -m 644 ../include/osmpbf/osmpbf.h $(DESTDIR)$(PREFIX)/include/osmpbf
install -m 644 ../include/osmpbf/fileformat.pb.h $(DESTDIR)$(PREFIX)/include/osmpbf
Expand Down

0 comments on commit cfea70c

Please sign in to comment.