sv4Lib.rules 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. XCOMM $TOG: sv4Lib.rules /main/19 1999/03/22 16:26:02 mgreess $
  2. /*
  3. * SVR4 shared library rules
  4. */
  5. #ifndef HasSharedLibraries
  6. # define HasSharedLibraries YES
  7. #endif
  8. #ifndef SharedDataSeparation
  9. # define SharedDataSeparation NO
  10. #endif
  11. #ifndef SharedCodeDef
  12. # define SharedCodeDef /**/
  13. #endif
  14. #ifndef SharedLibraryDef
  15. # define SharedLibraryDef /**/
  16. #endif
  17. #ifndef ShLibIncludeFile
  18. # define ShLibIncludeFile <sv4Lib.tmpl>
  19. #endif
  20. #ifndef SharedLibraryLoadFlags
  21. # define SharedLibraryLoadFlags -G -z text
  22. #endif
  23. #ifndef PositionIndependentCFlags
  24. # if HasGcc2
  25. # define PositionIndependentCFlags -fPIC
  26. # else
  27. # define PositionIndependentCFlags -K PIC
  28. # endif
  29. #endif
  30. #ifndef PositionIndependentCplusplusFlags
  31. # if HasGcc2ForCplusplus
  32. # define PositionIndependentCplusplusFlags -fpic
  33. # else
  34. # define PositionIndependentCplusplusFlags -K PIC
  35. # endif
  36. #endif
  37. #ifndef UseExportLists
  38. # define UseExportLists NO
  39. #endif
  40. /*
  41. * InstallSharedLibrary - generate rules to install the shared library.
  42. */
  43. #ifndef InstallSharedLibrary
  44. # define InstallSharedLibrary(libname,rev,dest) @@\
  45. install:: Concat(lib,libname.so.rev) @@\
  46. MakeDir($(DESTDIR)dest) @@\
  47. $(INSTALL) $(INSTALLFLAGS) $(INSTLIBFLAGS) Concat(lib,libname.so.rev) $(DESTDIR)dest @@\
  48. $(RM) Concat($(DESTDIR)dest/lib,libname.so) @@\
  49. cd $(DESTDIR)dest; $(LN) Concat(lib,libname.so.rev) Concat(lib,libname.so)
  50. #endif /* InstallSharedLibrary */
  51. /*
  52. * InstallSharedLibraryData - generate rules to install the shared library data
  53. */
  54. #ifndef InstallSharedLibraryData
  55. # define InstallSharedLibraryData(libname,rev,dest)
  56. #endif /* InstallSharedLibraryData */
  57. #ifndef LinkWithExports
  58. # if defined(SunArchitecture)
  59. # if HasGcc2
  60. # define LinkWithExports(libname,rev,solist,down,up) \
  61. (cd down; $(CC) -o up/$@~ $(SHLIBLDFLAGS) -Wl,-soname,$@ solist $(REQUIREDLIBS))
  62. # else
  63. # define LinkWithExports(libname,rev,solist,down,up) \
  64. (cd down; $(CCENVSETUP) $(CXX) -o up/$@~ $(SHLIBLDFLAGS) -h $@ solist $(REQUIREDLIBS))
  65. # endif
  66. # else
  67. # if UseExportLists
  68. # define LinkWithExports(libname,rev,solist,down,up) \
  69. (cd down; $(CCENVSETUP) $(LD) -o up/$@~ $(SHLIBLDFLAGS) -h $@ solist $(REQUIREDLIBS)) @@\
  70. if [ -f Concat(lib,libname.elist) ]; then \ @@\
  71. $(RM) down/$@.exports $@.list; \ @@\
  72. $(CPP) $(ALLINCLUDES) $(EXTRA_DEFINES) $(PROTO_DEFINES) $(THREADS_DEFINES) $(DEFINES) Concat(lib,libname.elist) | CppSedMagic >$@.list; \ @@\
  73. $(EXPORTLISTGEN) $@~ $@.list > down/$@.exports; \ @@\
  74. (cd down; $(CCENVSETUP) $(LD) -o up/$@~ $(SHLIBLDFLAGS) -h $@ ShlibExportListOpt($@.exports) solist $(REQUIREDLIBS)); \ @@\
  75. $(RM) down/$@.exports $@.list; \ @@\
  76. fi;
  77. # else
  78. # define LinkWithExports(libname,rev,solist,down,up) \
  79. (cd down; $(CCENVSETUP) $(LD) -o up/$@~ $(SHLIBLDFLAGS) -h $@ solist $(REQUIREDLIBS))
  80. # endif
  81. # endif
  82. #endif
  83. /*
  84. * SharedLibraryTarget - generate rules to create a shared library;
  85. * build it into a different name so that we do not hose people by having
  86. * the library gone for long periods.
  87. */
  88. #ifndef SharedLibraryTarget
  89. # define SharedLibraryTarget(libname,rev,solist,down,up) @@\
  90. AllTarget(Concat(lib,libname.so.rev)) @@\
  91. @@\
  92. Concat(lib,libname.so.rev): solist $(EXTRALIBRARYDEPS) @@\
  93. $(RM) $@~ @@\
  94. LinkWithExports(libname,rev,solist,down,up) @@\
  95. $(RM) $@ @@\
  96. $(MV) $@~ $@ @@\
  97. $(RM) Concat(lib,libname.so) @@\
  98. $(LN) $@ Concat(lib,libname.so) @@\
  99. LinkBuildLibrary($@) @@\
  100. LinkBuildLibrary(Concat(lib,libname.so)) @@\
  101. @@\
  102. clean:: @@\
  103. $(RM) Concat(lib,libname.so.rev) Concat(lib,libname.so)
  104. #endif /* SharedLibraryTarget */
  105. /*
  106. * SharedLibraryDataTarget - generate rules to create shlib data file;
  107. */
  108. #ifndef SharedLibraryDataTarget
  109. # define SharedLibraryDataTarget(libname,rev,salist)
  110. #endif /* SharedLibraryTarget */