Skip to content
This repository was archived by the owner on Nov 6, 2022. It is now read-only.

Commit 8ea9532

Browse files
grobianindutny
authored andcommitted
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: #359 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Fedor Indutny <[email protected]>
1 parent 291a32c commit 8ea9532

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

Makefile

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,22 @@
2121
PLATFORM ?= $(shell sh -c 'uname -s | tr "[A-Z]" "[a-z]"')
2222
HELPER ?=
2323
BINEXT ?=
24+
SOLIBNAME = libhttp_parser
25+
SOMAJOR = 2
26+
SOMINOR = 7
27+
SOREV = 1
2428
ifeq (darwin,$(PLATFORM))
25-
SONAME ?= libhttp_parser.2.7.1.dylib
2629
SOEXT ?= dylib
30+
SONAME ?= $(SOLIBNAME).$(SOMAJOR).$(SOMINOR).$(SOEXT)
31+
LIBNAME ?= $(SOLIBNAME).$(SOMAJOR).$(SOMINOR).$(SOREV).$(SOEXT)
2732
else ifeq (wine,$(PLATFORM))
2833
CC = winegcc
2934
BINEXT = .exe.so
3035
HELPER = wine
3136
else
32-
SONAME ?= libhttp_parser.so.2.7.1
3337
SOEXT ?= so
38+
SONAME ?= $(SOLIBNAME).$(SOEXT).$(SOMAJOR).$(SOMINOR)
39+
LIBNAME ?= $(SOLIBNAME).$(SOEXT).$(SOMAJOR).$(SOMINOR).$(SOREV)
3440
endif
3541

3642
CC?=gcc
@@ -102,7 +108,7 @@ libhttp_parser.o: http_parser.c http_parser.h Makefile
102108
$(CC) $(CPPFLAGS_FAST) $(CFLAGS_LIB) -c http_parser.c -o libhttp_parser.o
103109

104110
library: libhttp_parser.o
105-
$(CC) $(LDFLAGS_LIB) -o $(SONAME) $<
111+
$(CC) $(LDFLAGS_LIB) -o $(LIBNAME) $<
106112

107113
package: http_parser.o
108114
$(AR) rcs libhttp_parser.a http_parser.o
@@ -124,13 +130,15 @@ tags: http_parser.c http_parser.h test.c
124130

125131
install: library
126132
$(INSTALL) -D http_parser.h $(INCLUDEDIR)/http_parser.h
127-
$(INSTALL) -D $(SONAME) $(LIBDIR)/$(SONAME)
128-
ln -s $(LIBDIR)/$(SONAME) $(LIBDIR)/libhttp_parser.$(SOEXT)
133+
$(INSTALL) -D $(LIBNAME) $(LIBDIR)/$(LIBNAME)
134+
ln -s $(LIBDIR)/$(LIBNAME) $(LIBDIR)/$(SONAME)
135+
ln -s $(LIBDIR)/$(LIBNAME) $(LIBDIR)/$(SOLIBNAME).$(SOEXT)
129136

130137
install-strip: library
131138
$(INSTALL) -D http_parser.h $(INCLUDEDIR)/http_parser.h
132-
$(INSTALL) -D -s $(SONAME) $(LIBDIR)/$(SONAME)
133-
ln -s $(LIBDIR)/$(SONAME) $(LIBDIR)/libhttp_parser.$(SOEXT)
139+
$(INSTALL) -D -s $(LIBNAME) $(LIBDIR)/$(LIBNAME)
140+
ln -s $(LIBDIR)/$(LIBNAME) $(LIBDIR)/$(SONAME)
141+
ln -s $(LIBDIR)/$(LIBNAME) $(LIBDIR)/$(SOLIBNAME).$(SOEXT)
134142

135143
uninstall:
136144
rm $(INCLUDEDIR)/http_parser.h

0 commit comments

Comments
 (0)