2 * Library imakefile info - this contains any special redefinitions, etc.
3 * that Imakefiles in the various library subtrees will need.
5 * Before including this, you must set the following boolean variables:
6 * DoNormalLib, DoSharedLib, DoDebugLib, DoProfileLib
8 * To get automatic generation of standard rules, also set the variables:
9 * LibName, SoRev, HasSharedData, and optionally HugeLibrary and IncSubdir.
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.
17 XCOMM $TOG: Library.tmpl /main/44 1997/04/28 11:47:53 kaleb $
19 #ifndef LibraryCplusplusOptions
20 # if DoSharedLib && defined(SharedLibraryCplusplusOptions)
21 # define LibraryCplusplusOptions SharedLibraryCplusplusOptions
23 # define LibraryCplusplusOptions DefaultCplusplusOptions
26 #ifndef LibraryDefines
27 # define LibraryDefines StandardDefines
29 #ifndef LibraryCDebugFlags
30 # define LibraryCDebugFlags DefaultCDebugFlags
32 #ifndef LibraryCplusplusDebugFlags
33 # define LibraryCplusplusDebugFlags DefaultCplusplusDebugFlags
35 #ifndef SeparateSharedCompile
36 # define SeparateSharedCompile YES
39 #ifndef CplusplusSource
41 # if DoSharedLib && defined(SharedLibraryCcCmd)
42 # define LibraryCcCmd SharedLibraryCcCmd
44 # define LibraryCcCmd CcCmd
47 # ifndef LibraryCCOptions
48 # if DoSharedLib && defined(SharedLibraryCCOptions)
49 # define LibraryCCOptions SharedLibraryCCOptions
51 # define LibraryCCOptions DefaultCCOptions
56 CCOPTIONS = LibraryCCOptions
57 STD_DEFINES = LibraryDefines $(PROJECT_DEFINES)
58 CDEBUGFLAGS = LibraryCDebugFlags
59 # if defined(LargePICTable) && LargePICTable && defined(LargePositionIndependentCFlags)
60 PICFLAGS = LargePositionIndependentCFlags
63 # ifndef LibraryCplusplusCmd
64 # if DoSharedLib && defined(SharedLibraryCplusplusCmd)
65 # define LibraryCplusplusCmd SharedLibraryCplusplusCmd
67 # define LibraryCplusplusCmd CplusplusCmd
70 # ifndef LibraryCplusplusOptions
71 # if DoSharedLib && defined(SharedLibraryCplusplusOptions)
72 # define LibraryCplusplusOptions SharedLibraryCplusplusOptions
74 # define LibraryCplusplusOptions DefaultCplusplusOptions
78 CXX = LibraryCplusplusCmd
79 CXXOPTIONS = LibraryCplusplusOptions
80 STD_DEFINES = LibraryDefines $(PROJECT_DEFINES)
81 CXXDEBUGFLAGS = LibraryCplusplusDebugFlags
82 # if defined(LargePICTable) && LargePICTable
83 # ifdef LargePositionIndependentCplusplusFlags
84 CXXPICFLAGS = LargePositionIndependentCplusplusFlags
85 # elif defined(LargePositionIndependentCFlags)
86 CXXPICFLAGS = LargePositionIndependentCFlags
91 LIB_MT_DEFINES = LibraryMTDefines
93 #if defined(IHaveSubdirs) && HasSymLinks
94 #define _LibMkdir LibMkdirLinkSubdirs
96 #define _LibMkdir LibMkdir
100 # define _DebuggedLibMkdir() _LibMkdir(debugger)
101 # define _DebuggedObjCompile(options) DebuggedLibObjCompile(options)
102 # define _DebuggedObjCplusplusCompile(options) DebuggedLibObjCplusplusCompile(options)
103 # define _DebuggedCleanDir() LibCleanDir(debugger)
105 # define _DebuggedLibMkdir() $(_NULLCMD_)
106 # define _DebuggedObjCompile(options) $(_NULLCMD_)
107 # define _DebuggedObjCplusplusCompile(options) $(_NULLCMD_)
108 # define _DebuggedCleanDir() $(_NULLCMD_)
112 # define _ProfiledLibMkdir() _LibMkdir(profiled)
113 # define _ProfiledObjCompile(options) ProfiledLibObjCompile(options)
114 # define _ProfiledObjCplusplusCompile(options) ProfiledLibObjCplusplusCompile(options)
115 # define _ProfiledCleanDir() LibCleanDir(profiled)
117 # define _ProfiledLibMkdir() $(_NULLCMD_)
118 # define _ProfiledObjCompile(options) $(_NULLCMD_)
119 # define _ProfiledObjCplusplusCompile(options) $(_NULLCMD_)
120 # define _ProfiledCleanDir() $(_NULLCMD_)
124 # define _NormalLibMkdir() $(_NULLCMD_)
125 # define _NormalObjCompile(options) $(_NULLCMD_)
126 # define _NormalObjCplusplusCompile(options) $(_NULLCMD_)
127 # define _NormalCleanDir() $(_NULLCMD_)
129 # if DoSharedLib && SeparateSharedCompile
130 # define _NormalLibMkdir() _LibMkdir(unshared)
131 # define _NormalObjCompile(options) UnsharedLibObjCompile(options)
132 # define _NormalObjCplusplusCompile(options) UnsharedLibObjCplusplusCompile(options)
133 # define _NormalCleanDir() LibCleanDir(unshared)
135 # define _NormalLibMkdir() $(_NULLCMD_)
136 # define _NormalObjCompile(options) NormalLibObjCompile(options)
137 # define _NormalObjCplusplusCompile(options) NormalLibObjCplusplusCompile(options)
138 # define _NormalCleanDir() $(_NULLCMD_)
142 #if !DoSharedLib || (DoNormalLib && !SeparateSharedCompile)
143 # define _SharedObjCompile(options) $(_NULLCMD_)
144 # define _SharedObjCplusplusCompile(options) $(_NULLCMD_)
146 # if SeparateSharedCompile
147 # define _SharedObjCompile(options) NormalSharedLibObjCompile(options)
148 # define _SharedObjCplusplusCompile(options) NormalSharedLibObjCplusplusCompile(options)
150 # define _SharedObjCompile(options) NormalLibObjCompile(options)
151 # define _SharedObjCplusplusCompile(options) NormalLibObjCplusplusCompile(options)
155 #ifndef CplusplusSource
158 # define SRCsuf CCsuf
159 # ifdef SunArchitecture
164 #define _CompileObj(target, options) @@\
166 _DebuggedObjCompile(options) @@\
167 _ProfiledObjCompile(options) @@\
168 _NormalObjCompile(options) @@\
169 _SharedObjCompile(options)
171 #ifdef CplusplusSource
172 # define _CompileObjCplusplus(target, options) @@\
174 _DebuggedObjCplusplusCompile(options) @@\
175 _ProfiledObjCplusplusCompile(options) @@\
176 _NormalObjCplusplusCompile(options) @@\
177 _SharedObjCplusplusCompile(options)
179 # define _CompileObjCplusplus(target, options)
182 #ifndef LibraryObjectRule
183 # define LibraryObjectRule() @@\
185 _DebuggedLibMkdir() @@\
186 _ProfiledLibMkdir() @@\
187 _NormalLibMkdir() @@\
190 _DebuggedLibMkdir() @@\
191 _ProfiledLibMkdir() @@\
192 _NormalLibMkdir() @@\
194 _CompileObj(.c.Osuf:,$(_NOOP_)) @@\
195 _CompileObjCplusplus(.SRCsuf.Osuf:,$(_NOOP_)) @@\
198 _DebuggedCleanDir() @@\
199 _ProfiledCleanDir() @@\
200 _NormalCleanDir() @@\
202 #endif /* LibraryObjectRule */
204 #ifndef SpecialLibObjectRule
205 # define SpecialLibObjectRule(objs,depends,options) @@\
206 _CompileObj(objs: depends,options)
207 #endif /* SpecialLibObjectRule */
209 #ifndef SpecialCLibObjectRule
210 # define SpecialCLibObjectRule(basename,depends,options) @@\
211 _CompileObj(basename.Osuf: basename.SRCsuf depends,options) @@\
213 basename.i: basename.SRCsuf depends @@\
214 CPPOnlyCompile(basename.SRCsuf,options) @@\
216 CenterLoadTarget(debug_src,basename.SRCsuf,NullParameter,$(ALLDEFINES) options)
217 #endif /* SpecialCLibObjectRule */
219 #ifndef SpecialCplusplusLibObjectRule
220 # define SpecialCplusplusLibObjectRule(basename,depends,options) @@\
221 _CompileObjCplusplus(basename.Osuf: basename.SRCsuf depends,options) @@\
223 CenterLoadTarget(debug_src,basename.SRCsuf,NullParameter,$(ALLDEFINES) options)
224 #endif /* SpecialCplusplusLibObjectRule */
227 * ToolkitMakeStrings generates a string-table, i.e., a C source
228 * file and the matching header(s), e.g., Xt's StringDefs.c, StringDefs.h,
229 * and Shell.h files; or Motif's XmStrDefs.c and XmStrDefs.h files.
231 * The 'files' argument is the list of files that will be produced by
232 * this rule, e.g., for Xt they would be "Shell.h StringDefs.c StringDefs.h"
233 * and for Motif they would be "XmStrDefs.c XmStrDefs.h".
235 * The 'source' argument is the string-list file to be parsed, e.g., in
236 * Xt that would be "util/string.list". For Motif 2.0 it would be
237 * "../../tools/makestr/xmstring.list", and for Motif-CDE1 it would be
238 * "util/xmstring.list".
240 * The 'options' argument is passed by the library's Imakefile, see the
241 * Xt Imakefile for an example. Typically this would be nothing, -intelabi,
242 * or -sparcabi; there are other choices, but these are typical.
244 * The 'depends' argument names additional files the target files
245 * depend on. It should name the #ctmpl and #htmpl files from the
248 * The 'dest' argument is the C source output file. For Xt this should
249 * be "StringDefs.c", and for all versions of Motif it would be "XmStrDefs.c"
251 * Headers are generated and named according to data in the 'source'
256 * prevents clearmake from trying to remake makestrs if it exists.
257 * Including both $(MAKESTRS) and $(MAKESTRS).o as primary targets
258 * prevents clearmake from trying to recompile makestrs from here.
259 * We have includes, not files, depend on makestrs to try to get
260 * clearmake to wink in the files. Bug in clearmake 2.0.2?
263 #ifndef MakeStringsDependency
264 # define MakeStringsDependency @@\
265 MAKESTRS = $(CONFIGSRC)/util/makestrs @@\
266 NoCmpScript(ProgramTargetName($(MAKESTRS)) $(MAKESTRS).Osuf) @@\
268 ProgramTargetName($(MAKESTRS)) $(MAKESTRS).Osuf: @@\
269 cd $(CONFIGSRC)/util && $(MAKE) ProgramTargetName(makestrs) @@\
271 includes:: ProgramTargetName($(MAKESTRS))
273 #ifndef ToolkitMakeStrings
274 # if defined(LibTookitMakeStringsDependency) && LibTookitMakeStringsDependency
275 # define ToolkitMakeStrings(files,source,options,depends,dest) @@\
276 files: source depends @@\
277 RemoveFiles(files) @@\
278 RunProgram(MAKESTRS,options < source > dest) @@\
289 # define ToolkitMakeStrings(files,source,options,depends,dest) @@\
290 MakeStringsDependency @@\
292 files: source depends @@\
293 RemoveFiles(files) @@\
294 RunProgram(MAKESTRS,options < source > dest) @@\
305 #endif /* ToolkitMakeStrings */
311 # if defined(LibTookitMakeStringsDependency) && LibTookitMakeStringsDependency
313 * Do ToolkitMakeStrings() before BuildIncludes so makestrs is still
314 * built first, even if the generated header will be installed.
316 MakeStringsDependency
321 # undef _LinkBuildLibrary
322 # if !defined(LibInstall) || LibInstall
323 # define _LinkBuildLibrary(lib) LinkBuildLibrary(lib)
325 # define _LinkBuildLibrary(lib) $(_NULLCMD_)
328 # if !defined(LibCreate) || LibCreate
330 # if HugeLibrary && defined(SharedLibraryTarget3)
331 SharedLibraryTarget3($(LIBNAME),$(SoRev),$(OBJS1),$(OBJS2),$(OBJS3),.,.)
333 SharedLibraryTarget($(LIBNAME),$(SoRev),$(OBJS),.,.)
335 # if !defined(LibInstall) || LibInstall
336 InstallSharedLibrary($(LIBNAME),$(SoRev),$(SHLIBDIR))
339 SharedLibraryDataTarget($(LIBNAME),$(SoRev),$(UNSHAREDOBJS))
340 # if !defined(LibInstall) || LibInstall
341 InstallSharedLibraryData($(LIBNAME),$(SoRev),$(SHLIBDIR))
347 # if DoSharedLib && SeparateSharedCompile
348 UnsharedLibraryTarget3($(LIBNAME),$(OBJS1),$(OBJS2),$(OBJS3),unshared,..)
350 NormalLibraryTarget3($(LIBNAME),$(OBJS1),$(OBJS2),$(OBJS3))
353 # if DoSharedLib && SeparateSharedCompile
354 UnsharedLibraryTarget($(LIBNAME),$(OBJS),unshared,..)
356 NormalLibraryTarget($(LIBNAME),$(OBJS))
359 # if !defined(LibInstall) || LibInstall
360 InstallLibrary($(LIBNAME),$(USRLIBDIR))
364 ProfiledLibraryTarget($(LIBNAME),$(OBJS))
365 # if !defined(LibInstall) || LibInstall
366 InstallLibrary($(LIBNAME)_p,$(USRLIBDIR))
370 DebuggedLibraryTarget($(LIBNAME),$(OBJS))
371 # if !defined(LibInstall) || LibInstall
372 InstallLibrary($(LIBNAME)_d,$(USRLIBDIR))
376 LintLibraryTarget($(LIBNAME),$(SRCS))
377 # if !defined(LibInstall) || LibInstall
378 InstallLintLibrary($(LIBNAME),$(LINTLIBDIR))
380 # else /* not LibCreate */
388 # endif /* LibCreate */
391 BuildIncludes($(HEADERS),IncSubdir/IncSubSubdir,../..)
392 InstallMultipleFlags($(HEADERS),$(INCDIR)/IncSubdir/IncSubSubdir,$(INSTINCFLAGS))
394 BuildIncludes($(HEADERS),IncSubdir,..)
395 InstallMultipleFlags($(HEADERS),$(INCDIR)/IncSubdir,$(INSTINCFLAGS))
398 # ifndef CplusplusSource
399 # if !defined(LibHeaders) || LibHeaders
400 BuildIncludesTop($(HEADERS))
401 InstallMultipleFlags($(HEADERS),$(INCDIR),$(INSTINCFLAGS))
406 NormalLintTarget($(SRCS))
407 #endif /* defined(LibName) */