home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-bin / x11r6.1 / lib / x11 / config / library.tmpl < prev    next >
Encoding:
Text File  |  1996-10-17  |  9.8 KB  |  331 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.  
  12. XCOMM $XConsortium: Library.tmpl /main/36 1995/12/05 16:41:16 mor $
  13.  
  14. #ifndef LibraryCplusplusOptions
  15. #if DoSharedLib && defined(SharedLibraryCplusplusOptions)
  16. #define LibraryCplusplusOptions SharedLibraryCplusplusOptions
  17. #else
  18. #define LibraryCplusplusOptions DefaultCplusplusOptions
  19. #endif
  20. #endif
  21. #ifndef LibraryDefines
  22. #define LibraryDefines StandardDefines
  23. #endif
  24. #ifndef LibraryCDebugFlags
  25. #define LibraryCDebugFlags DefaultCDebugFlags
  26. #endif
  27. #ifndef LibraryCplusplusDebugFlags
  28. #define LibraryCplusplusDebugFlags DefaultCplusplusDebugFlags
  29. #endif
  30. #ifndef SeparateSharedCompile
  31. #define SeparateSharedCompile YES
  32. #endif
  33.  
  34. #ifndef CplusplusSource
  35. #ifndef LibraryCcCmd
  36. #if DoSharedLib && defined(SharedLibraryCcCmd)
  37. #define LibraryCcCmd SharedLibraryCcCmd
  38. #else
  39. #define LibraryCcCmd CcCmd
  40. #endif
  41. #endif
  42. #ifndef LibraryCCOptions
  43. #if DoSharedLib && defined(SharedLibraryCCOptions)
  44. #define LibraryCCOptions SharedLibraryCCOptions
  45. #else
  46. #define LibraryCCOptions DefaultCCOptions
  47. #endif
  48. #endif
  49.  
  50.          CC = LibraryCcCmd
  51.   CCOPTIONS = LibraryCCOptions
  52. STD_DEFINES = LibraryDefines
  53. CDEBUGFLAGS = LibraryCDebugFlags
  54. #else
  55. #ifndef LibraryCplusplusCmd
  56. #if DoSharedLib && defined(SharedLibraryCplusplusCmd)
  57. #define LibraryCplusplusCmd SharedLibraryCplusplusCmd
  58. #else
  59. #define LibraryCplusplusCmd CplusplusCmd
  60. #endif
  61. #endif
  62. #ifndef LibraryCplusplusOptions
  63. #if DoSharedLib && defined(SharedLibraryCplusplusOptions)
  64. #define LibraryCplusplusOptions SharedLibraryCplusplusOptions
  65. #else
  66. #define LibraryCplusplusOptions DefaultCplusplusOptions
  67. #endif
  68. #endif
  69.  
  70.           CXX = LibraryCplusplusCmd
  71.    CXXOPTIONS = LibraryCplusplusOptions
  72.   STD_DEFINES = LibraryDefines
  73. CXXDEBUGFLAGS = LibraryCplusplusDebugFlags
  74. #endif
  75.  
  76. #if DoDebugLib
  77. #define _DebuggedLibMkdir() LibMkdir(debugger)
  78. #ifndef CplusplusSource
  79. #define _DebuggedObjCompile(options) DebuggedLibObjCompile(options)
  80. #else
  81. #define _DebuggedObjCompile(options) DebuggedLibObjCplusplusCompile(options)
  82. #endif
  83. #define _DebuggedCleanDir() LibCleanDir(debugger)
  84. #else
  85. #define _DebuggedLibMkdir() $(_NULLCMD_)
  86. #define _DebuggedObjCompile(options) $(_NULLCMD_)
  87. #define _DebuggedCleanDir() $(_NULLCMD_)
  88. #endif
  89.  
  90. #if DoProfileLib
  91. #define _ProfiledLibMkdir() LibMkdir(profiled)
  92. #ifndef CplusplusSource
  93. #define _ProfiledObjCompile(options) ProfiledLibObjCompile(options)
  94. #else
  95. #define _ProfiledObjCompile(options) ProfiledLibObjCplusplusCompile(options)
  96. #endif
  97. #define _ProfiledCleanDir() LibCleanDir(profiled)
  98. #else
  99. #define _ProfiledLibMkdir() $(_NULLCMD_)
  100. #define _ProfiledObjCompile(options) $(_NULLCMD_)
  101. #define _ProfiledCleanDir() $(_NULLCMD_)
  102. #endif
  103.  
  104. #if !DoNormalLib
  105. #define _NormalLibMkdir() $(_NULLCMD_)
  106. #define _NormalObjCompile(options) $(_NULLCMD_)
  107. #define _NormalCleanDir() $(_NULLCMD_)
  108. #else
  109. #if DoSharedLib && SeparateSharedCompile
  110. #define _NormalLibMkdir() LibMkdir(unshared)
  111. #ifndef CplusplusSource
  112. #define _NormalObjCompile(options) UnsharedLibObjCompile(options)
  113. #else
  114. #define _NormalObjCompile(options) UnsharedLibObjCplusplusCompile(options)
  115. #endif
  116. #define _NormalCleanDir() LibCleanDir(unshared)
  117. #else
  118. #define _NormalLibMkdir() $(_NULLCMD_)
  119. #ifndef CplusplusSource
  120. #define _NormalObjCompile(options) NormalLibObjCompile(options)
  121. #else
  122. #define _NormalObjCompile(options) NormalLibObjCplusplusCompile(options)
  123. #endif
  124. #define _NormalCleanDir() $(_NULLCMD_)
  125. #endif
  126. #endif
  127.  
  128. #if !DoSharedLib || (DoNormalLib && !SeparateSharedCompile)
  129. #define _SharedObjCompile(options) $(_NULLCMD_)
  130. #else
  131. #if SeparateSharedCompile
  132. #ifndef CplusplusSource
  133. #define _SharedObjCompile(options) NormalSharedLibObjCompile(options)
  134. #else
  135. #define _SharedObjCompile(options) NormalSharedLibObjCplusplusCompile(options)
  136. #endif
  137. #else
  138. #ifndef CplusplusSource
  139. #define _SharedObjCompile(options) NormalLibObjCompile(options)
  140. #else
  141. #define _SharedObjCompile(options) NormalLibObjCplusplusCompile(options)
  142. #endif
  143. #endif
  144. #endif
  145.  
  146. #ifndef CplusplusSource
  147. #define SRCsuf c
  148. #else
  149. #define SRCsuf CCsuf
  150. #ifdef SunArchitecture
  151. .SUFFIXES: .CCsuf
  152. #endif
  153. #endif
  154.  
  155. #ifndef LibraryObjectRule
  156. #define LibraryObjectRule()                        @@\
  157. all::                                    @@\
  158.     _DebuggedLibMkdir()                        @@\
  159.     _ProfiledLibMkdir()                        @@\
  160.     _NormalLibMkdir()                        @@\
  161.                                     @@\
  162. includes::                                @@\
  163.     _DebuggedLibMkdir()                        @@\
  164.     _ProfiledLibMkdir()                        @@\
  165.     _NormalLibMkdir()                        @@\
  166.                                     @@\
  167. .SRCsuf.Osuf:                                @@\
  168.     _DebuggedObjCompile($(_NOOP_))                    @@\
  169.     _ProfiledObjCompile($(_NOOP_))                    @@\
  170.     _NormalObjCompile($(_NOOP_))                    @@\
  171.     _SharedObjCompile($(_NOOP_))                    @@\
  172.                                     @@\
  173. clean::                                    @@\
  174.     _DebuggedCleanDir()                        @@\
  175.     _ProfiledCleanDir()                        @@\
  176.     _NormalCleanDir()                        @@\
  177.  
  178. #endif /* LibraryObjectRule */
  179.  
  180. #ifndef SpecialLibObjectRule
  181. #define SpecialLibObjectRule(objs,depends,options)            @@\
  182. objs: depends                                @@\
  183.     _DebuggedObjCompile(options)                    @@\
  184.     _ProfiledObjCompile(options)                    @@\
  185.     _NormalObjCompile(options)                    @@\
  186.     _SharedObjCompile(options)                    @@\
  187.  
  188. #endif /* SpecialLibObjectRule */
  189.  
  190. #ifndef SpecialCLibObjectRule
  191. #define SpecialCLibObjectRule(basename,depends,options)            @@\
  192. SpecialLibObjectRule(basename.Osuf,basename.SRCsuf depends,options)    @@\
  193.                                     @@\
  194. basename.i: basename.SRCsuf depends                    @@\
  195.     CPPOnlyCompile(basename.SRCsuf,options)                @@\
  196.                                     @@\
  197. CenterLoadTarget(debug_src,basename.SRCsuf,NullParameter,$(ALLDEFINES) options)
  198. #endif /* SpecialCLibObjectRule */
  199.  
  200. #ifndef SpecialCplusplusLibObjectRule
  201. #define SpecialCplusplusLibObjectRule(basename,depends,options)        @@\
  202. SpecialLibObjectRule(basename.Osuf,basename.SRCsuf depends,options)    @@\
  203.                                     @@\
  204. CenterLoadTarget(debug_src,basename.SRCsuf,NullParameter,$(ALLDEFINES) options)
  205. #endif /* SpecialCplusplusLibObjectRule */
  206.  
  207. /*
  208.  * ToolkitMakeStrings generates a string-table, i.e., a C source
  209.  * file and the matching header(s), e.g., Xt's StringDefs.c, StringDefs.h,
  210.  * and Shell.h files; or Motif's XmStrDefs.c and XmStrDefs.h files.
  211.  *
  212.  * The 'files' argument is the list of files that will be produced by
  213.  * this rule, e.g., for Xt they would be "Shell.h StringDefs.c StringDefs.h"
  214.  * and for Motif they would be "XmStrDefs.c XmStrDefs.h".
  215.  *
  216.  * The 'source' argument is the string-list file to be parsed, e.g., in
  217.  * Xt that would be "util/string.list".  For Motif 2.0 it would be
  218.  * "../../tools/makestr/xmstring.list", and for Motif-CDE1 it would be
  219.  * "util/xmstring.list".
  220.  *
  221.  * The 'options' argument is passed by the library's Imakefile, see the
  222.  * Xt Imakefile for an example.  Typically this would be nothing, -intelabi,
  223.  * or -sparcabi; there are other choices, but these are typical.
  224.  *
  225.  * The 'depends' argument names additional files the target files
  226.  * depend on.  It should name the #ctmpl and #htmpl files from the
  227.  * 'source' file.
  228.  *
  229.  * The 'dest' argument is the C source output file.  For Xt this should
  230.  * be "StringDefs.c", and for all versions of Motif it would be "XmStrDefs.c"
  231.  *
  232.  * Headers are generated and named according to data in the 'source'
  233.  * file.
  234.  */
  235. /*
  236.  * The NoCmpScript
  237.  * prevents clearmake from trying to remake makestrs if it exists.
  238.  * Including both $(MAKESTRS) and $(MAKESTRS).o as primary targets
  239.  * prevents clearmake from trying to recompile makestrs from here.
  240.  * We have includes, not files, depend on makestrs to try to get
  241.  * clearmake to wink in the files.  Bug in clearmake 2.0.2?
  242.  */
  243.  
  244. #ifndef ToolkitMakeStrings
  245. #define ToolkitMakeStrings(files,source,options,depends,dest)        @@\
  246. MAKESTRS = $(CONFIGSRC)/util/makestrs                    @@\
  247. NoCmpScript(ProgramTargetName($(MAKESTRS)) $(MAKESTRS).Osuf)        @@\
  248.                                     @@\
  249. ProgramTargetName($(MAKESTRS)) $(MAKESTRS).Osuf:            @@\
  250.     cd $(CONFIGSRC)/util && $(MAKE) ProgramTargetName(makestrs)    @@\
  251.                                     @@\
  252. includes:: ProgramTargetName($(MAKESTRS))                 @@\
  253.                                     @@\
  254. files: source depends                            @@\
  255.     RemoveFiles(files)                        @@\
  256.     RunProgram(MAKESTRS,options < source > dest)            @@\
  257.                                     @@\
  258. AllTarget(files)                            @@\
  259.                                     @@\
  260. includes:: files                            @@\
  261.                                     @@\
  262. depend:: files                                @@\
  263.                                     @@\
  264. clean::                                    @@\
  265.     RemoveFiles(files)
  266.  
  267. #endif /* ToolkitMakeStrings */
  268.  
  269. #ifdef LibName
  270.  
  271. LIBNAME = LibName
  272.  
  273. LibraryObjectRule()
  274.  
  275. #undef _LinkBuildLibrary
  276. #define _LinkBuildLibrary(lib) LinkBuildLibrary(lib)
  277.  
  278. #if DoSharedLib
  279. #if HugeLibrary && defined(SharedLibraryTarget3)
  280. SharedLibraryTarget3($(LIBNAME),$(SoRev),$(OBJS1),$(OBJS2),$(OBJS3),.,.)
  281. #else
  282. SharedLibraryTarget($(LIBNAME),$(SoRev),$(OBJS),.,.)
  283. #endif
  284. InstallSharedLibrary($(LIBNAME),$(SoRev),$(SHLIBDIR))
  285. #if HasSharedData
  286. SharedLibraryDataTarget($(LIBNAME),$(SoRev),$(UNSHAREDOBJS))
  287. InstallSharedLibraryData($(LIBNAME),$(SoRev),$(SHLIBDIR))
  288. #endif
  289. #endif
  290. #if DoNormalLib
  291. #if HugeLibrary
  292. #if DoSharedLib && SeparateSharedCompile
  293. UnsharedLibraryTarget3($(LIBNAME),$(OBJS1),$(OBJS2),$(OBJS3),unshared,..)
  294. #else
  295. NormalLibraryTarget3($(LIBNAME),$(OBJS1),$(OBJS2),$(OBJS3))
  296. #endif
  297. #else
  298. #if DoSharedLib && SeparateSharedCompile
  299. UnsharedLibraryTarget($(LIBNAME),$(OBJS),unshared,..)
  300. #else
  301. NormalLibraryTarget($(LIBNAME),$(OBJS))
  302. #endif
  303. #endif
  304. InstallLibrary($(LIBNAME),$(USRLIBDIR))
  305. #endif
  306. #if DoProfileLib
  307. ProfiledLibraryTarget($(LIBNAME),$(OBJS))
  308. InstallLibrary($(LIBNAME)_p,$(USRLIBDIR))
  309. #endif
  310. #if DoDebugLib
  311. DebuggedLibraryTarget($(LIBNAME),$(OBJS))
  312. InstallLibrary($(LIBNAME)_d,$(USRLIBDIR))
  313. #endif
  314.  
  315. LintLibraryTarget($(LIBNAME),$(SRCS))
  316. InstallLintLibrary($(LIBNAME),$(LINTLIBDIR))
  317. #ifdef IncSubdir
  318. BuildIncludes($(HEADERS),IncSubdir,..)
  319. InstallMultipleFlags($(HEADERS),$(INCDIR)/IncSubdir,$(INSTINCFLAGS))
  320. #else
  321. #ifndef CplusplusSource
  322. #if !defined(LibHeaders) || LibHeaders
  323. BuildIncludesTop($(HEADERS))
  324. InstallMultipleFlags($(HEADERS),$(INCDIR),$(INSTINCFLAGS))
  325. #endif
  326. #endif
  327. #endif
  328.  
  329. NormalLintTarget($(SRCS))
  330. #endif
  331.