1 XCOMM $XConsortium: ibmLib.rules /main/15 1996/12/30 16:06:05 kaleb $
4 * AIX shared library rules
7 #ifndef HasSharedLibraries
8 # define HasSharedLibraries YES
10 #ifndef ForceNormalLib
11 # define ForceNormalLib NO
13 #ifndef SharedDataSeparation
14 # define SharedDataSeparation NO
17 # define SharedCodeDef -DSHAREDCODE
19 #ifndef SharedLibraryDef
20 # define SharedLibraryDef -DAIXSHLIB
22 #ifndef ShLibIncludeFile
23 # define ShLibIncludeFile <ibmLib.tmpl>
25 #ifndef PositionIndependentCFlags
26 # define PositionIndependentCFlags -bM\:SRE
28 #ifndef ExtraLoadFlags
29 # define ExtraLoadFlags -bnodelcsect
31 #if !defined(LdPostLib) && !defined(UseInstalled) && OSMajorVersion > 3
33 # define LdPostLib -blibpath:$(USRLIBDIRPATH):/usr/lib/threads:/usr/lib:/lib
35 # define LdPostLib -blibpath:$(USRLIBDIRPATH):/usr/lib:/lib
37 # define SharedLibPostRef $(LDPOSTLIBS)
39 #ifndef SharedLibPostRef
40 # define SharedLibPostRef $(LDPOSTLIBS)
43 # define BaseShLibReqs -lc_r -lm
45 # define BaseShLibReqs -lc -lm
47 #ifndef UseExportLists
48 # define UseExportLists YES
52 * MakeExportList - generate an export list file for linking libraries.
54 #ifndef MakeExportList
56 # define MakeExportList(libname,result) \
57 @-RemoveFile(result) @@\
58 case ,$(SHR4OBJLIBS), in *,libname,*) shr4obj=shr4.o;; esac &&\ @@\
59 echo "#! $@ ($${shr4obj:-shr.o})" > result @@\
60 if [ -f Concat(lib,libname.elist) ]; then \ @@\
61 $(CPP) $(ALLINCLUDES) $(EXTRA_DEFINES) $(PROTO_DEFINES) $(THREADS_DEFINES) $(DEFINES) Concat(lib,libname.elist) | CppSedMagic > $@.list; \ @@\
62 $(EXPORTLISTGEN) $@~ $@.list >> result; \ @@\
63 RemoveFile($@.list); \ @@\
65 dump -g $@~ | sed -n -e 's/^[ ]*[0-9][0-9]*[ ]*\([^ .][^ ]*\)$$/\1/p' >> result; \ @@\
68 # define MakeExportList(libname,result) \
69 @-RemoveFile(result) @@\
70 case ,$(SHR4OBJLIBS), in *,libname,*) shr4obj=shr4.o;; esac &&\ @@\
71 echo "#! $@ ($${shr4obj:-shr.o})" > result @@\
72 dump -g $@~ | sed -n -e 's/^[ ]*[0-9][0-9]*[ ]*\([^ .][^ ]*\)$$/\1/p' >> result;
74 #endif /* MakeExportList */
77 #if !defined(UseInstalled) && !defined(UseInstalledX11) \
78 && !defined(UseImports) && !defined(ImportX11)
79 /* we want this to be defined only when building X */
81 # if OSMajorVersion < 4
83 * SharedDSLibReferences - variables for shared libraries
86 # ifndef SharedLibReferences
87 # define SharedLibReferences(varname,libname,libsource,revname,rev) @@\
88 Concat3(DEP,varname,LIB) = /**/ @@\
89 Concat(varname,LIB) = _Use(Concat(-l,libname),Concat(libsource/lib,libname.a)) @@\
90 LintLibReferences(varname,libname,libsource)
95 # ifndef SharedLibReferences
96 # define SharedLibReferences(varname,libname,libsource,revname,rev) @@\
97 Concat3(DEP,varname,LIB) = /**/ @@\
98 Concat(varname,LIB) = _Use(Concat(-l,libname),Concat($(BUILDLIBDIR),/libname.imp) Concat3($(BUILDLIBDIR),/lib,libname.a)) @@\
99 LintLibReferences(varname,libname,libsource)
105 * SharedDSLibReferences - variables for shared libraries
107 # ifndef SharedDSLibReferences
108 # define SharedDSLibReferences(varname,libname,libsource,revname,rev) @@\
109 SharedLibReferences(varname,libname,libsource,revname,rev)
112 # if OSMajorVersion == 4
114 * UnsharedLibReferences - variables for unshared libraries
116 # ifndef UnsharedLibReferences
117 # define UnsharedLibReferences(varname,libname,libsource) @@\
118 Concat3(DEP,varname,LIB) = _UseCat($(USRLIBDIR)/lib,$(BUILDLIBDIR)/lib,libname.a) @@\
119 Concat(varname,LIB) = _Use(Concat(-l,libname),Concat($(BUILDLIBDIR)/lib,libname.a)) @@\
120 LintLibReferences(varname,libname,libsource)
124 #endif /* !defined(UseInstalled) && !defined(UseInstalledX11) ... */
128 * InstallSharedLibrary - generate rules to install the shared library.
130 #ifndef InstallSharedLibrary
131 # define InstallSharedLibrary(libname,rev,dest) @@\
132 InstallLibrary(libname,dest)
133 #endif /* InstallSharedLibrary */
136 * InstallSharedLibraryData - generate rules to install the shared library data
138 #ifndef InstallSharedLibraryData
139 # define InstallSharedLibraryData(libname,rev,dest)
140 #endif /* InstallSharedLibraryData */
143 * SharedLibraryTarget - generate rules to create a shared library;
144 * build it into a different name so that the we do not hose people by having
145 * the library gone for long periods.
147 * IBM uses an unusual shared object file name (shr4.o) in some libraries.
148 * Duplicate this behavior to preserve compatibility with IBM's libraries.
150 #if OSMajorVersion < 4
152 # ifndef SharedLibraryTarget
153 # define SharedLibraryTarget(libname,rev,solist,down,up) @@\
154 AllTarget(Concat(lib,libname.a)) @@\
156 Concat(lib,libname.a): solist $(UNSHAREDOBJS) $(EXTRALIBRARYDEPS) @@\
157 $(RM) $@~ shr.o shr4.o @@\
158 (cd down; $(AR) up/$@~ solist) @@\
159 dump -g $@~ | sed -n -e 's/^[ ]*[0-9][0-9]*[ ]*\([^ .][^ ]*\)$$/\1/p' > $@.syms @@\
160 $(LD) -o shr.o $@~ -H512 -T512 -bM\:SRE -bE\:$@.syms $(REQUIREDLIBS) BaseShLibReqs SharedLibPostRef @@\
161 $(LN) shr.o shr4.o @@\
163 case ,$(SHR4OBJLIBS), in *,libname,*) shr4obj=shr4.o;; esac &&\ @@\
164 $(AR) $@~ $${shr4obj} shr.o $(UNSHAREDOBJS) @@\
165 $(RM) $@.syms $@ shr.o shr4.o @@\
167 LinkBuildLibrary($@) @@\
170 $(RM) Concat(lib,libname.a)
171 # endif /* SharedLibraryTarget */
173 #else /* OSMajorVersion >= 4 */
175 # ifndef SharedLibraryTarget
176 # define SharedLibraryTarget(libname,rev,solist,down,up) @@\
177 AllTarget(Concat(lib,libname.a)) @@\
179 Concat(lib,libname.a): solist $(UNSHAREDOBJS) $(EXTRALIBRARYDEPS) @@\
180 RemoveFiles($@~ shr.o shr4.o) @@\
181 (cd down; $(AR) up/$@~ solist) @@\
182 MakeExportList(libname,libname.imp) @@\
183 $(LD) -o shr.o $@~ -H512 -T512 -bM\:SRE -bE\:libname.imp -bnoentry $(REQUIREDLIBS) BaseShLibReqs $(LDPOSTLIBS) @@\
184 $(LN) shr.o shr4.o @@\
186 case ,$(SHR4OBJLIBS), in *,libname,*) shr4obj=shr4.o;; esac &&\ @@\
187 $(AR) $@~ $${shr4obj} shr.o $(UNSHAREDOBJS) @@\
190 LinkBuildLibrary($@) @@\
191 LinkBuildLibrary(libname.imp) @@\
194 $(RM) Concat(lib,libname.a)
195 # endif /* SharedLibraryTarget */
200 * SharedLibraryDataTarget - generate rules to create shlib data file;
202 #ifndef SharedLibraryDataTarget
203 # define SharedLibraryDataTarget(libname,rev,salist)
204 #endif /* SharedLibraryTarget */