sgiLib.rules 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. XCOMM $XConsortium: sgiLib.rules /main/16 1996/09/28 18:11:04 rws $
  2. #ifndef HasSharedLibraries
  3. #define HasSharedLibraries YES
  4. #endif
  5. #if OSMajorVersion < 5
  6. #ifndef SharedDataSeparation
  7. #define SharedDataSeparation YES
  8. #endif
  9. #define SharedCodeDef -DSHAREDCODE
  10. #define SharedLibraryDef -DATTSHAREDLIB
  11. #define PositionIndependentCFlags -G 0
  12. /*
  13. * SharedLibraryTarget - generate rules to create a shared library;
  14. * build it into a different name so that we don't hose people by having
  15. * the library gone for long periods.
  16. */
  17. #define SharedLibraryTarget(libname,rev,solist,down,up) @@\
  18. AllTarget(Concat3(lib,libname,_s)) @@\
  19. @@\
  20. Concat3(lib,libname,_s): sharedlib.o solist Concat(lib,libname.spec) $(EXTRALIBRARYDEPS) @@\
  21. $(RM) $@ $@.a \ @@\
  22. && cd down \ @@\
  23. && mkshlib -s Concat(up/lib,libname.spec) -t up/$@ -h up/$@.a \ @@\
  24. && ar rs up/$@.a sharedlib.o @@\
  25. LinkBuildLibrary($@) @@\
  26. LinkBuildLibrary($@.a) @@\
  27. @@\
  28. clean:: @@\
  29. $(RM) Concat3(lib,libname,_s) Concat3(lib,libname,_s.a)
  30. #define SharedLibraryDataTarget(libname,rev,salist)
  31. /*
  32. * InstallSharedLibrary - generate rules to install the shared library.
  33. * NOTE: file must be executable, hence "INSTBINFLAGS"
  34. */
  35. #define InstallSharedLibrary(libname,rev,dest) @@\
  36. install:: Concat3(lib,libname,_s) @@\
  37. MakeDir($(DESTDIR)dest) @@\
  38. $(INSTALL) $(INSTALLFLAGS) $(INSTLIBFLAGS) Concat3(lib,libname,_s.a) $(DESTDIR)dest @@\
  39. $(INSTALL) $(INSTALLFLAGS) $(INSTBINFLAGS) Concat3(lib,libname,_s) $(DESTDIR)dest
  40. /*
  41. * InstallSharedLibraryData - generate rules to install the shared library data
  42. */
  43. #define InstallSharedLibraryData(libname,rev,dest) @@\
  44. InstallTarget(install,Concat3(lib,libname,_s.a),$(INSTLIBFLAGS),dest)
  45. #else /* OSMajorVersion >= 5 */
  46. #ifndef SharedDataSeparation
  47. #define SharedDataSeparation NO
  48. #endif
  49. #ifndef SharedCodeDef
  50. #define SharedCodeDef /**/
  51. #endif
  52. #ifndef SharedLibraryDef
  53. #define SharedLibraryDef /**/
  54. #endif
  55. #ifndef ShLibIncludeFile
  56. #define ShLibIncludeFile <sgiLib.tmpl>
  57. #endif
  58. #ifndef SharedLibraryLoadFlags
  59. #if OSMajorVersion < 6
  60. #define SharedLibraryLoadFlags -shared
  61. #else
  62. #ifndef Mips64Architecture
  63. #define SharedLibraryLoadFlags -shared
  64. #else
  65. #define SharedLibraryLoadFlags -shared -mips3
  66. #endif
  67. #endif
  68. #endif
  69. /* -KPIC is redundant, PIC is always used unless you specify -non_shared */
  70. #ifndef PositionIndependentCFlags
  71. #define PositionIndependentCFlags -KPIC
  72. #endif
  73. #ifndef PositionIndependentCplusplusFlags
  74. #define PositionIndependentCplusplusFlags -KPIC
  75. #endif
  76. /*
  77. * SGI's cc passes an undocumented flag to ld that causes it to look for
  78. * -lX11 and force use of libX11.so.1. And it can't be turned off. Sigh.
  79. * So we install one of those, too, in the shared library install target.
  80. */
  81. /*
  82. * InstallSharedLibrary - generate rules to install the shared library.
  83. */
  84. #ifndef InstallSharedLibrary
  85. #define InstallSharedLibrary(libname,rev,dest) @@\
  86. install:: Concat(lib,libname.so.rev) @@\
  87. MakeDir($(DESTDIR)dest) @@\
  88. $(INSTALL) $(INSTALLFLAGS) $(INSTLIBFLAGS) Concat(lib,libname.so.rev) $(DESTDIR)dest @@\
  89. $(RM) Concat($(DESTDIR)dest/lib,libname.so) @@\
  90. cd $(DESTDIR)dest; $(LN) Concat(lib,libname.so.rev) Concat(lib,libname.so) @@\
  91. if [ "libname" = X11 ]; then \ @@\
  92. RemoveFile(Concat($(DESTDIR)dest/lib,libname.so.1)); \ @@\
  93. cd $(DESTDIR)dest; $(LN) Concat(lib,libname.so.rev) Concat(lib,libname.so.1);\ @@\
  94. fi
  95. #endif /* InstallSharedLibrary */
  96. /*
  97. * InstallSharedLibraryData - generate rules to install the shared library data
  98. */
  99. #ifndef InstallSharedLibraryData
  100. #define InstallSharedLibraryData(libname,rev,dest)
  101. #endif /* InstallSharedLibraryData */
  102. /*
  103. * SharedLibraryTarget - generate rules to create a shared library;
  104. * build it into a different name so that we do not hose people by having
  105. * the library gone for long periods.
  106. */
  107. /*
  108. * SGI's cc passes an undocumented flag to ld that causes it to look for
  109. * -lX11 and force use of libX11.so.1. Sigh. So we make one of those, too,
  110. * in the shared library build target.
  111. */
  112. #ifndef sgiX11soHack
  113. #ifdef UseInstalled
  114. #define sgiX11soHack(libname) /**/
  115. #else
  116. #define sgiX11soHack(libname) if [ "libname" = X11 ]; then \ @@\
  117. RemoveFile($(BUILDLIBDIR)/Concat(lib,libname.so.1)); \ @@\
  118. cd $(BUILDLIBDIR); $(LN) $(BUILDINCTOP)/$(CURRENT_DIR)/$@ Concat(lib,libname.so.1); \ @@\
  119. fi
  120. #endif
  121. #endif /* sgiX11soHack */
  122. #ifndef SharedLibraryTarget
  123. #define SharedLibraryTarget(libname,rev,solist,down,up) @@\
  124. AllTarget(Concat(lib,libname.so.rev)) @@\
  125. @@\
  126. Concat(lib,libname.so.rev): solist $(EXTRALIBRARYDEPS) @@\
  127. $(RM) $@~ @@\
  128. (cd down; $(CCENVSETUP) $(LD) -o up/$@~ $(SHLIBLDFLAGS) -soname $@ solist $(REQUIREDLIBS)) @@\
  129. $(RM) $@ @@\
  130. $(MV) $@~ $@ @@\
  131. $(RM) Concat(lib,libname.so) @@\
  132. $(LN) $@ Concat(lib,libname.so) @@\
  133. LinkBuildLibrary($@) @@\
  134. LinkBuildLibrary(Concat(lib,libname.so)) @@\
  135. sgiX11soHack(libname) @@\
  136. @@\
  137. clean:: @@\
  138. $(RM) Concat(lib,libname.so.rev) Concat(lib,libname.so) so_locations
  139. #endif /* SharedLibraryTarget */
  140. /*
  141. * SharedLibraryDataTarget - generate rules to create shlib data file;
  142. */
  143. #ifndef SharedLibraryDataTarget
  144. #define SharedLibraryDataTarget(libname,rev,salist)
  145. #endif /* SharedLibraryTarget */
  146. #endif /* OsMajorVersion < 5 else */