home *** CD-ROM | disk | FTP | other *** search
/ PC World 2000 February / PCWorld_2000-02_cd.bin / live / usr / X11R6 / lib / X11 / config / bsdLib.rules < prev    next >
Text File  |  1999-09-03  |  10KB  |  341 lines

  1. XCOMM $XConsortium: bsdLib.rules /main/3 1996/09/28 16:09:18 rws $
  2.  
  3.  
  4.  
  5.  
  6.  
  7. XCOMM $XFree86: xc/config/cf/bsdLib.rules,v 3.4.2.7 1999/07/17 01:32:44 dawes Exp $
  8. /*
  9.  * NetBSD/FreeBSD shared library rules
  10.  */
  11.  
  12. #ifndef UseElfFormat
  13. #define UseElfFormat NO
  14. #endif
  15.  
  16. #if !UseElfFormat
  17. /* a.out shared libs */
  18. #ifndef HasSharedLibraries
  19. #define HasSharedLibraries YES
  20. #endif
  21. #ifndef SharedDataSeparation
  22. #define SharedDataSeparation NO
  23. #endif
  24. #ifndef SharedCodeDef
  25. #define SharedCodeDef
  26. #endif
  27. #ifndef SharedLibraryDef
  28. #define SharedLibraryDef -DBSDSHLIB
  29. #endif
  30. #ifndef ShLibIncludeFile
  31. #define ShLibIncludeFile <bsdLib.tmpl>
  32. #endif
  33. #ifndef SharedLibraryLoadFlags
  34. #define SharedLibraryLoadFlags -Bshareable
  35. #endif
  36. #ifndef PositionIndependentCFlags
  37. #define PositionIndependentCFlags -fpic
  38. #endif
  39.  
  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) -c $(INSTLIBFLAGS) Concat(lib,libname.so.rev) $(DESTDIR)dest 
  48. @@\
  49.  
  50. #endif /* InstallSharedLibrary */
  51.  
  52. /*
  53.  * SharedLibraryTarget - generate rules to create a shared library;
  54.  * build it into a different name so that we do not hose people by having
  55.  * the library gone for long periods.
  56.  */
  57. #ifndef SharedLibraryTarget
  58. #define SharedLibraryTarget(libname,rev,solist,down,up)            @@\
  59. AllTarget(Concat(lib,libname.so.rev))                    @@\
  60.                                     @@\
  61. Concat(lib,libname.so.rev):  solist $(EXTRALIBRARYDEPS)            @@\
  62.     $(RM) $@~                            @@\
  63.     (cd down; $(LD) -o up/$@~ $(SHLIBLDFLAGS) solist $(REQUIREDLIBS)) @@\
  64.     $(RM) $@                            @@\
  65.     $(MV) $@~ $@                            @@\
  66.     LinkBuildLibrary($@)                        @@\
  67.                                     @@\
  68. clean::                                    @@\
  69.     $(RM) Concat(lib,libname.so.rev)
  70.  
  71. #endif /* SharedLibraryTarget */
  72.  
  73. #ifndef SharedDepModuleTarget
  74. #define SharedDepModuleTarget(name,deps,solist)                @@\
  75. AllTarget(name)                                @@\
  76.                                     @@\
  77. name: deps                                @@\
  78.     $(RM) $@~                            @@\
  79.     $(LD) -o $@~ $(SHLIBLDFLAGS) solist $(REQUIREDLIBS)        @@\
  80.     $(RM) $@                            @@\
  81.     $(MV) $@~ $@                            @@\
  82.                                     @@\
  83. clean::                                    @@\
  84.     $(RM) name
  85.  
  86. #endif /* SharedDepModuleTarget */
  87.  
  88. /*
  89.  * SharedLibraryDataTarget - generate rules to create shlib data file;
  90.  */
  91. #ifndef SharedLibraryDataTarget
  92. #define SharedLibraryDataTarget(libname,rev,salist)
  93. #endif /* SharedLibraryDataTarget */
  94.  
  95. #ifndef InstallSharedLibraryData
  96. #define InstallSharedLibraryData(libname,rev,dest)
  97. #endif /* InstallSharedLibraryData */
  98.  
  99. /*
  100.  * SharedLibReferences - variables for shared libraries
  101.  */
  102. #ifndef SharedLibReferences
  103. #define SharedLibReferences(varname,libname,libsource,revname,rev)    @@\
  104. revname = rev                                @@\
  105. Concat3(DEP,varname,LIB) = SharedLibDependencies(libname,libsource,revname) @@\
  106. Concat(varname,LIB) = LoaderLibPrefix Concat(-l,libname)        @@\
  107. LintLibReferences(varname,libname,libsource)
  108. #endif
  109.  
  110. /*
  111.  * SharedDSLibReferences - variables for shared libraries
  112.  */
  113. #ifndef SharedDSLibReferences
  114. #define SharedDSLibReferences(varname,libname,libsource,revname,rev)    @@\
  115. revname = rev                                @@\
  116. Concat3(DEP,varname,LIB) = SharedDSLibDependencies(libname,libsource,revname) @@\
  117. Concat(varname,LIB) = LoaderLibPrefix Concat(-l,libname) Concat3(Shared,libname,Reqs)        @@\
  118. LintLibReferences(varname,libname,libsource)
  119. #endif
  120.  
  121. #else /* UseElfFormat */
  122.  
  123. /*
  124.  * NetBSD/FreeBSD (ELF) shared library rules
  125.  * Cloned from Linux ELF rules, with the following major change:
  126.  *
  127.  *     Shared libraries depend on -lc.  Since we don't have to worry
  128.  *    about libc vs. libg, etc., this is a good idea.  (This is actually
  129.  *    implied by using $(CC) to build the shared libraries.)
  130.  */
  131.  
  132. #ifndef HasSharedLibraries
  133. #define HasSharedLibraries YES
  134. #endif
  135. #ifndef ForceNormalLib
  136. #define ForceNormalLib YES
  137. #endif
  138.  
  139. #ifndef BaseShLibReqs
  140. #define BaseShLibReqs        /* -lc implied by $(CC) */
  141. #endif
  142.  
  143. #ifndef SharedDataSeparation
  144. #define SharedDataSeparation NO
  145. #endif
  146. #ifndef SharedCodeDef
  147. #define SharedCodeDef /**/
  148. #endif
  149. #ifndef SharedLibraryDef
  150. #define SharedLibraryDef /**/
  151. #endif
  152. #ifndef ShLibIncludeFile
  153. #define ShLibIncludeFile <bsdLib.tmpl>
  154. #endif
  155. #ifndef SharedLibraryLoadFlags
  156. #define SharedLibraryLoadFlags -shared -Wl,-rpath,$(USRLIBDIR)
  157. #endif
  158. #ifndef PositionIndependentCFlags
  159. #define PositionIndependentCFlags -fPIC
  160. #endif
  161. #ifndef PositionIndependentCplusplusFlags
  162. #define PositionIndependentCplusplusFlags -fPIC
  163. #endif
  164. #ifndef ExtraLoadFlags
  165. #ifdef UseInstalled
  166. #define ExtraLoadFlags -Wl,-rpath,$(USRLIBDIRPATH)
  167. #else
  168. #define ExtraLoadFlags -Wl,-rpath,$(USRLIBDIRPATH) -Wl,-rpath-link,$(BUILDLIBDIR)
  169. #endif
  170. #endif
  171.  
  172. /*
  173.  * InstallSharedLibrary - generate rules to install the shared library.
  174.  * NOTE: file must be executable, hence "INSTBINFLAGS"
  175.  */
  176. #ifndef FreeBSDArchitecture
  177. #ifndef InstallSharedLibrary
  178. #define InstallSharedLibrary(libname,rev,dest)                @@\
  179. install:: Concat(lib,libname.so.rev)                     @@\
  180.     MakeDir($(DESTDIR)dest)                        @@\
  181.     $(INSTALL) $(INSTALLFLAGS) $(INSTBINFLAGS) Concat(lib,libname.so.rev) $(DESTDIR)dest @@\
  182.     @T=`echo Concat($(DESTDIR)dest/lib,libname.so.rev) | sed 's/\.[^\.]*$$//'`;\    @@\
  183.       set -x; $(RM) $$T && $(LN) Concat(lib,libname.so.rev) $$T    @@\
  184.     $(RM) Concat($(DESTDIR)dest/lib,libname.so)            @@\
  185.     $(LN) Concat(lib,libname.so.rev) Concat($(DESTDIR)dest/lib,libname.so)
  186. #endif /* InstallSharedLibrary */
  187. #else
  188. /* FreeBSD version */
  189. #ifndef InstallSharedLibrary
  190. #define InstallSharedLibrary(libname,rev,dest)                @@\
  191. install:: Concat(lib,libname.so.rev)                     @@\
  192.     MakeDir($(DESTDIR)dest)                        @@\
  193.     @T=`echo Concat(lib,libname.so.rev) | sed 's/\.[^\.]*$$//'`;\    @@\
  194.       set -x;\                            @@\
  195.       $(INSTALL) $(INSTALLFLAGS) $(INSTBINFLAGS) Concat(lib,libname.so.rev) $(DESTDIR)dest/$$T;\    @@\
  196.       $(RM) Concat($(DESTDIR)dest/lib,libname.so);\            @@\
  197.       $(LN) $$T Concat($(DESTDIR)dest/lib,libname.so)
  198. #endif /* InstallSharedLibrary */
  199. #endif /* FreeBSDArchitecture */
  200.  
  201. /*
  202.  * InstallSharedLibraryData - generate rules to install the shared library data
  203.  */
  204. #ifndef InstallSharedLibraryData
  205. #define InstallSharedLibraryData(libname,rev,dest)
  206. #endif /* InstallSharedLibraryData */
  207.  
  208.  
  209. /*
  210.  * SharedLibraryTarget - generate rules to create a shared library;
  211.  * build it into a different name so that we do not hose people by having
  212.  * the library gone for long periods.
  213.  */
  214. #ifndef SharedLibraryTarget
  215. #ifdef UseInstalled  
  216. #define LinkBuildSonameLibrary(lib) true
  217. #else
  218. #define LinkBuildSonameLibrary(lib) (RemoveFile($(BUILDLIBDIR)/lib); \
  219.     cd $(BUILDLIBDIR); $(LN) $(BUILDINCTOP)/$(CURRENT_DIR)/lib .)
  220. #endif
  221.  
  222. #define SharedLibraryTarget(libname,rev,solist,down,up)            @@\
  223. AllTarget(Concat(lib,libname.so.rev))                    @@\
  224.                                     @@\
  225. Concat(lib,libname.so.rev):  solist                    @@\
  226.     $(RM) $@~                            @@\
  227.     @SONAME=`echo $@ | sed 's/\.[^\.]*$$//'`; set -x; \        @@\
  228.         (cd down; $(CC) -o up/$@~ $(SHLIBLDFLAGS) -Wl,-soname,$$SONAME solist $(REQUIREDLIBS) BaseShLibReqs); \ @@\
  229.         $(RM) $$SONAME; $(LN) $@ $$SONAME; \            @@\
  230.         LinkBuildSonameLibrary($$SONAME)            @@\
  231.     $(RM) $@                            @@\
  232.     $(MV) $@~ $@                            @@\
  233.     $(RM) Concat(lib,libname.so)                    @@\
  234.     $(LN) $@ Concat(lib,libname.so)                    @@\
  235.     LinkBuildLibrary($@)                        @@\
  236.     LinkBuildLibrary(Concat(lib,libname.so))            @@\
  237.                                     @@\
  238. clean::                                    @@\
  239.     @SONAME=`echo Concat(lib,libname.so.rev) | sed 's/\.[^\.]*$$//'`; \ @@\
  240.     set -x; $(RM) $$SONAME                        @@\
  241.     $(RM) Concat(lib,libname.so)                    @@\
  242.     $(RM) Concat(lib,libname.so.rev)
  243.  
  244. #endif /* SharedLibraryTarget */
  245.  
  246. #ifndef SharedDepModuleTarget
  247. #define SharedDepModuleTarget(name,deps,solist)                @@\
  248. AllTarget(name)                                @@\
  249.                                     @@\
  250. name: deps                                @@\
  251.     $(RM) $@~                            @@\
  252.     $(CC) -o $@~ $(SHLIBLDFLAGS) solist $(REQUIREDLIBS)        @@\
  253.     $(RM) $@                            @@\
  254.     $(MV) $@~ $@                            @@\
  255.                                     @@\
  256. clean::                                    @@\
  257.     $(RM) name
  258.  
  259. #endif /* SharedDepModuleTarget */
  260.  
  261. /*
  262.  * SharedLibraryDataTarget - generate rules to create shlib data file;
  263.  */
  264. #ifndef SharedLibraryDataTarget
  265. #define SharedLibraryDataTarget(libname,rev,salist)
  266. #endif /* SharedLibraryTarget */
  267.  
  268. #if defined(FreeBSDArchitecture)
  269.  
  270. /*
  271.  * Support for building a.out compatibility libraries on a FreeBSD/ELF system.
  272.  */
  273. #ifndef BuildAoutLibraries
  274. #define BuildAoutLibraries NO
  275. #endif
  276.  
  277. #if BuildAoutLibraries
  278.  
  279. #define ExtraLibRules
  280.  
  281. #ifndef AoutSharedLibraryDef
  282. #define AoutSharedLibraryDef -DBSDSHLIB -DAOUT_COMPAT_LIB
  283. #endif
  284. #ifndef AoutSharedLibraryLoadFlags
  285. #define AoutSharedLibraryLoadFlags -aout -Bshareable
  286. #endif
  287. #ifndef AoutPositionIndependentCFlags
  288. #define AoutPositionIndependentCFlags -fpic
  289. #endif
  290.  
  291. /*
  292.  * InstallAoutSharedLibrary - generate rules to install the shared library.
  293.  */
  294. #ifndef InstallAoutSharedLibrary
  295. #define InstallAoutSharedLibrary(libname,rev,dest)            @@\
  296. install:: Concat(aout/lib,libname.so.rev)                @@\
  297.     MakeDir($(DESTDIR)dest)                        @@\
  298.     $(INSTALL) -c $(INSTLIBFLAGS) Concat(aout/lib,libname.so.rev) $(DESTDIR)dest 
  299. @@\
  300.  
  301. #endif /* InstallAoutSharedLibrary */
  302.  
  303. /*
  304.  * AoutSharedLibraryTarget - generate rules to create a shared library;
  305.  * build it into a different name so that we do not hose people by having
  306.  * the library gone for long periods.
  307.  */
  308. #ifndef AoutSharedLibraryTarget
  309. #define AoutSharedLibraryTarget(libname,rev,solist,down,up)        @@\
  310. AllTarget(Concat(down/lib,libname.so.rev))                @@\
  311.                                     @@\
  312. Concat(down/lib,libname.so.rev):  solist $(EXTRALIBRARYDEPS)        @@\
  313.     $(RM) $@~                            @@\
  314.     (cd down; $(LD) -o up/$@~ AoutSharedLibraryLoadFlags solist)    @@\
  315.     $(RM) $@                            @@\
  316.     $(MV) $@~ $@                            @@\
  317.                                     @@\
  318. clean::                                    @@\
  319.     $(RM) Concat(down/lib,libname.so.rev)
  320.  
  321. #endif /* AoutSharedLibraryTarget */
  322.  
  323. #define AoutCDebugFlags -aout DefaultCDebugFlags
  324. #define AoutCplusplusDebugFlags -aout DefaultCplusplusDebugFlags
  325.  
  326. #define AoutLibObjCompile(options) LibObjCompile(aout,AoutCDebugFlags AoutSharedLibraryDef AoutPositionIndependentCFlags options)
  327. #define AoutLibObjCplusplusCompile(options) LibObjCompile(aout,AoutCplusplusDebugFlags options)
  328.  
  329. #define ExtraLibMkdir() _LibMkdir(aout)
  330. #define ExtraObjCompile(options) AoutLibObjCompile(options)
  331. #define ExtraObjCplusplusCompile(options) AoutLibObjCplusplusCompile(options)
  332. #define ExtraCleanDir() LibCleanDir(aout)
  333.  
  334. #define ExtraLibraryTarget(libname,so,objs) AoutSharedLibraryTarget(libname,so,objs,aout,..)
  335. #define ExtraInstallLibrary(libname,so) InstallAoutSharedLibrary(libname,so,$(SHLIBDIR)/aout)
  336.  
  337. #endif
  338. #endif
  339.  
  340. #endif /* UseElfFormat */
  341.