ibmLib.rules 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. XCOMM $XConsortium: ibmLib.rules /main/15 1996/12/30 16:06:05 kaleb $
  2. /*
  3. * AIX shared library rules
  4. */
  5. #ifndef HasSharedLibraries
  6. # define HasSharedLibraries YES
  7. #endif
  8. #ifndef ForceNormalLib
  9. # define ForceNormalLib NO
  10. #endif
  11. #ifndef SharedDataSeparation
  12. # define SharedDataSeparation NO
  13. #endif
  14. #ifndef SharedCodeDef
  15. # define SharedCodeDef -DSHAREDCODE
  16. #endif
  17. #ifndef SharedLibraryDef
  18. # define SharedLibraryDef -DAIXSHLIB
  19. #endif
  20. #ifndef ShLibIncludeFile
  21. # define ShLibIncludeFile <ibmLib.tmpl>
  22. #endif
  23. #ifndef PositionIndependentCFlags
  24. # define PositionIndependentCFlags -bM\:SRE
  25. #endif
  26. #ifndef ExtraLoadFlags
  27. # define ExtraLoadFlags -bnodelcsect
  28. #endif
  29. #if !defined(LdPostLib) && !defined(UseInstalled) && OSMajorVersion > 3
  30. # if ThreadedX
  31. # define LdPostLib -blibpath:$(USRLIBDIRPATH):/usr/lib/threads:/usr/lib:/lib
  32. # else
  33. # define LdPostLib -blibpath:$(USRLIBDIRPATH):/usr/lib:/lib
  34. # endif
  35. # define SharedLibPostRef $(LDPOSTLIBS)
  36. #endif
  37. #ifndef SharedLibPostRef
  38. # define SharedLibPostRef $(LDPOSTLIBS)
  39. #endif
  40. #if ThreadedX
  41. # define BaseShLibReqs -lc_r -lm
  42. #else
  43. # define BaseShLibReqs -lc -lm
  44. #endif
  45. #ifndef UseExportLists
  46. # define UseExportLists YES
  47. #endif
  48. /*
  49. * MakeExportList - generate an export list file for linking libraries.
  50. */
  51. #ifndef MakeExportList
  52. # if UseExportLists
  53. # define MakeExportList(libname,result) \
  54. @-RemoveFile(result) @@\
  55. case ,$(SHR4OBJLIBS), in *,libname,*) shr4obj=shr4.o;; esac &&\ @@\
  56. echo "#! $@ ($${shr4obj:-shr.o})" > result @@\
  57. if [ -f Concat(lib,libname.elist) ]; then \ @@\
  58. $(CPP) $(ALLINCLUDES) $(EXTRA_DEFINES) $(PROTO_DEFINES) $(THREADS_DEFINES) $(DEFINES) Concat(lib,libname.elist) | CppSedMagic > $@.list; \ @@\
  59. $(EXPORTLISTGEN) $@~ $@.list >> result; \ @@\
  60. RemoveFile($@.list); \ @@\
  61. else \ @@\
  62. dump -g $@~ | sed -n -e 's/^[ ]*[0-9][0-9]*[ ]*\([^ .][^ ]*\)$$/\1/p' >> result; \ @@\
  63. fi;
  64. # else
  65. # define MakeExportList(libname,result) \
  66. @-RemoveFile(result) @@\
  67. case ,$(SHR4OBJLIBS), in *,libname,*) shr4obj=shr4.o;; esac &&\ @@\
  68. echo "#! $@ ($${shr4obj:-shr.o})" > result @@\
  69. dump -g $@~ | sed -n -e 's/^[ ]*[0-9][0-9]*[ ]*\([^ .][^ ]*\)$$/\1/p' >> result;
  70. # endif
  71. #endif /* MakeExportList */
  72. #if !defined(UseInstalled) && !defined(UseInstalledX11) \
  73. && !defined(UseImports) && !defined(ImportX11)
  74. /* we want this to be defined only when building X */
  75. # if OSMajorVersion < 4
  76. /*
  77. * SharedDSLibReferences - variables for shared libraries
  78. */
  79. # ifndef SharedLibReferences
  80. # define SharedLibReferences(varname,libname,libsource,revname,rev) @@\
  81. Concat3(DEP,varname,LIB) = /**/ @@\
  82. Concat(varname,LIB) = _Use(Concat(-l,libname),Concat(libsource/lib,libname.a)) @@\
  83. LintLibReferences(varname,libname,libsource)
  84. # endif
  85. # else
  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($(BUILDLIBDIR),/libname.imp) Concat3($(BUILDLIBDIR),/lib,libname.a)) @@\
  90. LintLibReferences(varname,libname,libsource)
  91. # endif
  92. # endif
  93. /*
  94. * SharedDSLibReferences - variables for shared libraries
  95. */
  96. # ifndef SharedDSLibReferences
  97. # define SharedDSLibReferences(varname,libname,libsource,revname,rev) @@\
  98. SharedLibReferences(varname,libname,libsource,revname,rev)
  99. # endif
  100. # if OSMajorVersion == 4
  101. /*
  102. * UnsharedLibReferences - variables for unshared libraries
  103. */
  104. # ifndef UnsharedLibReferences
  105. # define UnsharedLibReferences(varname,libname,libsource) @@\
  106. Concat3(DEP,varname,LIB) = _UseCat($(USRLIBDIR)/lib,$(BUILDLIBDIR)/lib,libname.a) @@\
  107. Concat(varname,LIB) = _Use(Concat(-l,libname),Concat($(BUILDLIBDIR)/lib,libname.a)) @@\
  108. LintLibReferences(varname,libname,libsource)
  109. # endif
  110. # endif
  111. #endif /* !defined(UseInstalled) && !defined(UseInstalledX11) ... */
  112. /*
  113. * InstallSharedLibrary - generate rules to install the shared library.
  114. */
  115. #ifndef InstallSharedLibrary
  116. # define InstallSharedLibrary(libname,rev,dest) @@\
  117. InstallLibrary(libname,dest)
  118. #endif /* InstallSharedLibrary */
  119. /*
  120. * InstallSharedLibraryData - generate rules to install the shared library data
  121. */
  122. #ifndef InstallSharedLibraryData
  123. # define InstallSharedLibraryData(libname,rev,dest)
  124. #endif /* InstallSharedLibraryData */
  125. /*
  126. * SharedLibraryTarget - generate rules to create a shared library;
  127. * build it into a different name so that the we do not hose people by having
  128. * the library gone for long periods.
  129. *
  130. * IBM uses an unusual shared object file name (shr4.o) in some libraries.
  131. * Duplicate this behavior to preserve compatibility with IBM's libraries.
  132. */
  133. #if OSMajorVersion < 4
  134. # ifndef SharedLibraryTarget
  135. # define SharedLibraryTarget(libname,rev,solist,down,up) @@\
  136. AllTarget(Concat(lib,libname.a)) @@\
  137. @@\
  138. Concat(lib,libname.a): solist $(UNSHAREDOBJS) $(EXTRALIBRARYDEPS) @@\
  139. $(RM) $@~ shr.o shr4.o @@\
  140. (cd down; $(AR) up/$@~ solist) @@\
  141. dump -g $@~ | sed -n -e 's/^[ ]*[0-9][0-9]*[ ]*\([^ .][^ ]*\)$$/\1/p' > $@.syms @@\
  142. $(LD) -o shr.o $@~ -H512 -T512 -bM\:SRE -bE\:$@.syms $(REQUIREDLIBS) BaseShLibReqs SharedLibPostRef @@\
  143. $(LN) shr.o shr4.o @@\
  144. $(RM) $@~ @@\
  145. case ,$(SHR4OBJLIBS), in *,libname,*) shr4obj=shr4.o;; esac &&\ @@\
  146. $(AR) $@~ $${shr4obj} shr.o $(UNSHAREDOBJS) @@\
  147. $(RM) $@.syms $@ shr.o shr4.o @@\
  148. $(MV) $@~ $@ @@\
  149. LinkBuildLibrary($@) @@\
  150. @@\
  151. clean:: @@\
  152. $(RM) Concat(lib,libname.a)
  153. # endif /* SharedLibraryTarget */
  154. #else /* OSMajorVersion >= 4 */
  155. # ifndef SharedLibraryTarget
  156. # define SharedLibraryTarget(libname,rev,solist,down,up) @@\
  157. AllTarget(Concat(lib,libname.a)) @@\
  158. @@\
  159. Concat(lib,libname.a): solist $(UNSHAREDOBJS) $(EXTRALIBRARYDEPS) @@\
  160. RemoveFiles($@~ shr.o shr4.o) @@\
  161. (cd down; $(AR) up/$@~ solist) @@\
  162. MakeExportList(libname,libname.imp) @@\
  163. $(LD) -o shr.o $@~ -H512 -T512 -bM\:SRE -bE\:libname.imp -bnoentry $(REQUIREDLIBS) BaseShLibReqs $(LDPOSTLIBS) @@\
  164. $(LN) shr.o shr4.o @@\
  165. RemoveFile($@~) @@\
  166. case ,$(SHR4OBJLIBS), in *,libname,*) shr4obj=shr4.o;; esac &&\ @@\
  167. $(AR) $@~ $${shr4obj} shr.o $(UNSHAREDOBJS) @@\
  168. RemoveFile($@) @@\
  169. $(MV) $@~ $@ @@\
  170. LinkBuildLibrary($@) @@\
  171. LinkBuildLibrary(libname.imp) @@\
  172. @@\
  173. clean:: @@\
  174. $(RM) Concat(lib,libname.a)
  175. # endif /* SharedLibraryTarget */
  176. #endif
  177. /*
  178. * SharedLibraryDataTarget - generate rules to create shlib data file;
  179. */
  180. #ifndef SharedLibraryDataTarget
  181. # define SharedLibraryDataTarget(libname,rev,salist)
  182. #endif /* SharedLibraryTarget */