From 8ea9532378291b5a9c27ab61bb5cff336cc396b5 Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Tue, 14 Mar 2017 18:59:47 +0100 Subject: [PATCH] Makefile: set versions for SONAME correctly Raised in issue #356, reduce version number in SONAME to MAJOR.MINOR. While at it, create a symlink the from SONAME to the library, instead of the other way around, and add a (standard) unversioned symlink to the library to aid the ordinary linking process. PR-URL: https://github.com/nodejs/http-parser/pull/359 Reviewed-By: Ben Noordhuis Reviewed-By: Fedor Indutny --- Makefile | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index b2476db..04ec3d3 100644 --- a/Makefile +++ b/Makefile @@ -21,16 +21,22 @@ PLATFORM ?= $(shell sh -c 'uname -s | tr "[A-Z]" "[a-z]"') HELPER ?= BINEXT ?= +SOLIBNAME = libhttp_parser +SOMAJOR = 2 +SOMINOR = 7 +SOREV = 1 ifeq (darwin,$(PLATFORM)) -SONAME ?= libhttp_parser.2.7.1.dylib SOEXT ?= dylib +SONAME ?= $(SOLIBNAME).$(SOMAJOR).$(SOMINOR).$(SOEXT) +LIBNAME ?= $(SOLIBNAME).$(SOMAJOR).$(SOMINOR).$(SOREV).$(SOEXT) else ifeq (wine,$(PLATFORM)) CC = winegcc BINEXT = .exe.so HELPER = wine else -SONAME ?= libhttp_parser.so.2.7.1 SOEXT ?= so +SONAME ?= $(SOLIBNAME).$(SOEXT).$(SOMAJOR).$(SOMINOR) +LIBNAME ?= $(SOLIBNAME).$(SOEXT).$(SOMAJOR).$(SOMINOR).$(SOREV) endif CC?=gcc @@ -102,7 +108,7 @@ libhttp_parser.o: http_parser.c http_parser.h Makefile $(CC) $(CPPFLAGS_FAST) $(CFLAGS_LIB) -c http_parser.c -o libhttp_parser.o library: libhttp_parser.o - $(CC) $(LDFLAGS_LIB) -o $(SONAME) $< + $(CC) $(LDFLAGS_LIB) -o $(LIBNAME) $< package: http_parser.o $(AR) rcs libhttp_parser.a http_parser.o @@ -124,13 +130,15 @@ tags: http_parser.c http_parser.h test.c install: library $(INSTALL) -D http_parser.h $(INCLUDEDIR)/http_parser.h - $(INSTALL) -D $(SONAME) $(LIBDIR)/$(SONAME) - ln -s $(LIBDIR)/$(SONAME) $(LIBDIR)/libhttp_parser.$(SOEXT) + $(INSTALL) -D $(LIBNAME) $(LIBDIR)/$(LIBNAME) + ln -s $(LIBDIR)/$(LIBNAME) $(LIBDIR)/$(SONAME) + ln -s $(LIBDIR)/$(LIBNAME) $(LIBDIR)/$(SOLIBNAME).$(SOEXT) install-strip: library $(INSTALL) -D http_parser.h $(INCLUDEDIR)/http_parser.h - $(INSTALL) -D -s $(SONAME) $(LIBDIR)/$(SONAME) - ln -s $(LIBDIR)/$(SONAME) $(LIBDIR)/libhttp_parser.$(SOEXT) + $(INSTALL) -D -s $(LIBNAME) $(LIBDIR)/$(LIBNAME) + ln -s $(LIBDIR)/$(LIBNAME) $(LIBDIR)/$(SONAME) + ln -s $(LIBDIR)/$(LIBNAME) $(LIBDIR)/$(SOLIBNAME).$(SOEXT) uninstall: rm $(INCLUDEDIR)/http_parser.h