1 XCOMM ---------------------------------------------------------------------
2 XCOMM Imake rules for building libraries, programs, scripts, and data files
3 XCOMM rules: $TOG: Imake.rules /main/227 1998/02/02 12:07:57 kaleb $
6 * MACHINE-INDEPENDENT RULES; DO NOT MODIFY
8 * Warning, when defining rules: make sure you do not include both a trailing
9 * backslash and double ampersand backslash or else you will get an extra
10 * backslash in the Makefile.
12 * The following macros are defined for the various templates and Imakefiles
13 * (for a list of the applicable make variables, see the template files):
20 * ProgramTargetName (target)
21 * RunProgram (progvar,options)
22 * RunProgramWithSetup (setup,progvar,options)
25 * CenterLoadTarget (target,srclist,libs,defines)
26 * CenterProgramTarget (program,srclist,objlist,locallibs,syslibs)
27 * SentinelLinkTarget (step,program,linklist)
28 * SentinelProgramTarget (program,deplist,linklist)
29 * SentinelCplusplusProgramTarget (program,deplist,linklist)
30 * PurifyLinkTarget (step,program,linklist)
31 * PurifyProgramTarget (program,deplist,linklist)
32 * PurifyCplusplusProgramTarget (program,deplist,linklist)
33 * ProofLinkTarget (step,program,linklist)
34 * ProofProgramTarget (program,deplist,linklist)
35 * ProofCplusplusProgramTarget (program,deplist,linklist)
37 * RemoveTargetProgram (program)
39 * BuildIncludesTop (srclist)
40 * BuildIncludes (srclist,dstsubdir,dstupdir)
41 * LinkRule (program,options,objects,libraries)
42 * HostLinkRule (program,options,objects,libraries)
43 * NoCmpScript (target)
44 * NoConfigRec (target)
45 * NormalProgramTarget (program,objects,deplibs,locallibs,syslibs)
46 * SetUIDProgramTarget (program,objects,deplibs,locallibs,syslibs)
47 * SingleProgramTarget (program,objects,locallibs,syslibs)
48 * SimpleProgramTarget (program)
49 * ComplexProgramTarget (program)
50 * ComplexProgramTarget_1 (program,locallib,syslib)
51 * ComplexProgramTarget_2 (program,locallib,syslib)
52 * ComplexProgramTarget_3 (program,locallib,syslib)
53 * ServerTargetWithFlags (server,subdirs,objects,libs,syslibs,flags)
54 * ServerTarget (server,subdirs,objects,libs,syslibs)
55 * MoveToBakFile (file)
56 * RMoveToBakFile (file)
58 * LibraryTargetName (libname)
59 * LibraryTargetNameSuffix (libname,suffix)
60 * InstallNamedTarget (step,srcname,flags,dest,dstname)
61 * InstallTarget (step,file,flags,dest)
62 * InstallLibrary (libname,dest)
63 * MergeIntoInstalledLibrary (tolib,fromlib)
64 * InstallLibraryAlias (libname,alias,dest)
65 * InstallLintLibrary (libname,dest)
66 * InstallManPageLong (file,destdir,dest)
67 * InstallManPage (file,destdir)
68 * InstallManPageAliases (file,destdir,aliases)
69 * ManKeywordsTarget (manpath)
70 * InstallNamedNonExec (srcname,dstname,dest)
71 * InstallNonExecFile (file,dest)
72 * InstallNonExecFileNoClobber (file,dest)
73 * InstallNonExec (file,dest)
74 * InstallProgramWithFlags (program,dest,flags)
75 * InstallProgram (program,dest)
76 * InstallScript (program,dest)
77 * InstallNamedProg (srcname,dstname,dest)
78 * InstallNamedProgNoClobber (srcname,dstname,dest)
79 * MakeFlagsToShellFlags (makeflags,shellcmd)
80 * LinkFileList (step,list,dir,sub)
81 * LinkVarDirectory (mdir,cdir,rdir,ldir)
82 * InstallMultipleDestFlags (step,list,dest,flags)
83 * InstallMultipleDest (step,list,dest)
84 * InstallMultiple (list,dest)
85 * InstallMultipleFlags (list,dest,flags)
86 * InstallMultipleMan (list,dest)
89 * DependTarget3 (srcs1,srcs2,srcs3)
92 * ImakeDependency (target)
93 * BuildMakefileTarget (notused,imakeflags)
97 * LintLibReferences (varname,libname,libsource)
98 * UnsharedLibReferences (varname,libname,libsource)
99 * ProjectUnsharedLibReferences (varname,libname,libsource,buildlibdir)
100 * SharedLibDependencies (libname,libsource,revname)
101 * SharedDSLibDependencies (libname,libsource,revname)
102 * SharedLibReferences (varname,libname,libsource,revname,rev)
103 * SharedDSLibReferences (varname,libname,libsource,revname,rev)
104 * ObjectCompile (options)
105 * NormalLibObjCompile (options)
106 * NormalSharedLibObjCompile (options)
107 * LibObjCompile (dir,options)
108 * DebuggedLibObjCompile (options)
109 * ProfiledLibObjCompile (options)
110 * SharedLibObjCompile (options)
111 * NormalLibraryObjectRule ()
112 * NormalFortranObjectRule ()
113 * ObjectFromSpecialSource (dst,src,flags)
114 * SpecialObjectRule (objs,depends,options)
115 * SpecialCObjectRule (basename,depends,options)
117 * YaccFile (file,flags)
118 * YaccFileNoFlags (file)
119 * MakeLibrary (libname,objlist)
120 * NormalLibraryTarget (libname,objlist)
121 * NormalLibraryTarget2 (libname,objlist1,objlist2)
122 * NormalLibraryTarget3 (libname,objlist1,objlist2,objlist3)
123 * NormalDepLibraryTarget (libname,deplist,objlist)
124 * UnsharedLibraryTarget (libname,objlist,down,up)
125 * UnsharedLibraryTarget3 (libname,objlist1,objlist2,objlist3,down,up)
126 * SubdirLibraryRule (objlist)
127 * ProfiledLibraryTarget (libname,objlist)
128 * DebuggedLibraryTarget (libname,objlist)
129 * AliasedLibraryTarget (libname,alias)
130 * NormalRelocatableTarget (objname,objlist)
131 * ProfiledRelocatableTarget (objname,objlist)
132 * DebuggedRelocatableTarget (objname,objlist)
133 * LintLibraryTarget (libname,srclist)
134 * NormalLintTarget (srclist)
136 * LinkSourceFile (src,dir)
137 * CopySourceFile (src,dir)
138 * LinkFile (tofile,fromfile)
139 * MakeSubincludesForBuild (step,dir,srclist)
140 * LangNamedTargetSubdirs (lang,name,dirs,verb,flags,subname)
141 * LangNamedMakeSubdirs (lang,name,dirs)
142 * LangMakeSubdirs (lang,dirs)
143 * NamedTargetSubdirs (name,dirs,verb,flags,subname)
144 * NamedMakeSubdirs (name,dirs)
146 * DependSubdirs (dirs)
147 * ForceSubdirs (dirs)
148 * InstallSubdirs (dirs)
149 * InstallManSubdirs (dirs)
150 * IncludesSubdirs (dirs)
151 * NamedCleanSubdirs (name,dirs)
152 * CleanSubdirs (dirs)
153 * NamedTagSubdirs (name,dirs)
155 * MakeLintSubdirs (dirs,target,subtarget)
157 * MakeLintLibSubdirs (dirs)
158 * MakeMakeOneSubdirs ()
159 * MakeMakeSubdirs (dirs,target)
160 * MakefileSubdirs (dirs)
161 * CppScriptTarget (dst,src,defs,deplist)
162 * MakeScriptFromCpp (name,defs)
163 * CppFileTarget (dst,src,defs,deplist)
164 * CppSourceFile (dst,src,defs,deplist)
165 * MakeDirectories (step,dirs)
166 * AllTarget (depends)
168 * DoUDB_SCRIPT3 (target, file, script, build)
169 * DoUDB_SCRIPT4 (target, file, script, build)
172 * The following are in specific <os>Lib.rules:
174 * SharedLibraryTarget (libname,rev,solist,down,up)
175 * SharedLibraryDataTarget (libname,rev,salist)
176 * InstallSharedLibrary (libname,rev,dest)
177 * InstallSharedLibraryData (libname,rev,dest)
181 #define NullParameter
183 /* stringify macro */
185 # if defined(__llvm__)
190 #define STR(x) STR2(x)
193 /* if [ -d ] or [ ! -d ] causes make to fail, define this as - */
194 #ifndef DirFailPrefix
195 #define DirFailPrefix
199 * NoCmpScript - suppress clearmake build script comparison.
203 #define NoCmpScript(targ) @@\
204 XCOMM special target for clearmake @@\
207 #define NoCmpScript(targ) /**/
212 * NoConfigRec - suppress using clearmake configuration records.
216 #define NoConfigRec(targ) @@\
217 XCOMM special target for clearmake @@\
220 #define NoConfigRec(targ) /**/
225 * Concat - concatenates two strings.
228 #if (__STDC__ && !defined(UnixCpp)) || defined(AnsiCpp) || defined(__llvm__)
229 #define Concat(a,b)a##b
231 #define Concat(a,b)a/**/b
236 * Concat3 - concatenates three strings.
239 #if (__STDC__ && !defined(UnixCpp)) || defined(AnsiCpp) || defined(__llvm__)
240 #define Concat3(a,b,c)a##b##c
242 #define Concat3(a,b,c)a/**/b/**/c
247 * Concat4 - concatenates four strings.
250 #if (__STDC__ && !defined(UnixCpp)) || defined(AnsiCpp) || defined(__llvm__)
251 #define Concat4(a,b,c,d)a##b##c##d
253 #define Concat4(a,b,c,d)a/**/b/**/c/**/d
258 * _XUse - makes a choice based on UseInstalledX11.
261 # if defined(UseInstalled) || UseInstalledX11
262 # define _XUse(a,b) a
264 # define _XUse(a,b) b
269 * _Use - makes a choice based on UseInstalled.
276 * _XUseCat - combination of _XUse and Concat.
277 * exists to avoid problems with some preprocessors
280 # if (__STDC__ && !defined(UnixCpp)) || defined(AnsiCpp) || defined(__llvm__)
281 # if defined(UseInstalled) || UseInstalledX11
282 # define _XUseCat(a,b,c) a##c
284 # define _XUseCat(a,b,c) b##c
287 # if defined(UseInstalled) || UseInstalledX11
288 # define _XUseCat(a,b,c) a/**/c
290 # define _XUseCat(a,b,c) b/**/c
293 #endif /* _XUseCat */
296 * _UseCat - combination of _Use and Concat.
297 * exists to avoid problems with some preprocessors
300 # define _UseCat _XUseCat
303 #ifndef ProgramTargetName
304 #define ProgramTargetName(target)target
308 #define RunProgram(progvar,options) $(progvar) options
311 #ifndef RunProgramWithSetup
312 #define RunProgramWithSetup(setup,progvar,options) setup $(progvar) options
316 #define RemoveFile(file) $(RM) file
317 #endif /* RemoveFile */
320 #define RemoveFiles(files) $(RM) files
321 #endif /* RemoveFiles */
324 * CenterLoadTarget - generate rules to load files into CodeCenter
326 #ifndef CenterLoadTarget
328 #define CenterLoadTarget(target,srclist,libs,defines) @@\
329 ProgramTargetName(target):: srclist @@\
330 XCOMM load defines srclist libs
332 #define CenterLoadTarget(target,srclist,libs,defines) /**/
334 #endif /* CenterLoadTarget */
337 * CenterProgramTarget - generate rules to make CodeCenter read in sources
340 #ifndef CenterProgramTarget
341 #define CenterProgramTarget(program,srclist,objlist,locallibs,syslibs) @@\
342 CenterLoadTarget(Concat(debug_,program),srclist,$(EXTRA_LDOPTIONS) $(LOCAL_LDFLAGS) $(LDPRELIBS) locallibs $(LDLIBS) syslibs,$(ALLDEFINES)) @@\
344 CenterLoadTarget(Concat(odebug_,program),objlist,$(EXTRA_LDOPTIONS) $(LOCAL_LDFLAGS) $(LDPRELIBS) locallibs $(LDLIBS) syslibs,$(ALLDEFINES))
345 #endif /* CenterProgramTarget */
347 #ifndef SentinelLinkTarget
349 #define SentinelLinkTarget(step,program,linklist) @@\
350 ProgramTargetName(step.sentinel): @@\
351 RemoveTargetProgram($@) @@\
352 $(CCENVSETUP) $(SENTINEL) $(SENTINELOPTIONS) $(CC) -o program.sentinel $(LDOPTIONS) linklist $(EXTRA_LOAD_FLAGS)
354 #define SentinelLinkTarget(step,program,linklist) /**/
356 #endif /* SentinelLinkTarget */
359 * SentinelProgramTarget - generate rules to make Sentinel image
361 #ifndef SentinelProgramTarget
363 #define SentinelProgramTarget(program,deplist,linklist) @@\
364 ProgramTargetName(program.sentinel): deplist @@\
365 RemoveTargetProgram($@) @@\
366 $(CCENVSETUP) $(SENTINEL) $(SENTINELOPTIONS) $(CC) -o $@ $(LDOPTIONS) linklist $(EXTRA_LOAD_FLAGS) @@\
368 clean clean.sentinel:: @@\
369 RemoveFile(program.sentinel)
371 #define SentinelProgramTarget(program,deplist,linklist) /**/
373 #endif /* SentinelProgramTarget */
376 * SentinelCplusplusProgramTarget - generate rules to make Sentinel image
378 #ifndef SentinelCplusplusProgramTarget
380 #define SentinelCplusplusProgramTarget(program,deplist,linklist) @@\
381 ProgramTargetName(program.sentinel): deplist @@\
382 RemoveTargetProgram($@) @@\
383 $(CXXENVSETUP) $(SENTINEL) $(SENTINELOPTIONS) $(CXX) -o $@ $(CXXLDOPTIONS) linklist $(EXTRA_LOAD_FLAGS) @@\
385 clean clean.sentinel:: @@\
386 RemoveFile(program.sentinel)
388 #define SentinelCplusplusProgramTarget(program,deplist,linklist) /**/
390 #endif /* SentinelCplusplusProgramTarget */
392 #ifndef PurifyLinkTarget
394 #define PurifyLinkTarget(step,program,linklist) @@\
395 ProgramTargetName(step.pure): @@\
396 RemoveTargetProgram($@) @@\
397 $(CCENVSETUP) $(PURIFY) $(PURIFYOPTIONS) $(CC) -o program.pure $(LDOPTIONS) linklist $(EXTRA_LOAD_FLAGS)
399 #define PurifyLinkTarget(step,program,linklist) /**/
401 #endif /* PurifyLinkTarget */
404 * PurifyProgramTarget - generate rules to make Purify'ed image
406 #ifndef PurifyProgramTarget
408 #define PurifyProgramTarget(program,deplist,linklist) @@\
409 ProgramTargetName(program.pure): deplist @@\
410 RemoveTargetProgram($@) @@\
411 $(CCENVSETUP) $(PURIFY) $(PURIFYOPTIONS) $(CC) -o $@ $(LDOPTIONS) linklist $(EXTRA_LOAD_FLAGS) @@\
413 clean clean.pure:: @@\
414 RemoveFile(program.pure)
416 #define PurifyProgramTarget(program,deplist,linklist) /**/
418 #endif /* PurifyProgramTarget */
421 * PurifyCplusplusProgramTarget - generate rules to make Purify'ed image
423 #ifndef PurifyCplusplusProgramTarget
425 #define PurifyCplusplusProgramTarget(program,deplist,linklist) @@\
426 ProgramTargetName(program.pure): deplist @@\
427 RemoveTargetProgram($@) @@\
428 $(CXXENVSETUP) $(PURIFY) $(PURIFYOPTIONS) $(CXX) -o $@ $(CXXLDOPTIONS) linklist $(EXTRA_LOAD_FLAGS) @@\
430 clean clean.pure:: @@\
431 RemoveFile(program.pure)
433 #define PurifyCplusplusProgramTarget(program,deplist,linklist) /**/
435 #endif /* PurifyCplusplusProgramTarget */
437 #ifndef ProofLinkTarget
439 #define ProofLinkTarget(step,program,linklist) @@\
440 ProgramTargetName(step.tc): @@\
441 RemoveTargetProgram($@) @@\
442 $(CCENVSETUP) $(PROOF) $(PROOFOPTIONS) $(CC) -o program.tc $(LDOPTIONS) linklist $(EXTRA_LOAD_FLAGS)
444 #define ProofLinkTarget(step,program,linklist) /**/
446 #endif /* ProofLinkTarget */
449 * ProofProgramTarget - generate rules to make Proof'ed image
451 #ifndef ProofProgramTarget
453 #define ProofProgramTarget(program,deplist,linklist) @@\
454 ProgramTargetName(program.tc): deplist @@\
455 RemoveTargetProgram($@) @@\
456 $(CCENVSETUP) $(PROOF) $(PROOFOPTIONS) $(CC) -o $@ $(LDOPTIONS) linklist $(EXTRA_LOAD_FLAGS) @@\
459 RemoveFiles(program.tc program.tc.*.*)
461 #define ProofProgramTarget(program,deplist,linklist) /**/
463 #endif /* ProofProgramTarget */
466 * ProofCplusplusProgramTarget - generate rules to make Proof'ed image
468 #ifndef ProofCplusplusProgramTarget
470 #define ProofCplusplusProgramTarget(program,deplist,linklist) @@\
471 ProgramTargetName(program.tc): deplist @@\
472 RemoveTargetProgram($@) @@\
473 $(CXXENVSETUP) $(PROOF) $(PROOFOPTIONS) $(CXX) -o $@ $(CXXLDOPTIONS) linklist $(EXTRA_LOAD_FLAGS) @@\
476 RemoveFiles(program.tc program.tc.*.*)
478 #define ProofCplusplusProgramTarget(program,deplist,linklist) /**/
480 #endif /* ProofCplusplusProgramTarget */
482 #ifndef ProofCleanTarget
484 #define ProofCleanTarget() @@\
488 #define ProofCleanTarget() /**/
490 #endif /* ProofCleanTarget */
492 #ifndef RemoveTargetProgram
493 #if RemoveTargetProgramByMoving
494 #define RemoveTargetProgram(program) \
495 -if [ -f program ]; then RemoveFile(Concat(program,~)); $(MV) program Concat(program,~); fi
497 #define RemoveTargetProgram(program) RemoveFile(program)
499 #endif /* RemoveTargetProgram */
502 #define MakeDir(dir) DirFailPrefix@if [ -d dir ]; then set +x; \ @@\
503 else (set -x; $(MKDIRHIER) dir); fi
506 #ifndef BuildIncludesTop
507 #define BuildIncludesTop(srclist) @@\
508 includes:: srclist @@\
509 MakeDir($(BUILDINCDIR)) @@\
510 @(set -x; cd $(BUILDINCDIR); for i in srclist; do \ @@\
511 RemoveFile($$i); \ @@\
512 $(LN) $(BUILDINCTOP)/$(CURRENT_DIR)/$$i .; \ @@\
514 #endif /* BuildIncludesTop */
516 #ifndef BuildIncludes
517 #define BuildIncludes(srclist,dstsubdir,dstupdir) @@\
518 includes:: srclist @@\
519 MakeDir($(BUILDINCDIR)/dstsubdir) @@\
520 @(set -x; cd $(BUILDINCDIR)/dstsubdir; for i in srclist; do \ @@\
521 RemoveFile($$i); \ @@\
522 $(LN) $(BUILDINCTOP)/dstupdir/$(CURRENT_DIR)/$$i .; \ @@\
524 #endif /* BuildIncludes */
527 * LinkBuildBinary - export a binary from the build tree.
529 #ifndef LinkBuildBinary
530 #define LinkBuildBinary(binary) @@\
531 all:: $(BUILDBINDIR)/binary binary @@\
533 $(BUILDBINDIR)/binary: binary @@\
535 cd $(BUILDBINDIR) && $(LN) $(BUILDBINTOP)/$(CURRENT_DIR)/binary .
536 #endif /* LinkBuildBinary */
538 #ifndef BuildInterfaces
539 #define BuildInterfaces(srclist,dstsubdir,dstupdir) @@\
541 MakeDir($(BUILDINCDIR)/dstsubdir) @@\
542 @(set -x; cd $(BUILDINCDIR)/dstsubdir; for i in srclist; do \ @@\
543 RemoveFile($$i); \ @@\
544 $(LN) $(BUILDINCTOP)/dstupdir/$(CURRENT_DIR)/$$i .; \ @@\
546 #endif /* BuildInterfaces */
549 * LinkRule - link a program
552 #define LinkRule(program,options,objects,libraries) \
553 $(CCLINK) -o program options objects libraries $(EXTRA_LOAD_FLAGS)
554 #endif /* LinkRule */
557 * HostLinkRule - link a utility to be used on the build host
558 * (differs from LinkRule if cross compiling)
561 #define HostLinkRule LinkRule
564 #ifndef CplusplusLinkRule
565 #define CplusplusLinkRule(program,options,objects,libraries) \
566 $(CXXLINK) -o program options objects libraries $(EXTRA_LOAD_FLAGS)
567 #endif /* CplusplusLinkRule */
570 * NormalProgramTarget - generate rules to compile and link the indicated
571 * program; since it does not use any default object files, it may be used for
572 * multiple programs in the same Imakefile.
574 #ifndef NormalProgramTarget
575 #define NormalProgramTarget(program,objects,deplibs,locallibs,syslibs) @@\
576 ProgramTargetName(program): objects deplibs @@\
577 RemoveTargetProgram($@) @@\
578 LinkRule($@,$(LDOPTIONS),objects,locallibs $(LDLIBS) syslibs) @@\
580 SentinelProgramTarget(program,objects deplibs,objects locallibs $(LDLIBS) syslibs) @@\
581 PurifyProgramTarget(program,objects deplibs,objects locallibs $(LDLIBS) syslibs) @@\
582 ProofProgramTarget(program,objects deplibs,objects locallibs $(LDLIBS) syslibs) @@\
585 RemoveFile(ProgramTargetName(program))
586 #endif /* NormalProgramTarget */
590 * NormalCplusplusProgramTarget - Like NormalTargetProgram, but uses
593 #ifndef NormalCplusplusProgramTarget
594 #define NormalCplusplusProgramTarget(program,objects,deplibs,locallibs,syslibs) @@\
595 ProgramTargetName(program): objects deplibs @@\
596 RemoveTargetProgram($@) @@\
597 CplusplusLinkRule($@,$(CXXLDOPTIONS),objects,locallibs $(LDLIBS) syslibs) @@\
599 SentinelCplusplusProgramTarget(program,objects deplibs,objects locallibs $(LDLIBS) syslibs) @@\
600 PurifyCplusplusProgramTarget(program,objects deplibs,objects locallibs $(LDLIBS) syslibs) @@\
601 ProofCplusplusProgramTarget(program,objects deplibs,objects locallibs $(LDLIBS) syslibs) @@\
604 RemoveFile(ProgramTargetName(program))
605 #endif /* NormalCplusplusProgramTarget */
608 #ifndef SetUIDProgramTarget
609 #define SetUIDProgramTarget NormalProgramTarget
614 * SingleProgramTarget - obsolete version of NormalProgramTarget that does
617 #ifndef SingleProgramTarget
618 #define SingleProgramTarget(program,objects,locallibs,syslibs) @@\
619 NormalProgramTarget(program,objects,NullParameter,locallibs,syslibs)
620 #endif /* SingleProgramTarget */
623 * SimpleProgramTarget - generate rules for compiling and linking programs
624 * that only have one C source file. It should only be used in Imakefiles
625 * that describe a single program.
627 #ifndef SimpleProgramTarget
628 #define SimpleProgramTarget(program) @@\
632 ComplexProgramTarget(program)
633 #endif /* SimpleProgramTarget */
635 #ifndef SimpleCplusplusProgramTarget
636 #define SimpleCplusplusProgramTarget(program) @@\
638 SRCS = program.CCsuf @@\
640 ComplexCplusplusProgramTarget(program)
641 #endif /* SimpleCplusplusProgramTarget */
643 #ifndef ProgramTargetHelper
644 #define ProgramTargetHelper(program,srcs,objs,deplib,locallib,syslib) @@\
645 ProgramTargetName(program): $(objs) $(deplib) @@\
646 RemoveTargetProgram($@) @@\
647 LinkRule($@,$(LDOPTIONS),$(objs),locallib $(LDLIBS) syslib) @@\
649 CenterProgramTarget(program,$(srcs),$(objs),locallib,syslib) @@\
650 SentinelProgramTarget(program,$(objs) $(deplib),$(objs) locallib $(LDLIBS) syslib) @@\
651 PurifyProgramTarget(program,$(objs) $(deplib),$(objs) locallib $(LDLIBS) syslib) @@\
652 ProofProgramTarget(program,$(objs) $(deplib),$(objs) locallib $(LDLIBS) syslib) @@\
654 InstallProgram(program,$(BINDIR)) @@\
655 InstallManPage(program,$(MANDIR))
656 #endif /* ProgramTargetHelper */
658 #ifndef CplusplusProgramTargetHelper
659 #define CplusplusProgramTargetHelper(program,srcs,objs,deplib,locallib,syslib) @@\
660 ProgramTargetName(program): $(objs) $(deplib) @@\
661 RemoveTargetProgram($@) @@\
662 CplusplusLinkRule($@,$(CXXLDOPTIONS),$(objs),locallib $(LDLIBS) syslib) @@\
664 CenterProgramTarget(program,$(srcs),$(objs),locallib,syslib) @@\
665 SentinelCplusplusProgramTarget(program,$(objs) $(deplib),$(objs) locallib $(LDLIBS) syslib) @@\
666 PurifyCplusplusProgramTarget(program,$(objs) $(deplib),$(objs) locallib $(LDLIBS) syslib) @@\
667 ProofCplusplusProgramTarget(program,$(objs) $(deplib),$(objs) locallib $(LDLIBS) syslib) @@\
669 InstallProgram(program,$(BINDIR)) @@\
670 InstallManPage(program,$(MANDIR))
671 #endif /* CplusplusProgramTargetHelper */
674 * ComplexProgramTarget - generate rules for compiling and linking the
675 * program specified by $(OBJS) and $(SRCS), installing the program and its
676 * man page, and generating dependencies. It should only be used in
677 * Imakefiles that describe a single program.
679 #ifndef ComplexProgramTarget
680 #define ComplexProgramTarget(program) @@\
681 PROGRAM = program @@\
683 AllTarget(program) @@\
685 ProgramTargetHelper(program,SRCS,OBJS,DEPLIBS,$(LOCAL_LIBRARIES),NullParameter) @@\
691 RemoveFile(ProgramTargetName(program))
692 #endif /* ComplexProgramTarget */
694 #ifndef ComplexCplusplusProgramTarget
695 #define ComplexCplusplusProgramTarget(program) @@\
696 PROGRAM = program @@\
698 AllTarget(program) @@\
700 CplusplusProgramTargetHelper(program,SRCS,OBJS,DEPLIBS,$(LOCAL_LIBRARIES),NullParameter) @@\
706 RemoveFile(ProgramTargetName(program))
707 #endif /* ComplexCplusplusProgramTarget */
710 * ComplexProgramTarget_1 - generate rules for compiling and linking the
711 * program specified by $(OBJS1) and $(SRCS1), installing the program and its
712 * man page, and generating dependencies for it and any programs described
713 * by $(SRCS2) throgh $(SRCS10). It should be used to build the primary
714 * program in Imakefiles that describe multiple programs.
716 #ifndef ComplexProgramTarget_1
717 #define ComplexProgramTarget_1(program,locallib,syslib) @@\
718 OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $(OBJS4) $(OBJS5) \ @@\
719 $(OBJS6) $(OBJS7) $(OBJS8) $(OBJS9) $(OBJS10) @@\
720 SRCS = $(SRCS1) $(SRCS2) $(SRCS3) $(SRCS4) $(SRCS5) \ @@\
721 $(SRCS6) $(SRCS7) $(SRCS8) $(SRCS9) $(SRCS10) @@\
723 AllTarget($(PROGRAMS)) @@\
725 ProgramTargetHelper(program,SRCS1,OBJS1,DEPLIBS1,locallib,syslib) @@\
731 RemoveFiles($(PROGRAMS))
732 #endif /* ComplexProgramTarget_1 */
734 #ifndef ComplexCplusplusProgramTarget_1
735 #define ComplexCplusplusProgramTarget_1(program,locallib,syslib) @@\
736 OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $(OBJS4) $(OBJS5) \ @@\
737 $(OBJS6) $(OBJS7) $(OBJS8) $(OBJS9) $(OBJS10) @@\
738 SRCS = $(SRCS1) $(SRCS2) $(SRCS3) $(SRCS4) $(SRCS5) \ @@\
739 $(SRCS6) $(SRCS7) $(SRCS8) $(SRCS9) $(SRCS10) @@\
741 AllTarget($(PROGRAMS)) @@\
743 CplusplusProgramTargetHelper(program,SRCS1,OBJS1,DEPLIBS1,locallib,syslib)@@\
749 RemoveFiles($(PROGRAMS))
750 #endif /* ComplexCplusplusProgramTarget_1 */
753 * ComplexProgramTarget_2 - generate rules for compiling and linking the
754 * program specified by $(OBJS2) and $(SRCS2) and installing the program and
755 * man page. It should be used to build the second program in Imakefiles
756 * describing more than one program.
758 #ifndef ComplexProgramTarget_2
759 #define ComplexProgramTarget_2(program,locallib,syslib) @@\
760 ProgramTargetHelper(program,SRCS2,OBJS2,DEPLIBS2,locallib,syslib)
761 #endif /* ComplexProgramTarget_2 */
763 #ifndef ComplexCplusplusProgramTarget_2
764 #define ComplexCplusplusProgramTarget_2(program,locallib,syslib) @@\
765 CplusplusProgramTargetHelper(program,SRCS2,OBJS2,DEPLIBS2,locallib,syslib)
766 #endif /* ComplexCplusplusProgramTarget_2 */
769 * ComplexProgramTarget_3 - generate rules for compiling and linking the
770 * program specified by $(OBJS3) and $(SRCS3) and installing the program and
771 * man page. It should be used to build the third program in Imakefiles
772 * describing more than one program.
774 #ifndef ComplexProgramTarget_3
775 #define ComplexProgramTarget_3(program,locallib,syslib) @@\
776 ProgramTargetHelper(program,SRCS3,OBJS3,DEPLIBS3,locallib,syslib)
777 #endif /* ComplexProgramTarget_3 */
779 #ifndef ComplexCplusplusProgramTarget_3
780 #define ComplexCplusplusProgramTarget_3(program,locallib,syslib) @@\
781 CplusplusProgramTargetHelper(program,SRCS3,OBJS3,DEPLIBS3,locallib,syslib)
782 #endif /* ComplexCplusplusProgramTarget_3 */
785 * ComplexProgramTarget_4 - generate rules for compiling and linking the
786 * program specified by $(OBJS4) and $(SRCS4) and installing the program and
787 * man page. It should be used to build the third program in Imakefiles
788 * describing more than one program.
790 #ifndef ComplexProgramTarget_4
791 #define ComplexProgramTarget_4(program,locallib,syslib) @@\
792 ProgramTargetHelper(program,SRCS4,OBJS4,DEPLIBS4,locallib,syslib)
793 #endif /* ComplexProgramTarget_4 */
795 #ifndef ComplexCplusplusProgramTarget_4
796 #define ComplexCplusplusProgramTarget_4(program,locallib,syslib) @@\
797 CplusplusProgramTargetHelper(program,SRCS4,OBJS4,DEPLIBS4,locallib,syslib)
798 #endif /* ComplexCplusplusProgramTarget_4 */
801 * ComplexProgramTarget_5 - generate rules for compiling and linking the
802 * program specified by $(OBJS5) and $(SRCS5) and installing the program and
803 * man page. It should be used to build the third program in Imakefiles
804 * describing more than one program.
806 #ifndef ComplexProgramTarget_5
807 #define ComplexProgramTarget_5(program,locallib,syslib) @@\
808 ProgramTargetHelper(program,SRCS5,OBJS5,DEPLIBS5,locallib,syslib)
809 #endif /* ComplexProgramTarget_5 */
811 #ifndef ComplexCplusplusProgramTarget_5
812 #define ComplexCplusplusProgramTarget_5(program,locallib,syslib) @@\
813 CplusplusProgramTargetHelper(program,SRCS5,OBJS5,DEPLIBS5,locallib,syslib)
814 #endif /* ComplexCplusplusProgramTarget_5 */
817 * ComplexProgramTarget_6 - generate rules for compiling and linking the
818 * program specified by $(OBJS6) and $(SRCS6) and installing the program and
819 * man page. It should be used to build the third program in Imakefiles
820 * describing more than one program.
822 #ifndef ComplexProgramTarget_6
823 #define ComplexProgramTarget_6(program,locallib,syslib) @@\
824 ProgramTargetHelper(program,SRCS6,OBJS6,DEPLIBS6,locallib,syslib)
825 #endif /* ComplexProgramTarget_6 */
827 #ifndef ComplexCplusplusProgramTarget_6
828 #define ComplexCplusplusProgramTarget_6(program,locallib,syslib) @@\
829 CplusplusProgramTargetHelper(program,SRCS6,OBJS6,DEPLIBS6,locallib,syslib)
830 #endif /* ComplexCplusplusProgramTarget_6 */
833 * ComplexProgramTarget_7 - generate rules for compiling and linking the
834 * program specified by $(OBJS7) and $(SRCS7) and installing the program and
835 * man page. It should be used to build the third program in Imakefiles
836 * describing more than one program.
838 #ifndef ComplexProgramTarget_7
839 #define ComplexProgramTarget_7(program,locallib,syslib) @@\
840 ProgramTargetHelper(program,SRCS7,OBJS7,DEPLIBS7,locallib,syslib)
841 #endif /* ComplexProgramTarget_7 */
843 #ifndef ComplexCplusplusProgramTarget_7
844 #define ComplexCplusplusProgramTarget_7(program,locallib,syslib) @@\
845 CplusplusProgramTargetHelper(program,SRCS7,OBJS7,DEPLIBS7,locallib,syslib)
846 #endif /* ComplexCplusplusProgramTarget_7 */
849 * ComplexProgramTarget_8 - generate rules for compiling and linking the
850 * program specified by $(OBJS8) and $(SRCS8) and installing the program and
851 * man page. It should be used to build the third program in Imakefiles
852 * describing more than one program.
854 #ifndef ComplexProgramTarget_8
855 #define ComplexProgramTarget_8(program,locallib,syslib) @@\
856 ProgramTargetHelper(program,SRCS8,OBJS8,DEPLIBS8,locallib,syslib)
857 #endif /* ComplexProgramTarget_8 */
859 #ifndef ComplexCplusplusProgramTarget_8
860 #define ComplexCplusplusProgramTarget_8(program,locallib,syslib) @@\
861 CplusplusProgramTargetHelper(program,SRCS8,OBJS8,DEPLIBS8,locallib,syslib)
862 #endif /* ComplexCplusplusProgramTarget_8 */
865 * ComplexProgramTarget_9 - generate rules for compiling and linking the
866 * program specified by $(OBJS9) and $(SRCS9) and installing the program and
867 * man page. It should be used to build the third program in Imakefiles
868 * describing more than one program.
870 #ifndef ComplexProgramTarget_9
871 #define ComplexProgramTarget_9(program,locallib,syslib) @@\
872 ProgramTargetHelper(program,SRCS9,OBJS9,DEPLIBS9,locallib,syslib)
873 #endif /* ComplexProgramTarget_9 */
875 #ifndef ComplexCplusplusProgramTarget_9
876 #define ComplexCplusplusProgramTarget_9(program,locallib,syslib) @@\
877 CplusplusProgramTargetHelper(program,SRCS9,OBJS9,DEPLIBS9,locallib,syslib)
878 #endif /* ComplexCplusplusProgramTarget_9 */
881 * ComplexProgramTarget_10 - generate rules for compiling and linking the
882 * program specified by $(OBJS10) and $(SRCS10) and installing the program and
883 * man page. It should be used to build the third program in Imakefiles
884 * describing more than one program.
886 #ifndef ComplexProgramTarget_10
887 #define ComplexProgramTarget_10(program,locallib,syslib) @@\
888 ProgramTargetHelper(program,SRCS10,OBJS10,DEPLIBS10,locallib,syslib)
889 #endif /* ComplexProgramTarget_10 */
891 #ifndef ComplexCplusplusProgramTarget_10
892 #define ComplexCplusplusProgramTarget_10(program,locallib,syslib) @@\
893 CplusplusProgramTargetHelper(program,SRCS10,OBJS10,DEPLIBS10,locallib,syslib)
894 #endif /* ComplexCplusplusProgramTarget_10 */
896 #ifndef MoveToBakFile
897 #define MoveToBakFile(file) -@if [ -f file ]; then set -x; \ @@\
898 $(MV) file file.bak; else exit 0; fi
899 #endif /* MoveToBakFile */
901 #ifndef RMoveToBakFile
902 #define RMoveToBakFile(file) -@if [ -f file ]; then set -x; \ @@\
903 RemoveFile(file.bak); $(MV) file file.bak; \ @@\
905 #endif /* RMoveToBakFile */
908 * ServerTargetWithFlags - generate rules to compile, link, and relink a server
910 #ifndef ServerTargetWithFlags
911 #define ServerTargetWithFlags(server,subdirs,objects,libs,syslibs,flags) @@\
912 AllTarget(server) @@\
913 ProgramTargetName(server): subdirs objects libs @@\
914 MoveToBakFile($@) @@\
915 LinkRule($@,$(LDOPTIONS),objects,libs $(LDLIBS) syslibs) @@\
917 Concat(load,server): @@\
918 MoveToBakFile(ProgramTargetName(server)) @@\
919 LinkRule(ProgramTargetName(server),$(LDOPTIONS),objects,libs $(LDLIBS) syslibs) @@\
921 loadX:: Concat(load,server) @@\
923 SentinelProgramTarget(server,subdirs objects libs,objects libs $(LDLIBS) syslibs) @@\
924 SentinelLinkTarget(Concat(load,server),server,objects libs $(LDLIBS) syslibs) @@\
925 PurifyProgramTarget(server,subdirs objects libs,objects libs $(LDLIBS) syslibs) @@\
926 PurifyLinkTarget(Concat(load,server),server,objects libs $(LDLIBS) syslibs) @@\
927 ProofProgramTarget(server,subdirs objects libs,objects libs $(LDLIBS) syslibs) @@\
928 ProofLinkTarget(Concat(load,server),server,objects libs $(LDLIBS) syslibs) @@\
930 InstallProgramWithFlags(server,$(BINDIR),flags) @@\
933 RemoveFile(ProgramTargetName(server))
934 #endif /* ServerTargetWithFlags */
937 * ServerTarget - rules to compile, link, and relink a normal server
940 #define ServerTarget(server,subdirs,objects,libs,syslibs) @@\
941 ServerTargetWithFlags(server,subdirs,objects,libs,syslibs,$(_NOOP_))
942 #endif /* ServerTarget */
945 #define RanLibrary(args) $(RANLIB) args
947 #define RanLibrary(args) $(_NULLCMD_)
950 #ifndef LibraryTargetName
951 #define LibraryTargetName(libname)Concat(lib,libname.a)
954 #ifndef LibraryTargetNameSuffix
955 #define LibraryTargetNameSuffix(libname,suffix)Concat3(lib,libname,suffix.a)
958 #ifndef InstallNamedTarget
959 #define InstallNamedTarget(step,srcname,flags,dest,dstname) @@\
961 MakeDir($(DESTDIR)dest) @@\
962 $(INSTALL) $(INSTALLFLAGS) flags srcname $(DESTDIR)dest/dstname
963 #endif /* InstallNamedTarget */
966 * InstallNamedTargetNoClobber - Like InstallNamedTarget, but doesn't
967 * do the install if an installed version already exists. Useful
968 * for files that might have local customizations that you don't
969 * want to clobber. Config files are good candidates for this.
971 #ifndef InstallNamedTargetNoClobber
972 #define InstallNamedTargetNoClobber(step,srcname,flags,dest,dstname) @@\
974 MakeDir($(DESTDIR)dest) @@\
975 @if [ -f $(DESTDIR)dest/dstname ]; then \ @@\
976 echo "Not overwriting existing" $(DESTDIR)dest/dstname; \ @@\
978 $(INSTALL) $(INSTALLFLAGS) flags srcname $(DESTDIR)dest/dstname; fi
979 #endif /* InstallNamedTargetNoClobber */
981 #ifndef InstallTarget
982 #define InstallTarget(step,file,flags,dest) @@\
983 InstallNamedTarget(step,file,flags,dest,file)
984 #endif /* InstallTarget */
987 * InstallLibrary - generate rules to install the indicated library.
989 #ifndef InstallLibrary
990 #define InstallLibrary(libname,dest) @@\
991 install:: LibraryTargetName(libname) @@\
992 MakeDir($(DESTDIR)dest) @@\
993 $(INSTALL) $(INSTALLFLAGS) $(INSTLIBFLAGS) LibraryTargetName(libname) $(DESTDIR)dest @@\
994 RanLibrary($(RANLIBINSTFLAGS) $(DESTDIR)dest/LibraryTargetName(libname))
995 #endif /* InstallLibrary */
999 * InstallLinkKitLibrary - rule to install Link Kit library.
1000 * (only used for XFree86). This is a no-op
1001 * rule so that Imakefiles on non-XFree86 systems
1002 * continue to build Makefiles correctly.
1004 #ifndef InstallLinkKitLibrary
1005 #define InstallLinkKitLibrary(lib,dir)
1010 * InstallLinkKitNamedLibrary - rule to install Link Kit library.
1011 * (only used for XFree86). This is a no-op
1012 * rule so that Imakefiles on non-XFree86 systems
1013 * continue to build Makefiles correctly.
1015 #ifndef InstallLinkKitNamedLibrary
1016 #define InstallLinkKitNamedLibrary(lib,dlib,dir)
1021 * MergeIntoInstalledLibrary - generate rules to merge one library into another
1023 #ifndef MergeIntoInstalledLibrary
1024 #define MergeIntoInstalledLibrary(tolib,fromlib) @@\
1025 install:: fromlib @@\
1026 $(SCRIPTSRC)/mergelib $(DESTDIR)tolib fromlib
1027 #endif /* MergeIntoInstalledLibrary */
1030 * InstallLibraryAlias - generate rules to create a link from one library name
1031 * to another for the purposes of aliasing.
1033 #ifndef InstallLibraryAlias
1034 #define InstallLibraryAlias(libname,alias,dest) @@\
1036 -(cd $(DESTDIR)dest; \ @@\
1037 RemoveFile(LibraryTargetName(alias)); \ @@\
1038 $(LN) LibraryTargetName(libname) LibraryTargetName(alias))
1039 #endif /* InstallLibraryAlias */
1043 * InstallLintLibrary - generate rules to install the indicated lint library.
1045 #ifndef InstallLintLibrary
1046 #define InstallLintLibrary(libname,dest) @@\
1047 InstallTarget(install.ln,Concat(llib-l,libname.ln),$(INSTLIBFLAGS),dest)
1048 #endif /* InstallLintLibrary */
1052 * InstallManPageLong - generate rules to install the indicated manual page,
1053 * giving it an alternate name. This is used for installing man pages whose
1054 * base name without the .man suffix would normally be longer than 8 characters
1055 * (the limit for using source code control systems on files systems with
1056 * short file names).
1058 #ifndef InstallManPageLong
1059 #define InstallManPageLong(file,destdir,dest) @@\
1060 InstallNamedTarget(install.man,file.man,$(INSTMANFLAGS),destdir,dest.$(MANSUFFIX))
1061 #endif /* InstallManPageLong */
1065 * InstallManPage - generate rules to install the indicated manual page.
1067 #ifndef InstallManPage
1068 #define InstallManPage(file,destdir) @@\
1069 InstallManPageLong(file,destdir,file)
1070 #endif /* InstallManPage */
1074 * InstallManPageAliases - generate rules to install manual page aliases.
1076 #ifndef InstallManPageAliases
1077 #define InstallManPageAliases(file,destdir,aliases) @@\
1079 @(TMP=/tmp/tmp.$$$$; \ @@\
1080 RemoveFile($${TMP}); \ @@\
1081 echo .so `basename destdir`/file.$(MANSUFFIX) > $${TMP}; \ @@\
1082 for i in aliases; do (set -x; \ @@\
1083 $(INSTALL) $(INSTALLFLAGS) $(INSTMANFLAGS) $${TMP} $(DESTDIR)destdir/$$i.$(MANSUFFIX)); \ @@\
1085 RemoveFile($${TMP}))
1086 #endif /* InstallManPageAliases */
1089 * ManKeywordsTarget - generate the database used by "man -k".
1090 * This rule updates the index in the directory "manpath", which
1091 * indexes all the manual pages in the section subdirectories under
1092 * it. An update command is defined only on systems that have a
1093 * per MANPATH element index. If the OS supports only one system-wide
1094 * database, we don't update it, because then we can't do cross
1095 * installations or use a non-empty DESTDIR for testing.
1097 #ifndef ManKeywordsTarget
1098 #define ManKeywordsTarget(manpath) man_keywords::
1102 * InstallNamedNonExec - generate rules to install a data file
1104 #ifndef InstallNamedNonExec
1105 #define InstallNamedNonExec(srcname,dstname,dest) @@\
1106 InstallNamedTarget(install,srcname,$(INSTDATFLAGS),dest,dstname)
1107 #endif /* InstallNamedNonExec */
1111 * InstallNonExecFile - generate rules to install a data file
1113 #ifndef InstallNonExecFile
1114 #define InstallNonExecFile(file,dest) @@\
1115 InstallTarget(install,file,$(INSTDATFLAGS),dest)
1116 #endif /* InstallNonExecFile */
1120 * InstallNonExecFileNoClobber - install a data file once
1122 #ifndef InstallNonExecFileNoClobber
1123 #define InstallNonExecFileNoClobber(file,dest) @@\
1124 InstallNamedTargetNoClobber(install,file,$(INSTDATFLAGS),dest,file)
1125 #endif /* InstallNonExecFileNoClobber */
1129 * InstallLinkKitNonExecFile - rule for installing server Link Kit files.
1130 * (only used for XFree86). This is a no-op
1131 * rule so that Imakefiles on non-XFree86 systems
1132 * continue to build Makefiles correctly.
1134 #ifndef InstallLinkKitNonExecFile
1135 #define InstallLinkKitNonExecFile(file,dir)
1140 * InstallNonExec - generate rules to install a data file, but does not
1141 * try to create the destination directory (deprecated)
1143 #ifndef InstallNonExec
1144 #define InstallNonExec(file,dest) @@\
1146 $(INSTALL) $(INSTALLFLAGS) $(INSTDATFLAGS) file $(DESTDIR)dest
1147 #endif /* InstallNonExec */
1151 * InstallProgramWithFlags - generate rules to install an executable program
1152 * using given install flags.
1154 #ifndef InstallProgramWithFlags
1155 #define InstallProgramWithFlags(program,dest,flags) @@\
1156 InstallTarget(install,ProgramTargetName(program),$(INSTPGMFLAGS) flags,dest)
1157 #endif /* InstallProgramWithFlags */
1161 * InstallProgram - generate rules to install an executable program using any
1162 * special install flags set in $(INSTALLFLAGS).
1164 #ifndef InstallProgram
1165 #define InstallProgram(program,dest) @@\
1166 InstallProgramWithFlags(program,dest,NullParameter)
1167 #endif /* InstallProgram */
1172 * InstallScript - install a shell script.
1174 #ifndef InstallScript
1175 #define InstallScript(program,dest) @@\
1176 InstallNamedTarget(install,program.script,$(INSTBINFLAGS),dest,program)
1177 #endif /* InstallScript */
1181 * InstallNamedProg - install a program with renaming and no stripping.
1183 #ifndef InstallNamedProg
1184 #define InstallNamedProg(srcname,dstname,dest) @@\
1185 InstallNamedTarget(install,srcname,$(INSTBINFLAGS),dest,dstname)
1186 #endif /* InstallNamedProg */
1189 * InstallNamedProgNoClobber - Like InstallNamedProg, but doesn't
1190 * do the install if an installed version already exists.
1192 #ifndef InstallNamedProgNoClobber
1193 #define InstallNamedProgNoClobber(srcname,dstname,dest) @@\
1194 InstallNamedTargetNoClobber(install,srcname,$(INSTBINFLAGS),dest,dstname)
1195 #endif /* InstallNamedProgNoClobber */
1198 * MakeFlagsToShellFlags - set variables before starting a loop.
1199 * makeflags is the set of "make" flags to check.
1200 * shellcmd is the shell command to execute if any of the flags are set.
1202 * The usual use of this rule is to translate make's "don't quit on error"
1203 * flags into the equivalent for the shell. To do this, "make -i" always
1204 * becomes "set +e". "make -k" should also turn on "set +e" if the target
1205 * is building subdirectories. That is, subdirectories are independent
1206 * and should appear to be multiple targets, even though they are
1207 * implemented in a loop in a single target.
1209 #ifndef MakeFlagsToShellFlags
1210 #define MakeFlagsToShellFlags(makeflags,shellcmd)\
1211 for flag in ${MAKEFLAGS} ''; do \ @@\
1212 case "$$flag" in *=*) ;; *[makeflags]*) shellcmd;; esac; done
1216 * LinkFileList - link a list of files from one place to another
1218 #ifndef LinkFileList
1219 #define LinkFileList(step,list,dir,sub) @@\
1221 @MakeFlagsToShellFlags(i,set +e); \ @@\
1222 echo " cd" dir; cd dir && \ @@\
1223 for i in list; do (set -x; RemoveFile($$i); $(LN) sub/$$i .); done
1229 * Make links from $LIBDIR (<ProjectRoot>/lib/X11) to /var/X11/
1230 * For example /usr/X11R6/lib/X11/xdm ==> /var/X11/xdm so that X
1231 * binaries can be mounted from a read-only volume like a CD-ROM;
1232 * but files that may need to be edited can be stored locally on
1233 * read-write media. If someone has an existing installation, be
1234 * careful and move existing files to the new location in /var.
1236 #ifndef LinkVarDirectory
1238 #define LinkVarDirectory(mdir,cdir,rdir,ldir) @@\
1240 MakeDir(Concat($(DESTDIR)$(LIBDIR)/,cdir)) @@\
1241 MakeDir(Concat($(VARDIR)/,mdir)) @@\
1242 @MakeFlagsToShellFlags(i,set +e); \ @@\
1243 if [ -d Concat($(DESTDIR)$(LIBDIR)/,cdir) ]; then \ @@\
1244 cd Concat($(DESTDIR)$(LIBDIR)/,cdir); \ @@\
1245 if [ -d rdir -a ! -h rdir ]; then \ @@\
1246 (cd rdir; tar cf - . | (cd Concat($(VARDIR)/,mdir); tar xf -; exit 0); exit 0); \ @@\
1248 $(RM) -r rdir; \ @@\
1249 $(LN) Concat($(VARDIR)/,mdir) ldir; \ @@\
1252 #define LinkVarDirectory(mdir,cdir,rdir,ldir)
1258 * InstallMultipleDestFlags - generate rules to install multiple files at
1259 * once during a particular step in the build using a specific set of install
1262 #ifndef InstallMultipleDestFlags
1263 #define InstallMultipleDestFlags(step,list,dest,flags) @@\
1265 MakeDir($(DESTDIR)dest) @@\
1266 @MakeFlagsToShellFlags(i,set +e); \ @@\
1267 for i in list; do \ @@\
1268 (set -x; $(INSTALL) $(INSTALLFLAGS) flags $$i $(DESTDIR)dest); \ @@\
1270 #endif /* InstallMultipleDestFlags */
1274 * InstallMultipleDest - generate rules to install multiple files at once
1275 * during a particular step in the build using any install flags set in
1278 #ifndef InstallMultipleDest
1279 #define InstallMultipleDest(step,list,dest) @@\
1280 InstallMultipleDestFlags(step,list,dest,$(INSTDATFLAGS))
1281 #endif /* InstallMultipleDest */
1284 * InstallMultiple - generate rules to install multiple files at once
1285 * during the install step of the build using any install flags set in
1288 #ifndef InstallMultiple
1289 #define InstallMultiple(list,dest) @@\
1290 InstallMultipleDest(install,list,dest)
1291 #endif /* InstallMultiple */
1295 * InstallMultipleFlags - generate rules to install multiple files at once
1296 * during the install step of the build using the given install flags.
1298 #ifndef InstallMultipleFlags
1299 #define InstallMultipleFlags(list,dest,flags) @@\
1300 InstallMultipleDestFlags(install,list,dest,flags)
1301 #endif /* InstallMultipleFlags */
1305 * InstallMultipleMan - generate rules to install a variety of manual pages
1306 * during the install.man step of the build.
1308 #ifndef InstallMultipleMan
1309 #define InstallMultipleMan(list,dest) @@\
1310 InstallMultipleDestFlags(install.man,list,dest,$(INSTMANFLAGS))
1311 #endif /* InstallMultipleMan */
1314 * IncludeMakefile - rule to include another Makefile.
1315 * Must not generate an error or even a warning if the named file
1316 * is not present, since we use this to include Makefile.dep, which
1317 * may not be built yet.
1318 * This is defined non-null iff HasMakefileSafeInclude is YES.
1319 * The double-@ is to ensure no leading spaces on the line.
1321 #ifndef IncludeMakefile
1323 #define IncludeMakefile(file) @@sinclude file
1325 #define IncludeMakefile(file) /**/
1330 * DependDependencyStatement - Used by DependDependency to set up the
1331 * most specific dependency, which differs based on whether we support
1332 * a separate Makefile.dep on this platform.
1334 #ifndef DependDependencyStatement
1335 #if HasMakefileSafeInclude
1336 #define DependDependencyStatement() @@\
1337 DependFileName:: ProgramTargetName($(DEPEND))
1339 #define DependDependencyStatement() @@\
1340 depend:: ProgramTargetName($(DEPEND))
1345 * DependDependency - generate rules to build the makedepend program if
1346 * this Imakefile is within the source tree.
1348 #ifndef DependDependency
1350 #define DependDependency() /**/
1352 #define DependDependency() @@\
1353 DependDependencyStatement() @@\
1355 NoCmpScript(ProgramTargetName($(DEPEND))) @@\
1357 ProgramTargetName($(DEPEND)): @@\
1358 @echo "checking $@ over in $(DEPENDSRC) first..."; \ @@\
1359 cd $(DEPENDSRC) && $(MAKE); \ @@\
1360 echo "okay, continuing in $(CURRENT_DIR)"
1362 #endif /* UseInstalled */
1363 #endif /* DependDependency */
1367 * DependTarget - generate rules to compute dependencies for all files listed
1370 #ifndef DependTarget
1371 #if HasMakefileSafeInclude
1372 #define DependTarget() @@\
1373 DependDependency() @@\
1375 depend:: DependFileName @@\
1377 DependFileName:: @@\
1378 RunProgram(DEPEND,-f- $(DEPENDFLAGS) -- $(ALLDEFINES) $(DEPEND_DEFINES) -- $(SRCS)) > $@
1379 #else /* HasMakefileSafeInclude */
1380 #define DependTarget() @@\
1381 DependDependency() @@\
1384 RunProgram(DEPEND,$(DEPENDFLAGS) -- $(ALLDEFINES) $(DEPEND_DEFINES) -- $(SRCS))
1385 #endif /* HasMakefileSafeInclude else */
1386 #endif /* DependTarget */
1389 * DependTarget3 - generate rules to compute dependencies for all files given.
1391 #ifndef DependTarget3
1392 #if HasMakefileSafeInclude
1393 #define DependTarget3(srcs1,srcs2,srcs3) @@\
1394 DependDependency() @@\
1396 depend:: DependFileName @@\
1398 DependFileName:: @@\
1399 RunProgram(DEPEND,-f- $(DEPENDFLAGS) -- $(ALLDEFINES) $(DEPEND_DEFINES) -- srcs1) > $@ @@\
1400 RunProgram(DEPEND,-f- $(DEPENDFLAGS) -- $(ALLDEFINES) $(DEPEND_DEFINES) -- srcs2) >> $@ @@\
1401 RunProgram(DEPEND,-f- $(DEPENDFLAGS) -- $(ALLDEFINES) $(DEPEND_DEFINES) -- srcs3) >> $@
1402 #else /* HasMakefileSafeInclude */
1403 #define DependTarget3(srcs1,srcs2,srcs3) @@\
1404 DependDependency() @@\
1407 RunProgram(DEPEND,$(DEPENDFLAGS) -- $(ALLDEFINES) $(DEPEND_DEFINES) -- srcs1) @@\
1408 RunProgram(DEPEND,-a $(DEPENDFLAGS) -- $(ALLDEFINES) $(DEPEND_DEFINES) -- srcs2) @@\
1409 RunProgram(DEPEND,-a $(DEPENDFLAGS) -- $(ALLDEFINES) $(DEPEND_DEFINES) -- srcs3)
1410 #endif /* HasMakefileSafeInclude else */
1411 #endif /* DependTarget3 */
1415 * CleanTarget - generate rules to remove any garbage files
1418 #define CleanTarget() @@\
1420 $(RM) FilesToClean ExtraFilesToClean "#"* @@\
1423 #endif /* CleanTarget */
1427 * TagsTarget - generate rules to compute tags files for C source code.
1430 #define TagsTarget() @@\
1432 $(TAGS) -w *.[ch] @@\
1433 $(TAGS) -xw *.[ch] > TAGS
1434 #endif /* TagsTarget */
1438 * ImakeDependency - generate rules to compile imake if this Imakefile is
1439 * within the source tree.
1441 #ifndef ImakeDependency
1443 #define ImakeDependency(target) /**/
1445 #define ImakeDependency(target) @@\
1446 target:: ProgramTargetName($(IMAKE)) @@\
1448 NoCmpScript(ProgramTargetName($(IMAKE)) $(IMAKE).Osuf) @@\
1450 ProgramTargetName($(IMAKE)) $(IMAKE).Osuf: @@\
1451 -@(cd $(IMAKESRC); if [ -f Makefile ]; then \ @@\
1452 echo "checking $@ in $(IMAKESRC) first..."; $(MAKE) all; else \ @@\
1453 echo "bootstrapping $@ from Makefile.ini in $(IMAKESRC) first..."; \ @@\
1454 $(MAKE) -f Makefile.ini BOOTSTRAPCFLAGS="$(BOOTSTRAPCFLAGS)"; fi; \ @@\
1455 echo "okay, continuing in $(CURRENT_DIR)")
1456 #endif /* UseInstalled */
1457 #endif /* ImakeDependency */
1461 * BuildMakefileTarget - generate rules to build a Makefile from an Imakefile
1462 * and any special imake flags. This is generally done automatically by the
1463 * template or by any special Imakefiles. The first argument exists just
1464 * because imakeflags is usually empty and some preprocessors will complain
1465 * if an empty argument is passed as the sole argument to a macro.
1467 #ifndef BuildMakefileTarget
1468 #define BuildMakefileTarget(notused,imakeflags) @@\
1469 ImakeDependency(Makefile) @@\
1472 RMoveToBakFile(Makefile) @@\
1473 $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR) imakeflags
1475 #endif /* BuildMakefileTarget */
1479 * MakefileTarget - generate rules to build a normal Makefile.
1481 #ifndef MakefileTarget
1482 #define MakefileTarget() @@\
1483 BuildMakefileTarget(Imakefile,NullParameter)
1484 #endif /* MakefileTarget */
1488 * LibMkdir - helper for creating library object subdirectories
1491 #define LibMkdir(dir) DirFailPrefix@if [ -d dir ]; then exit 0; else set -x; mkdir dir; fi
1494 #ifndef LibMkdirLinkSubdirs
1495 #define LibMkdirLinkSubdirs(dir) DirFailPrefix@if [ -d dir ]; then \ @@\
1498 echo "mkdir dir"; mkdir dir; \ @@\
1499 for i in $(SUBDIRS); do \ @@\
1500 j=`echo "$$i" | $(SED) -e 's;[^/]\{1,\};..;g'`; \ @@\
1501 $(MKDIRHIER) "dir/`dirname $$i`"; \ @@\
1502 echo $(LN) "$$j/$$i/dir" "dir/$$i"; \ @@\
1503 $(LN) "$$j/$$i/dir" "dir/$$i"; \ @@\
1509 * LibCleanDir - helper for cleaning library object subdirectories
1512 #define LibCleanDir(dir) -@if [ -d dir ]; then \ @@\
1513 set -x; $(RM) -r dir; else exit 0; fi
1517 * LintLibReferences - variables for lint libraries
1519 #ifndef LintLibReferences
1520 #define LintLibReferences(varname,libname,libsource) @@\
1521 Concat(LINT,varname) = _UseCat($(LINTLIBDIR)/llib-l,libsource/llib-,libname.ln)
1526 * UnsharedLibReferences - variables for unshared libraries
1528 #ifndef UnsharedLibReferences
1529 #define UnsharedLibReferences(varname,libname,libsource) @@\
1530 ProjectUnsharedLibReferences(varname,libname,libsource,$(BUILDLIBDIR))
1534 * ProjectUnsharedLibReferences - variables for unshared libraries
1536 #ifndef ProjectUnsharedLibReferences
1537 #define ProjectUnsharedLibReferences(varname,libname,libsource,buildlibdir) @@\
1538 Concat3(DEP,varname,LIB) = _UseCat($(USRLIBDIR)/lib,buildlibdir/lib,libname.a) @@\
1539 Concat(varname,LIB) = LoaderLibPrefix Concat(-l,libname) @@\
1540 LintLibReferences(varname,libname,libsource)
1544 * SharedLibDependencies - shared library dependencies
1546 #ifndef SharedLibDependencies
1547 #define SharedLibDependencies(libname,libsource,revname) /**/
1551 * SharedDSLibDependencies - shared library dependencies with data separation
1553 #ifndef SharedDSLibDependencies
1554 #define SharedDSLibDependencies(libname,libsource,revname) /**/
1558 * SharedLibReferences - variables for shared libraries
1560 #ifndef SharedLibReferences
1561 #define SharedLibReferences(varname,libname,libsource,revname,rev) @@\
1563 Concat3(DEP,varname,LIB) = SharedLibDependencies(libname,libsource,revname) @@\
1564 Concat(varname,LIB) = LoaderLibPrefix Concat(-l,libname) @@\
1565 LintLibReferences(varname,libname,libsource)
1569 * SharedDSLibReferences - variables for shared libraries with data separation
1571 #ifndef SharedDSLibReferences
1572 #define SharedDSLibReferences(varname,libname,libsource,revname,rev) @@\
1574 Concat3(DEP,varname,LIB) = SharedDSLibDependencies(libname,libsource,revname) @@\
1575 Concat(varname,LIB) = LoaderLibPrefix Concat(-l,libname) @@\
1576 LintLibReferences(varname,libname,libsource)
1580 * CPPOnlyCompile - run C compiler's preprocessor only
1582 #ifndef CPPOnlyCompile
1583 #define CPPOnlyCompile(src,options) RemoveFile($@) @@\
1585 $(CC) -E $(CFLAGS) options src > $@
1589 * ObjectCompile - compile fragment for a normal object file
1591 #ifndef ObjectCompile
1592 #define ObjectCompile(options) RemoveFile($@) @@\
1594 $(CC) -c $(CFLAGS) options $*.c
1597 #ifndef ObjectCplusplusCompile
1598 #define ObjectCplusplusCompile(options) RemoveFile($@) @@\
1600 $(CXX) -c $(CXXFLAGS) options $*.CCsuf
1604 * NormalLibObjCompile - compile fragment for a normal library object file
1606 #ifndef NormalLibObjCompile
1607 #define NormalLibObjCompile(options) ObjectCompile(options)
1610 #ifndef NormalLibObjCplusplusCompile
1611 #define NormalLibObjCplusplusCompile(options) ObjectCplusplusCompile(options)
1615 * NormalSharedLibObjCompile - compile fragment for shared objects
1617 #ifndef NormalSharedLibObjCompile
1618 #define NormalSharedLibObjCompile(options) NormalLibObjCompile(options $(SHLIBDEF) $(SHAREDCODEDEF) $(PICFLAGS))
1621 #ifndef NormalSharedLibObjCplusplusCompile
1622 #define NormalSharedLibObjCplusplusCompile(options) NormalLibObjCplusplusCompile(options $(SHLIBDEF) $(SHAREDCODEDEF) $(CXXPICFLAGS))
1626 * LibObjCompile - compile fragment for unshared/profiled/debugged objects
1628 #ifndef LibObjCompile
1629 #define LibObjCompile(dir,options) RemoveFiles($@ dir/$@) @@\
1631 $(CC) -c $(CCOPTIONS) $(ALLDEFINES) options $*.c @@\
1635 #ifndef LibObjCplusplusCompile
1636 #define LibObjCplusplusCompile(dir,options) RemoveFiles($@ dir/$@) @@\
1638 $(CXX) -c $(CXXOPTIONS) $(CXXDEFINES) options $*.CCsuf @@\
1643 * DebuggedLibObjCompile - compile fragment for debugged objects
1645 #ifndef DebuggedLibObjCompile
1646 #define DebuggedLibObjCompile(options) LibObjCompile(debugger,DebuggableCDebugFlags options)
1649 #ifndef DebuggedLibObjCplusplusCompile
1650 #define DebuggedLibObjCplusplusCompile(options) LibObjCplusplusCompile(debugger,DebuggableCplusplusDebugFlags options)
1654 * ProfiledLibObjCompile - compile fragment for profiled objects
1656 #ifndef ProfiledLibObjCompile
1657 #define ProfiledLibObjCompile(options) LibObjCompile(profiled,ProfiledCDebugFlags options)
1660 #ifndef ProfiledLibObjCplusplusCompile
1661 #define ProfiledLibObjCplusplusCompile(options) LibObjCplusplusCompile(profiled,ProfiledCplusplusDebugFlags options)
1665 * UnsharedLibObjCompile - compile fragment for unshared objects
1667 #ifndef UnsharedLibObjCompile
1668 #define UnsharedLibObjCompile(options) LibObjCompile(unshared,$(CDEBUGFLAGS) options)
1671 #ifndef UnsharedLibObjCplusplusCompile
1672 #define UnsharedLibObjCplusplusCompile(options) LibObjCplusplusCompile(unshared,$(CXXDEBUGFLAGS) options)
1676 * SharedLibObjCompile - compile fragment for shared objects
1678 #ifndef SharedLibObjCompile
1679 #define SharedLibObjCompile(options) LibObjCompile(shared,options $(SHLIBDEF) $(SHAREDCODEDEF) $(PICFLAGS) $(CDEBUGFLAGS))
1683 * NormalLibraryObjectRule - for simple libraries
1685 #ifndef NormalLibraryObjectRule
1686 #define NormalLibraryObjectRule() @@\
1688 NormalLibObjCompile($(_NOOP_))
1689 #endif /* NormalLibraryObjectRule */
1691 #ifndef NormalCplusplusObjectRule
1692 #define NormalCplusplusObjectRule() @@\
1694 NormalLibObjCplusplusCompile($(_NOOP_))
1697 #ifndef NormalFortranObjectRule
1698 #define NormalFortranObjectRule() @@\
1702 $(FC) -c $(FCFLAGS) $*.f
1706 * SpecialObjectRule - generate rules to compile a file with special flags.
1708 #ifndef SpecialObjectRule
1709 #define SpecialObjectRule(objs,depends,options) @@\
1711 ObjectCompile(options)
1712 #endif /* SpecialObjectRule */
1714 #ifndef SpecialCplusplusObjectRule
1715 #define SpecialCplusplusObjectRule(baseobj,basedep,options) @@\
1716 baseobj.Osuf: basedep.CCsuf @@\
1717 ObjectCplusplusCompile(options)
1718 #endif /* SpecialCplusplusObjectRule */
1721 * SpecialCObjectRule - generate rules to compile a C file with special flags.
1722 * also handles CodeCenter rules
1724 #ifndef SpecialCObjectRule
1725 #define SpecialCObjectRule(basename,depends,options) @@\
1726 SpecialObjectRule(basename.Osuf,basename.c depends,options) @@\
1728 basename.i: basename.c depends @@\
1729 CPPOnlyCompile(basename.c,options) @@\
1731 CenterLoadTarget(debug_src,basename.c,NullParameter,$(ALLDEFINES) options)
1732 #endif /* SpecialCObjectRule */
1735 #ifndef ObjectFromSpecialSource
1736 #define ObjectFromSpecialSource(dst,src,flags) @@\
1737 NoConfigRec(dst.c) @@\
1743 SpecialCObjectRule(dst,NullParameter,flags) @@\
1749 #endif /* ObjectFromSpecialSource */
1751 #ifndef LexFileExplicit
1752 #if HasClearmake /* provide a place to hang ClearmakeOSName */
1753 #define LexFileExplicit(file) @@\
1756 $(LEX) $(LFLAGS) file.l @@\
1757 $(MV) lex.yy.c file.c
1759 #define LexFileExplicit(file) /* the default rule is fine */
1764 #define LexFile(file) @@\
1765 LexFileExplicit(file) @@\
1770 RemoveFiles(lex.yy.c file.c)
1771 #endif /* LexFile */
1774 #define YaccFile(file,flags) @@\
1777 file.h file.c: file.y @@\
1779 $(YACC) flags file.y @@\
1780 $(MV) y.tab.c file.c @@\
1781 @if [ -f y.tab.h ]; then set -x; $(MV) y.tab.h file.h; \ @@\
1785 RemoveFiles(y.tab.c y.tab.h file.h file.c)
1786 #endif /* YaccFile */
1788 #ifndef YaccFileNoFlags
1789 #define YaccFileNoFlags(file) @@\
1795 $(MV) y.tab.c file.c @@\
1798 RemoveFiles(y.tab.c file.c)
1799 #endif /* YaccFileNoFlags */
1803 #define MakeLibrary(libname,objlist) $(AR) libname objlist
1806 #ifndef LinkBuildLibrary
1808 #define LinkBuildLibrary(lib) $(_NULLCMD_)
1810 #define LinkBuildLibrary(lib) MakeDir($(BUILDLIBDIR)) @@\
1811 RemoveFile($(BUILDLIBDIR)/lib) @@\
1812 cd $(BUILDLIBDIR) && $(LN) $(BUILDLIBTOP)/$(CURRENT_DIR)/lib .
1814 #endif /* LinkBuildLibrary */
1816 #ifndef _LinkBuildLibrary /* will get redefined elsewhere */
1817 #define _LinkBuildLibrary(lib) $(_NULLCMD_)
1818 #endif /* _LinkBuildLibrary */
1821 * NormalLibraryTarget - generate rules to create a library.
1823 #ifndef NormalLibraryTarget
1824 #define NormalLibraryTarget(libname,objlist) @@\
1825 AllTarget(LibraryTargetName(libname)) @@\
1827 LibraryTargetName(libname): objlist $(EXTRALIBRARYDEPS) @@\
1829 MakeLibrary($@,objlist) @@\
1831 _LinkBuildLibrary($@)
1832 #endif /* NormalLibraryTarget */
1836 * NormalLibraryTarget2 - generate rules to create a library in two steps.
1837 * This is used to create libraries with large numbers of files.
1839 #ifndef NormalLibraryTarget2
1840 #define NormalLibraryTarget2(libname,objlist1,objlist2) @@\
1841 AllTarget(LibraryTargetName(libname)) @@\
1843 LibraryTargetName(libname): objlist1 objlist2 $(EXTRALIBRARYDEPS) @@\
1845 MakeLibrary($@,objlist1) @@\
1846 MakeLibrary($@,objlist2) @@\
1848 _LinkBuildLibrary($@)
1849 #endif /* NormalLibraryTarget2 */
1853 * NormalLibraryTarget3 - generate rules to create a library in three steps.
1854 * This is used to create libraries with very large numbers of files.
1856 #ifndef NormalLibraryTarget3
1857 #define NormalLibraryTarget3(libname,objlist1,objlist2,objlist3) @@\
1858 AllTarget(LibraryTargetName(libname)) @@\
1860 LibraryTargetName(libname): objlist1 objlist2 objlist3 $(EXTRALIBRARYDEPS) @@\
1862 MakeLibrary($@,objlist1) @@\
1863 MakeLibrary($@,objlist2) @@\
1864 MakeLibrary($@,objlist3) @@\
1866 _LinkBuildLibrary($@)
1867 #endif /* NormalLibraryTarget3 */
1871 * NormalDepLibraryTarget - generate rules to create a library.
1873 #ifndef NormalDepLibraryTarget
1874 #define NormalDepLibraryTarget(libname,deplist,objlist) @@\
1875 AllTarget(LibraryTargetName(libname)) @@\
1877 LibraryTargetName(libname): deplist $(EXTRALIBRARYDEPS) @@\
1879 MakeLibrary($@,objlist) @@\
1881 _LinkBuildLibrary($@)
1882 #endif /* NormalDepLibraryTarget */
1886 * UnsharedLibraryTarget - generate rules to create a library.
1888 #ifndef UnsharedLibraryTarget
1889 #define UnsharedLibraryTarget(libname,objlist,down,up) @@\
1890 AllTarget(LibraryTargetName(libname)) @@\
1892 LibraryTargetName(libname): objlist $(EXTRALIBRARYDEPS) @@\
1894 (cd down && MakeLibrary(up/$@,objlist)) @@\
1896 _LinkBuildLibrary($@)
1897 #endif /* UnsharedLibraryTarget */
1901 * UnsharedLibraryTarget3 - generate rules to create a library in three steps.
1902 * This is used to create libraries with very large numbers of files.
1904 #ifndef UnsharedLibraryTarget3
1905 #define UnsharedLibraryTarget3(libname,objlist1,objlist2,objlist3,down,up) @@\
1906 AllTarget(LibraryTargetName(libname)) @@\
1908 LibraryTargetName(libname): objlist1 objlist2 objlist3 $(EXTRALIBRARYDEPS) @@\
1910 (cd down && MakeLibrary(up/$@,objlist1)) @@\
1911 (cd down && MakeLibrary(up/$@,objlist2)) @@\
1912 (cd down && MakeLibrary(up/$@,objlist3)) @@\
1914 _LinkBuildLibrary($@)
1915 #endif /* UnsharedLibraryTarget3 */
1919 * SubdirLibraryRule -
1921 #ifndef SubdirLibraryRule
1922 #define SubdirLibraryRule(objlist) @@\
1931 #endif /* SubdirLibraryRule */
1935 * ProfiledLibraryTarget - generate rules to create a profiled library.
1937 #ifndef ProfiledLibraryTarget
1938 #define ProfiledLibraryTarget(libname,objlist) @@\
1939 AllTarget(LibraryTargetNameSuffix(libname,_p)) @@\
1941 LibraryTargetNameSuffix(libname,_p): objlist $(EXTRALIBRARYDEPS) @@\
1943 cd profiled && MakeLibrary(../$@,objlist) @@\
1946 #endif /* ProfiledLibraryTarget */
1950 * DebuggedLibraryTarget - generate rules to create a debuggable library.
1952 #ifndef DebuggedLibraryTarget
1953 #define DebuggedLibraryTarget(libname,objlist) @@\
1954 AllTarget(LibraryTargetNameSuffix(libname,_d)) @@\
1956 LibraryTargetNameSuffix(libname,_d): objlist $(EXTRALIBRARYDEPS) @@\
1958 cd debugger && MakeLibrary(../$@,objlist) @@\
1961 #endif /* DebuggedLibraryTarget */
1965 * AliasedLibraryTarget - generate rules to link one library to another.
1967 #ifndef AliasedLibraryTarget
1968 #define AliasedLibraryTarget(libname,alias) @@\
1969 AllTarget(LibraryTargetName(alias)) @@\
1971 LibraryTargetName(alias): LibraryTargetName(libname) @@\
1973 $(LN) LibraryTargetName(libname) $@ @@\
1976 RemoveFile(LibraryTargetName(alias))
1977 #endif /* AliasedLibraryTarget */
1981 * NormalRelocatableTarget - generate rules to produce a relocatable object
1982 * file instead of a library.
1984 #ifndef NormalRelocatableTarget
1985 #define NormalRelocatableTarget(objname,objlist) @@\
1986 AllTarget(objname.Osuf) @@\
1988 objname.Osuf: objlist $(EXTRALIBRARYDEPS) @@\
1990 $(LD) $(LDCOMBINEFLAGS) objlist -o $@
1991 #endif /* NormalRelocatableTarget */
1995 * ProfiledRelocatableTarget - generate rules to produce a profiled relocatable
1996 * object file instead of a library.
1998 #ifndef ProfiledRelocatableTarget
1999 #define ProfiledRelocatableTarget(objname,objlist) @@\
2000 AllTarget(Concat(objname,_p.Osuf)) @@\
2002 Concat(objname,_p.Osuf): objlist $(EXTRALIBRARYDEPS) @@\
2004 $(LD) -X -r objlist -o $@
2006 #endif /* ProfiledRelocatableTarget */
2010 * DebuggedRelocatableTarget - generate rules to produce a debuggable
2011 * relocatable object file instead of a library.
2013 #ifndef DebuggedRelocatableTarget
2014 #define DebuggedRelocatableTarget(objname,objlist) @@\
2015 AllTarget(Concat(objname,_d.Osuf)) @@\
2017 Concat(objname,_d.Osuf): objlist $(EXTRALIBRARYDEPS) @@\
2019 $(LD) -X -r objlist -o $@
2021 #endif /* DebuggedRelocatableTarget */
2025 * LintLibraryTarget - generate rules to create a lint library. Note that the
2026 * lint library is always forced to be newer than the library itself.
2028 #ifndef LintLibraryTarget
2029 #define LintLibraryTarget(libname,srclist) @@\
2030 lintlib:: Concat(llib-l,libname.ln) @@\
2032 Concat(llib-l,libname.ln): srclist $(EXTRALIBRARYDEPS) @@\
2034 $(LINT) Concat($(LINTLIBFLAG),libname) $(LINTFLAGS) srclist
2035 #endif /* LintLibraryTarget */
2039 * NormalLintTarget - generate rules to lint a set of sources.
2041 #ifndef NormalLintTarget
2042 #define NormalLintTarget(srclist) @@\
2044 $(LINT) $(LINTFLAGS) srclist $(LINTLIBS) @@\
2046 $(LINT) $(LINTFLAGS) $(FILE) $(LINTLIBS)
2047 #endif /* NormalLintTarget */
2051 * LintTarget - generate rules to lint $(SRCS)
2054 #define LintTarget() @@\
2055 NormalLintTarget($(SRCS))
2060 * LinkSourceFile - snag source file from some other directory
2062 #ifndef LinkSourceFile
2063 #define LinkSourceFile(src,dir) @@\
2068 NoConfigRec(src) @@\
2080 * CopySourceFile - snag source file from some other directory
2082 #ifndef CopySourceFile
2083 #define CopySourceFile(src,dir) @@\
2088 NoConfigRec(src) @@\
2100 * LinkFile - link a file
2103 #define LinkFile(tofile,fromfile) @@\
2104 tofile:: fromfile @@\
2108 NoConfigRec(tofile) @@\
2110 includes:: tofile @@\
2119 #ifndef MakeSubincludesForBuild
2120 #define MakeSubincludesForBuild(step,dir,srclist) @@\
2121 step:: dir srclist @@\
2122 @-(list=`echo srclist | $(SED) -e 's/[^ ]*\///g'`; \ @@\
2123 set -x; cd dir; RemoveFiles($$list)) @@\
2124 @for i in srclist; do \ @@\
2125 (set -x; cd dir; $(LN) ../$$i .); \ @@\
2129 $(MKDIRHIER) dir @@\
2132 @-(if [ -d dir ]; then \ @@\
2133 list=`echo srclist | $(SED) -e 's/[^ ]*\///g'`; \ @@\
2134 set -x; cd dir; RemoveFile($$list); else exit 0; fi)
2139 * LangNamedTargetSubdirs - recursively make a series of steps
2141 #ifndef LangNamedTargetSubdirs
2142 #define LangNamedTargetSubdirs(lang,name,dirs,verb,flags,subname) @@\
2144 @MakeFlagsToShellFlags(ik,set +e); \ @@\
2145 for i in dirs ;\ @@\
2147 echo verb "in $(CURRENT_DIR)/$$i..."; \ @@\
2148 (cd $$i && LANG=lang $(MAKE) $(MFLAGS) flags subname);\ @@\
2154 * NamedMakeSubdirs - generate rules to do makes in the given subdirectories.
2155 * If you want CDEBUGFLAGS passed along to subdirectories, provide a line like
2156 * the following in the appropriate Imakefile
2158 * #define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)'
2160 #ifndef LangNamedMakeSubdirs
2161 #define LangNamedMakeSubdirs(lang,name,dirs) \
2162 LangNamedTargetSubdirs(lang,name,dirs,"making" name,PassCDebugFlags,all)
2163 #endif /* LangNamedMakeSubdirs */
2165 #ifndef LangMakeSubdirs
2166 #define LangMakeSubdirs(lang,dirs) @@\
2167 LangNamedMakeSubdirs(lang,all,dirs)
2168 #endif /* LangMakeSubdirs */
2173 * NamedTargetSubdirs - recursively make a series of steps
2175 #ifndef NamedTargetSubdirs
2176 #define NamedTargetSubdirs(name,dirs,verb,flags,subname) @@\
2178 @MakeFlagsToShellFlags(ik,set +e); \ @@\
2179 for i in dirs ;\ @@\
2181 echo verb "in $(CURRENT_DIR)/$$i..."; \ @@\
2182 (cd $$i && $(MAKE) $(MFLAGS) flags subname); \ @@\
2188 * NamedMakeSubdirs - generate rules to do makes in the given subdirectories.
2189 * If you want CDEBUGFLAGS passed along to subdirectories, provide a line like
2190 * the following in the appropriate Imakefile
2192 * #define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)'
2194 #ifndef NamedMakeSubdirs
2195 #define NamedMakeSubdirs(name,dirs) \
2196 NamedTargetSubdirs(name,dirs,"making" name,PassCDebugFlags,all)
2197 #endif /* NamedMakeSubdirs */
2200 #define MakeSubdirs(dirs) @@\
2201 NamedMakeSubdirs(all,dirs)
2202 #endif /* MakeSubdirs */
2206 * DependSubdirs - generate rules to recursively compute dependencies as
2207 * part of the make depend step.
2209 #ifndef DependSubdirs
2210 #define DependSubdirs(dirs) \
2211 NamedTargetSubdirs(depend,dirs,"depending",NullParameter,depend)
2212 #endif /* DependSubdirs */
2216 * ForceSubdirs - force make to build subdirectories
2218 #ifndef ForceSubdirs
2219 #define ForceSubdirs(dirs) @@\
2221 @cd $@ ; echo "making all in $(CURRENT_DIR)/$@..."; \ @@\
2222 $(MAKE) $(MFLAGS) PassCDebugFlags all @@\
2225 #endif /* ForceSubdirs */
2228 * InstallSubdirs - generate rules to recursively install programs and files.
2230 #ifndef InstallSubdirs
2231 #define InstallSubdirs(dirs) \
2232 NamedTargetSubdirs(install,dirs,"installing",DESTDIR=$(DESTDIR),install)
2233 #endif /* InstallSubdirs */
2237 * InstallManSubdirs - generate rules to recursively install manual pages.
2239 #ifndef InstallManSubdirs
2240 #define InstallManSubdirs(dirs) \
2241 NamedTargetSubdirs(install.man,dirs,"installing man pages",DESTDIR=$(DESTDIR),install.man)
2242 #endif /* InstallManSubdirs */
2246 * IncludesSubdirs - generate rules to recursively put include files in build
2248 #ifndef IncludesSubdirs
2249 #define IncludesSubdirs(dirs) \
2250 NamedTargetSubdirs(includes,dirs,including,NullParameter,includes)
2255 * InstallLinkKitSubdirs - generate rules to recursively install server Link
2256 * Kit (only used for XFree86). This is a no-op
2257 * rule so that Imakefiles on non-XFree86 systems
2258 * continue to build Makefiles correctly.
2260 #ifndef InstallLinkKitSubdirs
2261 #define InstallLinkKitSubdirs(dirs)
2266 * CleanSubdirs - generate rules to recursively clean out garbage files.
2268 #define BootstrapCleanSubdirs /**/ /* used at top-level */
2269 #ifndef NamedCleanSubdirs
2270 #define NamedCleanSubdirs(name,dirs) \
2271 NamedTargetSubdirs(name,dirs,"cleaning",BootstrapCleanSubdirs,clean)
2272 #endif /* NamedCleanSubdirs */
2274 #ifndef CleanSubdirs
2275 #define CleanSubdirs(dirs) \
2276 NamedCleanSubdirs(clean,dirs)
2281 * TagSubdirs - generate rules to recursively create tags files.
2283 #ifndef NamedTagSubdirs
2284 #define NamedTagSubdirs(name,dirs) \
2285 NamedTargetSubdirs(name,dirs,"tagging",TAGS='$(TAGS)',tags)
2286 #endif /* TagSubdirs */
2289 #define TagSubdirs(dirs) \
2290 NamedTagSubdirs(tags,dirs)
2294 * MakeLintSubdirs - generate rules to recursively lint directories as part
2295 * of the named step.
2297 #ifndef MakeLintSubdirs
2298 #define MakeLintSubdirs(dirs,target,subtarget) \
2299 NamedTargetSubdirs(target,dirs,"linting" for target and subtarget,DESTDIR=$(DESTDIR) LINTOPTS='$(LINTOPTS)',subtarget)
2300 #endif /* MakeLintSubdirs */
2304 * LintSubdirs - generate rules to recursively lint directories as part of
2305 * the make lint step.
2308 #define LintSubdirs(dirs) @@\
2309 MakeLintSubdirs(dirs,lint,lint)
2310 #endif /* LintSubdirs */
2314 * MakeLintLibSubdirs - generate rules to recursively create lint libraries.
2316 #ifndef MakeLintLibSubdirs
2317 #define MakeLintLibSubdirs(dirs) @@\
2318 MakeLintSubdirs(dirs,lintlib,lintlib)
2319 #endif /* MakeLintLibSubdirs */
2323 * MakeMakeOneSubdirs - generate rules to recreate $(ONESUBDIR)/Makefile
2324 * as part of the specified step in the build. This separate, explicit target
2325 * exists so that clearmake will know what its goal is and do wink-in.
2327 #ifndef MakeMakeOneSubdirs
2328 #define MakeMakeOneSubdirs() @@\
2329 $(ONESUBDIR)/Makefile: @@\
2330 @MakeFlagsToShellFlags(n,executeit="no"); \ @@\
2331 cd $(ONESUBDIR); \ @@\
2332 if [ "$$executeit" != "no" ]; then \ @@\
2333 ImakeSubCmdHelper -DTOPDIR=$(IMAKETOP) -DCURDIR=$(ONECURDIR)$(ONESUBDIR); \ @@\
2335 #endif /* MakeMakeOneSubdirs */
2339 * MakeMakeSubdirs - generate rules to recursively recreate Makefiles as part
2340 * of the specified step in the build. If $(TOP) is set to an absolute path,
2341 * do not prepend the ../ prefix. This makes running things outside of the
2342 * source tree much easier.
2344 #ifndef MakeMakeSubdirs
2345 #define MakeMakeSubdirs(dirs,target) @@\
2347 -@MakeFlagsToShellFlags(ik,set +e); \ @@\
2348 MakeFlagsToShellFlags(n,executeit="no"); \ @@\
2349 for i in dirs ;\ @@\
2351 case "$(CURRENT_DIR)" in \ @@\
2353 *) curdir=$(CURRENT_DIR)/ ;; \ @@\
2355 echo "making Makefiles in $$curdir$$i..."; \ @@\
2356 itmp=`echo $$i | $(SED) -e 's;^\./;;g' -e 's;/\./;/;g'`; \ @@\
2357 curtmp="$(CURRENT_DIR)" \ @@\
2359 case "$$itmp" in \ @@\
2361 while echo "$$itmp" | grep '^\.\./' > /dev/null;\ @@\
2363 toptmp="/`basename $$curtmp`$$toptmp"; \ @@\
2364 curtmp="`dirname $$curtmp`"; \ @@\
2365 itmp="`echo $$itmp | $(SED) 's;\.\./;;'`"; \ @@\
2369 case "$$itmp" in \ @@\
2370 */?*/?*/?*/?*) newtop=../../../../..;; \ @@\
2371 */?*/?*/?*) newtop=../../../..;; \ @@\
2372 */?*/?*) newtop=../../..;; \ @@\
2373 */?*) newtop=../..;; \ @@\
2374 *) newtop=..;; \ @@\
2376 newtop="$$newtop$$toptmp"; \ @@\
2377 case "$(TOP)" in \ @@\
2378 /?*) imaketop=$(TOP) \ @@\
2379 imakeprefix= ;; \ @@\
2380 .) imaketop=$$newtop \ @@\
2381 imakeprefix=$$newtop/ ;; \ @@\
2382 *) imaketop=$$newtop/$(TOP) \ @@\
2383 imakeprefix=$$newtop/ ;; \ @@\
2385 RemoveFile($$i/Makefile.bak); \ @@\
2386 if [ -f $$i/Makefile ]; then \ @@\
2387 echo " $(MV) Makefile Makefile.bak"; \ @@\
2388 if [ "$$executeit" != "no" ]; then \ @@\
2389 $(MV) $$i/Makefile $$i/Makefile.bak; \ @@\
2392 $(MAKE) $(MFLAGS) $(MAKE_OPTS) ONESUBDIR=$$i ONECURDIR=$$curdir IMAKETOP=$$imaketop IMAKEPREFIX=$$imakeprefix $$i/Makefile; \ @@\
2394 $(MAKE) $(MFLAGS) Makefiles; \ @@\
2399 #define ImakeSubCmdHelper $(IMAKE_CMD)
2401 #define ImakeSubCmdHelper $(IMAKEPREFIX)$(IMAKE) -I$(IMAKEPREFIX)$(IRULESRC) $(IMAKE_DEFINES) $(IMAKE_DEF_DTINFO)
2404 #endif /* MakeMakeSubdirs */
2408 * MakefileSubdirs - generate rules to create Makefiles.
2410 #ifndef MakefileSubdirs
2411 #define MakefileSubdirs(dirs) @@\
2412 MakeMakeOneSubdirs() @@\
2413 MakeMakeSubdirs(dirs,Makefiles)
2414 #endif /* MakefileSubdirs */
2417 * Translate XCOMM into pound sign with sed, rather than passing -DXCOMM=XCOMM
2418 * to cpp, because that trick does not work on all ANSI C preprocessors.
2419 * Also delete line numbers from the cpp output (-P is not portable, I guess).
2422 #define CppSedMagic $(SED) -e '/^#[line]* *[0-9][0-9]* *.*$$/d' -e '/^XCOMM$$/s//#/' -e '/^XCOMM[^a-zA-Z0-9_]/s/^XCOMM/#/'
2423 #endif /* CppSedMagic */
2425 #ifndef CppFileTarget
2426 #define CppFileTarget(dst,src,defs,deplist) @@\
2427 dst:: src deplist @@\
2430 $(CPP) CppNoLineInfoOption defs <src | CppSedMagic >$@ @@\
2434 #endif /* CppFileTarget */
2437 * CppScriptTarget - generate rules to create a shell script by running the
2438 * input through cpp. If the ExecableScripts configuration parameter is not
2439 * set, then make sure that the first line begins with a colon.
2441 #ifndef CppScriptTarget
2442 #if ExecableScripts /* can use #! instead of colon */
2443 #define CppScriptTarget(dst,src,defs,deplist) @@\
2444 dst:: src deplist @@\
2447 $(CPP) CppNoLineInfoOption defs <src | CppSedMagic >$@ @@\
2453 #define CppScriptTarget(dst,src,defs,deplist) @@\
2454 dst:: src deplist @@\
2458 $(SED) '1d' src | $(CPP) CppNoLineInfoOption defs | CppSedMagic >>$@ @@\
2463 #endif /* ExecableScripts */
2464 #endif /* CppScriptTarget */
2468 * MakeScriptFromCpp - generate rules to create a script from a file with a
2471 #ifndef MakeScriptFromCpp
2472 #define MakeScriptFromCpp(name,defs) @@\
2473 CppScriptTarget(name,name.cpp,defs,NullParameter)
2474 #endif /* MakeScriptFromCpp */
2476 #ifndef CppSourceFile
2477 #define CppSourceFile(dst,src,defs,deplist) @@\
2478 CppFileTarget(dst,src,defs,deplist) @@\
2483 #endif /* CppSourceFile */
2487 * SedFileTarget - generate rules to create a file by running the
2488 * input through sed.
2490 #ifndef SedFileTarget
2491 #define SedFileTarget(dst,src,cmds) @@\
2494 $(SED) cmds src >$@ @@\
2499 #endif /* SedFileTarget */
2501 #ifndef SedSourceFile
2502 #define SedSourceFile(dst,src,cmds) @@\
2503 SedFileTarget(dst,src,cmds) @@\
2508 #endif /* SedSourceFile */
2512 * MakeDirectories - generate rules to create a hierarchy of directories.
2514 #ifndef MakeDirectories
2515 #define MakeDirectories(step,dirs) @@\
2517 DirFailPrefix@MakeFlagsToShellFlags(i,set +e); \ @@\
2518 for i in dirs; do if [ -d $(DESTDIR)$$i ]; then \ @@\
2519 set +x; else (set -x; $(MKDIRHIER) $(DESTDIR)$$i); fi \ @@\
2521 #endif /* MakeDirectories */
2525 * AllTarget - generate rules to build necessary things during make all.
2528 #define AllTarget(depends) @@\
2530 #endif /* AllTarget */
2534 * MakeImakeDir - call make in imake directory.
2536 #ifndef MakeImakeDir
2537 #define MakeImakeDir() cd $(IMAKESRC) && \ @@\
2538 if [ -f Makefile ]; then \ @@\
2539 $(MAKE) $(MFLAGS) BOOTSTRAPCFLAGS="$(BOOTSTRAPCFLAGS)"; \ @@\
2541 $(MAKE) $(MFLAGS) -f Makefile.ini BOOTSTRAPCFLAGS="$(BOOTSTRAPCFLAGS)"; \ @@\
2543 #endif /* MakeImakeDir */
2547 * DoUDB_SCRIPT3 - macro for creation of udb scripts for installation
2549 #ifndef DoUDB_SCRIPT3
2550 #define DoUDB_SCRIPT3(target, file, script, build) @@\
2551 target:: $(DATABASE_DIR)/file.udb @@\
2552 script -toLst -ReleaseStream $(PLATFORM) \ @@\
2553 $(DATABASE_DIR)/file.udb > file.lst @@\
2559 * DoUDB_SCRIPT4 - macro for creation of udb scripts for installation
2561 #ifndef DoUDB_SCRIPT4
2562 #define DoUDB_SCRIPT4(target, file, script, build) @@\
2563 target:: $(DATABASE_DIR)/file.udb @@\
2564 script -toLst -ReleaseStream $(PLATFORM) \ @@\
2565 $(DATABASE_DIR)/file.udb > file.lst @@\
2566 build file ../../../..
2570 #ifdef DefineOldLibraryRules
2571 #include <oldlib.rules>