21
21
PLATFORM ?= $(shell sh -c 'uname -s | tr "[A-Z]" "[a-z]"')
22
22
HELPER ?=
23
23
BINEXT ?=
24
+ SOLIBNAME = libhttp_parser
25
+ SOMAJOR = 2
26
+ SOMINOR = 8
27
+ SOREV = 0
24
28
ifeq (darwin,$(PLATFORM ) )
25
- SONAME ?= libhttp_parser.2.7.0.dylib
26
29
SOEXT ?= dylib
30
+ SONAME ?= $(SOLIBNAME ) .$(SOMAJOR ) .$(SOMINOR ) .$(SOEXT )
31
+ LIBNAME ?= $(SOLIBNAME ) .$(SOMAJOR ) .$(SOMINOR ) .$(SOREV ) .$(SOEXT )
27
32
else ifeq (wine,$(PLATFORM))
28
33
CC = winegcc
29
34
BINEXT = .exe.so
30
35
HELPER = wine
31
36
else
32
- SONAME ?= libhttp_parser.so.2.7.0
33
37
SOEXT ?= so
38
+ SONAME ?= $(SOLIBNAME ) .$(SOEXT ) .$(SOMAJOR ) .$(SOMINOR )
39
+ LIBNAME ?= $(SOLIBNAME ) .$(SOEXT ) .$(SOMAJOR ) .$(SOMINOR ) .$(SOREV )
34
40
endif
35
41
36
42
CC? =gcc
@@ -55,11 +61,13 @@ CFLAGS_LIB = $(CFLAGS_FAST) -fPIC
55
61
LDFLAGS_LIB = $(LDFLAGS ) -shared
56
62
57
63
INSTALL ?= install
58
- PREFIX ?= $( DESTDIR ) /usr/local
64
+ PREFIX ?= /usr/local
59
65
LIBDIR = $(PREFIX ) /lib
60
66
INCLUDEDIR = $(PREFIX ) /include
61
67
62
- ifneq (darwin,$(PLATFORM ) )
68
+ ifeq (darwin,$(PLATFORM ) )
69
+ LDFLAGS_LIB += -Wl,-install_name,$(LIBDIR ) /$(SONAME )
70
+ else
63
71
# TODO(bnoordhuis) The native SunOS linker expects -h rather than -soname...
64
72
LDFLAGS_LIB += -Wl,-soname=$(SONAME )
65
73
endif
@@ -102,7 +110,7 @@ libhttp_parser.o: http_parser.c http_parser.h Makefile
102
110
$(CC ) $(CPPFLAGS_FAST ) $(CFLAGS_LIB ) -c http_parser.c -o libhttp_parser.o
103
111
104
112
library : libhttp_parser.o
105
- $(CC ) $(LDFLAGS_LIB ) -o $(SONAME ) $<
113
+ $(CC ) $(LDFLAGS_LIB ) -o $(LIBNAME ) $<
106
114
107
115
package : http_parser.o
108
116
$(AR ) rcs libhttp_parser.a http_parser.o
@@ -123,19 +131,22 @@ tags: http_parser.c http_parser.h test.c
123
131
ctags $^
124
132
125
133
install : library
126
- $(INSTALL ) -D http_parser.h $(INCLUDEDIR ) /http_parser.h
127
- $(INSTALL ) -D $(SONAME ) $(LIBDIR ) /$(SONAME )
128
- ln -s $(LIBDIR ) /$(SONAME ) $(LIBDIR ) /libhttp_parser.$(SOEXT )
134
+ $(INSTALL ) -D http_parser.h $(DESTDIR )$(INCLUDEDIR ) /http_parser.h
135
+ $(INSTALL ) -D $(LIBNAME ) $(DESTDIR )$(LIBDIR ) /$(LIBNAME )
136
+ ln -s $(LIBNAME ) $(DESTDIR )$(LIBDIR ) /$(SONAME )
137
+ ln -s $(LIBNAME ) $(DESTDIR )$(LIBDIR ) /$(SOLIBNAME ) .$(SOEXT )
129
138
130
139
install-strip : library
131
- $(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 )
140
+ $(INSTALL ) -D http_parser.h $(DESTDIR )$(INCLUDEDIR ) /http_parser.h
141
+ $(INSTALL ) -D -s $(LIBNAME ) $(DESTDIR )$(LIBDIR ) /$(LIBNAME )
142
+ ln -s $(LIBNAME ) $(DESTDIR )$(LIBDIR ) /$(SONAME )
143
+ ln -s $(LIBNAME ) $(DESTDIR )$(LIBDIR ) /$(SOLIBNAME ) .$(SOEXT )
134
144
135
145
uninstall :
136
- rm $(INCLUDEDIR ) /http_parser.h
137
- rm $(LIBDIR ) /$(SONAME )
138
- rm $(LIBDIR ) /libhttp_parser.so
146
+ rm $(DESTDIR )$(INCLUDEDIR ) /http_parser.h
147
+ rm $(DESTDIR )$(LIBDIR ) /$(SOLIBNAME ) .$(SOEXT )
148
+ rm $(DESTDIR )$(LIBDIR ) /$(SONAME )
149
+ rm $(DESTDIR )$(LIBDIR ) /$(LIBNAME )
139
150
140
151
clean :
141
152
rm -f * .o * .a tags test test_fast test_g \
0 commit comments