cc1c9b
build system: added library version support.
@@ -70,6 +70,7 @@ include $(PROJECT_DIR)/sysinfo/compiler/$(COMPILER).mk
|
|
70
70
|
include $(PROJECT_DIR)/sysinfo/toolchain/$(TOOLCHAIN).mk
|
71
71
|
|
72
72
|
include $(PROJECT_DIR)/project/defs.mk
|
73
|
+
include $(PROJECT_DIR)/project/version.mk
|
73
74
|
include $(PROJECT_DIR)/project/tree.mk
|
74
75
|
include $(PROJECT_DIR)/project/depends.mk
|
75
76
|
include $(PROJECT_DIR)/project/headers.mk
|
@@ -89,7 +90,7 @@ src/%.lo: $(PROJECT_DIR)/src/%.c $(ALL_HEADERS) host.tag dirs.tag
|
|
89
90
|
src/%.o: $(PROJECT_DIR)/src/%.c $(ALL_HEADERS) host.tag dirs.tag
|
90
91
|
$(CC) -c -o $@ $< $(CFLAGS_STATIC)
|
91
92
|
|
92
|
-
lib/%$(OS_LIB_SUFFIX):
|
93
|
+
lib/%$(OS_LIB_SUFFIX)$(VER_XYZ):
|
93
94
|
$(CC) -shared -o $@ $^ $(LDFLAGS_SHARED)
|
94
95
|
|
95
96
|
lib/%$(OS_ARCHIVE_EXT):
|
@@ -105,13 +106,15 @@ install: install-libs install-headers install-app install-extras
|
|
105
106
|
app: default-app
|
106
107
|
|
107
108
|
|
108
|
-
install-libs: install-shared install-static install-
|
109
|
+
install-libs: install-shared install-static install-libs-extras
|
109
110
|
|
110
111
|
install-headers:shared static
|
111
112
|
mkdir -p $(DESTDIR)$(INCLUDEDIR)/$(PACKAGE)
|
112
113
|
cp $(API_HEADERS) $(DESTDIR)$(INCLUDEDIR)/$(PACKAGE)
|
113
114
|
|
114
|
-
install-shared: shared install-
|
115
|
+
install-shared: shared install-lib install-soname install-solink
|
116
|
+
|
117
|
+
install-lib: shared
|
115
118
|
mkdir -p $(DESTDIR)$(LIBDIR)
|
116
119
|
cp $(SHARED_LIB) $(DESTDIR)$(LIBDIR)
|
117
120
|
|
@@ -125,12 +128,16 @@ install-app: app install-app-extras
|
|
125
128
|
|
126
129
|
|
127
130
|
|
128
|
-
shared: shared-lib shared-
|
131
|
+
shared: shared-lib shared-soname shared-solink
|
129
132
|
|
130
133
|
static: static-lib
|
131
134
|
|
132
135
|
shared-lib: shared-objs $(SHARED_LIB)
|
133
136
|
|
137
|
+
shared-soname: shared-lib $(SHARED_SONAME)
|
138
|
+
|
139
|
+
shared-solink: shared-lib $(SHARED_SOLINK)
|
140
|
+
|
134
141
|
static-lib: static-objs $(STATIC_LIB)
|
135
142
|
|
136
143
|
shared-implib: shared-lib
|
@@ -200,6 +207,8 @@ clean:
|
|
200
207
|
rm -f $(STATIC_OBJS)
|
201
208
|
rm -f $(APP_OBJS)
|
202
209
|
rm -f $(SHARED_LIB)
|
210
|
+
rm -f $(SHARED_SONAME)
|
211
|
+
rm -f $(SHARED_SOLINK)
|
203
212
|
rm -f $(STATIC_LIB)
|
204
213
|
rm -f $(SHARED_IMPLIB)
|
205
214
|
rm -f $(APP)
|
@@ -256,6 +265,7 @@ clean:
|
|
256
265
|
.display-flags:
|
257
266
|
@echo CFLAGS_DEBUG:' '$(CFLAGS_DEBUG)
|
258
267
|
@echo CFLAGS_COMMON:' '$(CFLAGS_COMMON)
|
268
|
+
@echo CFLAGS_VERSION:' '$(CFLAGS_VERSION)
|
259
269
|
@echo CFLAGS_CMDLINE:' '$(CFLAGS_CMDLINE)
|
260
270
|
@echo CFLAGS_CONFIG:' '$(CFLAGS_CONFIG)
|
261
271
|
@echo CFLAGS_SYSROOT:' '$(CFLAGS_SYSROOT)
|
@@ -14,9 +14,16 @@ APP_OBJS = $(APP_SRCS:.c=.o)
|
|
14
14
|
SHARED_OBJS = $(COMMON_LOBJS) $(ARCH_LOBJS)
|
15
15
|
STATIC_OBJS = $(COMMON_OBJS) $(ARCH_OBJS)
|
16
16
|
|
17
|
-
|
18
|
-
|
17
|
+
DSO_VER = $(OS_LIB_PREFIX)$(PACKAGE)$(OS_LIB_SUFFIX)$(VER_XYZ)
|
18
|
+
DSO_SONAME = $(OS_LIB_PREFIX)$(PACKAGE)$(OS_LIB_SUFFIX)$(VER_SONAME)
|
19
|
+
DSO_SOLINK = $(OS_LIB_PREFIX)$(PACKAGE)$(OS_LIB_SUFFIX)
|
20
|
+
|
21
|
+
SHARED_LIB = lib/$(DSO_VER)
|
22
|
+
SHARED_SONAME = lib/$(DSO_SONAME)
|
23
|
+
SHARED_SOLINK = lib/$(DSO_SOLINK)
|
24
|
+
|
19
25
|
SHARED_IMPLIB = lib/$(OS_LIB_PREFIX)$(PACKAGE)$(OS_IMPLIB_EXT)
|
26
|
+
STATIC_LIB = lib/$(OS_LIB_PREFIX)$(PACKAGE)$(OS_ARCHIVE_EXT)
|
20
27
|
|
21
28
|
APP = bin/$(OS_APP_PREFIX)$(NICKNAME)$(OS_APP_SUFFIX)
|
22
29
|
DEFAULT_APP = bin/$(OS_APP_PREFIX)$(NICKNAME)-default$(OS_APP_SUFFIX)
|
@@ -25,7 +32,8 @@ STATIC_APP = bin/$(OS_APP_PREFIX)$(NICKNAME)-static$(OS_APP_SUFFIX)
|
|
25
32
|
|
26
33
|
CFLAGS = $(CFLAGS_DEBUG) $(CFLAGS_CONFIG) $(CFLAGS_SYSROOT) \
|
27
34
|
$(CFLAGS_COMMON) $(CFLAGS_CMDLINE) $(CFLAGS_HOST) \
|
28
|
-
$(CFLAGS_PATH) $(CFLAGS_OS) $(CFLAGS_SITE)
|
35
|
+
$(CFLAGS_PATH) $(CFLAGS_OS) $(CFLAGS_SITE) \
|
36
|
+
$(CFLAGS_VERSION)
|
29
37
|
|
30
38
|
CFLAGS_SHARED = $(CFLAGS) $(CFLAGS_PIC) $(CFLAGS_SHARED_ATTR)
|
31
39
|
CFLAGS_STATIC = $(CFLAGS) $(CFLAGS_OBJ) $(CFLAGS_STATIC_ATTR)
|
@@ -35,6 +43,9 @@ LDFLAGS_SHARED = $(LDFLAGS_DEBUG) $(LDFLAGS_CONFIG) $(LDFLAGS_SYSROOT) \
|
|
35
43
|
$(LDFLAGS_COMMON) $(LDFLAGS_CMDLINE) $(LDFLAGS_HOST) \
|
36
44
|
$(LDFLAGS_PATH) $(SHARED_LIB_DEPS) $(LDFLAGS_LAST)
|
37
45
|
|
46
|
+
LDFLAGS_SHARED += -Wl,-soname
|
47
|
+
LDFLAGS_SHARED += -Wl,$(DSO_SONAME)
|
48
|
+
|
38
49
|
LDFLAGS_APP = $(LDFLAGS_DEBUG) $(LDFLAGS_CONFIG) $(LDFLAGS_SYSROOT) \
|
39
50
|
$(LDFLAGS_COMMON) $(LDFLAGS_CMDLINE) $(LDFLAGS_HOST) \
|
40
51
|
$(LDFLAGS_PATH) $(SHARED_APP_DEPS) $(LDFLAGS_LAST)
|
@@ -0,0 +1,42 @@
|
|
1
|
+
include $(PROJECT_DIR)/project/tagver.mk
|
2
|
+
|
3
|
+
CFLAGS_VERSION += -D$(VER_NAMESPACE)_TAG_VER_MAJOR=$(VER_MAJOR)
|
4
|
+
CFLAGS_VERSION += -D$(VER_NAMESPACE)_TAG_VER_MINOR=$(VER_MINOR)
|
5
|
+
CFLAGS_VERSION += -D$(VER_NAMESPACE)_TAG_VER_PATCH=$(VER_PATCH)
|
6
|
+
|
7
|
+
VER_XYZ = .$(VER_MAJOR).$(VER_MINOR).$(VER_PATCH)
|
8
|
+
VER_SONAME = .$(VER_MAJOR)
|
9
|
+
|
10
|
+
# libfoo.so (common)
|
11
|
+
install-solink: install-lib
|
12
|
+
rm -f $@.tmp
|
13
|
+
ln -s $(DSO_VER) $@.tmp
|
14
|
+
mv $@.tmp $(DESTDIR)$(LIBDIR)/$(DSO_SOLINK)
|
15
|
+
|
16
|
+
$(SHARED_SOLINK): $(SHARED_LIB)
|
17
|
+
rm -f $@.tmp
|
18
|
+
ln -s $(DSO_VER) $@.tmp
|
19
|
+
mv $@.tmp $@
|
20
|
+
|
21
|
+
# libfoo.so.x (symlink)
|
22
|
+
ifeq ($(OS_SONAME),symlink)
|
23
|
+
$(SHARED_SONAME): $(SHARED_LIB)
|
24
|
+
rm -f $@.tmp
|
25
|
+
ln -s $(DSO_VER) $@.tmp
|
26
|
+
mv $@.tmp $@
|
27
|
+
|
28
|
+
install-soname: install-lib
|
29
|
+
rm -f $@.tmp
|
30
|
+
ln -s $(DSO_VER) $@.tmp
|
31
|
+
mv $@.tmp $(DESTDIR)$(LIBDIR)/$(DSO_SONAME)
|
32
|
+
endif
|
33
|
+
|
34
|
+
|
35
|
+
# libfoo.so.x (copy)
|
36
|
+
ifeq ($(OS_SONAME),copy)
|
37
|
+
install-soname: install-lib
|
38
|
+
cp $(SHARED_LIB) $(DESTDIR)$(LIBDIR)/$(DSO_SONAME)
|
39
|
+
|
40
|
+
$(SHARED_SONAME): $(SHARED_LIB)
|
41
|
+
cp $(SHARED_LIB) $(SHARED_SONAME)
|
42
|
+
endif
|
@@ -6,5 +6,6 @@ OS_LIB_SUFFIX = .so
|
|
6
6
|
OS_IMPLIB_EXT = .invalid
|
7
7
|
OS_LIBDEF_EXT = .invalid
|
8
8
|
OS_ARCHIVE_EXT = .a
|
9
|
+
OS_SONAME = symlink
|
9
10
|
|
10
11
|
|
@@ -6,5 +6,6 @@ OS_LIB_SUFFIX = .so
|
|
6
6
|
OS_IMPLIB_EXT = .invalid
|
7
7
|
OS_LIBDEF_EXT = .invalid
|
8
8
|
OS_ARCHIVE_EXT = .a
|
9
|
+
OS_SONAME = symlink
|
9
10
|
|
10
11
|
|
@@ -6,6 +6,7 @@ OS_LIB_SUFFIX = .dylib
|
|
6
6
|
OS_IMPLIB_EXT = .invalid
|
7
7
|
OS_LIBDEF_EXT = .invalid
|
8
8
|
OS_ARCHIVE_EXT = .a
|
9
|
+
OS_SONAME = symlink
|
9
10
|
|
10
11
|
CFLAGS_OS += -D_DARWIN_C_SOURCE
|
11
12
|
|
@@ -6,5 +6,6 @@ OS_LIB_SUFFIX = .so
|
|
6
6
|
OS_IMPLIB_EXT = .invalid
|
7
7
|
OS_LIBDEF_EXT = .invalid
|
8
8
|
OS_ARCHIVE_EXT = .a
|
9
|
+
OS_SONAME = symlink
|
9
10
|
|
10
11
|
|
@@ -6,6 +6,7 @@ OS_LIB_SUFFIX = .so
|
|
6
6
|
OS_IMPLIB_EXT = .lib.a
|
7
7
|
OS_LIBDEF_EXT = .so.def
|
8
8
|
OS_ARCHIVE_EXT = .a
|
9
|
+
OS_SONAME = copy
|
9
10
|
|
10
11
|
LDFLAGS_CONFIG += -mout-implib
|
11
12
|
|
@@ -6,6 +6,7 @@ OS_LIB_SUFFIX = .dll
|
|
6
6
|
OS_IMPLIB_EXT = .dll.a
|
7
7
|
OS_LIBDEF_EXT = .def
|
8
8
|
OS_ARCHIVE_EXT = .a
|
9
|
+
OS_SONAME = copy
|
9
10
|
|
10
11
|
CFLAGS_PIC =
|
11
12
|
LDFLAGS_CONFIG += -Wl,--out-implib,$(SHARED_IMPLIB)
|