Fixed loading of plug ins when multiple plug in class sets used. Especially H.323...
[pwlib.git] / make / lib.mak
blobf0359e23d996af5bf324b7fedbeeb3bee2ec385a
2 # lib.mak
4 # Make rules for building libraries rather than applications.
6 # Portable Windows Library
8 # Copyright (c) 1993-1998 Equivalence Pty. Ltd.
10 # The contents of this file are subject to the Mozilla Public License
11 # Version 1.0 (the "License"); you may not use this file except in
12 # compliance with the License. You may obtain a copy of the License at
13 # http://www.mozilla.org/MPL/
15 # Software distributed under the License is distributed on an "AS IS"
16 # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
17 # the License for the specific language governing rights and limitations
18 # under the License.
20 # The Original Code is Portable Windows Library.
22 # The Initial Developer of the Original Code is Equivalence Pty. Ltd.
24 # Contributor(s): ______________________________________.
26 # $Log$
27 # Revision 1.38 2004/04/25 10:30:08 rjongbloed
28 # Fixed correct SONAME when using beta versions.
30 # Revision 1.37 2003/09/08 22:13:18 dereksmithies
31 # Fix patch implementation. Thanks to Zygmuntowicz Michal <m.zygmuntowicz@onet.pl>
33 # Revision 1.36 2003/09/08 22:07:41 dereksmithies
34 # Add patch from Zygmuntowicz Michal <m.zygmuntowicz@onet.pl> for Solaris.
35 # Many thanks!!!
37 # Revision 1.35 2003/07/29 12:33:34 csoutheren
38 # Changed to ensure dynamic libraries using pwlib always dynamically link pwlib
40 # Revision 1.34 2003/06/23 06:44:11 csoutheren
41 # Added minor revision into the soname for the libraries as requested by Damien Sandras
43 # Revision 1.33 2003/05/29 09:03:36 rjongbloed
44 # Changed SONAME so includes minor version number to allow for API changes.
46 # Revision 1.32 2003/05/06 09:47:20 robertj
47 # Fixed up MacOSX changes so is compatible with previous "API" not requiring
48 # downstream libraries to change
50 # Revision 1.31 2003/05/06 06:59:12 robertj
51 # Dynamic library support for MacOSX, thanks Hugo Santos
53 # Revision 1.30 2002/11/22 10:14:07 robertj
54 # QNX port, thanks Xiaodan Tang
56 # Revision 1.29 2002/10/17 13:44:27 robertj
57 # Port to RTEMS, thanks Vladimir Nesic.
59 # Revision 1.28 2002/09/26 00:17:48 robertj
60 # Fixed make install to force creation of symlinks, thanks Pierre.
62 # Revision 1.27 2002/08/30 11:42:46 robertj
63 # Added formatting.
64 # Changed alpha & beta sharable library file name convention.
66 # Revision 1.26 2002/02/01 11:11:27 rogerh
67 # Use .$(MAJOR_VERSION) with soname (instead of hard coding .1)
69 # Revision 1.25 2002/01/31 06:55:22 robertj
70 # Removed redundant inclusion of ssl, is already in unix.mak
72 # Revision 1.24 2002/01/27 08:45:50 rogerh
73 # FreeBSD and OpwnBSD use -pthread and not -lpthread
75 # Revision 1.23 2002/01/26 23:57:08 craigs
76 # Changed for GCC 3.0 compatibility, thanks to manty@manty.net
78 # Revision 1.22 2002/01/15 07:47:30 robertj
79 # Fixed previous fix
81 # Revision 1.21 2002/01/14 23:14:29 robertj
82 # Added ENDLDFLAGS to shared library link, thanks Paul a écrit
84 # Revision 1.20 2001/12/18 04:12:08 robertj
85 # Fixed Linux compatibility of previous change for Solaris.
87 # Revision 1.19 2001/12/17 23:33:50 robertj
88 # Solaris 8 porting changes, thanks James Dugal
90 # Revision 1.18 2001/12/05 08:32:06 rogerh
91 # ln -sf complains if the file already exists on Solaris. So do rm -f first
93 # Revision 1.17 2001/12/01 17:41:07 rogerh
94 # Use locall defined compiler binary instead of hard coded gcc
96 # Revision 1.16 2001/11/30 00:37:16 robertj
97 # Fixed incorrect library filename when building static library during shared
98 # library build.
100 # Revision 1.15 2001/11/27 22:42:13 robertj
101 # Changed to make system to better support non-shared library building.
103 # Revision 1.14 2001/07/07 06:51:52 robertj
104 # Added fix to remove shared libraries in make clean, thanks Jac Goudsmit
106 # Revision 1.13 2001/07/03 04:41:25 yurik
107 # Corrections to Jac's submission from 6/28
109 # Revision 1.12 2001/06/30 06:59:06 yurik
110 # Jac Goudsmit from Be submit these changes 6/28. Implemented by Yuri Kiryanov
112 # Revision 1.11 2001/03/23 03:18:01 robertj
113 # Fixed addition of trailing dot at end of release versions of so libraries
114 # caused to removal of the "pl" build type, changing it to a dot.
116 # Revision 1.10 2001/03/14 06:24:55 robertj
117 # Fixed setting of symlinks for shared libraries to be relative paths.
119 # Revision 1.9 2000/05/19 01:26:31 robertj
120 # Added copyright notice
123 ifneq ($(OSTYPE),Darwin)
124 LIBNAME_MAJ = $(LIB_FILENAME).$(MAJOR_VERSION)
125 LIBNAME_MIN = $(LIBNAME_MAJ).$(MINOR_VERSION)
126 ifeq ($(BUILD_TYPE),.)
127 LIBNAME_PAT = $(LIBNAME_MIN).$(BUILD_NUMBER)
128 else
129 LIBNAME_PAT = $(LIBNAME_MIN)-$(BUILD_TYPE)$(BUILD_NUMBER)
130 endif
131 else
132 LIBNAME_MAJ = $(subst .$(LIB_SUFFIX),.$(MAJOR_VERSION).$(LIB_SUFFIX),$(LIB_FILENAME))
133 LIBNAME_MIN = $(subst .$(LIB_SUFFIX),.$(MAJOR_VERSION).$(MINOR_VERSION).$(LIB_SUFFIX),$(LIB_FILENAME))
134 ifeq ($(BUILD_TYPE),.)
135 LIBNAME_PAT = $(subst .$(LIB_SUFFIX),.$(MAJOR_VERSION).$(MINOR_VERSION).$(BUILD_NUMBER).$(LIB_SUFFIX),$(LIB_FILENAME))
136 else
137 LIBNAME_PAT = $(subst .$(LIB_SUFFIX),.$(MAJOR_VERSION).$(MINOR_VERSION)-$(BUILD_TYPE)$(BUILD_NUMBER).$(LIB_SUFFIX),$(LIB_FILENAME))
138 endif
139 endif
141 LIB_SONAME = $(LIBNAME_PAT)
143 CLEAN_FILES += $(LIBDIR)/$(LIBNAME_PAT) $(LIBDIR)/$(LIB_FILENAME) $(LIBDIR)/$(LIBNAME_MAJ) $(LIBDIR)/$(LIBNAME_MIN)
145 ifneq ($(P_SHAREDLIB),1)
146 STATIC_LIB_FILE = $(LIBDIR)/$(LIB_FILENAME)
147 else
148 STATIC_LIB_FILE = $(LIBDIR)/$(subst .$(LIB_SUFFIX),_s.$(STATICLIBEXT),$(LIB_FILENAME))
149 endif
151 $(LIBDIR)/$(LIB_FILENAME) : $(TARGETLIB)
153 ifeq ($(P_SHAREDLIB),1)
155 ENDLDLIBS := $(SYSLIBS) $(ENDLDLIBS)
156 ifeq ($(OSTYPE),beos)
157 # BeOS requires different options when building shared libraries
158 # Also, when building a shared library x that references symbols in libraries y,
159 # the y libraries need to be added to the linker command
160 LDSOOPTS = -nostdlib -nostart
161 EXTLIBS = -lstdc++.r4
162 else
163 ifeq ($(OSTYPE),Darwin)
164 LDSOOPTS = -dynamiclib
165 else
166 LDSOOPTS = -shared
167 endif
168 endif
170 ifeq ($(OSTYPE),rtems)
171 EXTLIBS = -lstdc++
172 endif
174 ifneq ($(OSTYPE), QNX)
175 ifneq (,$(findstring $(OSTYPE),FreeBSD OpenBSDs))
176 ifdef P_PTHREADS
177 EXTLIBS += -pthread
178 endif
179 else
180 ifdef P_PTHREADS
181 EXTLIBS += -lpthread
182 endif
183 endif
184 endif
186 # Solaris loader doesn't grok -soname (sees it as -s -oname)
187 # We could use -Wl,-h,$(LIB_BASENAME).1 but then we find that the arglist
188 # to gcc is 2900+ bytes long and it will barf. I fix this by invoking ld
189 # directly and passing it the equivalent arguments...jpd@louisiana.edu
190 ifeq ($(OSTYPE),solaris)
191 LDSOOPTS = -Bdynamic -G -h $(LIB_SONAME)
192 LD = ld
193 else
194 ifneq ($(OSTYPE),Darwin)
195 LDSOOPTS += -Wl,-soname,$(LIB_SONAME)
196 endif
197 LD = $(CPLUS)
198 endif
200 $(LIBDIR)/$(LIB_FILENAME): $(LIBDIR)/$(LIBNAME_PAT)
201 cd $(LIBDIR) ; rm -f $(LIB_FILENAME) ; ln -sf $(LIBNAME_PAT) $(LIB_FILENAME)
202 cd $(LIBDIR) ; rm -f $(LIBNAME_MAJ) ; ln -sf $(LIBNAME_PAT) $(LIBNAME_MAJ)
203 cd $(LIBDIR) ; rm -f $(LIBNAME_MIN) ; ln -sf $(LIBNAME_PAT) $(LIBNAME_MIN)
205 $(LIBDIR)/$(LIBNAME_PAT): $(STATIC_LIB_FILE)
206 @echo EXTLIBS = $(EXTLIBS)
207 @echo SYSLIBS = $(SYSLIBS)
208 @if [ ! -d $(LIBDIR) ] ; then mkdir $(LIBDIR) ; fi
209 $(LD) $(LDSOOPTS) -o $(LIBDIR)/$(LIBNAME_PAT) $(LDFLAGS) $(EXTLIBS) $(OBJS) $(ENDLDLIBS)
211 install: $(LIBDIR)/$(LIBNAME_PAT)
212 $(INSTALL) $(LIBDIR)/$(LIBNAME_PAT) $(INSTALLLIB_DIR)/$(LIBNAME_PAT)
213 ln -sf $(LIBNAME_PAT) $(INSTALLLIB_DIR)/$(LIB_FILENAME)
214 ln -sf $(LIBNAME_PAT) $(INSTALLLIB_DIR)/$(LIBNAME_MAJ)
215 ln -sf $(LIBNAME_PAT) $(INSTALLLIB_DIR)/$(LIBNAME_MIN)
217 endif # P_SHAREDLIB
219 $(STATIC_LIB_FILE): $(OBJS)
220 @if [ ! -d $(LIBDIR) ] ; then mkdir $(LIBDIR) ; fi
221 $(ARCHIVE) $(STATIC_LIB_FILE) $(OBJS)
222 ifeq ($(P_USE_RANLIB),1)
223 $(RANLIB) $(STATIC_LIB_FILE)
224 endif
228 # End of file ################################################################