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 $
22 XCOMM $XFree86: xc/config/cf/Library.tmpl,v 3.5.2.1 1997/06/11 12:08:29 dawes Exp $
24 #ifndef LibraryCplusplusOptions
25 # if DoSharedLib && defined(SharedLibraryCplusplusOptions)
26 # define LibraryCplusplusOptions SharedLibraryCplusplusOptions
28 # define LibraryCplusplusOptions DefaultCplusplusOptions
31 #ifndef LibraryDefines
32 # define LibraryDefines StandardDefines
34 #ifndef LibraryCDebugFlags
35 # define LibraryCDebugFlags DefaultCDebugFlags
37 #ifndef LibraryCplusplusDebugFlags
38 # define LibraryCplusplusDebugFlags DefaultCplusplusDebugFlags
40 #ifndef SeparateSharedCompile
41 # define SeparateSharedCompile YES
44 #ifndef CplusplusSource
46 # if DoSharedLib && defined(SharedLibraryCcCmd)
47 # define LibraryCcCmd SharedLibraryCcCmd
49 # define LibraryCcCmd CcCmd
52 # ifndef LibraryCCOptions
53 # if DoSharedLib && defined(SharedLibraryCCOptions)
54 # define LibraryCCOptions SharedLibraryCCOptions
56 # define LibraryCCOptions DefaultCCOptions
61 CCOPTIONS = LibraryCCOptions
62 STD_DEFINES = LibraryDefines $(PROJECT_DEFINES)
63 CDEBUGFLAGS = LibraryCDebugFlags
64 # if defined(LargePICTable) && LargePICTable && defined(LargePositionIndependentCFlags)
65 PICFLAGS = LargePositionIndependentCFlags
68 # ifndef LibraryCplusplusCmd
69 # if DoSharedLib && defined(SharedLibraryCplusplusCmd)
70 # define LibraryCplusplusCmd SharedLibraryCplusplusCmd
72 # define LibraryCplusplusCmd CplusplusCmd
75 # ifndef LibraryCplusplusOptions
76 # if DoSharedLib && defined(SharedLibraryCplusplusOptions)
77 # define LibraryCplusplusOptions SharedLibraryCplusplusOptions
79 # define LibraryCplusplusOptions DefaultCplusplusOptions
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
96 LIB_MT_DEFINES = LibraryMTDefines
98 #if defined(IHaveSubdirs) && HasSymLinks
99 #define _LibMkdir LibMkdirLinkSubdirs
101 #define _LibMkdir LibMkdir
105 # define _DebuggedLibMkdir() _LibMkdir(debugger)
106 # define _DebuggedObjCompile(options) DebuggedLibObjCompile(options)
107 # define _DebuggedObjCplusplusCompile(options) DebuggedLibObjCplusplusCompile(options)
108 # define _DebuggedCleanDir() LibCleanDir(debugger)
110 # define _DebuggedLibMkdir() $(_NULLCMD_)
111 # define _DebuggedObjCompile(options) $(_NULLCMD_)
112 # define _DebuggedObjCplusplusCompile(options) $(_NULLCMD_)
113 # define _DebuggedCleanDir() $(_NULLCMD_)
117 # define _ProfiledLibMkdir() _LibMkdir(profiled)
118 # define _ProfiledObjCompile(options) ProfiledLibObjCompile(options)
119 # define _ProfiledObjCplusplusCompile(options) ProfiledLibObjCplusplusCompile(options)
120 # define _ProfiledCleanDir() LibCleanDir(profiled)
122 # define _ProfiledLibMkdir() $(_NULLCMD_)
123 # define _ProfiledObjCompile(options) $(_NULLCMD_)
124 # define _ProfiledObjCplusplusCompile(options) $(_NULLCMD_)
125 # define _ProfiledCleanDir() $(_NULLCMD_)
129 # define _NormalLibMkdir() $(_NULLCMD_)
130 # define _NormalObjCompile(options) $(_NULLCMD_)
131 # define _NormalObjCplusplusCompile(options) $(_NULLCMD_)
132 # define _NormalCleanDir() $(_NULLCMD_)
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)
140 # define _NormalLibMkdir() $(_NULLCMD_)
141 # define _NormalObjCompile(options) NormalLibObjCompile(options)
142 # define _NormalObjCplusplusCompile(options) NormalLibObjCplusplusCompile(options)
143 # define _NormalCleanDir() $(_NULLCMD_)
147 #if !DoSharedLib || (DoNormalLib && !SeparateSharedCompile)
148 # define _SharedObjCompile(options) $(_NULLCMD_)
149 # define _SharedObjCplusplusCompile(options) $(_NULLCMD_)
151 # if SeparateSharedCompile
152 # define _SharedObjCompile(options) NormalSharedLibObjCompile(options)
153 # define _SharedObjCplusplusCompile(options) NormalSharedLibObjCplusplusCompile(options)
155 # define _SharedObjCompile(options) NormalLibObjCompile(options)
156 # define _SharedObjCplusplusCompile(options) NormalLibObjCplusplusCompile(options)
160 #ifndef CplusplusSource
163 # define SRCsuf CCsuf
164 # ifdef SunArchitecture
169 #define _CompileObj(target, options) @@\
171 _DebuggedObjCompile(options) @@\
172 _ProfiledObjCompile(options) @@\
173 _NormalObjCompile(options) @@\
174 _SharedObjCompile(options)
176 #ifdef CplusplusSource
177 # define _CompileObjCplusplus(target, options) @@\
179 _DebuggedObjCplusplusCompile(options) @@\
180 _ProfiledObjCplusplusCompile(options) @@\
181 _NormalObjCplusplusCompile(options) @@\
182 _SharedObjCplusplusCompile(options)
184 # define _CompileObjCplusplus(target, options)
187 #ifndef LibraryObjectRule
188 # define LibraryObjectRule() @@\
190 _DebuggedLibMkdir() @@\
191 _ProfiledLibMkdir() @@\
192 _NormalLibMkdir() @@\
195 _DebuggedLibMkdir() @@\
196 _ProfiledLibMkdir() @@\
197 _NormalLibMkdir() @@\
199 _CompileObj(.c.Osuf:,$(_NOOP_)) @@\
200 _CompileObjCplusplus(.SRCsuf.Osuf:,$(_NOOP_)) @@\
203 _DebuggedCleanDir() @@\
204 _ProfiledCleanDir() @@\
205 _NormalCleanDir() @@\
207 #endif /* LibraryObjectRule */
209 #ifndef SpecialLibObjectRule
210 # define SpecialLibObjectRule(objs,depends,options) @@\
211 _CompileObj(objs: depends,options)
212 #endif /* SpecialLibObjectRule */
214 #ifndef SpecialCLibObjectRule
215 # define SpecialCLibObjectRule(basename,depends,options) @@\
216 _CompileObj(basename.Osuf: basename.SRCsuf depends,options) @@\
218 basename.i: basename.SRCsuf depends @@\
219 CPPOnlyCompile(basename.SRCsuf,options) @@\
221 CenterLoadTarget(debug_src,basename.SRCsuf,NullParameter,$(ALLDEFINES) options)
222 #endif /* SpecialCLibObjectRule */
224 #ifndef SpecialCplusplusLibObjectRule
225 # define SpecialCplusplusLibObjectRule(basename,depends,options) @@\
226 _CompileObjCplusplus(basename.Osuf: basename.SRCsuf depends,options) @@\
228 CenterLoadTarget(debug_src,basename.SRCsuf,NullParameter,$(ALLDEFINES) options)
229 #endif /* SpecialCplusplusLibObjectRule */
232 * ToolkitMakeStrings generates a string-table, i.e., a C source
233 * file and the matching header(s), e.g., Xt's StringDefs.c, StringDefs.h,
234 * and Shell.h files; or Motif's XmStrDefs.c and XmStrDefs.h files.
236 * The 'files' argument is the list of files that will be produced by
237 * this rule, e.g., for Xt they would be "Shell.h StringDefs.c StringDefs.h"
238 * and for Motif they would be "XmStrDefs.c XmStrDefs.h".
240 * The 'source' argument is the string-list file to be parsed, e.g., in
241 * Xt that would be "util/string.list". For Motif 2.0 it would be
242 * "../../tools/makestr/xmstring.list", and for Motif-CDE1 it would be
243 * "util/xmstring.list".
245 * The 'options' argument is passed by the library's Imakefile, see the
246 * Xt Imakefile for an example. Typically this would be nothing, -intelabi,
247 * or -sparcabi; there are other choices, but these are typical.
249 * The 'depends' argument names additional files the target files
250 * depend on. It should name the #ctmpl and #htmpl files from the
253 * The 'dest' argument is the C source output file. For Xt this should
254 * be "StringDefs.c", and for all versions of Motif it would be "XmStrDefs.c"
256 * Headers are generated and named according to data in the 'source'
261 * prevents clearmake from trying to remake makestrs if it exists.
262 * Including both $(MAKESTRS) and $(MAKESTRS).o as primary targets
263 * prevents clearmake from trying to recompile makestrs from here.
264 * We have includes, not files, depend on makestrs to try to get
265 * clearmake to wink in the files. Bug in clearmake 2.0.2?
268 #ifndef MakeStringsDependency
269 # define MakeStringsDependency @@\
270 MAKESTRS = $(CONFIGSRC)/util/makestrs @@\
271 NoCmpScript(ProgramTargetName($(MAKESTRS)) $(MAKESTRS).Osuf) @@\
273 ProgramTargetName($(MAKESTRS)) $(MAKESTRS).Osuf: @@\
274 cd $(CONFIGSRC)/util && $(MAKE) ProgramTargetName(makestrs) @@\
276 includes:: ProgramTargetName($(MAKESTRS))
278 #ifndef ToolkitMakeStrings
279 # if defined(LibTookitMakeStringsDependency) && LibTookitMakeStringsDependency
280 # define ToolkitMakeStrings(files,source,options,depends,dest) @@\
281 files: source depends @@\
282 RemoveFiles(files) @@\
283 RunProgram(MAKESTRS,options < source > dest) @@\
294 # define ToolkitMakeStrings(files,source,options,depends,dest) @@\
295 MakeStringsDependency @@\
297 files: source depends @@\
298 RemoveFiles(files) @@\
299 RunProgram(MAKESTRS,options < source > dest) @@\
310 #endif /* ToolkitMakeStrings */
316 # if defined(LibTookitMakeStringsDependency) && LibTookitMakeStringsDependency
318 * Do ToolkitMakeStrings() before BuildIncludes so makestrs is still
319 * built first, even if the generated header will be installed.
321 MakeStringsDependency
326 # undef _LinkBuildLibrary
327 # if !defined(LibInstall) || LibInstall
328 # define _LinkBuildLibrary(lib) LinkBuildLibrary(lib)
330 # define _LinkBuildLibrary(lib) $(_NULLCMD_)
333 # if !defined(LibCreate) || LibCreate
335 # if HugeLibrary && defined(SharedLibraryTarget3)
336 SharedLibraryTarget3($(LIBNAME),$(SoRev),$(OBJS1),$(OBJS2),$(OBJS3),.,.)
338 SharedLibraryTarget($(LIBNAME),$(SoRev),$(OBJS),.,.)
340 # if !defined(LibInstall) || LibInstall
341 InstallSharedLibrary($(LIBNAME),$(SoRev),$(SHLIBDIR))
344 SharedLibraryDataTarget($(LIBNAME),$(SoRev),$(UNSHAREDOBJS))
345 # if !defined(LibInstall) || LibInstall
346 InstallSharedLibraryData($(LIBNAME),$(SoRev),$(SHLIBDIR))
352 # if DoSharedLib && SeparateSharedCompile
353 UnsharedLibraryTarget3($(LIBNAME),$(OBJS1),$(OBJS2),$(OBJS3),unshared,..)
355 NormalLibraryTarget3($(LIBNAME),$(OBJS1),$(OBJS2),$(OBJS3))
358 # if DoSharedLib && SeparateSharedCompile
359 UnsharedLibraryTarget($(LIBNAME),$(OBJS),unshared,..)
361 NormalLibraryTarget($(LIBNAME),$(OBJS))
364 # if !defined(LibInstall) || LibInstall
365 InstallLibrary($(LIBNAME),$(USRLIBDIR))
369 ProfiledLibraryTarget($(LIBNAME),$(OBJS))
370 # if !defined(LibInstall) || LibInstall
371 InstallLibrary($(LIBNAME)_p,$(USRLIBDIR))
375 DebuggedLibraryTarget($(LIBNAME),$(OBJS))
376 # if !defined(LibInstall) || LibInstall
377 InstallLibrary($(LIBNAME)_d,$(USRLIBDIR))
381 LintLibraryTarget($(LIBNAME),$(SRCS))
382 # if !defined(LibInstall) || LibInstall
383 InstallLintLibrary($(LIBNAME),$(LINTLIBDIR))
385 # else /* not LibCreate */
393 # endif /* LibCreate */
396 BuildIncludes($(HEADERS),IncSubdir/IncSubSubdir,../..)
397 InstallMultipleFlags($(HEADERS),$(INCDIR)/IncSubdir/IncSubSubdir,$(INSTINCFLAGS))
399 BuildIncludes($(HEADERS),IncSubdir,..)
400 InstallMultipleFlags($(HEADERS),$(INCDIR)/IncSubdir,$(INSTINCFLAGS))
403 # ifndef CplusplusSource
404 # if !defined(LibHeaders) || LibHeaders
405 BuildIncludesTop($(HEADERS))
406 InstallMultipleFlags($(HEADERS),$(INCDIR),$(INSTINCFLAGS))
411 NormalLintTarget($(SRCS))
412 #endif /* defined(LibName) */