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 * LinkFile (tofile,fromfile)
138 * MakeSubincludesForBuild (step,dir,srclist)
139 * LangNamedTargetSubdirs (lang,name,dirs,verb,flags,subname)
140 * LangNamedMakeSubdirs (lang,name,dirs)
141 * LangMakeSubdirs (lang,dirs)
142 * NamedTargetSubdirs (name,dirs,verb,flags,subname)
143 * NamedMakeSubdirs (name,dirs)
145 * DependSubdirs (dirs)
146 * ForceSubdirs (dirs)
147 * InstallSubdirs (dirs)
148 * InstallManSubdirs (dirs)
149 * IncludesSubdirs (dirs)
150 * NamedCleanSubdirs (name,dirs)
151 * CleanSubdirs (dirs)
152 * NamedTagSubdirs (name,dirs)
154 * MakeLintSubdirs (dirs,target,subtarget)
156 * MakeLintLibSubdirs (dirs)
157 * MakeMakeSubdirs (dirs,target)
158 * MakefileSubdirs (dirs)
159 * CppScriptTarget (dst,src,defs,deplist)
160 * MakeScriptFromCpp (name,defs)
161 * CppFileTarget (dst,src,defs,deplist)
162 * CppSourceFile (dst,src,defs,deplist)
163 * MakeDirectories (step,dirs)
164 * AllTarget (depends)
167 * The following are in specific <os>Lib.rules:
169 * SharedLibraryTarget (libname,rev,solist,down,up)
170 * SharedLibraryDataTarget (libname,rev,salist)
171 * InstallSharedLibrary (libname,rev,dest)
172 * InstallSharedLibraryData (libname,rev,dest)
176 #define NullParameter
178 /* if [ -d ] or [ ! -d ] causes make to fail, define this as - */
179 #ifndef DirFailPrefix
180 #define DirFailPrefix
184 * NoCmpScript - suppress clearmake build script comparison.
188 #define NoCmpScript(targ) @@\
189 XCOMM special target for clearmake @@\
192 #define NoCmpScript(targ) /**/
197 * NoConfigRec - suppress using clearmake configuration records.
201 #define NoConfigRec(targ) @@\
202 XCOMM special target for clearmake @@\
205 #define NoConfigRec(targ) /**/
210 * Concat - concatenates two strings.
213 #if (__STDC__ && !defined(UnixCpp)) || defined(AnsiCpp)
214 #define Concat(a,b)a##b
216 #define Concat(a,b)a/**/b
221 * Concat3 - concatenates three strings.
224 #if (__STDC__ && !defined(UnixCpp)) || defined(AnsiCpp)
225 #define Concat3(a,b,c)a##b##c
227 #define Concat3(a,b,c)a/**/b/**/c
232 * Concat4 - concatenates four strings.
235 #if (__STDC__ && !defined(UnixCpp)) || defined(AnsiCpp)
236 #define Concat4(a,b,c,d)a##b##c##d
238 #define Concat4(a,b,c,d)a/**/b/**/c/**/d
243 * _XUse - makes a choice based on UseInstalledX11.
246 # if defined(UseInstalled) || UseInstalledX11
247 # define _XUse(a,b) a
249 # define _XUse(a,b) b
254 * _Use - makes a choice based on UseInstalled.
261 * _XUseCat - combination of _XUse and Concat.
262 * exists to avoid problems with some preprocessors
265 # if (__STDC__ && !defined(UnixCpp)) || defined(AnsiCpp)
266 # if defined(UseInstalled) || UseInstalledX11
267 # define _XUseCat(a,b,c) a##c
269 # define _XUseCat(a,b,c) b##c
272 # if defined(UseInstalled) || UseInstalledX11
273 # define _XUseCat(a,b,c) a/**/c
275 # define _XUseCat(a,b,c) b/**/c
278 #endif /* _XUseCat */
281 * _UseCat - combination of _Use and Concat.
282 * exists to avoid problems with some preprocessors
285 # define _UseCat _XUseCat
288 #ifndef ProgramTargetName
289 #define ProgramTargetName(target)target
293 #define RunProgram(progvar,options) $(progvar) options
296 #ifndef RunProgramWithSetup
297 #define RunProgramWithSetup(setup,progvar,options) setup $(progvar) options
301 #define RemoveFile(file) $(RM) file
302 #endif /* RemoveFile */
305 #define RemoveFiles(files) $(RM) files
306 #endif /* RemoveFiles */
309 * CenterLoadTarget - generate rules to load files into CodeCenter
311 #ifndef CenterLoadTarget
313 #define CenterLoadTarget(target,srclist,libs,defines) @@\
314 ProgramTargetName(target):: srclist @@\
315 XCOMM load defines srclist libs
317 #define CenterLoadTarget(target,srclist,libs,defines) /**/
319 #endif /* CenterLoadTarget */
322 * CenterProgramTarget - generate rules to make CodeCenter read in sources
325 #ifndef CenterProgramTarget
326 #define CenterProgramTarget(program,srclist,objlist,locallibs,syslibs) @@\
327 CenterLoadTarget(Concat(debug_,program),srclist,$(EXTRA_LDOPTIONS) $(LOCAL_LDFLAGS) $(LDPRELIBS) locallibs $(LDLIBS) syslibs,$(ALLDEFINES)) @@\
329 CenterLoadTarget(Concat(odebug_,program),objlist,$(EXTRA_LDOPTIONS) $(LOCAL_LDFLAGS) $(LDPRELIBS) locallibs $(LDLIBS) syslibs,$(ALLDEFINES))
330 #endif /* CenterProgramTarget */
332 #ifndef SentinelLinkTarget
334 #define SentinelLinkTarget(step,program,linklist) @@\
335 ProgramTargetName(step.sentinel): @@\
336 RemoveTargetProgram($@) @@\
337 $(CCENVSETUP) $(SENTINEL) $(SENTINELOPTIONS) $(CC) -o program.sentinel $(LDOPTIONS) linklist $(EXTRA_LOAD_FLAGS)
339 #define SentinelLinkTarget(step,program,linklist) /**/
341 #endif /* SentinelLinkTarget */
344 * SentinelProgramTarget - generate rules to make Sentinel image
346 #ifndef SentinelProgramTarget
348 #define SentinelProgramTarget(program,deplist,linklist) @@\
349 ProgramTargetName(program.sentinel): deplist @@\
350 RemoveTargetProgram($@) @@\
351 $(CCENVSETUP) $(SENTINEL) $(SENTINELOPTIONS) $(CC) -o $@ $(LDOPTIONS) linklist $(EXTRA_LOAD_FLAGS) @@\
353 clean clean.sentinel:: @@\
354 RemoveFile(program.sentinel)
356 #define SentinelProgramTarget(program,deplist,linklist) /**/
358 #endif /* SentinelProgramTarget */
361 * SentinelCplusplusProgramTarget - generate rules to make Sentinel image
363 #ifndef SentinelCplusplusProgramTarget
365 #define SentinelCplusplusProgramTarget(program,deplist,linklist) @@\
366 ProgramTargetName(program.sentinel): deplist @@\
367 RemoveTargetProgram($@) @@\
368 $(CXXENVSETUP) $(SENTINEL) $(SENTINELOPTIONS) $(CXX) -o $@ $(CXXLDOPTIONS) linklist $(EXTRA_LOAD_FLAGS) @@\
370 clean clean.sentinel:: @@\
371 RemoveFile(program.sentinel)
373 #define SentinelCplusplusProgramTarget(program,deplist,linklist) /**/
375 #endif /* SentinelCplusplusProgramTarget */
377 #ifndef PurifyLinkTarget
379 #define PurifyLinkTarget(step,program,linklist) @@\
380 ProgramTargetName(step.pure): @@\
381 RemoveTargetProgram($@) @@\
382 $(CCENVSETUP) $(PURIFY) $(PURIFYOPTIONS) $(CC) -o program.pure $(LDOPTIONS) linklist $(EXTRA_LOAD_FLAGS)
384 #define PurifyLinkTarget(step,program,linklist) /**/
386 #endif /* PurifyLinkTarget */
389 * PurifyProgramTarget - generate rules to make Purify'ed image
391 #ifndef PurifyProgramTarget
393 #define PurifyProgramTarget(program,deplist,linklist) @@\
394 ProgramTargetName(program.pure): deplist @@\
395 RemoveTargetProgram($@) @@\
396 $(CCENVSETUP) $(PURIFY) $(PURIFYOPTIONS) $(CC) -o $@ $(LDOPTIONS) linklist $(EXTRA_LOAD_FLAGS) @@\
398 clean clean.pure:: @@\
399 RemoveFile(program.pure)
401 #define PurifyProgramTarget(program,deplist,linklist) /**/
403 #endif /* PurifyProgramTarget */
406 * PurifyCplusplusProgramTarget - generate rules to make Purify'ed image
408 #ifndef PurifyCplusplusProgramTarget
410 #define PurifyCplusplusProgramTarget(program,deplist,linklist) @@\
411 ProgramTargetName(program.pure): deplist @@\
412 RemoveTargetProgram($@) @@\
413 $(CXXENVSETUP) $(PURIFY) $(PURIFYOPTIONS) $(CXX) -o $@ $(CXXLDOPTIONS) linklist $(EXTRA_LOAD_FLAGS) @@\
415 clean clean.pure:: @@\
416 RemoveFile(program.pure)
418 #define PurifyCplusplusProgramTarget(program,deplist,linklist) /**/
420 #endif /* PurifyCplusplusProgramTarget */
422 #ifndef ProofLinkTarget
424 #define ProofLinkTarget(step,program,linklist) @@\
425 ProgramTargetName(step.tc): @@\
426 RemoveTargetProgram($@) @@\
427 $(CCENVSETUP) $(PROOF) $(PROOFOPTIONS) $(CC) -o program.tc $(LDOPTIONS) linklist $(EXTRA_LOAD_FLAGS)
429 #define ProofLinkTarget(step,program,linklist) /**/
431 #endif /* ProofLinkTarget */
434 * ProofProgramTarget - generate rules to make Proof'ed image
436 #ifndef ProofProgramTarget
438 #define ProofProgramTarget(program,deplist,linklist) @@\
439 ProgramTargetName(program.tc): deplist @@\
440 RemoveTargetProgram($@) @@\
441 $(CCENVSETUP) $(PROOF) $(PROOFOPTIONS) $(CC) -o $@ $(LDOPTIONS) linklist $(EXTRA_LOAD_FLAGS) @@\
444 RemoveFiles(program.tc program.tc.*.*)
446 #define ProofProgramTarget(program,deplist,linklist) /**/
448 #endif /* ProofProgramTarget */
451 * ProofCplusplusProgramTarget - generate rules to make Proof'ed image
453 #ifndef ProofCplusplusProgramTarget
455 #define ProofCplusplusProgramTarget(program,deplist,linklist) @@\
456 ProgramTargetName(program.tc): deplist @@\
457 RemoveTargetProgram($@) @@\
458 $(CXXENVSETUP) $(PROOF) $(PROOFOPTIONS) $(CXX) -o $@ $(CXXLDOPTIONS) linklist $(EXTRA_LOAD_FLAGS) @@\
461 RemoveFiles(program.tc program.tc.*.*)
463 #define ProofCplusplusProgramTarget(program,deplist,linklist) /**/
465 #endif /* ProofCplusplusProgramTarget */
467 #ifndef ProofCleanTarget
469 #define ProofCleanTarget() @@\
473 #define ProofCleanTarget() /**/
475 #endif /* ProofCleanTarget */
477 #ifndef RemoveTargetProgram
478 #if RemoveTargetProgramByMoving
479 #define RemoveTargetProgram(program) \
480 -if [ -f program ]; then RemoveFile(Concat(program,~)); $(MV) program Concat(program,~); fi
482 #define RemoveTargetProgram(program) RemoveFile(program)
484 #endif /* RemoveTargetProgram */
487 #define MakeDir(dir) DirFailPrefix@if [ -d dir ]; then set +x; \ @@\
488 else (set -x; $(MKDIRHIER) dir); fi
491 #ifndef BuildIncludesTop
492 #define BuildIncludesTop(srclist) @@\
493 includes:: srclist @@\
494 MakeDir($(BUILDINCDIR)) @@\
495 @(set -x; cd $(BUILDINCDIR); for i in srclist; do \ @@\
496 RemoveFile($$i); \ @@\
497 $(LN) $(BUILDINCTOP)/$(CURRENT_DIR)/$$i .; \ @@\
499 #endif /* BuildIncludesTop */
501 #ifndef BuildIncludes
502 #define BuildIncludes(srclist,dstsubdir,dstupdir) @@\
503 includes:: srclist @@\
504 MakeDir($(BUILDINCDIR)/dstsubdir) @@\
505 @(set -x; cd $(BUILDINCDIR)/dstsubdir; for i in srclist; do \ @@\
506 RemoveFile($$i); \ @@\
507 $(LN) $(BUILDINCTOP)/dstupdir/$(CURRENT_DIR)/$$i .; \ @@\
509 #endif /* BuildIncludes */
512 * LinkBuildBinary - export a binary from the build tree.
514 #ifndef LinkBuildBinary
515 #define LinkBuildBinary(binary) @@\
516 all:: $(BUILDBINDIR)/binary binary @@\
518 $(BUILDBINDIR)/binary: binary @@\
520 cd $(BUILDBINDIR) && $(LN) $(BUILDBINTOP)/$(CURRENT_DIR)/binary .
521 #endif /* LinkBuildBinary */
523 #ifndef BuildInterfaces
524 #define BuildInterfaces(srclist,dstsubdir,dstupdir) @@\
526 MakeDir($(BUILDINCDIR)/dstsubdir) @@\
527 @(set -x; cd $(BUILDINCDIR)/dstsubdir; for i in srclist; do \ @@\
528 RemoveFile($$i); \ @@\
529 $(LN) $(BUILDINCTOP)/dstupdir/$(CURRENT_DIR)/$$i .; \ @@\
531 #endif /* BuildInterfaces */
534 * LinkRule - link a program
537 #define LinkRule(program,options,objects,libraries) \
538 $(CCLINK) -o program options objects libraries $(EXTRA_LOAD_FLAGS)
539 #endif /* LinkRule */
542 * HostLinkRule - link a utility to be used on the build host
543 * (differs from LinkRule if cross compiling)
546 #define HostLinkRule LinkRule
549 #ifndef CplusplusLinkRule
550 #define CplusplusLinkRule(program,options,objects,libraries) \
551 $(CXXLINK) -o program options objects libraries $(EXTRA_LOAD_FLAGS)
552 #endif /* CplusplusLinkRule */
555 * NormalProgramTarget - generate rules to compile and link the indicated
556 * program; since it does not use any default object files, it may be used for
557 * multiple programs in the same Imakefile.
559 #ifndef NormalProgramTarget
560 #define NormalProgramTarget(program,objects,deplibs,locallibs,syslibs) @@\
561 ProgramTargetName(program): objects deplibs @@\
562 RemoveTargetProgram($@) @@\
563 LinkRule($@,$(LDOPTIONS),objects,locallibs $(LDLIBS) syslibs) @@\
565 SentinelProgramTarget(program,objects deplibs,objects locallibs $(LDLIBS) syslibs) @@\
566 PurifyProgramTarget(program,objects deplibs,objects locallibs $(LDLIBS) syslibs) @@\
567 ProofProgramTarget(program,objects deplibs,objects locallibs $(LDLIBS) syslibs) @@\
570 RemoveFile(ProgramTargetName(program))
571 #endif /* NormalProgramTarget */
575 * NormalCplusplusProgramTarget - Like NormalTargetProgram, but uses
578 #ifndef NormalCplusplusProgramTarget
579 #define NormalCplusplusProgramTarget(program,objects,deplibs,locallibs,syslibs) @@\
580 ProgramTargetName(program): objects deplibs @@\
581 RemoveTargetProgram($@) @@\
582 CplusplusLinkRule($@,$(CXXLDOPTIONS),objects,locallibs $(LDLIBS) syslibs) @@\
584 SentinelCplusplusProgramTarget(program,objects deplibs,objects locallibs $(LDLIBS) syslibs) @@\
585 PurifyCplusplusProgramTarget(program,objects deplibs,objects locallibs $(LDLIBS) syslibs) @@\
586 ProofCplusplusProgramTarget(program,objects deplibs,objects locallibs $(LDLIBS) syslibs) @@\
589 RemoveFile(ProgramTargetName(program))
590 #endif /* NormalCplusplusProgramTarget */
593 #ifndef SetUIDProgramTarget
594 #define SetUIDProgramTarget NormalProgramTarget
599 * SingleProgramTarget - obsolete version of NormalProgramTarget that does
602 #ifndef SingleProgramTarget
603 #define SingleProgramTarget(program,objects,locallibs,syslibs) @@\
604 NormalProgramTarget(program,objects,NullParameter,locallibs,syslibs)
605 #endif /* SingleProgramTarget */
608 * SimpleProgramTarget - generate rules for compiling and linking programs
609 * that only have one C source file. It should only be used in Imakefiles
610 * that describe a single program.
612 #ifndef SimpleProgramTarget
613 #define SimpleProgramTarget(program) @@\
617 ComplexProgramTarget(program)
618 #endif /* SimpleProgramTarget */
620 #ifndef SimpleCplusplusProgramTarget
621 #define SimpleCplusplusProgramTarget(program) @@\
623 SRCS = program.CCsuf @@\
625 ComplexCplusplusProgramTarget(program)
626 #endif /* SimpleCplusplusProgramTarget */
628 #ifndef ProgramTargetHelper
629 #define ProgramTargetHelper(program,srcs,objs,deplib,locallib,syslib) @@\
630 ProgramTargetName(program): $(objs) $(deplib) @@\
631 RemoveTargetProgram($@) @@\
632 LinkRule($@,$(LDOPTIONS),$(objs),locallib $(LDLIBS) syslib) @@\
634 CenterProgramTarget(program,$(srcs),$(objs),locallib,syslib) @@\
635 SentinelProgramTarget(program,$(objs) $(deplib),$(objs) locallib $(LDLIBS) syslib) @@\
636 PurifyProgramTarget(program,$(objs) $(deplib),$(objs) locallib $(LDLIBS) syslib) @@\
637 ProofProgramTarget(program,$(objs) $(deplib),$(objs) locallib $(LDLIBS) syslib) @@\
639 InstallProgram(program,$(BINDIR)) @@\
640 InstallManPage(program,$(MANDIR))
641 #endif /* ProgramTargetHelper */
643 #ifndef CplusplusProgramTargetHelper
644 #define CplusplusProgramTargetHelper(program,srcs,objs,deplib,locallib,syslib) @@\
645 ProgramTargetName(program): $(objs) $(deplib) @@\
646 RemoveTargetProgram($@) @@\
647 CplusplusLinkRule($@,$(CXXLDOPTIONS),$(objs),locallib $(LDLIBS) syslib) @@\
649 CenterProgramTarget(program,$(srcs),$(objs),locallib,syslib) @@\
650 SentinelCplusplusProgramTarget(program,$(objs) $(deplib),$(objs) locallib $(LDLIBS) syslib) @@\
651 PurifyCplusplusProgramTarget(program,$(objs) $(deplib),$(objs) locallib $(LDLIBS) syslib) @@\
652 ProofCplusplusProgramTarget(program,$(objs) $(deplib),$(objs) locallib $(LDLIBS) syslib) @@\
654 InstallProgram(program,$(BINDIR)) @@\
655 InstallManPage(program,$(MANDIR))
656 #endif /* CplusplusProgramTargetHelper */
659 * ComplexProgramTarget - generate rules for compiling and linking the
660 * program specified by $(OBJS) and $(SRCS), installing the program and its
661 * man page, and generating dependencies. It should only be used in
662 * Imakefiles that describe a single program.
664 #ifndef ComplexProgramTarget
665 #define ComplexProgramTarget(program) @@\
666 PROGRAM = program @@\
668 AllTarget(program) @@\
670 ProgramTargetHelper(program,SRCS,OBJS,DEPLIBS,$(LOCAL_LIBRARIES),NullParameter) @@\
676 RemoveFile(ProgramTargetName(program))
677 #endif /* ComplexProgramTarget */
679 #ifndef ComplexCplusplusProgramTarget
680 #define ComplexCplusplusProgramTarget(program) @@\
681 PROGRAM = program @@\
683 AllTarget(program) @@\
685 CplusplusProgramTargetHelper(program,SRCS,OBJS,DEPLIBS,$(LOCAL_LIBRARIES),NullParameter) @@\
691 RemoveFile(ProgramTargetName(program))
692 #endif /* ComplexCplusplusProgramTarget */
695 * ComplexProgramTarget_1 - generate rules for compiling and linking the
696 * program specified by $(OBJS1) and $(SRCS1), installing the program and its
697 * man page, and generating dependencies for it and any programs described
698 * by $(SRCS2) throgh $(SRCS10). It should be used to build the primary
699 * program in Imakefiles that describe multiple programs.
701 #ifndef ComplexProgramTarget_1
702 #define ComplexProgramTarget_1(program,locallib,syslib) @@\
703 OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $(OBJS4) $(OBJS5) \ @@\
704 $(OBJS6) $(OBJS7) $(OBJS8) $(OBJS9) $(OBJS10) @@\
705 SRCS = $(SRCS1) $(SRCS2) $(SRCS3) $(SRCS4) $(SRCS5) \ @@\
706 $(SRCS6) $(SRCS7) $(SRCS8) $(SRCS9) $(SRCS10) @@\
708 AllTarget($(PROGRAMS)) @@\
710 ProgramTargetHelper(program,SRCS1,OBJS1,DEPLIBS1,locallib,syslib) @@\
716 RemoveFiles($(PROGRAMS))
717 #endif /* ComplexProgramTarget_1 */
719 #ifndef ComplexCplusplusProgramTarget_1
720 #define ComplexCplusplusProgramTarget_1(program,locallib,syslib) @@\
721 OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $(OBJS4) $(OBJS5) \ @@\
722 $(OBJS6) $(OBJS7) $(OBJS8) $(OBJS9) $(OBJS10) @@\
723 SRCS = $(SRCS1) $(SRCS2) $(SRCS3) $(SRCS4) $(SRCS5) \ @@\
724 $(SRCS6) $(SRCS7) $(SRCS8) $(SRCS9) $(SRCS10) @@\
726 AllTarget($(PROGRAMS)) @@\
728 CplusplusProgramTargetHelper(program,SRCS1,OBJS1,DEPLIBS1,locallib,syslib)@@\
734 RemoveFiles($(PROGRAMS))
735 #endif /* ComplexCplusplusProgramTarget_1 */
738 * ComplexProgramTarget_2 - generate rules for compiling and linking the
739 * program specified by $(OBJS2) and $(SRCS2) and installing the program and
740 * man page. It should be used to build the second program in Imakefiles
741 * describing more than one program.
743 #ifndef ComplexProgramTarget_2
744 #define ComplexProgramTarget_2(program,locallib,syslib) @@\
745 ProgramTargetHelper(program,SRCS2,OBJS2,DEPLIBS2,locallib,syslib)
746 #endif /* ComplexProgramTarget_2 */
748 #ifndef ComplexCplusplusProgramTarget_2
749 #define ComplexCplusplusProgramTarget_2(program,locallib,syslib) @@\
750 CplusplusProgramTargetHelper(program,SRCS2,OBJS2,DEPLIBS2,locallib,syslib)
751 #endif /* ComplexCplusplusProgramTarget_2 */
754 * ComplexProgramTarget_3 - generate rules for compiling and linking the
755 * program specified by $(OBJS3) and $(SRCS3) and installing the program and
756 * man page. It should be used to build the third program in Imakefiles
757 * describing more than one program.
759 #ifndef ComplexProgramTarget_3
760 #define ComplexProgramTarget_3(program,locallib,syslib) @@\
761 ProgramTargetHelper(program,SRCS3,OBJS3,DEPLIBS3,locallib,syslib)
762 #endif /* ComplexProgramTarget_3 */
764 #ifndef ComplexCplusplusProgramTarget_3
765 #define ComplexCplusplusProgramTarget_3(program,locallib,syslib) @@\
766 CplusplusProgramTargetHelper(program,SRCS3,OBJS3,DEPLIBS3,locallib,syslib)
767 #endif /* ComplexCplusplusProgramTarget_3 */
770 * ComplexProgramTarget_4 - generate rules for compiling and linking the
771 * program specified by $(OBJS4) and $(SRCS4) and installing the program and
772 * man page. It should be used to build the third program in Imakefiles
773 * describing more than one program.
775 #ifndef ComplexProgramTarget_4
776 #define ComplexProgramTarget_4(program,locallib,syslib) @@\
777 ProgramTargetHelper(program,SRCS4,OBJS4,DEPLIBS4,locallib,syslib)
778 #endif /* ComplexProgramTarget_4 */
780 #ifndef ComplexCplusplusProgramTarget_4
781 #define ComplexCplusplusProgramTarget_4(program,locallib,syslib) @@\
782 CplusplusProgramTargetHelper(program,SRCS4,OBJS4,DEPLIBS4,locallib,syslib)
783 #endif /* ComplexCplusplusProgramTarget_4 */
786 * ComplexProgramTarget_5 - generate rules for compiling and linking the
787 * program specified by $(OBJS5) and $(SRCS5) and installing the program and
788 * man page. It should be used to build the third program in Imakefiles
789 * describing more than one program.
791 #ifndef ComplexProgramTarget_5
792 #define ComplexProgramTarget_5(program,locallib,syslib) @@\
793 ProgramTargetHelper(program,SRCS5,OBJS5,DEPLIBS5,locallib,syslib)
794 #endif /* ComplexProgramTarget_5 */
796 #ifndef ComplexCplusplusProgramTarget_5
797 #define ComplexCplusplusProgramTarget_5(program,locallib,syslib) @@\
798 CplusplusProgramTargetHelper(program,SRCS5,OBJS5,DEPLIBS5,locallib,syslib)
799 #endif /* ComplexCplusplusProgramTarget_5 */
802 * ComplexProgramTarget_6 - generate rules for compiling and linking the
803 * program specified by $(OBJS6) and $(SRCS6) and installing the program and
804 * man page. It should be used to build the third program in Imakefiles
805 * describing more than one program.
807 #ifndef ComplexProgramTarget_6
808 #define ComplexProgramTarget_6(program,locallib,syslib) @@\
809 ProgramTargetHelper(program,SRCS6,OBJS6,DEPLIBS6,locallib,syslib)
810 #endif /* ComplexProgramTarget_6 */
812 #ifndef ComplexCplusplusProgramTarget_6
813 #define ComplexCplusplusProgramTarget_6(program,locallib,syslib) @@\
814 CplusplusProgramTargetHelper(program,SRCS6,OBJS6,DEPLIBS6,locallib,syslib)
815 #endif /* ComplexCplusplusProgramTarget_6 */
818 * ComplexProgramTarget_7 - generate rules for compiling and linking the
819 * program specified by $(OBJS7) and $(SRCS7) and installing the program and
820 * man page. It should be used to build the third program in Imakefiles
821 * describing more than one program.
823 #ifndef ComplexProgramTarget_7
824 #define ComplexProgramTarget_7(program,locallib,syslib) @@\
825 ProgramTargetHelper(program,SRCS7,OBJS7,DEPLIBS7,locallib,syslib)
826 #endif /* ComplexProgramTarget_7 */
828 #ifndef ComplexCplusplusProgramTarget_7
829 #define ComplexCplusplusProgramTarget_7(program,locallib,syslib) @@\
830 CplusplusProgramTargetHelper(program,SRCS7,OBJS7,DEPLIBS7,locallib,syslib)
831 #endif /* ComplexCplusplusProgramTarget_7 */
834 * ComplexProgramTarget_8 - generate rules for compiling and linking the
835 * program specified by $(OBJS8) and $(SRCS8) and installing the program and
836 * man page. It should be used to build the third program in Imakefiles
837 * describing more than one program.
839 #ifndef ComplexProgramTarget_8
840 #define ComplexProgramTarget_8(program,locallib,syslib) @@\
841 ProgramTargetHelper(program,SRCS8,OBJS8,DEPLIBS8,locallib,syslib)
842 #endif /* ComplexProgramTarget_8 */
844 #ifndef ComplexCplusplusProgramTarget_8
845 #define ComplexCplusplusProgramTarget_8(program,locallib,syslib) @@\
846 CplusplusProgramTargetHelper(program,SRCS8,OBJS8,DEPLIBS8,locallib,syslib)
847 #endif /* ComplexCplusplusProgramTarget_8 */
850 * ComplexProgramTarget_9 - generate rules for compiling and linking the
851 * program specified by $(OBJS9) and $(SRCS9) and installing the program and
852 * man page. It should be used to build the third program in Imakefiles
853 * describing more than one program.
855 #ifndef ComplexProgramTarget_9
856 #define ComplexProgramTarget_9(program,locallib,syslib) @@\
857 ProgramTargetHelper(program,SRCS9,OBJS9,DEPLIBS9,locallib,syslib)
858 #endif /* ComplexProgramTarget_9 */
860 #ifndef ComplexCplusplusProgramTarget_9
861 #define ComplexCplusplusProgramTarget_9(program,locallib,syslib) @@\
862 CplusplusProgramTargetHelper(program,SRCS9,OBJS9,DEPLIBS9,locallib,syslib)
863 #endif /* ComplexCplusplusProgramTarget_9 */
866 * ComplexProgramTarget_10 - generate rules for compiling and linking the
867 * program specified by $(OBJS10) and $(SRCS10) and installing the program and
868 * man page. It should be used to build the third program in Imakefiles
869 * describing more than one program.
871 #ifndef ComplexProgramTarget_10
872 #define ComplexProgramTarget_10(program,locallib,syslib) @@\
873 ProgramTargetHelper(program,SRCS10,OBJS10,DEPLIBS10,locallib,syslib)
874 #endif /* ComplexProgramTarget_10 */
876 #ifndef ComplexCplusplusProgramTarget_10
877 #define ComplexCplusplusProgramTarget_10(program,locallib,syslib) @@\
878 CplusplusProgramTargetHelper(program,SRCS10,OBJS10,DEPLIBS10,locallib,syslib)
879 #endif /* ComplexCplusplusProgramTarget_10 */
881 #ifndef MoveToBakFile
882 #define MoveToBakFile(file) -@if [ -f file ]; then set -x; \ @@\
883 $(MV) file file.bak; else exit 0; fi
884 #endif /* MoveToBakFile */
886 #ifndef RMoveToBakFile
887 #define RMoveToBakFile(file) -@if [ -f file ]; then set -x; \ @@\
888 RemoveFile(file.bak); $(MV) file file.bak; \ @@\
890 #endif /* RMoveToBakFile */
893 * ServerTargetWithFlags - generate rules to compile, link, and relink a server
895 #ifndef ServerTargetWithFlags
896 #define ServerTargetWithFlags(server,subdirs,objects,libs,syslibs,flags) @@\
897 AllTarget(server) @@\
898 ProgramTargetName(server): subdirs objects libs @@\
899 MoveToBakFile($@) @@\
900 LinkRule($@,$(LDOPTIONS),objects,libs $(LDLIBS) syslibs) @@\
902 Concat(load,server): @@\
903 MoveToBakFile(ProgramTargetName(server)) @@\
904 LinkRule(ProgramTargetName(server),$(LDOPTIONS),objects,libs $(LDLIBS) syslibs) @@\
906 loadX:: Concat(load,server) @@\
908 SentinelProgramTarget(server,subdirs objects libs,objects libs $(LDLIBS) syslibs) @@\
909 SentinelLinkTarget(Concat(load,server),server,objects libs $(LDLIBS) syslibs) @@\
910 PurifyProgramTarget(server,subdirs objects libs,objects libs $(LDLIBS) syslibs) @@\
911 PurifyLinkTarget(Concat(load,server),server,objects libs $(LDLIBS) syslibs) @@\
912 ProofProgramTarget(server,subdirs objects libs,objects libs $(LDLIBS) syslibs) @@\
913 ProofLinkTarget(Concat(load,server),server,objects libs $(LDLIBS) syslibs) @@\
915 InstallProgramWithFlags(server,$(BINDIR),flags) @@\
918 RemoveFile(ProgramTargetName(server))
919 #endif /* ServerTargetWithFlags */
922 * ServerTarget - rules to compile, link, and relink a normal server
925 #define ServerTarget(server,subdirs,objects,libs,syslibs) @@\
926 ServerTargetWithFlags(server,subdirs,objects,libs,syslibs,$(_NOOP_))
927 #endif /* ServerTarget */
930 #define RanLibrary(args) $(RANLIB) args
932 #define RanLibrary(args) $(_NULLCMD_)
935 #ifndef LibraryTargetName
936 #define LibraryTargetName(libname)Concat(lib,libname.a)
939 #ifndef LibraryTargetNameSuffix
940 #define LibraryTargetNameSuffix(libname,suffix)Concat3(lib,libname,suffix.a)
943 #ifndef InstallNamedTarget
944 #define InstallNamedTarget(step,srcname,flags,dest,dstname) @@\
946 MakeDir($(DESTDIR)dest) @@\
947 $(INSTALL) $(INSTALLFLAGS) flags srcname $(DESTDIR)dest/dstname
948 #endif /* InstallNamedTarget */
951 * InstallNamedTargetNoClobber - Like InstallNamedTarget, but doesn't
952 * do the install if an installed version already exists. Useful
953 * for files that might have local customizations that you don't
954 * want to clobber. Config files are good candidates for this.
956 #ifndef InstallNamedTargetNoClobber
957 #define InstallNamedTargetNoClobber(step,srcname,flags,dest,dstname) @@\
959 MakeDir($(DESTDIR)dest) @@\
960 @if [ -f $(DESTDIR)dest/dstname ]; then \ @@\
961 echo "Not overwriting existing" $(DESTDIR)dest/dstname; \ @@\
963 $(INSTALL) $(INSTALLFLAGS) flags srcname $(DESTDIR)dest/dstname; fi
964 #endif /* InstallNamedTargetNoClobber */
966 #ifndef InstallTarget
967 #define InstallTarget(step,file,flags,dest) @@\
968 InstallNamedTarget(step,file,flags,dest,file)
969 #endif /* InstallTarget */
972 * InstallLibrary - generate rules to install the indicated library.
974 #ifndef InstallLibrary
975 #define InstallLibrary(libname,dest) @@\
976 install:: LibraryTargetName(libname) @@\
977 MakeDir($(DESTDIR)dest) @@\
978 $(INSTALL) $(INSTALLFLAGS) $(INSTLIBFLAGS) LibraryTargetName(libname) $(DESTDIR)dest @@\
979 RanLibrary($(RANLIBINSTFLAGS) $(DESTDIR)dest/LibraryTargetName(libname))
980 #endif /* InstallLibrary */
984 * InstallLinkKitLibrary - rule to install Link Kit library.
985 * (only used for XFree86). This is a no-op
986 * rule so that Imakefiles on non-XFree86 systems
987 * continue to build Makefiles correctly.
989 #ifndef InstallLinkKitLibrary
990 #define InstallLinkKitLibrary(lib,dir)
995 * InstallLinkKitNamedLibrary - rule to install Link Kit library.
996 * (only used for XFree86). This is a no-op
997 * rule so that Imakefiles on non-XFree86 systems
998 * continue to build Makefiles correctly.
1000 #ifndef InstallLinkKitNamedLibrary
1001 #define InstallLinkKitNamedLibrary(lib,dlib,dir)
1006 * MergeIntoInstalledLibrary - generate rules to merge one library into another
1008 #ifndef MergeIntoInstalledLibrary
1009 #define MergeIntoInstalledLibrary(tolib,fromlib) @@\
1010 install:: fromlib @@\
1011 $(SCRIPTSRC)/mergelib $(DESTDIR)tolib fromlib
1012 #endif /* MergeIntoInstalledLibrary */
1015 * InstallLibraryAlias - generate rules to create a link from one library name
1016 * to another for the purposes of aliasing.
1018 #ifndef InstallLibraryAlias
1019 #define InstallLibraryAlias(libname,alias,dest) @@\
1021 -(cd $(DESTDIR)dest; \ @@\
1022 RemoveFile(LibraryTargetName(alias)); \ @@\
1023 $(LN) LibraryTargetName(libname) LibraryTargetName(alias))
1024 #endif /* InstallLibraryAlias */
1028 * InstallLintLibrary - generate rules to install the indicated lint library.
1030 #ifndef InstallLintLibrary
1031 #define InstallLintLibrary(libname,dest) @@\
1032 InstallTarget(install.ln,Concat(llib-l,libname.ln),$(INSTLIBFLAGS),dest)
1033 #endif /* InstallLintLibrary */
1037 * InstallManPageLong - generate rules to install the indicated manual page,
1038 * giving it an alternate name. This is used for installing man pages whose
1039 * base name without the .man suffix would normally be longer than 8 characters
1040 * (the limit for using source code control systems on files systems with
1041 * short file names).
1043 #ifndef InstallManPageLong
1044 #define InstallManPageLong(file,destdir,dest) @@\
1045 InstallNamedTarget(install.man,file.man,$(INSTMANFLAGS),destdir,dest.$(MANSUFFIX))
1046 #endif /* InstallManPageLong */
1050 * InstallManPage - generate rules to install the indicated manual page.
1052 #ifndef InstallManPage
1053 #define InstallManPage(file,destdir) @@\
1054 InstallManPageLong(file,destdir,file)
1055 #endif /* InstallManPage */
1059 * InstallManPageAliases - generate rules to install manual page aliases.
1061 #ifndef InstallManPageAliases
1062 #define InstallManPageAliases(file,destdir,aliases) @@\
1064 @(TMP=/tmp/tmp.$$$$; \ @@\
1065 RemoveFile($${TMP}); \ @@\
1066 echo .so `basename destdir`/file.$(MANSUFFIX) > $${TMP}; \ @@\
1067 for i in aliases; do (set -x; \ @@\
1068 $(INSTALL) $(INSTALLFLAGS) $(INSTMANFLAGS) $${TMP} $(DESTDIR)destdir/$$i.$(MANSUFFIX)); \ @@\
1070 RemoveFile($${TMP}))
1071 #endif /* InstallManPageAliases */
1074 * ManKeywordsTarget - generate the database used by "man -k".
1075 * This rule updates the index in the directory "manpath", which
1076 * indexes all the manual pages in the section subdirectories under
1077 * it. An update command is defined only on systems that have a
1078 * per MANPATH element index. If the OS supports only one system-wide
1079 * database, we don't update it, because then we can't do cross
1080 * installations or use a non-empty DESTDIR for testing.
1082 #ifndef ManKeywordsTarget
1083 #define ManKeywordsTarget(manpath) man_keywords::
1087 * InstallNamedNonExec - generate rules to install a data file
1089 #ifndef InstallNamedNonExec
1090 #define InstallNamedNonExec(srcname,dstname,dest) @@\
1091 InstallNamedTarget(install,srcname,$(INSTDATFLAGS),dest,dstname)
1092 #endif /* InstallNamedNonExec */
1096 * InstallNonExecFile - generate rules to install a data file
1098 #ifndef InstallNonExecFile
1099 #define InstallNonExecFile(file,dest) @@\
1100 InstallTarget(install,file,$(INSTDATFLAGS),dest)
1101 #endif /* InstallNonExecFile */
1105 * InstallNonExecFileNoClobber - install a data file once
1107 #ifndef InstallNonExecFileNoClobber
1108 #define InstallNonExecFileNoClobber(file,dest) @@\
1109 InstallNamedTargetNoClobber(install,file,$(INSTDATFLAGS),dest,file)
1110 #endif /* InstallNonExecFileNoClobber */
1114 * InstallLinkKitNonExecFile - rule for installing server Link Kit files.
1115 * (only used for XFree86). This is a no-op
1116 * rule so that Imakefiles on non-XFree86 systems
1117 * continue to build Makefiles correctly.
1119 #ifndef InstallLinkKitNonExecFile
1120 #define InstallLinkKitNonExecFile(file,dir)
1125 * InstallNonExec - generate rules to install a data file, but does not
1126 * try to create the destination directory (deprecated)
1128 #ifndef InstallNonExec
1129 #define InstallNonExec(file,dest) @@\
1131 $(INSTALL) $(INSTALLFLAGS) $(INSTDATFLAGS) file $(DESTDIR)dest
1132 #endif /* InstallNonExec */
1136 * InstallProgramWithFlags - generate rules to install an executable program
1137 * using given install flags.
1139 #ifndef InstallProgramWithFlags
1140 #define InstallProgramWithFlags(program,dest,flags) @@\
1141 InstallTarget(install,ProgramTargetName(program),$(INSTPGMFLAGS) flags,dest)
1142 #endif /* InstallProgramWithFlags */
1146 * InstallProgram - generate rules to install an executable program using any
1147 * special install flags set in $(INSTALLFLAGS).
1149 #ifndef InstallProgram
1150 #define InstallProgram(program,dest) @@\
1151 InstallProgramWithFlags(program,dest,NullParameter)
1152 #endif /* InstallProgram */
1157 * InstallScript - install a shell script.
1159 #ifndef InstallScript
1160 #define InstallScript(program,dest) @@\
1161 InstallNamedTarget(install,program.script,$(INSTBINFLAGS),dest,program)
1162 #endif /* InstallScript */
1166 * InstallNamedProg - install a program with renaming and no stripping.
1168 #ifndef InstallNamedProg
1169 #define InstallNamedProg(srcname,dstname,dest) @@\
1170 InstallNamedTarget(install,srcname,$(INSTBINFLAGS),dest,dstname)
1171 #endif /* InstallNamedProg */
1174 * InstallNamedProgNoClobber - Like InstallNamedProg, but doesn't
1175 * do the install if an installed version already exists.
1177 #ifndef InstallNamedProgNoClobber
1178 #define InstallNamedProgNoClobber(srcname,dstname,dest) @@\
1179 InstallNamedTargetNoClobber(install,srcname,$(INSTBINFLAGS),dest,dstname)
1180 #endif /* InstallNamedProgNoClobber */
1183 * MakeFlagsToShellFlags - set variables before starting a loop.
1184 * makeflags is the set of "make" flags to check.
1185 * shellcmd is the shell command to execute if any of the flags are set.
1187 * The usual use of this rule is to translate make's "don't quit on error"
1188 * flags into the equivalent for the shell. To do this, "make -i" always
1189 * becomes "set +e". "make -k" should also turn on "set +e" if the target
1190 * is building subdirectories. That is, subdirectories are independent
1191 * and should appear to be multiple targets, even though they are
1192 * implemented in a loop in a single target.
1194 #ifndef MakeFlagsToShellFlags
1195 #define MakeFlagsToShellFlags(makeflags,shellcmd)\
1196 for flag in ${MAKEFLAGS} ''; do \ @@\
1197 case "$$flag" in *=*) ;; *[makeflags]*) shellcmd;; esac; done
1201 * LinkFileList - link a list of files from one place to another
1203 #ifndef LinkFileList
1204 #define LinkFileList(step,list,dir,sub) @@\
1206 @MakeFlagsToShellFlags(i,set +e); \ @@\
1207 echo " cd" dir; cd dir && \ @@\
1208 for i in list; do (set -x; RemoveFile($$i); $(LN) sub/$$i .); done
1214 * Make links from $LIBDIR (<ProjectRoot>/lib/X11) to /var/X11/
1215 * For example /usr/X11R6/lib/X11/xdm ==> /var/X11/xdm so that X
1216 * binaries can be mounted from a read-only volume like a CD-ROM;
1217 * but files that may need to be edited can be stored locally on
1218 * read-write media. If someone has an existing installation, be
1219 * careful and move existing files to the new location in /var.
1221 #ifndef LinkVarDirectory
1223 #define LinkVarDirectory(mdir,cdir,rdir,ldir) @@\
1225 MakeDir(Concat($(DESTDIR)$(LIBDIR)/,cdir)) @@\
1226 MakeDir(Concat($(VARDIR)/,mdir)) @@\
1227 @MakeFlagsToShellFlags(i,set +e); \ @@\
1228 if [ -d Concat($(DESTDIR)$(LIBDIR)/,cdir) ]; then \ @@\
1229 cd Concat($(DESTDIR)$(LIBDIR)/,cdir); \ @@\
1230 if [ -d rdir -a ! -h rdir ]; then \ @@\
1231 (cd rdir; tar cf - . | (cd Concat($(VARDIR)/,mdir); tar xf -; exit 0); exit 0); \ @@\
1233 $(RM) -r rdir; \ @@\
1234 $(LN) Concat($(VARDIR)/,mdir) ldir; \ @@\
1237 #define LinkVarDirectory(mdir,cdir,rdir,ldir)
1243 * InstallMultipleDestFlags - generate rules to install multiple files at
1244 * once during a particular step in the build using a specific set of install
1247 #ifndef InstallMultipleDestFlags
1248 #define InstallMultipleDestFlags(step,list,dest,flags) @@\
1250 MakeDir($(DESTDIR)dest) @@\
1251 @MakeFlagsToShellFlags(i,set +e); \ @@\
1252 for i in list; do \ @@\
1253 (set -x; $(INSTALL) $(INSTALLFLAGS) flags $$i $(DESTDIR)dest); \ @@\
1255 #endif /* InstallMultipleDestFlags */
1259 * InstallMultipleDest - generate rules to install multiple files at once
1260 * during a particular step in the build using any install flags set in
1263 #ifndef InstallMultipleDest
1264 #define InstallMultipleDest(step,list,dest) @@\
1265 InstallMultipleDestFlags(step,list,dest,$(INSTDATFLAGS))
1266 #endif /* InstallMultipleDest */
1269 * InstallMultiple - generate rules to install multiple files at once
1270 * during the install step of the build using any install flags set in
1273 #ifndef InstallMultiple
1274 #define InstallMultiple(list,dest) @@\
1275 InstallMultipleDest(install,list,dest)
1276 #endif /* InstallMultiple */
1280 * InstallMultipleFlags - generate rules to install multiple files at once
1281 * during the install step of the build using the given install flags.
1283 #ifndef InstallMultipleFlags
1284 #define InstallMultipleFlags(list,dest,flags) @@\
1285 InstallMultipleDestFlags(install,list,dest,flags)
1286 #endif /* InstallMultipleFlags */
1290 * InstallMultipleMan - generate rules to install a variety of manual pages
1291 * during the install.man step of the build.
1293 #ifndef InstallMultipleMan
1294 #define InstallMultipleMan(list,dest) @@\
1295 InstallMultipleDestFlags(install.man,list,dest,$(INSTMANFLAGS))
1296 #endif /* InstallMultipleMan */
1299 * IncludeMakefile - rule to include another Makefile.
1300 * Must not generate an error or even a warning if the named file
1301 * is not present, since we use this to include Makefile.dep, which
1302 * may not be built yet.
1303 * This is defined non-null iff HasMakefileSafeInclude is YES.
1304 * The double-@ is to ensure no leading spaces on the line.
1306 #ifndef IncludeMakefile
1308 #define IncludeMakefile(file) @@sinclude file
1310 #define IncludeMakefile(file) /**/
1315 * DependDependencyStatement - Used by DependDependency to set up the
1316 * most specific dependency, which differs based on whether we support
1317 * a separate Makefile.dep on this platform.
1319 #ifndef DependDependencyStatement
1320 #if HasMakefileSafeInclude
1321 #define DependDependencyStatement() @@\
1322 DependFileName:: ProgramTargetName($(DEPEND))
1324 #define DependDependencyStatement() @@\
1325 depend:: ProgramTargetName($(DEPEND))
1330 * DependDependency - generate rules to build the makedepend program if
1331 * this Imakefile is within the source tree.
1333 #ifndef DependDependency
1335 #define DependDependency() /**/
1337 #define DependDependency() @@\
1338 DependDependencyStatement() @@\
1340 NoCmpScript(ProgramTargetName($(DEPEND))) @@\
1342 ProgramTargetName($(DEPEND)): @@\
1343 @echo "checking $@ over in $(DEPENDSRC) first..."; \ @@\
1344 cd $(DEPENDSRC) && $(MAKE); \ @@\
1345 echo "okay, continuing in $(CURRENT_DIR)"
1347 #endif /* UseInstalled */
1348 #endif /* DependDependency */
1352 * DependTarget - generate rules to compute dependencies for all files listed
1355 #ifndef DependTarget
1356 #if HasMakefileSafeInclude
1357 #define DependTarget() @@\
1358 DependDependency() @@\
1360 depend:: DependFileName @@\
1362 DependFileName:: @@\
1363 RunProgram(DEPEND,-f- $(DEPENDFLAGS) -- $(ALLDEFINES) $(DEPEND_DEFINES) -- $(SRCS)) > $@
1364 #else /* HasMakefileSafeInclude */
1365 #define DependTarget() @@\
1366 DependDependency() @@\
1369 RunProgram(DEPEND,$(DEPENDFLAGS) -- $(ALLDEFINES) $(DEPEND_DEFINES) -- $(SRCS))
1370 #endif /* HasMakefileSafeInclude else */
1371 #endif /* DependTarget */
1374 * DependTarget3 - generate rules to compute dependencies for all files given.
1376 #ifndef DependTarget3
1377 #if HasMakefileSafeInclude
1378 #define DependTarget3(srcs1,srcs2,srcs3) @@\
1379 DependDependency() @@\
1381 depend:: DependFileName @@\
1383 DependFileName:: @@\
1384 RunProgram(DEPEND,-f- $(DEPENDFLAGS) -- $(ALLDEFINES) $(DEPEND_DEFINES) -- srcs1) > $@ @@\
1385 RunProgram(DEPEND,-f- $(DEPENDFLAGS) -- $(ALLDEFINES) $(DEPEND_DEFINES) -- srcs2) >> $@ @@\
1386 RunProgram(DEPEND,-f- $(DEPENDFLAGS) -- $(ALLDEFINES) $(DEPEND_DEFINES) -- srcs3) >> $@
1387 #else /* HasMakefileSafeInclude */
1388 #define DependTarget3(srcs1,srcs2,srcs3) @@\
1389 DependDependency() @@\
1392 RunProgram(DEPEND,$(DEPENDFLAGS) -- $(ALLDEFINES) $(DEPEND_DEFINES) -- srcs1) @@\
1393 RunProgram(DEPEND,-a $(DEPENDFLAGS) -- $(ALLDEFINES) $(DEPEND_DEFINES) -- srcs2) @@\
1394 RunProgram(DEPEND,-a $(DEPENDFLAGS) -- $(ALLDEFINES) $(DEPEND_DEFINES) -- srcs3)
1395 #endif /* HasMakefileSafeInclude else */
1396 #endif /* DependTarget3 */
1400 * CleanTarget - generate rules to remove any garbage files
1403 #define CleanTarget() @@\
1405 $(RM) FilesToClean ExtraFilesToClean "#"* @@\
1408 #endif /* CleanTarget */
1412 * TagsTarget - generate rules to compute tags files for C source code.
1415 #define TagsTarget() @@\
1417 $(TAGS) -w *.[ch] @@\
1418 $(TAGS) -xw *.[ch] > TAGS
1419 #endif /* TagsTarget */
1423 * ImakeDependency - generate rules to compile imake if this Imakefile is
1424 * within the source tree.
1426 #ifndef ImakeDependency
1428 #define ImakeDependency(target) /**/
1430 #define ImakeDependency(target) @@\
1431 target:: ProgramTargetName($(IMAKE)) @@\
1433 NoCmpScript(ProgramTargetName($(IMAKE)) $(IMAKE).Osuf) @@\
1435 ProgramTargetName($(IMAKE)) $(IMAKE).Osuf: @@\
1436 -@(cd $(IMAKESRC); if [ -f Makefile ]; then \ @@\
1437 echo "checking $@ in $(IMAKESRC) first..."; $(MAKE) all; else \ @@\
1438 echo "bootstrapping $@ from Makefile.ini in $(IMAKESRC) first..."; \ @@\
1439 $(MAKE) -f Makefile.ini BOOTSTRAPCFLAGS="$(BOOTSTRAPCFLAGS)"; fi; \ @@\
1440 echo "okay, continuing in $(CURRENT_DIR)")
1441 #endif /* UseInstalled */
1442 #endif /* ImakeDependency */
1446 * BuildMakefileTarget - generate rules to build a Makefile from an Imakefile
1447 * and any special imake flags. This is generally done automatically by the
1448 * template or by any special Imakefiles. The first argument exists just
1449 * because imakeflags is usually empty and some preprocessors will complain
1450 * if an empty argument is passed as the sole argument to a macro.
1452 #ifndef BuildMakefileTarget
1453 #define BuildMakefileTarget(notused,imakeflags) @@\
1454 ImakeDependency(Makefile) @@\
1457 RMoveToBakFile(Makefile) @@\
1458 $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR) imakeflags
1460 #endif /* BuildMakefileTarget */
1464 * MakefileTarget - generate rules to build a normal Makefile.
1466 #ifndef MakefileTarget
1467 #define MakefileTarget() @@\
1468 BuildMakefileTarget(Imakefile,NullParameter)
1469 #endif /* MakefileTarget */
1473 * LibMkdir - helper for creating library object subdirectories
1476 #define LibMkdir(dir) DirFailPrefix@if [ -d dir ]; then exit 0; else set -x; mkdir dir; fi
1479 #ifndef LibMkdirLinkSubdirs
1480 #define LibMkdirLinkSubdirs(dir) DirFailPrefix@if [ -d dir ]; then \ @@\
1483 echo "mkdir dir"; mkdir dir; \ @@\
1484 for i in $(SUBDIRS); do \ @@\
1485 j=`echo "$$i" | sed -e 's;[^/]\{1,\};..;g'`; \ @@\
1486 $(MKDIRHIER) "dir/`dirname $$i`"; \ @@\
1487 echo $(LN) "$$j/$$i/dir" "dir/$$i"; \ @@\
1488 $(LN) "$$j/$$i/dir" "dir/$$i"; \ @@\
1494 * LibCleanDir - helper for cleaning library object subdirectories
1497 #define LibCleanDir(dir) -@if [ -d dir ]; then \ @@\
1498 set -x; $(RM) -r dir; else exit 0; fi
1502 * LintLibReferences - variables for lint libraries
1504 #ifndef LintLibReferences
1505 #define LintLibReferences(varname,libname,libsource) @@\
1506 Concat(LINT,varname) = _UseCat($(LINTLIBDIR)/llib-l,libsource/llib-,libname.ln)
1511 * UnsharedLibReferences - variables for unshared libraries
1513 #ifndef UnsharedLibReferences
1514 #define UnsharedLibReferences(varname,libname,libsource) @@\
1515 ProjectUnsharedLibReferences(varname,libname,libsource,$(BUILDLIBDIR))
1519 * ProjectUnsharedLibReferences - variables for unshared libraries
1521 #ifndef ProjectUnsharedLibReferences
1522 #define ProjectUnsharedLibReferences(varname,libname,libsource,buildlibdir) @@\
1523 Concat3(DEP,varname,LIB) = _UseCat($(USRLIBDIR)/lib,buildlibdir/lib,libname.a) @@\
1524 Concat(varname,LIB) = LoaderLibPrefix Concat(-l,libname) @@\
1525 LintLibReferences(varname,libname,libsource)
1529 * SharedLibDependencies - shared library dependencies
1531 #ifndef SharedLibDependencies
1532 #define SharedLibDependencies(libname,libsource,revname) /**/
1536 * SharedDSLibDependencies - shared library dependencies with data separation
1538 #ifndef SharedDSLibDependencies
1539 #define SharedDSLibDependencies(libname,libsource,revname) /**/
1543 * SharedLibReferences - variables for shared libraries
1545 #ifndef SharedLibReferences
1546 #define SharedLibReferences(varname,libname,libsource,revname,rev) @@\
1548 Concat3(DEP,varname,LIB) = SharedLibDependencies(libname,libsource,revname) @@\
1549 Concat(varname,LIB) = LoaderLibPrefix Concat(-l,libname) @@\
1550 LintLibReferences(varname,libname,libsource)
1554 * SharedDSLibReferences - variables for shared libraries with data separation
1556 #ifndef SharedDSLibReferences
1557 #define SharedDSLibReferences(varname,libname,libsource,revname,rev) @@\
1559 Concat3(DEP,varname,LIB) = SharedDSLibDependencies(libname,libsource,revname) @@\
1560 Concat(varname,LIB) = LoaderLibPrefix Concat(-l,libname) @@\
1561 LintLibReferences(varname,libname,libsource)
1565 * CPPOnlyCompile - run C compiler's preprocessor only
1567 #ifndef CPPOnlyCompile
1568 #define CPPOnlyCompile(src,options) RemoveFile($@) @@\
1570 $(CC) -E $(CFLAGS) options src > $@
1574 * ObjectCompile - compile fragment for a normal object file
1576 #ifndef ObjectCompile
1577 #define ObjectCompile(options) RemoveFile($@) @@\
1579 $(CC) -c $(CFLAGS) options $*.c
1582 #ifndef ObjectCplusplusCompile
1583 #define ObjectCplusplusCompile(options) RemoveFile($@) @@\
1585 $(CXX) -c $(CXXFLAGS) options $*.CCsuf
1589 * NormalLibObjCompile - compile fragment for a normal library object file
1591 #ifndef NormalLibObjCompile
1592 #define NormalLibObjCompile(options) ObjectCompile(options)
1595 #ifndef NormalLibObjCplusplusCompile
1596 #define NormalLibObjCplusplusCompile(options) ObjectCplusplusCompile(options)
1600 * NormalSharedLibObjCompile - compile fragment for shared objects
1602 #ifndef NormalSharedLibObjCompile
1603 #define NormalSharedLibObjCompile(options) NormalLibObjCompile(options $(SHLIBDEF) $(SHAREDCODEDEF) $(PICFLAGS))
1606 #ifndef NormalSharedLibObjCplusplusCompile
1607 #define NormalSharedLibObjCplusplusCompile(options) NormalLibObjCplusplusCompile(options $(SHLIBDEF) $(SHAREDCODEDEF) $(CXXPICFLAGS))
1611 * LibObjCompile - compile fragment for unshared/profiled/debugged objects
1613 #ifndef LibObjCompile
1614 #define LibObjCompile(dir,options) RemoveFiles($@ dir/$@) @@\
1616 $(CC) -c $(CCOPTIONS) $(ALLDEFINES) options $*.c @@\
1620 #ifndef LibObjCplusplusCompile
1621 #define LibObjCplusplusCompile(dir,options) RemoveFiles($@ dir/$@) @@\
1623 $(CXX) -c $(CXXOPTIONS) $(CXXDEFINES) options $*.CCsuf @@\
1628 * DebuggedLibObjCompile - compile fragment for debugged objects
1630 #ifndef DebuggedLibObjCompile
1631 #define DebuggedLibObjCompile(options) LibObjCompile(debugger,DebuggableCDebugFlags options)
1634 #ifndef DebuggedLibObjCplusplusCompile
1635 #define DebuggedLibObjCplusplusCompile(options) LibObjCplusplusCompile(debugger,DebuggableCplusplusDebugFlags options)
1639 * ProfiledLibObjCompile - compile fragment for profiled objects
1641 #ifndef ProfiledLibObjCompile
1642 #define ProfiledLibObjCompile(options) LibObjCompile(profiled,ProfiledCDebugFlags options)
1645 #ifndef ProfiledLibObjCplusplusCompile
1646 #define ProfiledLibObjCplusplusCompile(options) LibObjCplusplusCompile(profiled,ProfiledCplusplusDebugFlags options)
1650 * UnsharedLibObjCompile - compile fragment for unshared objects
1652 #ifndef UnsharedLibObjCompile
1653 #define UnsharedLibObjCompile(options) LibObjCompile(unshared,$(CDEBUGFLAGS) options)
1656 #ifndef UnsharedLibObjCplusplusCompile
1657 #define UnsharedLibObjCplusplusCompile(options) LibObjCplusplusCompile(unshared,$(CXXDEBUGFLAGS) options)
1661 * SharedLibObjCompile - compile fragment for shared objects
1663 #ifndef SharedLibObjCompile
1664 #define SharedLibObjCompile(options) LibObjCompile(shared,options $(SHLIBDEF) $(SHAREDCODEDEF) $(PICFLAGS) $(CDEBUGFLAGS))
1668 * NormalLibraryObjectRule - for simple libraries
1670 #ifndef NormalLibraryObjectRule
1671 #define NormalLibraryObjectRule() @@\
1673 NormalLibObjCompile($(_NOOP_))
1674 #endif /* NormalLibraryObjectRule */
1676 #ifndef NormalCplusplusObjectRule
1677 #define NormalCplusplusObjectRule() @@\
1679 NormalLibObjCplusplusCompile($(_NOOP_))
1682 #ifndef NormalFortranObjectRule
1683 #define NormalFortranObjectRule() @@\
1687 $(FC) -c $(FCFLAGS) $*.f
1691 * SpecialObjectRule - generate rules to compile a file with special flags.
1693 #ifndef SpecialObjectRule
1694 #define SpecialObjectRule(objs,depends,options) @@\
1696 ObjectCompile(options)
1697 #endif /* SpecialObjectRule */
1699 #ifndef SpecialCplusplusObjectRule
1700 #define SpecialCplusplusObjectRule(baseobj,basedep,options) @@\
1701 baseobj.Osuf: basedep.CCsuf @@\
1702 ObjectCplusplusCompile(options)
1703 #endif /* SpecialCplusplusObjectRule */
1706 * SpecialCObjectRule - generate rules to compile a C file with special flags.
1707 * also handles CodeCenter rules
1709 #ifndef SpecialCObjectRule
1710 #define SpecialCObjectRule(basename,depends,options) @@\
1711 SpecialObjectRule(basename.Osuf,basename.c depends,options) @@\
1713 basename.i: basename.c depends @@\
1714 CPPOnlyCompile(basename.c,options) @@\
1716 CenterLoadTarget(debug_src,basename.c,NullParameter,$(ALLDEFINES) options)
1717 #endif /* SpecialCObjectRule */
1720 #ifndef ObjectFromSpecialSource
1721 #define ObjectFromSpecialSource(dst,src,flags) @@\
1722 NoConfigRec(dst.c) @@\
1728 SpecialCObjectRule(dst,NullParameter,flags) @@\
1734 #endif /* ObjectFromSpecialSource */
1736 #ifndef LexFileExplicit
1737 #if HasClearmake /* provide a place to hang ClearmakeOSName */
1738 #define LexFileExplicit(file) @@\
1741 $(LEX) $(LFLAGS) file.l @@\
1742 $(MV) lex.yy.c file.c
1744 #define LexFileExplicit(file) /* the default rule is fine */
1749 #define LexFile(file) @@\
1750 LexFileExplicit(file) @@\
1755 RemoveFiles(lex.yy.c file.c)
1756 #endif /* LexFile */
1759 #define YaccFile(file,flags) @@\
1762 file.h file.c: file.y @@\
1764 $(YACC) flags file.y @@\
1765 $(MV) y.tab.c file.c @@\
1766 @if [ -f y.tab.h ]; then set -x; $(MV) y.tab.h file.h; \ @@\
1770 RemoveFiles(y.tab.c y.tab.h file.h file.c)
1771 #endif /* YaccFile */
1773 #ifndef YaccFileNoFlags
1774 #define YaccFileNoFlags(file) @@\
1780 $(MV) y.tab.c file.c @@\
1783 RemoveFiles(y.tab.c file.c)
1784 #endif /* YaccFileNoFlags */
1788 #define MakeLibrary(libname,objlist) $(AR) libname objlist
1791 #ifndef LinkBuildLibrary
1793 #define LinkBuildLibrary(lib) $(_NULLCMD_)
1795 #define LinkBuildLibrary(lib) MakeDir($(BUILDLIBDIR)) @@\
1796 RemoveFile($(BUILDLIBDIR)/lib) @@\
1797 cd $(BUILDLIBDIR) && $(LN) $(BUILDLIBTOP)/$(CURRENT_DIR)/lib .
1799 #endif /* LinkBuildLibrary */
1801 #ifndef _LinkBuildLibrary /* will get redefined elsewhere */
1802 #define _LinkBuildLibrary(lib) $(_NULLCMD_)
1803 #endif /* _LinkBuildLibrary */
1806 * NormalLibraryTarget - generate rules to create a library.
1808 #ifndef NormalLibraryTarget
1809 #define NormalLibraryTarget(libname,objlist) @@\
1810 AllTarget(LibraryTargetName(libname)) @@\
1812 LibraryTargetName(libname): objlist $(EXTRALIBRARYDEPS) @@\
1814 MakeLibrary($@,objlist) @@\
1816 _LinkBuildLibrary($@)
1817 #endif /* NormalLibraryTarget */
1821 * NormalLibraryTarget2 - generate rules to create a library in two steps.
1822 * This is used to create libraries with large numbers of files.
1824 #ifndef NormalLibraryTarget2
1825 #define NormalLibraryTarget2(libname,objlist1,objlist2) @@\
1826 AllTarget(LibraryTargetName(libname)) @@\
1828 LibraryTargetName(libname): objlist1 objlist2 $(EXTRALIBRARYDEPS) @@\
1830 MakeLibrary($@,objlist1) @@\
1831 MakeLibrary($@,objlist2) @@\
1833 _LinkBuildLibrary($@)
1834 #endif /* NormalLibraryTarget2 */
1838 * NormalLibraryTarget3 - generate rules to create a library in three steps.
1839 * This is used to create libraries with very large numbers of files.
1841 #ifndef NormalLibraryTarget3
1842 #define NormalLibraryTarget3(libname,objlist1,objlist2,objlist3) @@\
1843 AllTarget(LibraryTargetName(libname)) @@\
1845 LibraryTargetName(libname): objlist1 objlist2 objlist3 $(EXTRALIBRARYDEPS) @@\
1847 MakeLibrary($@,objlist1) @@\
1848 MakeLibrary($@,objlist2) @@\
1849 MakeLibrary($@,objlist3) @@\
1851 _LinkBuildLibrary($@)
1852 #endif /* NormalLibraryTarget3 */
1856 * NormalDepLibraryTarget - generate rules to create a library.
1858 #ifndef NormalDepLibraryTarget
1859 #define NormalDepLibraryTarget(libname,deplist,objlist) @@\
1860 AllTarget(LibraryTargetName(libname)) @@\
1862 LibraryTargetName(libname): deplist $(EXTRALIBRARYDEPS) @@\
1864 MakeLibrary($@,objlist) @@\
1866 _LinkBuildLibrary($@)
1867 #endif /* NormalDepLibraryTarget */
1871 * UnsharedLibraryTarget - generate rules to create a library.
1873 #ifndef UnsharedLibraryTarget
1874 #define UnsharedLibraryTarget(libname,objlist,down,up) @@\
1875 AllTarget(LibraryTargetName(libname)) @@\
1877 LibraryTargetName(libname): objlist $(EXTRALIBRARYDEPS) @@\
1879 (cd down && MakeLibrary(up/$@,objlist)) @@\
1881 _LinkBuildLibrary($@)
1882 #endif /* UnsharedLibraryTarget */
1886 * UnsharedLibraryTarget3 - generate rules to create a library in three steps.
1887 * This is used to create libraries with very large numbers of files.
1889 #ifndef UnsharedLibraryTarget3
1890 #define UnsharedLibraryTarget3(libname,objlist1,objlist2,objlist3,down,up) @@\
1891 AllTarget(LibraryTargetName(libname)) @@\
1893 LibraryTargetName(libname): objlist1 objlist2 objlist3 $(EXTRALIBRARYDEPS) @@\
1895 (cd down && MakeLibrary(up/$@,objlist1)) @@\
1896 (cd down && MakeLibrary(up/$@,objlist2)) @@\
1897 (cd down && MakeLibrary(up/$@,objlist3)) @@\
1899 _LinkBuildLibrary($@)
1900 #endif /* UnsharedLibraryTarget3 */
1904 * SubdirLibraryRule -
1906 #ifndef SubdirLibraryRule
1907 #define SubdirLibraryRule(objlist) @@\
1916 #endif /* SubdirLibraryRule */
1920 * ProfiledLibraryTarget - generate rules to create a profiled library.
1922 #ifndef ProfiledLibraryTarget
1923 #define ProfiledLibraryTarget(libname,objlist) @@\
1924 AllTarget(LibraryTargetNameSuffix(libname,_p)) @@\
1926 LibraryTargetNameSuffix(libname,_p): objlist $(EXTRALIBRARYDEPS) @@\
1928 cd profiled && MakeLibrary(../$@,objlist) @@\
1931 #endif /* ProfiledLibraryTarget */
1935 * DebuggedLibraryTarget - generate rules to create a debuggable library.
1937 #ifndef DebuggedLibraryTarget
1938 #define DebuggedLibraryTarget(libname,objlist) @@\
1939 AllTarget(LibraryTargetNameSuffix(libname,_d)) @@\
1941 LibraryTargetNameSuffix(libname,_d): objlist $(EXTRALIBRARYDEPS) @@\
1943 cd debugger && MakeLibrary(../$@,objlist) @@\
1946 #endif /* DebuggedLibraryTarget */
1950 * AliasedLibraryTarget - generate rules to link one library to another.
1952 #ifndef AliasedLibraryTarget
1953 #define AliasedLibraryTarget(libname,alias) @@\
1954 AllTarget(LibraryTargetName(alias)) @@\
1956 LibraryTargetName(alias): LibraryTargetName(libname) @@\
1958 $(LN) LibraryTargetName(libname) $@ @@\
1961 RemoveFile(LibraryTargetName(alias))
1962 #endif /* AliasedLibraryTarget */
1966 * NormalRelocatableTarget - generate rules to produce a relocatable object
1967 * file instead of a library.
1969 #ifndef NormalRelocatableTarget
1970 #define NormalRelocatableTarget(objname,objlist) @@\
1971 AllTarget(objname.Osuf) @@\
1973 objname.Osuf: objlist $(EXTRALIBRARYDEPS) @@\
1975 $(LD) $(LDCOMBINEFLAGS) objlist -o $@
1976 #endif /* NormalRelocatableTarget */
1980 * ProfiledRelocatableTarget - generate rules to produce a profiled relocatable
1981 * object file instead of a library.
1983 #ifndef ProfiledRelocatableTarget
1984 #define ProfiledRelocatableTarget(objname,objlist) @@\
1985 AllTarget(Concat(objname,_p.Osuf)) @@\
1987 Concat(objname,_p.Osuf): objlist $(EXTRALIBRARYDEPS) @@\
1989 $(LD) -X -r objlist -o $@
1991 #endif /* ProfiledRelocatableTarget */
1995 * DebuggedRelocatableTarget - generate rules to produce a debuggable
1996 * relocatable object file instead of a library.
1998 #ifndef DebuggedRelocatableTarget
1999 #define DebuggedRelocatableTarget(objname,objlist) @@\
2000 AllTarget(Concat(objname,_d.Osuf)) @@\
2002 Concat(objname,_d.Osuf): objlist $(EXTRALIBRARYDEPS) @@\
2004 $(LD) -X -r objlist -o $@
2006 #endif /* DebuggedRelocatableTarget */
2010 * LintLibraryTarget - generate rules to create a lint library. Note that the
2011 * lint library is always forced to be newer than the library itself.
2013 #ifndef LintLibraryTarget
2014 #define LintLibraryTarget(libname,srclist) @@\
2015 lintlib:: Concat(llib-l,libname.ln) @@\
2017 Concat(llib-l,libname.ln): srclist $(EXTRALIBRARYDEPS) @@\
2019 $(LINT) Concat($(LINTLIBFLAG),libname) $(LINTFLAGS) srclist
2020 #endif /* LintLibraryTarget */
2024 * NormalLintTarget - generate rules to lint a set of sources.
2026 #ifndef NormalLintTarget
2027 #define NormalLintTarget(srclist) @@\
2029 $(LINT) $(LINTFLAGS) srclist $(LINTLIBS) @@\
2031 $(LINT) $(LINTFLAGS) $(FILE) $(LINTLIBS)
2032 #endif /* NormalLintTarget */
2036 * LintTarget - generate rules to lint $(SRCS)
2039 #define LintTarget() @@\
2040 NormalLintTarget($(SRCS))
2045 * LinkSourceFile - snag source file from some other directory
2047 #ifndef LinkSourceFile
2048 #define LinkSourceFile(src,dir) @@\
2053 NoConfigRec(src) @@\
2065 * LinkFile - link a file
2068 #define LinkFile(tofile,fromfile) @@\
2069 tofile:: fromfile @@\
2073 NoConfigRec(tofile) @@\
2075 includes:: tofile @@\
2084 #ifndef MakeSubincludesForBuild
2085 #define MakeSubincludesForBuild(step,dir,srclist) @@\
2086 step:: dir srclist @@\
2087 @-(list=`echo srclist | sed -e 's/[^ ]*\///g'`; \ @@\
2088 set -x; cd dir; RemoveFiles($$list)) @@\
2089 @for i in srclist; do \ @@\
2090 (set -x; cd dir; $(LN) ../$$i .); \ @@\
2094 $(MKDIRHIER) dir @@\
2097 @-(if [ -d dir ]; then \ @@\
2098 list=`echo srclist | sed -e 's/[^ ]*\///g'`; \ @@\
2099 set -x; cd dir; RemoveFile($$list); else exit 0; fi)
2104 * LangNamedTargetSubdirs - recursively make a series of steps
2106 #ifndef LangNamedTargetSubdirs
2107 #define LangNamedTargetSubdirs(lang,name,dirs,verb,flags,subname) @@\
2109 @MakeFlagsToShellFlags(ik,set +e); \ @@\
2110 for i in dirs ;\ @@\
2112 echo verb "in $(CURRENT_DIR)/$$i..."; \ @@\
2113 (cd $$i && LANG=lang $(MAKE) $(MFLAGS) flags subname);\ @@\
2119 * NamedMakeSubdirs - generate rules to do makes in the given subdirectories.
2120 * If you want CDEBUGFLAGS passed along to subdirectories, provide a line like
2121 * the following in the appropriate Imakefile
2123 * #define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)'
2125 #ifndef LangNamedMakeSubdirs
2126 #define LangNamedMakeSubdirs(lang,name,dirs) \
2127 LangNamedTargetSubdirs(lang,name,dirs,"making" name,PassCDebugFlags,all)
2128 #endif /* LangNamedMakeSubdirs */
2130 #ifndef LangMakeSubdirs
2131 #define LangMakeSubdirs(lang,dirs) @@\
2132 LangNamedMakeSubdirs(lang,all,dirs)
2133 #endif /* LangMakeSubdirs */
2138 * NamedTargetSubdirs - recursively make a series of steps
2140 #ifndef NamedTargetSubdirs
2141 #define NamedTargetSubdirs(name,dirs,verb,flags,subname) @@\
2143 @MakeFlagsToShellFlags(ik,set +e); \ @@\
2144 for i in dirs ;\ @@\
2146 echo verb "in $(CURRENT_DIR)/$$i..."; \ @@\
2147 (cd $$i && $(MAKE) $(MFLAGS) flags subname); \ @@\
2153 * NamedMakeSubdirs - generate rules to do makes in the given subdirectories.
2154 * If you want CDEBUGFLAGS passed along to subdirectories, provide a line like
2155 * the following in the appropriate Imakefile
2157 * #define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)'
2159 #ifndef NamedMakeSubdirs
2160 #define NamedMakeSubdirs(name,dirs) \
2161 NamedTargetSubdirs(name,dirs,"making" name,PassCDebugFlags,all)
2162 #endif /* NamedMakeSubdirs */
2165 #define MakeSubdirs(dirs) @@\
2166 NamedMakeSubdirs(all,dirs)
2167 #endif /* MakeSubdirs */
2171 * DependSubdirs - generate rules to recursively compute dependencies as
2172 * part of the make depend step.
2174 #ifndef DependSubdirs
2175 #define DependSubdirs(dirs) \
2176 NamedTargetSubdirs(depend,dirs,"depending",NullParameter,depend)
2177 #endif /* DependSubdirs */
2181 * ForceSubdirs - force make to build subdirectories
2183 #ifndef ForceSubdirs
2184 #define ForceSubdirs(dirs) @@\
2186 @cd $@ ; echo "making all in $(CURRENT_DIR)/$@..."; \ @@\
2187 $(MAKE) $(MFLAGS) PassCDebugFlags all @@\
2190 #endif /* ForceSubdirs */
2193 * InstallSubdirs - generate rules to recursively install programs and files.
2195 #ifndef InstallSubdirs
2196 #define InstallSubdirs(dirs) \
2197 NamedTargetSubdirs(install,dirs,"installing",DESTDIR=$(DESTDIR),install)
2198 #endif /* InstallSubdirs */
2202 * InstallManSubdirs - generate rules to recursively install manual pages.
2204 #ifndef InstallManSubdirs
2205 #define InstallManSubdirs(dirs) \
2206 NamedTargetSubdirs(install.man,dirs,"installing man pages",DESTDIR=$(DESTDIR),install.man)
2207 #endif /* InstallManSubdirs */
2211 * IncludesSubdirs - generate rules to recursively put include files in build
2213 #ifndef IncludesSubdirs
2214 #define IncludesSubdirs(dirs) \
2215 NamedTargetSubdirs(includes,dirs,including,NullParameter,includes)
2220 * InstallLinkKitSubdirs - generate rules to recursively install server Link
2221 * Kit (only used for XFree86). This is a no-op
2222 * rule so that Imakefiles on non-XFree86 systems
2223 * continue to build Makefiles correctly.
2225 #ifndef InstallLinkKitSubdirs
2226 #define InstallLinkKitSubdirs(dirs)
2231 * CleanSubdirs - generate rules to recursively clean out garbage files.
2233 #define BootstrapCleanSubdirs /**/ /* used at top-level */
2234 #ifndef NamedCleanSubdirs
2235 #define NamedCleanSubdirs(name,dirs) \
2236 NamedTargetSubdirs(name,dirs,"cleaning",BootstrapCleanSubdirs,clean)
2237 #endif /* NamedCleanSubdirs */
2239 #ifndef CleanSubdirs
2240 #define CleanSubdirs(dirs) \
2241 NamedCleanSubdirs(clean,dirs)
2246 * TagSubdirs - generate rules to recursively create tags files.
2248 #ifndef NamedTagSubdirs
2249 #define NamedTagSubdirs(name,dirs) \
2250 NamedTargetSubdirs(name,dirs,"tagging",TAGS='$(TAGS)',tags)
2251 #endif /* TagSubdirs */
2254 #define TagSubdirs(dirs) \
2255 NamedTagSubdirs(tags,dirs)
2259 * MakeLintSubdirs - generate rules to recursively lint directories as part
2260 * of the named step.
2262 #ifndef MakeLintSubdirs
2263 #define MakeLintSubdirs(dirs,target,subtarget) \
2264 NamedTargetSubdirs(target,dirs,"linting" for target and subtarget,DESTDIR=$(DESTDIR) LINTOPTS='$(LINTOPTS)',subtarget)
2265 #endif /* MakeLintSubdirs */
2269 * LintSubdirs - generate rules to recursively lint directories as part of
2270 * the make lint step.
2273 #define LintSubdirs(dirs) @@\
2274 MakeLintSubdirs(dirs,lint,lint)
2275 #endif /* LintSubdirs */
2279 * MakeLintLibSubdirs - generate rules to recursively create lint libraries.
2281 #ifndef MakeLintLibSubdirs
2282 #define MakeLintLibSubdirs(dirs) @@\
2283 MakeLintSubdirs(dirs,lintlib,lintlib)
2284 #endif /* MakeLintLibSubdirs */
2288 * MakeMakeSubdirs - generate rules to recursively recreate Makefiles as part
2289 * of the specified step in the build. If $(TOP) is set to an absolute path,
2290 * do not prepend the ../ prefix. This makes running things outside of the
2291 * source tree much easier.
2292 * $(ONESUBDIR)/Makefile exists as a separate, explicit target so that
2293 * clearmake will know what its goal is and do wink-in.
2295 #ifndef MakeMakeSubdirs
2296 #define MakeMakeSubdirs(dirs,target) @@\
2297 $(ONESUBDIR)/Makefile: @@\
2298 @MakeFlagsToShellFlags(n,executeit="no"); \ @@\
2299 cd $(ONESUBDIR); \ @@\
2300 if [ "$$executeit" != "no" ]; then \ @@\
2301 ImakeSubCmdHelper -DTOPDIR=$(IMAKETOP) -DCURDIR=$(ONECURDIR)$(ONESUBDIR); \ @@\
2305 -@MakeFlagsToShellFlags(ik,set +e); \ @@\
2306 MakeFlagsToShellFlags(n,executeit="no"); \ @@\
2307 for i in dirs ;\ @@\
2309 case "$(CURRENT_DIR)" in \ @@\
2311 *) curdir=$(CURRENT_DIR)/ ;; \ @@\
2313 echo "making Makefiles in $$curdir$$i..."; \ @@\
2314 itmp=`echo $$i | sed -e 's;^\./;;g' -e 's;/\./;/;g'`; \ @@\
2315 curtmp="$(CURRENT_DIR)" \ @@\
2317 case "$$itmp" in \ @@\
2319 while echo "$$itmp" | grep '^\.\./' > /dev/null;\ @@\
2321 toptmp="/`basename $$curtmp`$$toptmp"; \ @@\
2322 curtmp="`dirname $$curtmp`"; \ @@\
2323 itmp="`echo $$itmp | sed 's;\.\./;;'`"; \ @@\
2327 case "$$itmp" in \ @@\
2328 */?*/?*/?*/?*) newtop=../../../../..;; \ @@\
2329 */?*/?*/?*) newtop=../../../..;; \ @@\
2330 */?*/?*) newtop=../../..;; \ @@\
2331 */?*) newtop=../..;; \ @@\
2332 *) newtop=..;; \ @@\
2334 newtop="$$newtop$$toptmp"; \ @@\
2335 case "$(TOP)" in \ @@\
2336 /?*) imaketop=$(TOP) \ @@\
2337 imakeprefix= ;; \ @@\
2338 .) imaketop=$$newtop \ @@\
2339 imakeprefix=$$newtop/ ;; \ @@\
2340 *) imaketop=$$newtop/$(TOP) \ @@\
2341 imakeprefix=$$newtop/ ;; \ @@\
2343 RemoveFile($$i/Makefile.bak); \ @@\
2344 if [ -f $$i/Makefile ]; then \ @@\
2345 echo " $(MV) Makefile Makefile.bak"; \ @@\
2346 if [ "$$executeit" != "no" ]; then \ @@\
2347 $(MV) $$i/Makefile $$i/Makefile.bak; \ @@\
2350 $(MAKE) $(MFLAGS) $(MAKE_OPTS) ONESUBDIR=$$i ONECURDIR=$$curdir IMAKETOP=$$imaketop IMAKEPREFIX=$$imakeprefix $$i/Makefile; \ @@\
2352 $(MAKE) $(MFLAGS) Makefiles; \ @@\
2357 #define ImakeSubCmdHelper $(IMAKE_CMD)
2359 #define ImakeSubCmdHelper $(IMAKEPREFIX)$(IMAKE) -I$(IMAKEPREFIX)$(IRULESRC) $(IMAKE_DEFINES)
2362 #endif /* MakeMakeSubdirs */
2366 * MakefileSubdirs - generate rules to create Makefiles.
2368 #ifndef MakefileSubdirs
2369 #define MakefileSubdirs(dirs) @@\
2370 MakeMakeSubdirs(dirs,Makefiles)
2371 #endif /* MakefileSubdirs */
2374 * Translate XCOMM into pound sign with sed, rather than passing -DXCOMM=XCOMM
2375 * to cpp, because that trick does not work on all ANSI C preprocessors.
2376 * Also delete line numbers from the cpp output (-P is not portable, I guess).
2379 #define CppSedMagic sed -e '/^# *[0-9][0-9]* *.*$$/d' -e '/^XCOMM$$/s//#/' -e '/^XCOMM[^a-zA-Z0-9_]/s/^XCOMM/#/'
2380 #endif /* CppSedMagic */
2382 #ifndef CppFileTarget
2383 #define CppFileTarget(dst,src,defs,deplist) @@\
2384 dst:: src deplist @@\
2387 $(CPP) CppNoLineInfoOption defs <src | CppSedMagic >$@ @@\
2391 #endif /* CppFileTarget */
2394 * CppScriptTarget - generate rules to create a shell script by running the
2395 * input through cpp. If the ExecableScripts configuration parameter is not
2396 * set, then make sure that the first line begins with a colon.
2398 #ifndef CppScriptTarget
2399 #if ExecableScripts /* can use #! instead of colon */
2400 #define CppScriptTarget(dst,src,defs,deplist) @@\
2401 dst:: src deplist @@\
2404 $(CPP) CppNoLineInfoOption defs <src | CppSedMagic >$@ @@\
2410 #define CppScriptTarget(dst,src,defs,deplist) @@\
2411 dst:: src deplist @@\
2415 sed '1d' src | $(CPP) CppNoLineInfoOption defs | CppSedMagic >>$@ @@\
2420 #endif /* ExecableScripts */
2421 #endif /* CppScriptTarget */
2425 * MakeScriptFromCpp - generate rules to create a script from a file with a
2428 #ifndef MakeScriptFromCpp
2429 #define MakeScriptFromCpp(name,defs) @@\
2430 CppScriptTarget(name,name.cpp,defs,NullParameter)
2431 #endif /* MakeScriptFromCpp */
2433 #ifndef CppSourceFile
2434 #define CppSourceFile(dst,src,defs,deplist) @@\
2435 CppFileTarget(dst,src,defs,deplist) @@\
2440 #endif /* CppFileTarget */
2443 * MakeDirectories - generate rules to create a hierarchy of directories.
2445 #ifndef MakeDirectories
2446 #define MakeDirectories(step,dirs) @@\
2448 DirFailPrefix@MakeFlagsToShellFlags(i,set +e); \ @@\
2449 for i in dirs; do if [ -d $(DESTDIR)$$i ]; then \ @@\
2450 set +x; else (set -x; $(MKDIRHIER) $(DESTDIR)$$i); fi \ @@\
2452 #endif /* MakeDirectories */
2456 * AllTarget - generate rules to build necessary things during make all.
2459 #define AllTarget(depends) @@\
2461 #endif /* AllTarget */
2463 #ifdef DefineOldLibraryRules
2464 #include <oldlib.rules>