]> git.sesse.net Git - rdpsrv/blob - Xserver/config/cf/Library.tmpl
Import X server from vnc-3.3.7.
[rdpsrv] / Xserver / config / cf / Library.tmpl
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.1 1997/06/11 12:08:29 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 CplusplusSource
161 # define SRCsuf c
162 #else
163 # define SRCsuf CCsuf
164 # ifdef SunArchitecture
165 .SUFFIXES: .CCsuf
166 # endif
167 #endif
168
169 #define _CompileObj(target, options)                                    @@\
170 target                                                                  @@\
171         _DebuggedObjCompile(options)                                    @@\
172         _ProfiledObjCompile(options)                                    @@\
173         _NormalObjCompile(options)                                      @@\
174         _SharedObjCompile(options)
175
176 #ifdef CplusplusSource
177 # define _CompileObjCplusplus(target, options)                          @@\
178 target                                                                  @@\
179         _DebuggedObjCplusplusCompile(options)                           @@\
180         _ProfiledObjCplusplusCompile(options)                           @@\
181         _NormalObjCplusplusCompile(options)                             @@\
182         _SharedObjCplusplusCompile(options)
183 #else
184 # define _CompileObjCplusplus(target, options)
185 #endif
186
187 #ifndef LibraryObjectRule
188 # define LibraryObjectRule()                                            @@\
189 all::                                                                   @@\
190         _DebuggedLibMkdir()                                             @@\
191         _ProfiledLibMkdir()                                             @@\
192         _NormalLibMkdir()                                               @@\
193                                                                         @@\
194 includes::                                                              @@\
195         _DebuggedLibMkdir()                                             @@\
196         _ProfiledLibMkdir()                                             @@\
197         _NormalLibMkdir()                                               @@\
198                                                                         @@\
199 _CompileObj(.c.Osuf:,$(_NOOP_))                                         @@\
200 _CompileObjCplusplus(.SRCsuf.Osuf:,$(_NOOP_))                           @@\
201                                                                         @@\
202 clean::                                                                 @@\
203         _DebuggedCleanDir()                                             @@\
204         _ProfiledCleanDir()                                             @@\
205         _NormalCleanDir()                                               @@\
206
207 #endif /* LibraryObjectRule */
208
209 #ifndef SpecialLibObjectRule
210 # define SpecialLibObjectRule(objs,depends,options)                     @@\
211 _CompileObj(objs: depends,options)
212 #endif /* SpecialLibObjectRule */
213
214 #ifndef SpecialCLibObjectRule
215 # define SpecialCLibObjectRule(basename,depends,options)                @@\
216 _CompileObj(basename.Osuf: basename.SRCsuf depends,options)             @@\
217                                                                         @@\
218 basename.i: basename.SRCsuf depends                                     @@\
219         CPPOnlyCompile(basename.SRCsuf,options)                         @@\
220                                                                         @@\
221 CenterLoadTarget(debug_src,basename.SRCsuf,NullParameter,$(ALLDEFINES) options)
222 #endif /* SpecialCLibObjectRule */
223
224 #ifndef SpecialCplusplusLibObjectRule
225 # define SpecialCplusplusLibObjectRule(basename,depends,options)        @@\
226 _CompileObjCplusplus(basename.Osuf: basename.SRCsuf depends,options)    @@\
227                                                                         @@\
228 CenterLoadTarget(debug_src,basename.SRCsuf,NullParameter,$(ALLDEFINES) options)
229 #endif /* SpecialCplusplusLibObjectRule */
230
231 /*
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.
235  *
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".
239  *
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".
244  *
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.
248  *
249  * The 'depends' argument names additional files the target files
250  * depend on.  It should name the #ctmpl and #htmpl files from the
251  * 'source' file.
252  *
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"
255  *
256  * Headers are generated and named according to data in the 'source'
257  * file.
258  */
259 /*
260  * The NoCmpScript
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?
266  */
267
268 #ifndef MakeStringsDependency
269 # define MakeStringsDependency                                          @@\
270 MAKESTRS = $(CONFIGSRC)/util/makestrs                                   @@\
271 NoCmpScript(ProgramTargetName($(MAKESTRS)) $(MAKESTRS).Osuf)            @@\
272                                                                         @@\
273 ProgramTargetName($(MAKESTRS)) $(MAKESTRS).Osuf:                        @@\
274         cd $(CONFIGSRC)/util && $(MAKE) ProgramTargetName(makestrs)     @@\
275                                                                         @@\
276 includes:: ProgramTargetName($(MAKESTRS))
277 #endif
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)                    @@\
284                                                                         @@\
285 AllTarget(files)                                                        @@\
286                                                                         @@\
287 includes:: files                                                        @@\
288                                                                         @@\
289 depend:: files                                                          @@\
290                                                                         @@\
291 clean::                                                                 @@\
292         RemoveFiles(files)
293 # else
294 #  define ToolkitMakeStrings(files,source,options,depends,dest)         @@\
295 MakeStringsDependency                                                   @@\
296                                                                         @@\
297 files: source depends                                                   @@\
298         RemoveFiles(files)                                              @@\
299         RunProgram(MAKESTRS,options < source > dest)                    @@\
300                                                                         @@\
301 AllTarget(files)                                                        @@\
302                                                                         @@\
303 includes:: files                                                        @@\
304                                                                         @@\
305 depend:: files                                                          @@\
306                                                                         @@\
307 clean::                                                                 @@\
308         RemoveFiles(files)
309 # endif
310 #endif /* ToolkitMakeStrings */
311
312 #ifdef LibName
313
314 LIBNAME = LibName
315
316 # if defined(LibTookitMakeStringsDependency) && LibTookitMakeStringsDependency
317 /*
318  * Do ToolkitMakeStrings() before BuildIncludes so makestrs is still
319  * built first, even if the generated header will be installed.
320  */
321 MakeStringsDependency
322 # endif
323
324 LibraryObjectRule()
325
326 # undef _LinkBuildLibrary
327 # if !defined(LibInstall) || LibInstall
328 #  define _LinkBuildLibrary(lib) LinkBuildLibrary(lib)
329 # else
330 #  define _LinkBuildLibrary(lib) $(_NULLCMD_)
331 # endif
332
333 # if !defined(LibCreate) || LibCreate
334 #  if DoSharedLib
335 #   if HugeLibrary && defined(SharedLibraryTarget3)
336 SharedLibraryTarget3($(LIBNAME),$(SoRev),$(OBJS1),$(OBJS2),$(OBJS3),.,.)
337 #   else
338 SharedLibraryTarget($(LIBNAME),$(SoRev),$(OBJS),.,.)
339 #   endif
340 #   if !defined(LibInstall) || LibInstall
341 InstallSharedLibrary($(LIBNAME),$(SoRev),$(SHLIBDIR))
342 #   endif
343 #   if HasSharedData
344 SharedLibraryDataTarget($(LIBNAME),$(SoRev),$(UNSHAREDOBJS))
345 #    if !defined(LibInstall) || LibInstall
346 InstallSharedLibraryData($(LIBNAME),$(SoRev),$(SHLIBDIR))
347 #    endif
348 #   endif
349 #  endif
350 #  if DoNormalLib
351 #   if HugeLibrary
352 #    if DoSharedLib && SeparateSharedCompile
353 UnsharedLibraryTarget3($(LIBNAME),$(OBJS1),$(OBJS2),$(OBJS3),unshared,..)
354 #    else
355 NormalLibraryTarget3($(LIBNAME),$(OBJS1),$(OBJS2),$(OBJS3))
356 #    endif
357 #   else
358 #    if DoSharedLib && SeparateSharedCompile
359 UnsharedLibraryTarget($(LIBNAME),$(OBJS),unshared,..)
360 #    else
361 NormalLibraryTarget($(LIBNAME),$(OBJS))
362 #    endif
363 #   endif
364 #   if !defined(LibInstall) || LibInstall
365 InstallLibrary($(LIBNAME),$(USRLIBDIR))
366 #   endif
367 #  endif
368 #  if DoProfileLib
369 ProfiledLibraryTarget($(LIBNAME),$(OBJS))
370 #   if !defined(LibInstall) || LibInstall
371 InstallLibrary($(LIBNAME)_p,$(USRLIBDIR))
372 #   endif
373 #  endif
374 #  if DoDebugLib
375 DebuggedLibraryTarget($(LIBNAME),$(OBJS))
376 #   if !defined(LibInstall) || LibInstall
377 InstallLibrary($(LIBNAME)_d,$(USRLIBDIR))
378 #   endif
379 #  endif
380
381 LintLibraryTarget($(LIBNAME),$(SRCS))
382 #  if !defined(LibInstall) || LibInstall
383 InstallLintLibrary($(LIBNAME),$(LINTLIBDIR))
384 #  endif
385 # else /* not LibCreate */
386 #  if HugeLibrary
387 AllTarget($(OBJS1))
388 AllTarget($(OBJS2))
389 AllTarget($(OBJS3))
390 #  else
391 AllTarget($(OBJS))
392 #  endif
393 # endif /* LibCreate */
394 # ifdef IncSubdir
395 #  ifdef IncSubSubdir
396 BuildIncludes($(HEADERS),IncSubdir/IncSubSubdir,../..)
397 InstallMultipleFlags($(HEADERS),$(INCDIR)/IncSubdir/IncSubSubdir,$(INSTINCFLAGS))
398 #  else
399 BuildIncludes($(HEADERS),IncSubdir,..)
400 InstallMultipleFlags($(HEADERS),$(INCDIR)/IncSubdir,$(INSTINCFLAGS))
401 #  endif
402 # else
403 #  ifndef CplusplusSource
404 #   if !defined(LibHeaders) || LibHeaders
405 BuildIncludesTop($(HEADERS))
406 InstallMultipleFlags($(HEADERS),$(INCDIR),$(INSTINCFLAGS))
407 #   endif
408 #  endif
409 # endif
410
411 NormalLintTarget($(SRCS))
412 #endif /* defined(LibName) */