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

  1. /*
  2.  * Library imakefile info  - this contains any special redefinitions, etc.
  3.  * that Imakefiles in the various library subtrees will need.
  4.  *
  5.  * Before including this, you must set the following boolean variables:
  6.  * DoNormalLib, DoSharedLib, DoDebugLib, DoProfileLib
  7.  *
  8.  * To get automatic generation of standard rules, also set the variables:
  9.  * LibName, SoRev, HasSharedData, and optionally HugeLibrary and IncSubdir.
  10.  *
  11.  * To suppress installation of the library define LibInstall NO.
  12.  * To suppress creating (and installing) the library define LibCreate NO.
  13.  * To suppress installing headers define LibHeaders NO.
  14.  * Define LargePICTable YES if large (32-bit) PIC tables are needed.
  15.  */
  16.  
  17. XCOMM $TOG: Library.tmpl /main/44 1997/04/28 11:47:53 kaleb $
  18.  
  19.  
  20.  
  21.  
  22. XCOMM $XFree86: xc/config/cf/Library.tmpl,v 3.5.2.3 1998/11/06 23:14:02 dawes Exp $
  23.  
  24. #ifndef LibraryCplusplusOptions
  25. # if DoSharedLib && defined(SharedLibraryCplusplusOptions)
  26. #  define LibraryCplusplusOptions SharedLibraryCplusplusOptions
  27. # else
  28. #  define LibraryCplusplusOptions DefaultCplusplusOptions
  29. # endif
  30. #endif
  31. #ifndef LibraryDefines
  32. # define LibraryDefines StandardDefines
  33. #endif
  34. #ifndef LibraryCDebugFlags
  35. # define LibraryCDebugFlags DefaultCDebugFlags
  36. #endif
  37. #ifndef LibraryCplusplusDebugFlags
  38. # define LibraryCplusplusDebugFlags DefaultCplusplusDebugFlags
  39. #endif
  40. #ifndef SeparateSharedCompile
  41. # define SeparateSharedCompile YES
  42. #endif
  43.  
  44. #ifndef CplusplusSource
  45. # ifndef LibraryCcCmd
  46. #  if DoSharedLib && defined(SharedLibraryCcCmd)
  47. #   define LibraryCcCmd SharedLibraryCcCmd
  48. #  else
  49. #   define LibraryCcCmd CcCmd
  50. #  endif
  51. # endif
  52. # ifndef LibraryCCOptions
  53. #  if DoSharedLib && defined(SharedLibraryCCOptions)
  54. #   define LibraryCCOptions SharedLibraryCCOptions
  55. #  else
  56. #   define LibraryCCOptions DefaultCCOptions
  57. #  endif
  58. # endif
  59.  
  60.          CC = LibraryCcCmd
  61.   CCOPTIONS = LibraryCCOptions
  62. STD_DEFINES = LibraryDefines $(PROJECT_DEFINES)
  63. CDEBUGFLAGS = LibraryCDebugFlags
  64. # if defined(LargePICTable) && LargePICTable && defined(LargePositionIndependentCFlags)
  65.    PICFLAGS = LargePositionIndependentCFlags
  66. # endif
  67. #else
  68. # ifndef LibraryCplusplusCmd
  69. #  if DoSharedLib && defined(SharedLibraryCplusplusCmd)
  70. #   define LibraryCplusplusCmd SharedLibraryCplusplusCmd
  71. #  else
  72. #   define LibraryCplusplusCmd CplusplusCmd
  73. #  endif
  74. # endif
  75. # ifndef LibraryCplusplusOptions
  76. #  if DoSharedLib && defined(SharedLibraryCplusplusOptions)
  77. #   define LibraryCplusplusOptions SharedLibraryCplusplusOptions
  78. #  else
  79. #   define LibraryCplusplusOptions DefaultCplusplusOptions
  80. #  endif
  81. # endif
  82.  
  83.           CXX = LibraryCplusplusCmd
  84.    CXXOPTIONS = LibraryCplusplusOptions
  85.   STD_DEFINES = LibraryDefines $(PROJECT_DEFINES)
  86. CXXDEBUGFLAGS = LibraryCplusplusDebugFlags
  87. # if defined(LargePICTable) && LargePICTable
  88. #  ifdef LargePositionIndependentCplusplusFlags
  89.   CXXPICFLAGS = LargePositionIndependentCplusplusFlags
  90. #  elif defined(LargePositionIndependentCFlags)
  91.   CXXPICFLAGS = LargePositionIndependentCFlags
  92. #  endif
  93. # endif
  94. #endif
  95.  
  96. LIB_MT_DEFINES = LibraryMTDefines
  97.  
  98. #if defined(IHaveSubdirs) && HasSymLinks
  99. #define _LibMkdir LibMkdirLinkSubdirs
  100. #else
  101. #define _LibMkdir LibMkdir
  102. #endif
  103.  
  104. #if DoDebugLib
  105. # define _DebuggedLibMkdir() _LibMkdir(debugger)
  106. # define _DebuggedObjCompile(options) DebuggedLibObjCompile(options)
  107. # define _DebuggedObjCplusplusCompile(options) DebuggedLibObjCplusplusCompile(options)
  108. # define _DebuggedCleanDir() LibCleanDir(debugger)
  109. #else
  110. # define _DebuggedLibMkdir() $(_NULLCMD_)
  111. # define _DebuggedObjCompile(options) $(_NULLCMD_)
  112. # define _DebuggedObjCplusplusCompile(options) $(_NULLCMD_)
  113. # define _DebuggedCleanDir() $(_NULLCMD_)
  114. #endif
  115.  
  116. #if DoProfileLib
  117. # define _ProfiledLibMkdir() _LibMkdir(profiled)
  118. # define _ProfiledObjCompile(options) ProfiledLibObjCompile(options)
  119. # define _ProfiledObjCplusplusCompile(options) ProfiledLibObjCplusplusCompile(options)
  120. # define _ProfiledCleanDir() LibCleanDir(profiled)
  121. #else
  122. # define _ProfiledLibMkdir() $(_NULLCMD_)
  123. # define _ProfiledObjCompile(options) $(_NULLCMD_)
  124. # define _ProfiledObjCplusplusCompile(options) $(_NULLCMD_)
  125. # define _ProfiledCleanDir() $(_NULLCMD_)
  126. #endif
  127.  
  128. #if !DoNormalLib
  129. # define _NormalLibMkdir() $(_NULLCMD_)
  130. # define _NormalObjCompile(options) $(_NULLCMD_)
  131. # define _NormalObjCplusplusCompile(options) $(_NULLCMD_)
  132. # define _NormalCleanDir() $(_NULLCMD_)
  133. #else
  134. # if DoSharedLib && SeparateSharedCompile
  135. #  define _NormalLibMkdir() _LibMkdir(unshared)
  136. #  define _NormalObjCompile(options) UnsharedLibObjCompile(options)
  137. #  define _NormalObjCplusplusCompile(options) UnsharedLibObjCplusplusCompile(options)
  138. #  define _NormalCleanDir() LibCleanDir(unshared)
  139. # else
  140. #  define _NormalLibMkdir() $(_NULLCMD_)
  141. #  define _NormalObjCompile(options) NormalLibObjCompile(options)
  142. #  define _NormalObjCplusplusCompile(options) NormalLibObjCplusplusCompile(options)
  143. #  define _NormalCleanDir() $(_NULLCMD_)
  144. # endif
  145. #endif
  146.  
  147. #if !DoSharedLib || (DoNormalLib && !SeparateSharedCompile)
  148. # define _SharedObjCompile(options) $(_NULLCMD_)
  149. # define _SharedObjCplusplusCompile(options) $(_NULLCMD_)
  150. #else
  151. # if SeparateSharedCompile
  152. #  define _SharedObjCompile(options) NormalSharedLibObjCompile(options)
  153. #  define _SharedObjCplusplusCompile(options) NormalSharedLibObjCplusplusCompile(options)
  154. #else
  155. # define _SharedObjCompile(options) NormalLibObjCompile(options)
  156. # define _SharedObjCplusplusCompile(options) NormalLibObjCplusplusCompile(options)
  157. #endif
  158. #endif
  159.  
  160. #ifndef DoExtraLib
  161. #define DoExtraLib NO
  162. #endif
  163.  
  164. #if DoExtraLib && defined(ExtraLibRules)
  165. # define _ExtraLibMkdir() ExtraLibMkdir()
  166. # define _ExtraObjCompile(options) ExtraObjCompile(options)
  167. # define _ExtraObjCplusplusCompile(options) ExtraObjCplusplusCompile(options)
  168. # define _ExtraCleanDir() ExtraCleanDir()
  169. #else
  170. # define _ExtraLibMkdir() $(_NULLCMD_)
  171. # define _ExtraObjCompile(options) $(_NULLCMD_)
  172. # define _ExtraObjCplusplusCompile(options) $(_NULLCMD_)
  173. # define _ExtraCleanDir() $(_NULLCMD_)
  174. #endif
  175.  
  176. #ifndef CplusplusSource
  177. # define SRCsuf c
  178. #else
  179. # define SRCsuf CCsuf
  180. # ifdef SunArchitecture
  181. .SUFFIXES: .CCsuf
  182. # endif
  183. #endif
  184.  
  185. #define _CompileObj(target, options)                    @@\
  186. target                                    @@\
  187.     _DebuggedObjCompile(options)                    @@\
  188.     _ProfiledObjCompile(options)                    @@\
  189.     _NormalObjCompile(options)                    @@\
  190.     _ExtraObjCompile(options)                    @@\
  191.     _SharedObjCompile(options)
  192.  
  193. #ifdef CplusplusSource
  194. # define _CompileObjCplusplus(target, options)                @@\
  195. target                                    @@\
  196.     _DebuggedObjCplusplusCompile(options)                @@\
  197.     _ProfiledObjCplusplusCompile(options)                @@\
  198.     _NormalObjCplusplusCompile(options)                @@\
  199.     _ExtraObjCplusplusCompile(options)                @@\
  200.     _SharedObjCplusplusCompile(options)
  201. #else
  202. # define _CompileObjCplusplus(target, options)
  203. #endif
  204.  
  205. #ifndef LibraryObjectRule
  206. # define LibraryObjectRule()                        @@\
  207. all::                                    @@\
  208.     _DebuggedLibMkdir()                        @@\
  209.     _ProfiledLibMkdir()                        @@\
  210.     _NormalLibMkdir()                        @@\
  211.     _ExtraLibMkdir()                        @@\
  212.                                     @@\
  213. includes::                                @@\
  214.     _DebuggedLibMkdir()                        @@\
  215.     _ProfiledLibMkdir()                        @@\
  216.     _NormalLibMkdir()                        @@\
  217.     _ExtraLibMkdir()                        @@\
  218.                                     @@\
  219. _CompileObj(.c.Osuf:,$(_NOOP_))                        @@\
  220. _CompileObjCplusplus(.SRCsuf.Osuf:,$(_NOOP_))                @@\
  221.                                     @@\
  222. clean::                                    @@\
  223.     _DebuggedCleanDir()                        @@\
  224.     _ProfiledCleanDir()                        @@\
  225.     _NormalCleanDir()                        @@\
  226.     _ExtraCleanDir()                        @@\
  227.  
  228. #endif /* LibraryObjectRule */
  229.  
  230. #ifndef SpecialLibObjectRule
  231. # define SpecialLibObjectRule(objs,depends,options)            @@\
  232. _CompileObj(objs: depends,options)
  233. #endif /* SpecialLibObjectRule */
  234.  
  235. #ifndef SpecialCLibObjectRule
  236. # define SpecialCLibObjectRule(basename,depends,options)        @@\
  237. _CompileObj(basename.Osuf: basename.SRCsuf depends,options)        @@\
  238.                                     @@\
  239. basename.i: basename.SRCsuf depends                    @@\
  240.     CPPOnlyCompile(basename.SRCsuf,options)                @@\
  241.                                     @@\
  242. CenterLoadTarget(debug_src,basename.SRCsuf,NullParameter,$(ALLDEFINES) options)
  243. #endif /* SpecialCLibObjectRule */
  244.  
  245. #ifndef SpecialCplusplusLibObjectRule
  246. # define SpecialCplusplusLibObjectRule(basename,depends,options)    @@\
  247. _CompileObjCplusplus(basename.Osuf: basename.SRCsuf depends,options)    @@\
  248.                                     @@\
  249. CenterLoadTarget(debug_src,basename.SRCsuf,NullParameter,$(ALLDEFINES) options)
  250. #endif /* SpecialCplusplusLibObjectRule */
  251.  
  252. /*
  253.  * ToolkitMakeStrings generates a string-table, i.e., a C source
  254.  * file and the matching header(s), e.g., Xt's StringDefs.c, StringDefs.h,
  255.  * and Shell.h files; or Motif's XmStrDefs.c and XmStrDefs.h files.
  256.  *
  257.  * The 'files' argument is the list of files that will be produced by
  258.  * this rule, e.g., for Xt they would be "Shell.h StringDefs.c StringDefs.h"
  259.  * and for Motif they would be "XmStrDefs.c XmStrDefs.h".
  260.  *
  261.  * The 'source' argument is the string-list file to be parsed, e.g., in
  262.  * Xt that would be "util/string.list".  For Motif 2.0 it would be
  263.  * "../../tools/makestr/xmstring.list", and for Motif-CDE1 it would be
  264.  * "util/xmstring.list".
  265.  *
  266.  * The 'options' argument is passed by the library's Imakefile, see the
  267.  * Xt Imakefile for an example.  Typically this would be nothing, -intelabi,
  268.  * or -sparcabi; there are other choices, but these are typical.
  269.  *
  270.  * The 'depends' argument names additional files the target files
  271.  * depend on.  It should name the #ctmpl and #htmpl files from the
  272.  * 'source' file.
  273.  *
  274.  * The 'dest' argument is the C source output file.  For Xt this should
  275.  * be "StringDefs.c", and for all versions of Motif it would be "XmStrDefs.c"
  276.  *
  277.  * Headers are generated and named according to data in the 'source'
  278.  * file.
  279.  */
  280. /*
  281.  * The NoCmpScript
  282.  * prevents clearmake from trying to remake makestrs if it exists.
  283.  * Including both $(MAKESTRS) and $(MAKESTRS).o as primary targets
  284.  * prevents clearmake from trying to recompile makestrs from here.
  285.  * We have includes, not files, depend on makestrs to try to get
  286.  * clearmake to wink in the files.  Bug in clearmake 2.0.2?
  287.  */
  288.  
  289. #ifndef MakeStringsDependency
  290. # define MakeStringsDependency                        @@\
  291. MAKESTRS = $(CONFIGSRC)/util/makestrs                    @@\
  292. NoCmpScript(ProgramTargetName($(MAKESTRS)) $(MAKESTRS).Osuf)        @@\
  293.                                     @@\
  294. ProgramTargetName($(MAKESTRS)) $(MAKESTRS).Osuf:            @@\
  295.     cd $(CONFIGSRC)/util && $(MAKE) ProgramTargetName(makestrs)    @@\
  296.                                     @@\
  297. includes:: ProgramTargetName($(MAKESTRS))
  298. #endif
  299. #ifndef ToolkitMakeStrings
  300. # if defined(LibTookitMakeStringsDependency) && LibTookitMakeStringsDependency
  301. #  define ToolkitMakeStrings(files,source,options,depends,dest)        @@\
  302. files: source depends                            @@\
  303.     RemoveFiles(files)                        @@\
  304.     RunProgram(MAKESTRS,options < source > dest)            @@\
  305.                                     @@\
  306. AllTarget(files)                            @@\
  307.                                     @@\
  308. includes:: files                            @@\
  309.                                     @@\
  310. depend:: files                                @@\
  311.                                     @@\
  312. clean::                                    @@\
  313.     RemoveFiles(files)
  314. # else
  315. #  define ToolkitMakeStrings(files,source,options,depends,dest)        @@\
  316. MakeStringsDependency                            @@\
  317.                                     @@\
  318. files: source depends                            @@\
  319.     RemoveFiles(files)                        @@\
  320.     RunProgram(MAKESTRS,options < source > dest)            @@\
  321.                                     @@\
  322. AllTarget(files)                            @@\
  323.                                     @@\
  324. includes:: files                            @@\
  325.                                     @@\
  326. depend:: files                                @@\
  327.                                     @@\
  328. clean::                                    @@\
  329.     RemoveFiles(files)
  330. # endif
  331. #endif /* ToolkitMakeStrings */
  332.  
  333. #ifdef LibName
  334.  
  335. LIBNAME = LibName
  336.  
  337. # if defined(LibTookitMakeStringsDependency) && LibTookitMakeStringsDependency
  338. /*
  339.  * Do ToolkitMakeStrings() before BuildIncludes so makestrs is still
  340.  * built first, even if the generated header will be installed.
  341.  */
  342. MakeStringsDependency
  343. # endif
  344.  
  345. LibraryObjectRule()
  346.  
  347. # undef _LinkBuildLibrary
  348. # if !defined(LibInstall) || LibInstall
  349. #  define _LinkBuildLibrary(lib) LinkBuildLibrary(lib)
  350. # else
  351. #  define _LinkBuildLibrary(lib) $(_NULLCMD_)
  352. # endif
  353.  
  354. # if !defined(LibCreate) || LibCreate
  355. #  if DoSharedLib
  356. #   if HugeLibrary && defined(SharedLibraryTarget3)
  357. SharedLibraryTarget3($(LIBNAME),$(SoRev),$(OBJS1),$(OBJS2),$(OBJS3),.,.)
  358. #   else
  359. SharedLibraryTarget($(LIBNAME),$(SoRev),$(OBJS),.,.)
  360. #   endif
  361. #   if !defined(LibInstall) || LibInstall
  362. InstallSharedLibrary($(LIBNAME),$(SoRev),$(SHLIBDIR))
  363. #   endif
  364. #   if HasSharedData
  365. SharedLibraryDataTarget($(LIBNAME),$(SoRev),$(UNSHAREDOBJS))
  366. #    if !defined(LibInstall) || LibInstall
  367. InstallSharedLibraryData($(LIBNAME),$(SoRev),$(SHLIBDIR))
  368. #    endif
  369. #   endif
  370. #  endif
  371. #  if DoNormalLib
  372. #   if HugeLibrary
  373. #    if DoSharedLib && SeparateSharedCompile
  374. UnsharedLibraryTarget3($(LIBNAME),$(OBJS1),$(OBJS2),$(OBJS3),unshared,..)
  375. #    else
  376. NormalLibraryTarget3($(LIBNAME),$(OBJS1),$(OBJS2),$(OBJS3))
  377. #    endif
  378. #   else
  379. #    if DoSharedLib && SeparateSharedCompile
  380. UnsharedLibraryTarget($(LIBNAME),$(OBJS),unshared,..)
  381. #    else
  382. NormalLibraryTarget($(LIBNAME),$(OBJS))
  383. #    endif
  384. #   endif
  385. #   if !defined(LibInstall) || LibInstall
  386. InstallLibrary($(LIBNAME),$(USRLIBDIR))
  387. #   endif
  388. #  endif
  389. #  if DoProfileLib
  390. ProfiledLibraryTarget($(LIBNAME),$(OBJS))
  391. #   if !defined(LibInstall) || LibInstall
  392. InstallLibrary($(LIBNAME)_p,$(USRLIBDIR))
  393. #   endif
  394. #  endif
  395. #  if DoDebugLib
  396. DebuggedLibraryTarget($(LIBNAME),$(OBJS))
  397. #   if !defined(LibInstall) || LibInstall
  398. InstallLibrary($(LIBNAME)_d,$(USRLIBDIR))
  399. #   endif
  400. #  endif
  401. #  if DoExtraLib && defined(ExtraLibRules)
  402. ExtraLibraryTarget($(LIBNAME),$(SoRev),$(OBJS))
  403. #   if !defined(LibInstall) || LibInstall
  404. ExtraInstallLibrary($(LIBNAME),$(SoRev))
  405. #   endif
  406. #  endif
  407.  
  408. LintLibraryTarget($(LIBNAME),$(SRCS))
  409. #  if !defined(LibInstall) || LibInstall
  410. InstallLintLibrary($(LIBNAME),$(LINTLIBDIR))
  411. #  endif
  412. # else /* not LibCreate */
  413. #  if HugeLibrary
  414. AllTarget($(OBJS1))
  415. AllTarget($(OBJS2))
  416. AllTarget($(OBJS3))
  417. #  else
  418. AllTarget($(OBJS))
  419. #  endif
  420. # endif /* LibCreate */
  421. # ifdef IncSubdir
  422. #  ifdef IncSubSubdir
  423. BuildIncludes($(HEADERS),IncSubdir/IncSubSubdir,../..)
  424. InstallMultipleFlags($(HEADERS),$(INCDIR)/IncSubdir/IncSubSubdir,$(INSTINCFLAGS))
  425. #  else
  426. BuildIncludes($(HEADERS),IncSubdir,..)
  427. InstallMultipleFlags($(HEADERS),$(INCDIR)/IncSubdir,$(INSTINCFLAGS))
  428. #  endif
  429. # else
  430. #  ifndef CplusplusSource
  431. #   if !defined(LibHeaders) || LibHeaders
  432. BuildIncludesTop($(HEADERS))
  433. InstallMultipleFlags($(HEADERS),$(INCDIR),$(INSTINCFLAGS))
  434. #   endif
  435. #  endif
  436. # endif
  437.  
  438. NormalLintTarget($(SRCS))
  439. #endif /* defined(LibName) */
  440.