Changed to look for configure.ac, then configure.in
[pwlib.git] / make / lib.mak
blobb8a5c9967847d1da1eabf243c513367a11709fc0
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.39 2004/06/17 06:33:07 csoutheren
28 # Changed Solaris linker to g++. It should never have been using ld
30 # Revision 1.38 2004/04/25 10:30:08 rjongbloed
31 # Fixed correct SONAME when using beta versions.
33 # Revision 1.37 2003/09/08 22:13:18 dereksmithies
34 # Fix patch implementation. Thanks to Zygmuntowicz Michal <m.zygmuntowicz@onet.pl>
36 # Revision 1.36 2003/09/08 22:07:41 dereksmithies
37 # Add patch from Zygmuntowicz Michal <m.zygmuntowicz@onet.pl> for Solaris.
38 # Many thanks!!!
40 # Revision 1.35 2003/07/29 12:33:34 csoutheren
41 # Changed to ensure dynamic libraries using pwlib always dynamically link pwlib
43 # Revision 1.34 2003/06/23 06:44:11 csoutheren
44 # Added minor revision into the soname for the libraries as requested by Damien Sandras
46 # Revision 1.33 2003/05/29 09:03:36 rjongbloed
47 # Changed SONAME so includes minor version number to allow for API changes.
49 # Revision 1.32 2003/05/06 09:47:20 robertj
50 # Fixed up MacOSX changes so is compatible with previous "API" not requiring
51 # downstream libraries to change
53 # Revision 1.31 2003/05/06 06:59:12 robertj
54 # Dynamic library support for MacOSX, thanks Hugo Santos
56 # Revision 1.30 2002/11/22 10:14:07 robertj
57 # QNX port, thanks Xiaodan Tang
59 # Revision 1.29 2002/10/17 13:44:27 robertj
60 # Port to RTEMS, thanks Vladimir Nesic.
62 # Revision 1.28 2002/09/26 00:17:48 robertj
63 # Fixed make install to force creation of symlinks, thanks Pierre.
65 # Revision 1.27 2002/08/30 11:42:46 robertj
66 # Added formatting.
67 # Changed alpha & beta sharable library file name convention.
69 # Revision 1.26 2002/02/01 11:11:27 rogerh
70 # Use .$(MAJOR_VERSION) with soname (instead of hard coding .1)
72 # Revision 1.25 2002/01/31 06:55:22 robertj
73 # Removed redundant inclusion of ssl, is already in unix.mak
75 # Revision 1.24 2002/01/27 08:45:50 rogerh
76 # FreeBSD and OpwnBSD use -pthread and not -lpthread
78 # Revision 1.23 2002/01/26 23:57:08 craigs
79 # Changed for GCC 3.0 compatibility, thanks to manty@manty.net
81 # Revision 1.22 2002/01/15 07:47:30 robertj
82 # Fixed previous fix
84 # Revision 1.21 2002/01/14 23:14:29 robertj
85 # Added ENDLDFLAGS to shared library link, thanks Paul a écrit
87 # Revision 1.20 2001/12/18 04:12:08 robertj
88 # Fixed Linux compatibility of previous change for Solaris.
90 # Revision 1.19 2001/12/17 23:33:50 robertj
91 # Solaris 8 porting changes, thanks James Dugal
93 # Revision 1.18 2001/12/05 08:32:06 rogerh
94 # ln -sf complains if the file already exists on Solaris. So do rm -f first
96 # Revision 1.17 2001/12/01 17:41:07 rogerh
97 # Use locall defined compiler binary instead of hard coded gcc
99 # Revision 1.16 2001/11/30 00:37:16 robertj
100 # Fixed incorrect library filename when building static library during shared
101 # library build.
103 # Revision 1.15 2001/11/27 22:42:13 robertj
104 # Changed to make system to better support non-shared library building.
106 # Revision 1.14 2001/07/07 06:51:52 robertj
107 # Added fix to remove shared libraries in make clean, thanks Jac Goudsmit
109 # Revision 1.13 2001/07/03 04:41:25 yurik
110 # Corrections to Jac's submission from 6/28
112 # Revision 1.12 2001/06/30 06:59:06 yurik
113 # Jac Goudsmit from Be submit these changes 6/28. Implemented by Yuri Kiryanov
115 # Revision 1.11 2001/03/23 03:18:01 robertj
116 # Fixed addition of trailing dot at end of release versions of so libraries
117 # caused to removal of the "pl" build type, changing it to a dot.
119 # Revision 1.10 2001/03/14 06:24:55 robertj
120 # Fixed setting of symlinks for shared libraries to be relative paths.
122 # Revision 1.9 2000/05/19 01:26:31 robertj
123 # Added copyright notice
126 ifneq ($(OSTYPE),Darwin)
127 LIBNAME_MAJ = $(LIB_FILENAME).$(MAJOR_VERSION)
128 LIBNAME_MIN = $(LIBNAME_MAJ).$(MINOR_VERSION)
129 ifeq ($(BUILD_TYPE),.)
130 LIBNAME_PAT = $(LIBNAME_MIN).$(BUILD_NUMBER)
131 else
132 LIBNAME_PAT = $(LIBNAME_MIN)-$(BUILD_TYPE)$(BUILD_NUMBER)
133 endif
134 else
135 LIBNAME_MAJ = $(subst .$(LIB_SUFFIX),.$(MAJOR_VERSION).$(LIB_SUFFIX),$(LIB_FILENAME))
136 LIBNAME_MIN = $(subst .$(LIB_SUFFIX),.$(MAJOR_VERSION).$(MINOR_VERSION).$(LIB_SUFFIX),$(LIB_FILENAME))
137 ifeq ($(BUILD_TYPE),.)
138 LIBNAME_PAT = $(subst .$(LIB_SUFFIX),.$(MAJOR_VERSION).$(MINOR_VERSION).$(BUILD_NUMBER).$(LIB_SUFFIX),$(LIB_FILENAME))
139 else
140 LIBNAME_PAT = $(subst .$(LIB_SUFFIX),.$(MAJOR_VERSION).$(MINOR_VERSION)-$(BUILD_TYPE)$(BUILD_NUMBER).$(LIB_SUFFIX),$(LIB_FILENAME))
141 endif
142 endif
144 LIB_SONAME = $(LIBNAME_PAT)
146 CLEAN_FILES += $(LIBDIR)/$(LIBNAME_PAT) $(LIBDIR)/$(LIB_FILENAME) $(LIBDIR)/$(LIBNAME_MAJ) $(LIBDIR)/$(LIBNAME_MIN)
148 ifneq ($(P_SHAREDLIB),1)
149 STATIC_LIB_FILE = $(LIBDIR)/$(LIB_FILENAME)
150 else
151 STATIC_LIB_FILE = $(LIBDIR)/$(subst .$(LIB_SUFFIX),_s.$(STATICLIBEXT),$(LIB_FILENAME))
152 endif
154 $(LIBDIR)/$(LIB_FILENAME) : $(TARGETLIB)
156 ifeq ($(P_SHAREDLIB),1)
158 ENDLDLIBS := $(SYSLIBS) $(ENDLDLIBS)
159 ifeq ($(OSTYPE),beos)
160 # BeOS requires different options when building shared libraries
161 # Also, when building a shared library x that references symbols in libraries y,
162 # the y libraries need to be added to the linker command
163 LDSOOPTS = -nostdlib -nostart
164 EXTLIBS = -lstdc++.r4
165 else
166 ifeq ($(OSTYPE),Darwin)
167 LDSOOPTS = -dynamiclib
168 else
169 LDSOOPTS = -shared
170 endif
171 endif
173 ifeq ($(OSTYPE),rtems)
174 EXTLIBS = -lstdc++
175 endif
177 ifneq ($(OSTYPE), QNX)
178 ifneq (,$(findstring $(OSTYPE),FreeBSD OpenBSDs))
179 ifdef P_PTHREADS
180 EXTLIBS += -pthread
181 endif
182 else
183 ifdef P_PTHREADS
184 EXTLIBS += -lpthread
185 endif
186 endif
187 endif
189 # Solaris loader doesn't grok -soname (sees it as -s -oname)
190 # We could use -Wl,-h,$(LIB_BASENAME).1 but then we find that the arglist
191 # to gcc is 2900+ bytes long and it will barf. I fix this by invoking ld
192 # directly and passing it the equivalent arguments...jpd@louisiana.edu
193 ifeq ($(OSTYPE),solaris)
194 LDSOOPTS = -Bdynamic -G -h $(LIB_SONAME)
195 LD = $(CPLUS)
196 else
197 ifneq ($(OSTYPE),Darwin)
198 LDSOOPTS += -Wl,-soname,$(LIB_SONAME)
199 endif
200 LD = $(CPLUS)
201 endif
203 $(LIBDIR)/$(LIB_FILENAME): $(LIBDIR)/$(LIBNAME_PAT)
204 cd $(LIBDIR) ; rm -f $(LIB_FILENAME) ; ln -sf $(LIBNAME_PAT) $(LIB_FILENAME)
205 cd $(LIBDIR) ; rm -f $(LIBNAME_MAJ) ; ln -sf $(LIBNAME_PAT) $(LIBNAME_MAJ)
206 cd $(LIBDIR) ; rm -f $(LIBNAME_MIN) ; ln -sf $(LIBNAME_PAT) $(LIBNAME_MIN)
208 $(LIBDIR)/$(LIBNAME_PAT): $(STATIC_LIB_FILE)
209 @echo EXTLIBS = $(EXTLIBS)
210 @echo SYSLIBS = $(SYSLIBS)
211 @if [ ! -d $(LIBDIR) ] ; then mkdir $(LIBDIR) ; fi
212 $(LD) $(LDSOOPTS) -o $(LIBDIR)/$(LIBNAME_PAT) $(LDFLAGS) $(EXTLIBS) $(OBJS) $(ENDLDLIBS)
214 install: $(LIBDIR)/$(LIBNAME_PAT)
215 $(INSTALL) $(LIBDIR)/$(LIBNAME_PAT) $(INSTALLLIB_DIR)/$(LIBNAME_PAT)
216 ln -sf $(LIBNAME_PAT) $(INSTALLLIB_DIR)/$(LIB_FILENAME)
217 ln -sf $(LIBNAME_PAT) $(INSTALLLIB_DIR)/$(LIBNAME_MAJ)
218 ln -sf $(LIBNAME_PAT) $(INSTALLLIB_DIR)/$(LIBNAME_MIN)
220 endif # P_SHAREDLIB
222 $(STATIC_LIB_FILE): $(OBJS)
223 @if [ ! -d $(LIBDIR) ] ; then mkdir $(LIBDIR) ; fi
224 $(ARCHIVE) $(STATIC_LIB_FILE) $(OBJS)
225 ifeq ($(P_USE_RANLIB),1)
226 $(RANLIB) $(STATIC_LIB_FILE)
227 endif
231 # End of file ################################################################