home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-bin / x11r6.1 / lib / x11 / config / sgilib.rules < prev    next >
Encoding:
Text File  |  1996-10-17  |  5.0 KB  |  159 lines

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