home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 594a.lha / imake / Imake.rules < prev    next >
Text File  |  1991-10-20  |  53KB  |  1,454 lines

  1. /**/###########################################################################
  2. /**/# Imake rules for building libraries, programs, scripts, and data files
  3. /**/# rules:  $XConsortium: Imake.rules,v 1.67 89/12/18 17:14:15 jim Exp $
  4.  
  5. /*
  6.  *           MACHINE-INDEPENDENT RULES; DO NOT MODIFY
  7.  *
  8.  * Warning, when defining rules: make sure you don't include both a trailing
  9.  * backslash and double ampersand backslash or else you will get an extra
  10.  * backslash in the Makefile.
  11.  *
  12.  * These macros are defined for the various templates and Imakefiles (for a
  13.  * list of the applicable make variables, see the template files):
  14.  *
  15.  *    SaberProgramTarget        (program,srclist,objlist,locallibs,syslibs)
  16.  *    RemoveTargetProgram             (program)
  17.  *    BuildIncludes                 (srclist,dstdir)
  18.  *    NormalProgramTarget        (program,objects,deplibs,locallibs,syslibs)
  19.  *    SimpleProgramTarget             (program)
  20.  *    ComplexProgramTarget             (program)
  21.  *    ComplexProgramTarget_1             (program,locallib,syslib)
  22.  *    ComplexProgramTarget_2             (program,locallib,syslib)
  23.  *    ComplexProgramTarget_3             (program,locallib,syslib)
  24.  *    ServerTarget             (server,subdirs,objects,libs,syslibs)
  25.  *    InstallLibrary                 (libname,dest)
  26.  *    InstallSharedLibrary             (libname,rev,dest)
  27.  *    InstallLibraryAlias             (libname,alias,dest)
  28.  *    InstallLintLibrary             (libname,dest)
  29.  *    InstallManPageLong             (file,destdir,dest)
  30.  *    InstallManPage                 (file,dest)
  31.  *    InstallNonExec                 (file,dest)
  32.  *    InstallProgram                 (program,dest)
  33.  *    InstallProgramWithFlags          (program,dest,flags)
  34.  *    InstallScript                 (program,dest)
  35.  *    LinkFileList                 (step,list,dir,sub)
  36.  *    InstallMultipleDestFlags         (step,list,dest,flags)
  37.  *    InstallMultipleDest             (step,list,dest)
  38.  *    InstallMultiple              (list,dest)
  39.  *    InstallMultipleFlags             (list,dest,flags)
  40.  *    InstallMultipleMan             (list,dest)
  41.  *    InstallAppDefaults             (class)
  42.  *    DependDependency             ()
  43.  *    DependTarget                 ()
  44.  *    CleanTarget                 ()
  45.  *    TagsTarget                 ()
  46.  *    ImakeDependency              (target)
  47.  *    BuildMakefileTarget             (imakefile,imakeflags)
  48.  *    MakefileTarget                 ()
  49.  *    NormalLibraryObjectRule          ()
  50.  *    ProfiledLibraryObjectRule         ()
  51.  *    DebuggedLibraryObjectRule         ()
  52.  *    DebuggedAndProfiledLibraryObjectRule     ()
  53.  *    SharedLibraryObjectRule          ()
  54.  *    SharedAndDebuggedLibraryObjectRule     ()
  55.  *    SpecialObjectRule             (objs,depends,options)
  56.  *    SpecialProfiledObjectRule         (objs,depends,options)
  57.  *    SpecialDebuggedObjectRule         (objs,depends,options)
  58.  *    SpecialDebuggedAndProfiledObjectRule     (objs,depends,options)
  59.  *    NormalLibraryTarget             (libname,objlist)
  60.  *    NormalSharedLibraryTarget         (libname,rev,solist,salist)
  61.  *    NormalLibraryTarget2             (libname,objlist1,objlist2)
  62.  *    ProfiledLibraryTarget             (libname,objlist)
  63.  *    DebuggedLibraryTarget             (libname,objlist)
  64.  *    AliasedLibraryTarget             (libname,alias)
  65.  *    NormalRelocatableTarget          (objname,objlist)
  66.  *    ProfiledRelocatableTarget         (objname,objlist)
  67.  *    DebuggedRelocatableTarget         (objname,objlist)
  68.  *    LintLibraryTarget             (libname,srclist)
  69.  *    NormalLintTarget             (srclist)
  70.  *    LintTarget                 ()
  71.  *    MakeSubincludesForBuild          (step,dir,srclist)
  72.  *    NamedTargetSubdirs             (name,dirs,verb,flags,subname)
  73.  *    MakeSubdirs                 (dirs)
  74.  *    NamedMakeSubdirs             (name,dirs)
  75.  *    DependSubdirs                 (dirs)
  76.  *    InstallSubdirs                 (dirs)
  77.  *    InstallManSubdirs             (dirs)
  78.  *    NamedIncludesSubdirs             (name,dirs)
  79.  *    IncludesSubdirs                 (dirs)
  80.  *    NamedCleanSubdirs             (name,dirs)
  81.  *    CleanSubdirs                 (dirs)
  82.  *    NamedTagSubdirs              (name,dirs)
  83.  *    TagSubdirs                 (dirs)
  84.  *    MakeLintSubdirs              (dirs,target,subtarget)
  85.  *    LintSubdirs                 (dirs)
  86.  *    MakeLintLibSubdirs             (dirs)
  87.  *    MakeMakeSubdirs              (dirs,target)
  88.  *    MakeNsubdirMakefiles             ()
  89.  *    MakefileSubdirs              (dirs)
  90.  *    CppScriptTarget              (dst,src,defs,deplist)
  91.  *    MakeScriptFromCpp             (name,defs)
  92.  *    MakeDirectories              (step,dirs)
  93.  *    MakeFonts                 ()
  94.  *    InstallFonts                 (dest)
  95.  *    InstallFontAliases             (dest)
  96.  *    FontTarget                 (basename)
  97.  *    CompressedFontTarget             (basename)
  98.  *    AllTarget                 (depends)
  99.  *
  100.  *
  101.  * The general linking for building programs is:
  102.  *
  103.  *    program-objects programlibs syslibs EXTRA_LIBRARIES systemlibs \
  104.  *        EXTRA_LOAD_FLAGS
  105.  *
  106.  * where programlibs is LOCAL_LIBRARIES for ComplexProgramTarget
  107.  * and EXTRA comes with syslibs from the LDLIBS
  108.  */
  109.  
  110.  
  111. #ifndef RemoveTargetProgram
  112. #define RemoveTargetProgram(program) $(RM) program
  113. #endif
  114.  
  115. #ifndef BuildIncludes
  116. #define BuildIncludes(srclist,dstsubdir,dstupdir)                       @@\
  117. includes::                                @@\
  118.     $(MKDIRHIER) $(BUILDINCDIR)/dstsubdir                           @@\
  119.     @(set -x; cd $(BUILDINCDIR)/dstsubdir; for i in srclist; do \   @@\
  120.         $(RM) $$i; \                                            @@\
  121.         $(LN) $(BUILDINCTOP)/dstupdir/$(CURRENT_DIR)/$$i .; \   @@\
  122.     done)
  123. #endif /* BuildIncludes */
  124.  
  125. /*
  126.  * NormalProgramTarget - generate rules to compile and link the indicated
  127.  * program; since it does not use any default object files, it may be used for
  128.  * multiple programs in the same Imakefile.
  129.  */
  130. #ifndef NormalProgramTarget
  131. #ifdef __SASC
  132. #define NormalProgramTarget(program,objects,deplibs,locallibs,syslibs)  @@\
  133. program: objects deplibs                        @@\
  134.     RemoveTargetProgram($@)                                         @@\
  135.     $(LD) <WITH <(T\:/**/program/**/.link)                          @@\
  136.         FROM $(STARTUP) objects                                 @@\
  137.         LIB deplibs locallibs syslibs                @@\
  138.         TO $@                            @@\
  139.         $(LDFLAGS)                                              @@\
  140. <                                    @@\
  141.                                     @@\
  142. clean_/**/program:                            @@\
  143.     $(RM) program
  144. #else
  145. #define NormalProgramTarget(program,objects,deplibs,locallibs,syslibs)  @@\
  146. program: objects deplibs                        @@\
  147.     RemoveTargetProgram($@)                                         @@\
  148.     $(CC) -o $@ objects $(LDOPTIONS) locallibs $(LDLIBS) syslibs $(EXTRA_LOAD_FLAGS) @@\
  149.                                     @@\
  150. clean::                                 @@\
  151.     $(RM) program
  152. #endif /* !__SASC */
  153. #endif /* NormalProgramTarget */
  154.  
  155.  
  156. /*
  157.  * SimpleProgramTarget - generate rules for compiling and linking programs
  158.  * that only have one C source file.  It should only be used in Imakefiles
  159.  * that describe a single program.
  160.  */
  161. #ifndef SimpleProgramTarget
  162. #define SimpleProgramTarget(program)                                    @@\
  163.        OBJS = program.o                        @@\
  164.        SRCS = program.c                        @@\
  165.                                     @@\
  166. ComplexProgramTarget(program)
  167. #endif /* SimpleProgramTarget */
  168.  
  169.  
  170.  
  171. /*
  172.  * ComplexProgramTarget - generate rules for compiling and linking the
  173.  * program specified by $(OBJS) and $(SRCS), installing the program and its
  174.  * man page, and generating dependencies.  It should only be used in
  175.  * Imakefiles that describe a single program.
  176.  */
  177. #ifndef ComplexProgramTarget
  178. #ifdef __SASC
  179. #define ComplexProgramTarget(program)                                   @@\
  180.     PROGRAM = program                        @@\
  181.                                     @@\
  182. AllTarget(program)                                                      @@\
  183.                                     @@\
  184. program: $(OBJS) $(DEPLIBS)                                             @@\
  185.     RemoveTargetProgram($@)                                         @@\
  186.     $(LD) <WITH <(T\:/**/program/**/.link)                          @@\
  187.         FROM $(STARTUP) $(OBJS)                                 @@\
  188.         LIB $(LOCAL_LIBRARIES) $(LDLIBS)                        @@\
  189.         TO $@                            @@\
  190.         $(LDOPTIONS)                                            @@\
  191.         $(EXTRA_LOADFLAGS)                                      @@\
  192. <                                    @@\
  193.                                     @@\
  194. InstallProgram(program,$(BINDIR))                                       @@\
  195. InstallManPage(program,$(MANDIR))                                       @@\
  196. DependTarget()                                                          @@\
  197.                                     @@\
  198. clean_/**/program:                            @@\
  199.     $(RM) $(PROGRAM)
  200. #else
  201. #define ComplexProgramTarget(program)                                   @@\
  202.     PROGRAM = program                        @@\
  203.                                     @@\
  204. AllTarget(program)                                                      @@\
  205.                                     @@\
  206. program: $(OBJS) $(DEPLIBS)                                             @@\
  207.     RemoveTargetProgram($@)                                         @@\
  208.     $(CC) -o $@ $(OBJS) $(LDOPTIONS) $(LOCAL_LIBRARIES) $(LDLIBS) $(EXTRA_LOAD_FLAGS) @@\
  209.                                     @@\
  210. InstallProgram(program,$(BINDIR))                                       @@\
  211. InstallManPage(program,$(MANDIR))                                       @@\
  212. DependTarget()                                                          @@\
  213. LintTarget()                                                            @@\
  214.                                     @@\
  215. clean::                                 @@\
  216.     $(RM) $(PROGRAM)
  217. #endif /* !__SASC */
  218. #endif /* ComplexProgramTarget */
  219.  
  220.  
  221. /*
  222.  * ComplexProgramTarget_1 - generate rules for compiling and linking the
  223.  * program specified by $(OBJS1) and $(SRCS1), installing the program and its
  224.  * man page, and generating dependencies for it and any programs described
  225.  * by $(SRCS2) and $(SRCS3).  It should be used to build the primary
  226.  * program in Imakefiles that describe multiple programs.
  227.  */
  228. #ifndef ComplexProgramTarget_1
  229. #ifdef __SASC
  230. #define ComplexProgramTarget_1(program,locallib,syslib)                 @@\
  231.         OBJS = $(OBJS1) $(OBJS2) $(OBJS3)                           @@\
  232.         SRCS = $(SRCS1) $(SRCS2) $(SRCS3)                           @@\
  233.                                     @@\
  234. AllTarget($(PROGRAMS))                                                  @@\
  235.                                     @@\
  236. program: $(OBJS1) $(DEPLIBS1)                                           @@\
  237.     RemoveTargetProgram($@)                                         @@\
  238.     $(LD) <WITH <(T\:/**/program/**/.link)                          @@\
  239.         FROM $(STARTUP) $(OBJS1)                                @@\
  240.         LIB locallib $(LDLIBS) syslib                           @@\
  241.         TO $@                            @@\
  242.         $(LDOPTIONS)                                            @@\
  243.         $(EXTRA_LOADFLAGS)                                      @@\
  244. <                                    @@\
  245.                                     @@\
  246. InstallProgram(program,$(BINDIR))                                       @@\
  247. InstallManPage(program,$(MANDIR))                                       @@\
  248.                                     @@\
  249. DependTarget()                                                          @@\
  250.                                     @@\
  251. clean_/**/program:                            @@\
  252.     $(RM) $(PROGRAM)
  253. #else /* !__SASC */
  254. #define ComplexProgramTarget_1(program,locallib,syslib)                 @@\
  255.         OBJS = $(OBJS1) $(OBJS2) $(OBJS3)                           @@\
  256.         SRCS = $(SRCS1) $(SRCS2) $(SRCS3)                           @@\
  257.                                     @@\
  258. AllTarget($(PROGRAMS))                                                  @@\
  259.                                     @@\
  260. program: $(OBJS1) $(DEPLIBS1)                                           @@\
  261.     RemoveTargetProgram($@)                                         @@\
  262.     $(CC) -o $@ $(LDOPTIONS) $(OBJS1) locallib $(LDLIBS) syslib $(EXTRA_LOAD_FLAGS) @@\
  263.                                     @@\
  264. InstallProgram(program,$(BINDIR))                                       @@\
  265. InstallManPage(program,$(MANDIR))                                       @@\
  266.                                     @@\
  267. SaberProgramTarget(program,$(SRCS1),$(OBJS1),locallib,syslib)           @@\
  268.                                     @@\
  269. DependTarget()                                                          @@\
  270. LintTarget()                                                            @@\
  271.                                     @@\
  272. clean::                                 @@\
  273.     $(RM) $(PROGRAMS)
  274. #endif /* !__SASC */
  275. #endif /* ComplexProgramTarget_1 */
  276.  
  277.  
  278. /*
  279.  * ComplexProgramTarget_2 - generate rules for compiling and linking the
  280.  * program specified by $(OBJS2) and $(SRCS2) and installing the program and
  281.  * man page.  It should be used to build the second program in Imakefiles
  282.  * describing more than one program.
  283.  */
  284. #ifndef ComplexProgramTarget_2
  285. #ifdef __SASC
  286. #define ComplexProgramTarget_2(program,locallib,syslib)                 @@\
  287. program: $(OBJS2) $(DEPLIBS2)                                           @@\
  288.     RemoveTargetProgram($@)                                         @@\
  289.     $(LD) <WITH <(T\:/**/program/**/.link)                          @@\
  290.         FROM $(STARTUP) $(OBJS2)                                @@\
  291.         LIB locallib $(LDLIBS) syslib                           @@\
  292.         TO $@                            @@\
  293.         $(LDOPTIONS)                                            @@\
  294.         $(EXTRA_LOADFLAGS)                                      @@\
  295. <                                    @@\
  296.                                     @@\
  297. InstallProgram(program,$(BINDIR))                                       @@\
  298. InstallManPage(program,$(MANDIR))
  299. #else /* !__SASC */
  300. #define ComplexProgramTarget_2(program,locallib,syslib)                 @@\
  301. program: $(OBJS2) $(DEPLIBS2)                                           @@\
  302.     RemoveTargetProgram($@)                                         @@\
  303.     $(CC) -o $@ $(LDOPTIONS) $(OBJS2) locallib $(LDLIBS) syslib $(EXTRA_LOAD_FLAGS) @@\
  304.                                     @@\
  305. SaberProgramTarget(program,$(SRCS2),$(OBJS2),locallib,syslib)           @@\
  306.                                     @@\
  307. InstallProgram(program,$(BINDIR))                                       @@\
  308. InstallManPage(program,$(MANDIR))
  309. #endif /* !__SASC */
  310. #endif /* ComplexProgramTarget_2 */
  311.  
  312.  
  313. /*
  314.  * ComplexProgramTarget_3 - generate rules for compiling and linking the
  315.  * program specified by $(OBJS3) and $(SRCS3) and installing the program and
  316.  * man page.  It should be used to build the third program in Imakefiles
  317.  * describing more than one program.
  318.  */
  319. #ifndef ComplexProgramTarget_3
  320. #ifdef __SASC
  321. #define ComplexProgramTarget_3(program,locallib,syslib)                 @@\
  322. program: $(OBJS3) $(DEPLIBS3)                                           @@\
  323.     RemoveTargetProgram($@)                                         @@\
  324.     $(LD) <WITH <(T\:/**/program/**/.link)                          @@\
  325.         FROM $(STARTUP) $(OBJS3)                                @@\
  326.         LIB locallib $(LDLIBS) syslib                           @@\
  327.         TO $@                            @@\
  328.         $(LDOPTIONS)                                            @@\
  329.         $(EXTRA_LOADFLAGS)                                      @@\
  330. <                                    @@\
  331.                                     @@\
  332. InstallProgram(program,$(BINDIR))                                       @@\
  333. InstallManPage(program,$(MANDIR))
  334. #else /* !__SASC */
  335. #define ComplexProgramTarget_3(program,locallib,syslib)                 @@\
  336. program: $(OBJS3) $(DEPLIBS3)                                           @@\
  337.     RemoveTargetProgram($@)                                         @@\
  338.     $(CC) -o $@ $(LDOPTIONS) $(OBJS3) locallib $(LDLIBS) syslib $(EXTRA_LOAD_FLAGS) @@\
  339.                                     @@\
  340. SaberProgramTarget(program,$(SRCS3),$(OBJS3),locallib,syslib)           @@\
  341.                                     @@\
  342. InstallProgram(program,$(BINDIR))                                       @@\
  343. InstallManPage(program,$(MANDIR))
  344. #endif /* !__SASC */
  345. #endif /* ComplexProgramTarget_3 */
  346.  
  347.  
  348. /*
  349.  * InstallLibrary - generate rules to install the indicated library.
  350.  */
  351. #ifndef InstallLibrary
  352. #define InstallLibrary(libname,dest)                                    @@\
  353. install:: lib/**/libname.a                        @@\
  354.     $(INSTALL) -c $(INSTLIBFLAGS) lib/**/libname.a dest             @@\
  355.     $(RANLIB) $(RANLIBINSTFLAGS) dest/lib/**/libname.a
  356. #endif /* InstallLibrary */
  357.  
  358. /*
  359.  * MergeIntoInstalledLibrary - generate rules to merge one library into another
  360.  */
  361. #ifndef MergeIntoInstalledLibrary
  362. #define MergeIntoInstalledLibrary(tolib,fromlib)                        @@\
  363. install::  fromlib                            @@\
  364.     $(SCRIPTSRC)/mergelib tolib fromlib
  365. #endif /* MergeIntoInstalledLibrary */
  366.  
  367. /*
  368.  * InstallSharedLibrary - generate rules to install the shared library.
  369.  */
  370. #ifndef InstallSharedLibrary
  371. #define InstallSharedLibrary(libname,rev,dest)                          @@\
  372. install:: lib/**/libname.so.rev                     @@\
  373.     $(INSTALL) -c $(INSTLIBFLAGS) lib/**/libname.so.rev dest        @@\
  374.  
  375. #endif /* InstallSharedLibrary */
  376.  
  377. /*
  378.  * InstallSharedLibraryData - generate rules to install the shared library data
  379.  */
  380. #ifndef InstallSharedLibraryData
  381. #define InstallSharedLibraryData(libname,rev,dest)                      @@\
  382. install:: lib/**/libname.sa.rev                     @@\
  383.     $(INSTALL) -c $(INSTLIBFLAGS) lib/**/libname.sa.rev dest
  384.  
  385. #endif /* InstallSharedLibraryData */
  386.  
  387.  
  388. /*
  389.  * InstallLibraryAlias - generate rules to create a link from one library name
  390.  * to another for the purposes of aliasing.
  391.  */
  392. #ifndef InstallLibraryAlias
  393. #define InstallLibraryAlias(libname,alias,dest)                         @@\
  394. install::                                @@\
  395.     -(cd dest; $(LN) lib/**/libname.a lib/**/alias.a)
  396. #endif /* InstallLibraryAlias */
  397.  
  398.  
  399. /*
  400.  * InstallLintLibrary - generate rules to install the indicated lint library.
  401.  */
  402. #ifndef InstallLintLibrary
  403. #define InstallLintLibrary(libname,dest)                                @@\
  404. install.ln:: llib-l/**/libname.ln                    @@\
  405.     $(INSTALL) -c $(INSTLIBFLAGS) llib-l/**/libname.ln dest
  406. #endif /* InstallLintLibrary */
  407.  
  408.  
  409. /*
  410.  * InstallManPageLong - generate rules to install the indicated manual page,
  411.  * giving it an alternate name.  This is used for installing man pages whose
  412.  * base name without the .man suffix would normally be longer than 8 characters
  413.  * (the limit for using source code control systems on files systems with
  414.  * short file names).
  415.  */
  416. #ifndef InstallManPageLong
  417. #define InstallManPageLong(file,destdir,dest)                           @@\
  418. install.man:: file.man                            @@\
  419.     $(INSTALL) -c $(INSTMANFLAGS) file.man destdir/dest.ManSuffix
  420. #endif /* InstallManPageLong */
  421.  
  422.  
  423. /*
  424.  * InstallManPage - generate rules to install the indicated manual page.
  425.  */
  426. #ifndef InstallManPage
  427. #define InstallManPage(file,dest)                                       @@\
  428. InstallManPageLong(file,dest,file)
  429. #endif /* InstallManPage */
  430.  
  431.  
  432. /*
  433.  * InstallNonExec - generate rules to install a data file using any special
  434.  * install flags
  435.  */
  436. #ifndef InstallNonExec
  437. #define InstallNonExec(file,dest)                                       @@\
  438. install:: file                                @@\
  439.     $(INSTALL) -c $(INSTDATFLAGS) file dest
  440. #endif /* InstallNonExec */
  441.  
  442.  
  443. /*
  444.  * InstallProgramWithFlags - generate rules to install an executable program
  445.  * using given install flags.
  446.  */
  447. #ifndef InstallProgramWithFlags
  448. #define InstallProgramWithFlags(program,dest,flags)                     @@\
  449. install:: program                            @@\
  450.     $(INSTALL) -c $(INSTPGMFLAGS) flags program dest
  451. #endif /* InstallProgramWithFlags */
  452.  
  453.  
  454. /*
  455.  * InstallProgram - generate rules to install an executable program using any
  456.  * special install flags set in $(INSTALLFLAGS).
  457.  */
  458. #ifndef InstallProgram
  459. #define InstallProgram(program,dest)                                    @@\
  460. InstallProgramWithFlags(program,dest, /**/)
  461. #endif /* InstallProgram */
  462.  
  463.  
  464.  
  465. /*
  466.  * InstallScript - install a shell script using special install flags set in
  467.  * $(INSTALLFLAGS).  This macro has been superceeded by CppScriptTarget.
  468.  */
  469. #ifndef InstallScript
  470. #define InstallScript(program,dest)                                     @@\
  471. install:: program.script                        @@\
  472.     $(INSTALL) -c $(INSTPGMFLAGS) program.script dest/program
  473. #endif /* InstallScript */
  474.  
  475.  
  476. /*
  477.  * LinkFileList - link a list of list of files from one place to another
  478.  */
  479. #ifndef LinkFileList
  480. #define LinkFileList(step,list,dir,sub)                                 @@\
  481. step:: list                                @@\
  482.     @case '${MFLAGS}' in *[i]*) set +e;; esac; \                    @@\
  483.     echo "  cd" dir; cd dir; for i in list; do (set -x; $(LN) sub/$$i .); done
  484. #endif
  485.  
  486.  
  487. /*
  488.  * InstallMultipleDestFlags - generate rules to install multiple files at
  489.  * once during a particular step in the build using a specific set of install
  490.  * flags.
  491.  */
  492. #ifndef InstallMultipleDestFlags
  493. #define InstallMultipleDestFlags(step,list,dest,flags)                  @@\
  494. step:: list                                @@\
  495.     @case '${MFLAGS}' in *[i]*) set +e;; esac; \                    @@\
  496.     for i in list; do \                        @@\
  497.         (set -x; $(INSTALL) -c flags $$i dest); \               @@\
  498.     done
  499. #endif /* InstallMultipleDestFlags */
  500.  
  501.  
  502. /*
  503.  * InstallMultipleDest - generate rules to install multiple files at once
  504.  * during a particular step in the build using any install flags set in
  505.  * $(INSTALLFLAGS).
  506.  */
  507. #ifndef InstallMultipleDest
  508. #define InstallMultipleDest(step,list,dest)                             @@\
  509. InstallMultipleDestFlags(step,list,dest,$(INSTALLFLAGS))
  510. #endif /* InstallMultipleDest */
  511.  
  512. /*
  513.  * InstallMultiple - generate rules to install multiple files at once
  514.  * during the install step of the build using any install flags set in
  515.  * $(INSTALLFLAGS).
  516.  */
  517. #ifndef InstallMultiple
  518. #define InstallMultiple(list,dest)                                      @@\
  519. InstallMultipleDest(install,list,dest)
  520. #endif /* InstallMultiple */
  521.  
  522.  
  523. /*
  524.  * InstallMultipleFlags - generate rules to install multiple files at once
  525.  * during the install step of the build using the given install flags.
  526.  */
  527. #ifndef InstallMultipleFlags
  528. #define InstallMultipleFlags(list,dest,flags)                           @@\
  529. InstallMultipleDestFlags(install,list,dest,flags)
  530. #endif /* InstallMultipleFlags */
  531.  
  532.  
  533. /*
  534.  * InstallMultipleMan - generate rules to install a variety of manual pages
  535.  * during the install.man step of the build.
  536.  */
  537. #ifndef InstallMultipleMan
  538. #define InstallMultipleMan(list,dest)                                   @@\
  539. InstallMultipleDest(install.man,list,dest)
  540. #endif /* InstallMultipleMan */
  541.  
  542.  
  543. /*
  544.  * InstallAppDefaults - generate rules to install appliation default files
  545.  * if the InstallAppDefFiles configuration parameter is set.
  546.  */
  547. #ifndef InstallAppDefaults
  548. #if InstallAppDefFiles
  549. #define InstallAppDefaults(class)                                       @@\
  550. install:: class.ad                            @@\
  551.     $(INSTALL) -c $(INSTAPPFLAGS) class.ad $(XAPPLOADDIR)/class
  552. #else
  553. #define InstallAppDefaults(class)
  554. #endif /* InstallAppDefFiles */
  555. #endif /* InstallAppDefaults */
  556.  
  557.  
  558.  
  559.  
  560. /*
  561.  * DependDependency - generate rules to build the makedepend program if
  562.  * this Imakefile is within the source tree.
  563.  */
  564. #ifndef DependDependency
  565. #ifdef UseInstalled
  566. #define DependDependency() /**/
  567. #else
  568. #define DependDependency()                                              @@\
  569. depend:: $(DEPEND)                                                      @@\
  570.                                     @@\
  571. $(DEPEND):                                                              @@\
  572.     @echo "checking $@ over in $(DEPENDSRC) first..."; \            @@\
  573.     cd $(DEPENDSRC); $(MAKE); \                                     @@\
  574.     echo "okay, continuing in $(CURRENT_DIR)"
  575.  
  576. #endif /* UseInstalled */
  577. #endif /* DependDependency */
  578.  
  579.  
  580. /*
  581.  * DependTarget - generate rules to compute dependencies for all files listed
  582.  * in $(SRCS).
  583.  */
  584. #ifndef DependTarget
  585. #define DependTarget()                                                  @@\
  586. DependDependency()                                                      @@\
  587.                                     @@\
  588. depend::                                @@\
  589.     $(DEPEND) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS)
  590. #endif /* DependTarget */
  591.  
  592.  
  593. /*
  594.  * CleanTarget - generate rules to remove any garbage files; the #* is here
  595.  * instead of in the definition of RM_CMD because System V will treat the
  596.  * pound sign in the RM_CMD variable as a comment.
  597.  */
  598. #ifndef CleanTarget
  599. #define CleanTarget()                                                   @@\
  600. clean::                                 @@\
  601.     $(RM_CMD) \#*
  602. #endif /* CleanTarget */
  603.  
  604.  
  605. /*
  606.  * TagsTarget - generate rules to compute tags files for C source code.
  607.  */
  608. #ifndef TagsTarget
  609. #define TagsTarget()                                                    @@\
  610. tags::                                    @@\
  611.     $(TAGS) -w *.[ch]                                               @@\
  612.     $(TAGS) -xw *.[ch] > TAGS
  613. #endif /* TagsTarget */
  614.  
  615.  
  616. /*
  617.  * ImakeDependency - generate rules to compile imake if this Imakefile is
  618.  * within the source tree.
  619.  */
  620. #ifndef ImakeDependency
  621. #ifdef UseInstalled
  622. #define ImakeDependency(target) /**/
  623. #else
  624. #define ImakeDependency(target)                                         @@\
  625. target:: $(IMAKE)                                                       @@\
  626.                                     @@\
  627. $(IMAKE):                                                               @@\
  628.     @(cd $(IMAKESRC); if [ -f Makefile ]; then \                    @@\
  629.     echo "checking $@ in $(IMAKESRC) first..."; $(MAKE) all; else \ @@\
  630.     echo "bootstrapping $@ from Makefile.ini in $(IMAKESRC) first..."; \    @@\
  631.     $(MAKE) -f Makefile.ini BOOTSTRAPCFLAGS=$(BOOTSTRAPCFLAGS); fi; \       @@\
  632.     echo "okay, continuing in $(CURRENT_DIR)")
  633. #endif /* UseInstalled */
  634. #endif /* ImakeDependency */
  635.  
  636.  
  637. /*
  638.  * BuildMakefileTarget - generate rules to build a Makefile from an Imakefile
  639.  * and any special imake flags.  This is generally done automatically by the
  640.  * template or by any special Imakefiles.
  641.  */
  642. #ifndef BuildMakefileTarget
  643. #define BuildMakefileTarget(imakefile,imakeflags)                       @@\
  644. ImakeDependency(Makefile)                                               @@\
  645.                                     @@\
  646. Makefile::                                @@\
  647.     -@if [ -f Makefile ]; then \                    @@\
  648.         echo "  $(RM) Makefile.bak; $(MV) Makefile Makefile.bak"; \ @@\
  649.         $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \      @@\
  650.     else exit 0; fi                         @@\
  651.     $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR) imakeflags
  652.  
  653. #endif /* BuildMakefileTarget */
  654.  
  655.  
  656. /*
  657.  * MakefileTarget - generate rules to build a normal Makefile.
  658.  */
  659. #ifndef MakefileTarget
  660. #define MakefileTarget()                                                @@\
  661. BuildMakefileTarget(Imakefile, /**/)
  662. #endif /* MakefileTarget */
  663.  
  664.  
  665. /*
  666.  * NormalLibraryObjectRule - generate make rules to build "normal" objects.
  667.  */
  668. #ifndef NormalLibraryObjectRule
  669. #define NormalLibraryObjectRule()                                       @@\
  670. .c.o:                                    @@\
  671.     $(RM) $@                                                        @@\
  672.     $(CC) -c $(CFLAGS) $*.c
  673. #endif /* NormalLibraryObjectRule */
  674.  
  675. #ifndef NormalFortranObjectRule
  676. #define NormalFortranObjectRule()                                       @@\
  677. .f.o:                                    @@\
  678.     $(RM) $@                                                        @@\
  679.     $(FC) -c $(FCFLAGS) $*.f
  680. #endif
  681.  
  682.  
  683. /*
  684.  * ProfiledLibraryObjectRule - generate make rules to build both profiled
  685.  * and "normal" objects.
  686.  */
  687. #ifndef ProfiledLibraryObjectRule
  688. #define ProfiledLibraryObjectRule()                                     @@\
  689. all::                                    @@\
  690.     @if [ ! -d profiled ]; then mkdir profiled; else exit 0; fi    @@\
  691.                                     @@\
  692. .c.o:                                    @@\
  693.     $(RM) $@ profiled/$@                                            @@\
  694.     $(CC) -pg -c $(CFLAGS) $*.c                                     @@\
  695.     $(MV) $*.o profiled/$*.o                                        @@\
  696.     $(CC) -c $(CFLAGS) $*.c                                         @@\
  697.                                     @@\
  698. clean::                                 @@\
  699.     -@if [ -d profiled ]; then echo "       $(RM) profiled/?*.o"; \ @@\
  700.         $(RM) profiled/?*.o; else exit 0; fi                    @@\
  701.  
  702. #endif /* ProfiledLibraryObjectRule */
  703.  
  704.  
  705. /*
  706.  * DebuggedLibraryObjectRule - generate make rules to build both debuggable
  707.  * and "normal" objects.
  708.  */
  709. #ifndef DebuggedLibraryObjectRule
  710. #define DebuggedLibraryObjectRule()                                     @@\
  711. all::                                    @@\
  712.     @if [ ! -d debugger ]; then mkdir debugger; else exit 0; fi    @@\
  713.                                     @@\
  714. .c.o:                                    @@\
  715.     $(RM) $@ debugger/$@                                            @@\
  716.     $(CC) -g -c $(CFLAGS) $*.c                                      @@\
  717.     $(MV) $*.o debugger/$*.o                                        @@\
  718.     $(CC) -c $(CFLAGS) $*.c                                         @@\
  719.                                     @@\
  720. clean::                                 @@\
  721.     -@if [ -d debugger ]; then echo "       $(RM) debugger/?*.o"; \ @@\
  722.         $(RM) debugger/?*.o; else exit 0; fi                    @@\
  723.  
  724. #endif /* DebuggedLibraryObjectRule */
  725.  
  726.  
  727. /*
  728.  * DebuggedAndProfiledLibraryOjbectRule - generate make rules to build
  729.  * debuggable, profiled, and "normal" objects.
  730.  */
  731. #ifndef DebuggedAndProfiledLibraryObjectRule
  732. #define DebuggedAndProfiledLibraryObjectRule()                          @@\
  733. all::                                    @@\
  734.     @if [ ! -d profiled ]; then mkdir profiled; else exit 0; fi    @@\
  735.     @if [ ! -d debugger ]; then mkdir debugger; else exit 0; fi    @@\
  736.                                     @@\
  737. .c.o:                                    @@\
  738.     $(RM) $@ profiled/$@ debugger/$@                                @@\
  739.     $(CC) -pg -c $(CFLAGS) $*.c                                     @@\
  740.     $(MV) $*.o profiled/$*.o                                        @@\
  741.     $(CC) -g -c $(CFLAGS) $*.c                                      @@\
  742.     $(MV) $*.o debugger/$*.o                                        @@\
  743.     $(CC) -c $(CFLAGS) $*.c                                         @@\
  744.                                     @@\
  745. clean::                                 @@\
  746.     -@if [ -d profiled ]; then echo "       $(RM) profiled/?*.o"; \ @@\
  747.         $(RM) profiled/?*.o; else exit 0; fi                    @@\
  748.     -@if [ -d debugger ]; then echo "       $(RM) debugger/?*.o"; \ @@\
  749.         $(RM) debugger/?*.o; else exit 0; fi                    @@\
  750.  
  751. #endif /* DebuggedAndProfiledLibraryObjectRule */
  752.  
  753.  
  754. /*
  755.  * SharedLibraryObjectRule - generate make rules to build shared and "normal"
  756.  * object files.
  757.  */
  758. #ifndef SharedLibraryObjectRule
  759. #define SharedLibraryObjectRule()                                       @@\
  760. all::                                    @@\
  761.     @if [ ! -d shared ]; then mkdir shared; else exit 0; fi     @@\
  762.                                     @@\
  763. .c.o:                                    @@\
  764.     $(RM) $@ shared/$@                                              @@\
  765.     $(CC) -pic -c $(SHAREDCODEDEF) $(SHLIBDEF) $(CFLAGS) $*.c       @@\
  766.     $(MV) $*.o shared/$*.o                                          @@\
  767.     $(CC) -c $(SHLIBDEF) $(CFLAGS) $*.c                             @@\
  768.                                     @@\
  769. clean::                                 @@\
  770.     -@if [ -d shared ]; then echo " $(RM) shared/?*.o"; \           @@\
  771.         $(RM) shared/?*.o; else exit 0; fi                      @@\
  772.  
  773. #endif /* SharedLibraryObjectRule */
  774.  
  775. /*
  776.  * SharedAndDebuggedLibraryObjectRule - generate make rules to build shared,
  777.  * debuggable, and "normal" object files.
  778.  */
  779. #ifndef SharedAndDebuggedLibraryObjectRule
  780. #define SharedAndDebuggedLibraryObjectRule()                            @@\
  781. all::                                    @@\
  782.     @if [ ! -d shared ]; then mkdir shared; else exit 0; fi     @@\
  783.     @if [ ! -d debugger ]; then mkdir debugger; else exit 0; fi    @@\
  784.                                     @@\
  785. .c.o:                                    @@\
  786.     $(RM) $@ shared/$@ debugger/$@                                  @@\
  787.     $(CC) -pic -c $(SHAREDCODEDEF) $(SHLIBDEF) $(CFLAGS) $*.c       @@\
  788.     $(MV) $*.o shared/$*.o                                          @@\
  789.     $(CC) -g -c $(SHLIBDEF) $(CFLAGS) $*.c                          @@\
  790.     $(MV) $*.o debugger/$*.o                                        @@\
  791.     $(CC) -c $(SHLIBDEF) $(CFLAGS) $*.c                             @@\
  792.                                     @@\
  793. clean::                                 @@\
  794.     -@if [ -d shared ]; then echo " $(RM) shared/?*.o"; \   @@\
  795.         $(RM) shared/?*.o; else exit 0; fi                      @@\
  796.     -@if [ -d debugger ]; then echo "       $(RM) debugger/?*.o"; \ @@\
  797.         $(RM) debugger/?*.o; else exit 0; fi                    @@\
  798.  
  799. #endif /* SharedAndDebuggedLibraryObjectRule */
  800.  
  801. /*
  802.  * SpecialSharedAndDebuggedObjectRule - generate rules to compile a file
  803.  * with special flags and to make shared and debuggable versions.
  804.  */
  805. #ifndef SpecialSharedAndDebuggedObjectRule
  806. #define SpecialSharedAndDebuggedObjectRule(objs,depends,options)        @@\
  807. all::                                    @@\
  808.     @if [ ! -d shared ]; then mkdir shared; else exit 0; fi     @@\
  809.     @if [ ! -d debugger ]; then mkdir debugger; else exit 0; fi    @@\
  810.                                     @@\
  811. objs:    depends                             @@\
  812.     $(RM) $@ shared/$@ debugger/$@                                  @@\
  813.     $(CC) -pic -c $(SHAREDCODEDEF) $(SHLIBDEF) $(CFLAGS) options $*.c @@\
  814.     $(MV) $*.o shared/$*.o                                          @@\
  815.     $(CC) -g -c $(SHLIBDEF) $(CFLAGS) options $*.c                  @@\
  816.     $(MV) $*.o debugger/$*.o                                        @@\
  817.     $(CC) -c $(SHLIBDEF) $(CFLAGS) options $*.c
  818. #endif /* SpecialDebuggedAndProfiledObjectRule */
  819.  
  820. /*
  821.  * SpecialSharedObjectRule - generate rules to compile a file
  822.  * with special flags and to make shared and debuggable versions.
  823.  */
  824. #ifndef SpecialSharedObjectRule
  825. #define SpecialSharedObjectRule(objs,depends,options)                   @@\
  826. all::                                    @@\
  827.     @if [ ! -d shared ]; then mkdir shared; else exit 0; fi     @@\
  828.                                     @@\
  829. objs:    depends                             @@\
  830.     $(RM) $@ shared/$@                                              @@\
  831.     $(CC) -pic -c $(SHAREDCODEDEF) $(SHLIBDEF) $(CFLAGS) options $*.c @@\
  832.     $(MV) $*.o shared/$*.o                                          @@\
  833.     $(CC) -c $(SHLIBDEF) $(CFLAGS) options $*.c
  834. #endif /* SpecialDebuggedAndProfiledObjectRule */
  835.  
  836.  
  837.  
  838. /*
  839.  * SpecialObjectRule - generate rules to compile a file with special flags.
  840.  */
  841. #ifndef SpecialObjectRule
  842. #define SpecialObjectRule(objs,depends,options)                         @@\
  843. objs:    depends                             @@\
  844.     $(RM) $@                                                        @@\
  845.     $(CC) -c $(CFLAGS) options $*.c
  846. #endif /* SpecialObjectRule */
  847.  
  848.  
  849. /*
  850.  * SpecialProfiledObjectRule - generate rules to compile a file with special
  851.  * flags and to make a profiled version.
  852.  */
  853. #ifndef SpecialProfiledObjectRule
  854. #define SpecialProfiledObjectRule(objs,depends,options)                 @@\
  855. all::                                    @@\
  856.     @if [ ! -d profiled ]; then mkdir profiled; else exit 0; fi    @@\
  857.                                     @@\
  858. objs:    depends                             @@\
  859.     $(RM) $@ profiled/$@                                            @@\
  860.     $(CC) -pg -c $(CFLAGS) options $*.c                             @@\
  861.     $(MV) $*.o profiled/$*.o                                        @@\
  862.     $(CC) -c $(CFLAGS) options $*.c
  863. #endif /* SpecialProfiledObjectRule */
  864.  
  865.  
  866. /*
  867.  * SpecialDebuggedObjectRule - generate rules to compile a file with special
  868.  * flags and to make a debuggable version.
  869.  */
  870. #ifndef SpecialDebuggedObjectRule
  871. #define SpecialDebuggedObjectRule(objs,depends,options)                 @@\
  872. all::                                    @@\
  873.     @if [ ! -d debugger ]; then mkdir debugger; else exit 0; fi    @@\
  874.                                     @@\
  875. objs:    depends                             @@\
  876.     $(RM) $@ debugger/$@                                            @@\
  877.     $(CC) -g -c $(CFLAGS) options $*.c                              @@\
  878.     $(MV) $*.o debugger/$*.o                                        @@\
  879.     $(CC) -c $(CFLAGS) options $*.c
  880. #endif /* SpecialDebuggedObjectRule */
  881.  
  882.  
  883. /*
  884.  * SpecialDebuggedAndProfiledObjectRule - generate rules to compile a file
  885.  * with special flags and to make debuggable and profiled versions.
  886.  */
  887. #ifndef SpecialDebuggedAndProfiledObjectRule
  888. #define SpecialDebuggedAndProfiledObjectRule(objs,depends,options)      @@\
  889. all::                                    @@\
  890.     @if [ ! -d profiled ]; then mkdir profiled; else exit 0; fi    @@\
  891.     @if [ ! -d debugger ]; then mkdir debugger; else exit 0; fi    @@\
  892.                                     @@\
  893. objs:    depends                             @@\
  894.     $(RM) $@ profiled/$@ debugger/$@                                @@\
  895.     $(CC) -pg -c $(CFLAGS) options $*.c                             @@\
  896.     $(MV) $*.o profiled/$*.o                                        @@\
  897.     $(CC) -g -c $(CFLAGS) options $*.c                              @@\
  898.     $(MV) $*.o debugger/$*.o                                        @@\
  899.     $(CC) -c $(CFLAGS) options $*.c
  900. #endif /* SpecialDebuggedAndProfiledObjectRule */
  901.  
  902.  
  903. /*
  904.  * NormalLibraryTarget - generate rules to create a library.
  905.  */
  906. #ifndef NormalLibraryTarget
  907. #define NormalLibraryTarget(libname,objlist)                            @@\
  908. AllTarget(lib/**/libname.a)                                             @@\
  909.                                     @@\
  910. lib/**/libname.a: objlist                        @@\
  911.     $(RM) $@                                                        @@\
  912.     $(AR) $@ objlist                                                @@\
  913.     $(RANLIB) $@
  914. #endif /* NormalLibraryTarget */
  915.  
  916.  
  917. /*
  918.  * NormalSharedLibraryTarget - generate rules to create a shared library;
  919.  * build it into a different name so that the we don't hose people by having
  920.  * the library gone for long periods.
  921.  */
  922. #ifndef NormalSharedLibraryTarget
  923. #define NormalSharedLibraryTarget(libname,rev,solist)                   @@\
  924. AllTarget(lib/**/libname.so.rev)                                        @@\
  925.                                     @@\
  926. lib/**/libname.so.rev:    solist                        @@\
  927.     $(RM) $@~                                                       @@\
  928.     (cd shared; $(LD) -o ../$@~ -assert pure-text solist)           @@\
  929.     $(RM) $@                                                        @@\
  930.     $(MV) $@~ $@                                                    @@\
  931.                                     @@\
  932. clean::                                 @@\
  933.     $(RM) lib/**/libname.so.rev
  934.  
  935. #endif
  936.  
  937. /*
  938.  * NormalSharedLibraryDataTarget - generate rules to create shlib data file;
  939.  * build it into a different name so that the we don't hose people by having
  940.  * the library gone for long periods.
  941.  */
  942. #ifndef NormalSharedLibraryDataTarget
  943. #define NormalSharedLibraryDataTarget(libname,rev,salist)               @@\
  944. AllTarget(lib/**/libname.sa.rev)                                        @@\
  945.                                     @@\
  946. lib/**/libname.sa.rev:    salist                        @@\
  947.     $(RM) $@                                                        @@\
  948.     $(AR) $@ salist                                                 @@\
  949.     $(RANLIB) $@                                                    @@\
  950.                                     @@\
  951. clean::                                 @@\
  952.     $(RM) lib/**/libname.sa.rev
  953.  
  954. #endif /* NormalSharedLibraryTarget */
  955.  
  956.  
  957.  
  958.  
  959.  
  960. /*
  961.  * NormalLibraryTarget2 - generate rules to create a library in two steps.
  962.  * This is used to create libraries with large numbers of files.
  963.  */
  964. #ifndef NormalLibraryTarget2
  965. #define NormalLibraryTarget2(libname,objlist1,objlist2)                 @@\
  966. AllTarget(lib/**/libname.a)                                             @@\
  967.                                     @@\
  968. lib/**/libname.a: objlist1 objlist2                    @@\
  969.     $(RM) $@                                                        @@\
  970.     $(AR) $@ objlist1                                               @@\
  971.     $(AR) $@ objlist2                                               @@\
  972.     $(RANLIB) $@
  973. #endif /* NormalLibraryTarget2 */
  974.  
  975.  
  976. /*
  977.  * ProfiledLibraryTarget - generate rules to create a profiled library.
  978.  */
  979. #ifndef ProfiledLibraryTarget
  980. #define ProfiledLibraryTarget(libname,objlist)                          @@\
  981. AllTarget(lib/**/libname/**/_p.a)                                       @@\
  982.                                     @@\
  983. lib/**/libname/**/_p.a: objlist                     @@\
  984.     $(RM) $@                                                        @@\
  985.     cd profiled; $(AR) ../$@ objlist                                @@\
  986.     $(RANLIB) $@
  987.  
  988. #endif /* ProfiledLibraryTarget */
  989.  
  990.  
  991. /*
  992.  * DebuggedLibraryTarget - generate rules to create a debuggable library.
  993.  */
  994. #ifndef DebuggedLibraryTarget
  995. #define DebuggedLibraryTarget(libname,objlist)                          @@\
  996. AllTarget(lib/**/libname/**/_d.a)                                       @@\
  997.                                     @@\
  998. lib/**/libname/**/_d.a: objlist                     @@\
  999.     $(RM) $@                                                        @@\
  1000.     cd debugger; $(AR) ../$@ objlist                                @@\
  1001.     $(RANLIB) $@
  1002.  
  1003. #endif /* DebuggedLibraryTarget */
  1004.  
  1005.  
  1006. /*
  1007.  * AliasedLibraryTarget - generate rules to link one library to another.
  1008.  */
  1009. #ifndef AliasedLibraryTarget
  1010. #define AliasedLibraryTarget(libname,alias)                             @@\
  1011. AllTarget(lib/**/alias.a)                                               @@\
  1012.                                     @@\
  1013. lib/**/alias.a: lib/**/libname.a                    @@\
  1014.     $(RM) $@                                                        @@\
  1015.     $(LN) lib/**/libname.a $@
  1016. #endif /* AliasedLibraryTarget */
  1017.  
  1018.  
  1019. /*
  1020.  * NormalRelocatableTarget - generate rules to produce a relocatable object
  1021.  * file instead of a library.
  1022.  */
  1023. #ifndef NormalRelocatableTarget
  1024. #define NormalRelocatableTarget(objname,objlist)                        @@\
  1025. AllTarget(objname.o)                                                    @@\
  1026.                                     @@\
  1027. objname.o: objlist                            @@\
  1028.     $(RM) $@                                                        @@\
  1029.     $(LD) $(LDCOMBINEFLAGS) objlist -o $@
  1030. #endif /* NormalRelocatableTarget */
  1031.  
  1032.  
  1033. /*
  1034.  * ProfiledRelocatableTarget - generate rules to produce a profiled relocatable
  1035.  * object file instead of a library.
  1036.  */
  1037. #ifndef ProfiledRelocatableTarget
  1038. #define ProfiledRelocatableTarget(objname,objlist)                      @@\
  1039. AllTarget(objname/**/_p.o)                                              @@\
  1040.                                     @@\
  1041. objname/**/_p.o: objlist                        @@\
  1042.     $(RM) $@                                                        @@\
  1043.     $(LD) -X -r objlist -o $@
  1044.  
  1045. #endif /* ProfiledRelocatableTarget */
  1046.  
  1047.  
  1048. /*
  1049.  * DebuggedRelocatableTarget - generate rules to produce a debuggable
  1050.  * relocatable object file instead of a library.
  1051.  */
  1052. #ifndef DebuggedRelocatableTarget
  1053. #define DebuggedRelocatableTarget(objname,objlist)                      @@\
  1054. AllTarget(objname/**/_d.o)                                              @@\
  1055.                                     @@\
  1056. objname/**/_d.o: objlist                        @@\
  1057.     $(RM) $@                                                        @@\
  1058.     $(LD) -X -r objlist -o $@
  1059.  
  1060. #endif /* DebuggedRelocatableTarget */
  1061.  
  1062.  
  1063. /*
  1064.  * LintLibraryTarget - generate rules to create a lint library.  Note that the
  1065.  * lint library is always forced to be newer than the library itself.
  1066.  */
  1067. #ifndef LintLibraryTarget
  1068. #define LintLibraryTarget(libname,srclist)                              @@\
  1069. lintlib:: llib-l/**/libname.ln                        @@\
  1070.                                     @@\
  1071. llib-l/**/libname.ln: srclist                        @@\
  1072.     $(RM) $@                                                        @@\
  1073.     $(LINT) $(LINTLIBFLAG)/**/libname $(LINTFLAGS) srclist
  1074. #endif /* LintLibraryTarget */
  1075.  
  1076.  
  1077. /*
  1078.  * NormalLintTarget - generate rules to lint a set of sources.
  1079.  */
  1080. #ifndef NormalLintTarget
  1081. #define NormalLintTarget(srclist)                                       @@\
  1082. lint:                                    @@\
  1083.     $(LINT) $(LINTFLAGS) srclist $(LINTLIBS)                        @@\
  1084. lint1:                                    @@\
  1085.     $(LINT) $(LINTFLAGS) $(FILE) $(LINTLIBS)
  1086. #endif /* NormalLintTarget */
  1087.  
  1088.  
  1089. /*
  1090.  * LintTarget - generate rules to lint $(SRCS)
  1091.  */
  1092. #ifndef LintTarget
  1093. #define LintTarget()                                                    @@\
  1094. NormalLintTarget($(SRCS))
  1095. #endif
  1096.  
  1097.  
  1098. /*
  1099.  * LinkSourceFile - snag source file from some other directory
  1100.  */
  1101. #ifndef LinkSourceFile
  1102. #define LinkSourceFile(src,dir)                                         @@\
  1103. src:  dir/src                                @@\
  1104.     $(RM) $@                                                        @@\
  1105.     $(LN) $? $@                                                     @@\
  1106.  
  1107. #endif
  1108.  
  1109.  
  1110.  
  1111. #ifndef MakeSubincludesForBuild
  1112. #define MakeSubincludesForBuild(step,dir,srclist)                       @@\
  1113. step::    dir srclist                            @@\
  1114.     @-(list=`echo srclist | sed -e 's/[^ ]*\///g'`; \               @@\
  1115.         set -x; cd dir; $(RM) $$list)                           @@\
  1116.     @for i in srclist; do \                     @@\
  1117.         (set -x; cd dir; $(LN) ../$$i .); \                     @@\
  1118.     done                                @@\
  1119.                                     @@\
  1120. MakeDirectories(dir,dir)                                                @@\
  1121.                                     @@\
  1122. clean::                                 @@\
  1123.     @-(if [ -d dir ]; then \                                        @@\
  1124.         list=`echo srclist | sed -e 's/[^ ]*\///g'`; \          @@\
  1125.         set -x; cd dir; $(RM) $$list; else exit 0; fi)
  1126. #endif
  1127.  
  1128.  
  1129. /*
  1130.  * NamedTargetSubdirs - recursively make a series of steps
  1131.  */
  1132. #ifndef NamedTargetSubdirs
  1133. #define NamedTargetSubdirs(name,dirs,verb,flags,subname)                @@\
  1134. name::                                    @@\
  1135.     @case '${MFLAGS}' in *[ik]*) set +e;; esac; \                   @@\
  1136.     for i in dirs ;\                        @@\
  1137.     do \                                @@\
  1138.         (cd $$i ; echo verb "in $(CURRENT_DIR)/$$i..."; \       @@\
  1139.             $(MAKE) $(MFLAGS) flags subname); \             @@\
  1140.     done
  1141. #endif
  1142.  
  1143.  
  1144. /*
  1145.  * NamedMakeSubdirs - generate rules to do makes in the given subdirectories.
  1146.  * If you want CDEBUGFLAGS passed along to subdirectories, provide a line like
  1147.  * the following in the appropriate Imakefile
  1148.  *
  1149.  *       #define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)'
  1150.  */
  1151. #ifndef NamedMakeSubdirs
  1152. #define NamedMakeSubdirs(name,dirs) \
  1153. NamedTargetSubdirs(name,dirs,"making" name,PassCDebugFlags,all)
  1154. #endif /* NamedMakeSubdirs */
  1155.  
  1156. #ifndef MakeSubdirs
  1157. #define MakeSubdirs(dirs)                                               @@\
  1158. NamedMakeSubdirs(all,dirs)
  1159. #endif /* MakeSubdirs */
  1160.  
  1161.  
  1162. /*
  1163.  * DependSubdirs - generate rules to recursively compute dependencies as
  1164.  * part of the make depend step.
  1165.  */
  1166. #ifndef DependSubdirs
  1167. #define DependSubdirs(dirs) \
  1168. NamedTargetSubdirs(depend,dirs,"depending", /**/,depend)
  1169. #endif /* DependSubdirs */
  1170.  
  1171.  
  1172. /*
  1173.  * InstallSubdirs - generate rules to recursively install programs and files.
  1174.  */
  1175. #ifndef InstallSubdirs
  1176. #define InstallSubdirs(dirs) \
  1177. NamedTargetSubdirs(install,dirs,"installing",DESTDIR='$(DESTDIR)',install)
  1178. #endif /* InstallSubdirs */
  1179.  
  1180.  
  1181. /*
  1182.  * InstallManSubdirs - generate rules to recursively install manual pages.
  1183.  */
  1184. #ifndef InstallManSubdirs
  1185. #define InstallManSubdirs(dirs) \
  1186. NamedTargetSubdirs(install.man,dirs,"installing man pages",DESTDIR='$(DESTDIR)',install.man)
  1187. #endif /* InstallManSubdirs */
  1188.  
  1189.  
  1190. /*
  1191.  * IncludesSubdirs - generate rules to recursively put include files in build
  1192.  */
  1193. #ifndef IncludesSubdirs
  1194. #define IncludesSubdirs(dirs) \
  1195. NamedTargetSubdirs(includes,dirs,including, /**/,includes)
  1196. #endif
  1197.  
  1198.  
  1199. /*
  1200.  * CleanSubdirs - generate rules to recursively clean out garbage files.
  1201.  */
  1202. #ifndef NamedCleanSubdirs
  1203. #define NamedCleanSubdirs(name,dirs) \
  1204. NamedTargetSubdirs(name,dirs,"cleaning",RM_CMD='$(RM_CMD)',clean)
  1205. #endif /* NamedCleanSubdirs */
  1206.  
  1207. #ifndef CleanSubdirs
  1208. #define CleanSubdirs(dirs) \
  1209. NamedCleanSubdirs(clean,dirs)
  1210. #endif
  1211.  
  1212.  
  1213. /*
  1214.  * TagSubdirs - generate rules to recursively create tags files.
  1215.  */
  1216. #ifndef NamedTagSubdirs
  1217. #define NamedTagSubdirs(name,dirs) \
  1218. NamedTargetSubdirs(name,dirs,"tagging",TAGS='$(TAGS)',tags)
  1219. #endif /* TagSubdirs */
  1220.  
  1221. #ifndef TagSubdirs
  1222. #define TagSubdirs(dirs) \
  1223. NamedTagSubdirs(tags,dirs)
  1224. #endif
  1225.  
  1226. /*
  1227.  * MakeLintSubdirs - generate rules to recursively lint directories as part
  1228.  * of the named step.
  1229.  */
  1230. #ifndef MakeLintSubdirs
  1231. #define MakeLintSubdirs(dirs,target,subtarget) \
  1232. NamedTargetSubdirs(target,dirs,"linting" for target and subtarget,DESTDIR='$(DESTDIR)' LINTOPTS='$(LINTOPTS)',subtarget)
  1233. #endif /* MakeLintSubdirs */
  1234.  
  1235.  
  1236. /*
  1237.  * LintSubdirs - generate rules to recursively lint directories as part of
  1238.  * the make lint step.
  1239.  */
  1240. #ifndef LintSubdirs
  1241. #define LintSubdirs(dirs)                                               @@\
  1242. MakeLintSubdirs(dirs,lint,lint)
  1243. #endif /* LintSubdirs */
  1244.  
  1245.  
  1246. /*
  1247.  * MakeLintLibSubdirs - generate rules to recursively create lint libraries.
  1248.  */
  1249. #ifndef MakeLintLibSubdirs
  1250. #define MakeLintLibSubdirs(dirs)                                        @@\
  1251. MakeLintSubdirs(dirs,lintlib,lintlib)
  1252. #endif /* MakeLintLibSubdirs */
  1253.  
  1254.  
  1255. /*
  1256.  * MakeMakeSubdirs - generate rules to recursively recreate Makefiles as part
  1257.  * of the specified step in the build.    If $(TOP) is set to an absolute path,
  1258.  * don't prepend the ../ prefix.  This makes running things outside of the
  1259.  * source tree to be much easier.
  1260.  */
  1261. #ifndef MakeMakeSubdirs
  1262. #define MakeMakeSubdirs(dirs,target)                                    @@\
  1263. target::                                @@\
  1264.     @case '${MFLAGS}' in *[ik]*) set +e;; esac; \                   @@\
  1265.     for i in dirs ;\                        @@\
  1266.     do \                                @@\
  1267.         echo "making Makefiles in $(CURRENT_DIR)/$$i..."; \     @@\
  1268.         case "$$i" in \                                         @@\
  1269.         ./?*/?*/?*/?*) newtop=../../../../ sub=subsubsubsub;; \ @@\
  1270.         ./?*/?*/?*) newtop=../../../ sub=subsubsub;; \        @@\
  1271.         ./?*/?*)    newtop=../../ sub=subsub;; \        @@\
  1272.         ./?*)        newtop=../ sub=sub;; \            @@\
  1273.         */?*/?*/?*)    newtop=../../../../ sub=subsubsubsub;; \ @@\
  1274.         */?*/?*)    newtop=../../../ sub=subsubsub;; \        @@\
  1275.         */?*)        newtop=../../ sub=subsub;; \        @@\
  1276.         *)        newtop=../ sub=sub;; \            @@\
  1277.         esac; \                         @@\
  1278.         case "$(TOP)" in \                                      @@\
  1279.         /?*) newtop=  upprefix=  ;; \                @@\
  1280.         *) upprefix=../ ;; \                    @@\
  1281.         esac; \                         @@\
  1282.         $(MAKE) $${sub}dirMakefiles UPPREFIX=$$upprefix NEWTOP=$$newtop \               @@\
  1283.         MAKEFILE_SUBDIR=$$i NEW_CURRENT_DIR=$(CURRENT_DIR)/$$i;\ @@\
  1284.     done
  1285. #endif /* MakeMakeSubdirs */
  1286.  
  1287.  
  1288. /*
  1289.  * MakeNsubdirMakefiles - generate rules to create sub Makefiles.
  1290.  */
  1291. #ifndef MakeNsubdirMakefiles
  1292. #define MakeNsubdirMakefiles()                                          @@\
  1293. subdirMakefiles:                            @@\
  1294.     $(RM) $(MAKEFILE_SUBDIR)/Makefile.bak                           @@\
  1295.     -@if [ -f $(MAKEFILE_SUBDIR)/Makefile ]; then \                 @@\
  1296.     echo "  $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak"; \ @@\
  1297.     $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; \ @@\
  1298.     else exit 0; fi                         @@\
  1299.     cd $(MAKEFILE_SUBDIR); $(IMAKE_CMD) -DTOPDIR=$(UPPREFIX)$(TOP) -DCURDIR=$(NEW_CURRENT_DIR); \   @@\
  1300.     $(MAKE) $(MFLAGS) Makefiles                                     @@\
  1301.                                     @@\
  1302. subsubdirMakefiles:                            @@\
  1303.     $(RM) $(MAKEFILE_SUBDIR)/Makefile.bak                           @@\
  1304.     -@if [ -f $(MAKEFILE_SUBDIR)/Makefile ]; then \                 @@\
  1305.     echo "  $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak"; \ @@\
  1306.     $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; \ @@\
  1307.     else exit 0; fi                         @@\
  1308.     cd $(MAKEFILE_SUBDIR); $(IMAKE_CMD) -DTOPDIR=$(UPPREFIX)$(UPPREFIX)$(TOP) -DCURDIR=$(NEW_CURRENT_DIR); \        @@\
  1309.     $(MAKE) $(MFLAGS) Makefiles                                     @@\
  1310.                                     @@\
  1311. subsubsubdirMakefiles:                            @@\
  1312.     $(RM) $(MAKEFILE_SUBDIR)/Makefile.bak                           @@\
  1313.     -@if [ -f $(MAKEFILE_SUBDIR)/Makefile ]; then \                 @@\
  1314.     echo "  $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak"; \ @@\
  1315.     $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; \ @@\
  1316.     else exit 0; fi @@\
  1317.     cd $(MAKEFILE_SUBDIR); $(IMAKE_CMD) -DTOPDIR=$(UPPREFIX)$(UPPREFIX)$(UPPREFIX)$(TOP) -DCURDIR=$(NEW_CURRENT_DIR); \     @@\
  1318.     $(MAKE) $(MFLAGS) Makefiles                                     @@\
  1319.                                     @@\
  1320. subsubsubsubdirMakefiles:                        @@\
  1321.     $(RM) $(MAKEFILE_SUBDIR)/Makefile.bak                           @@\
  1322.     -@if [ -f $(MAKEFILE_SUBDIR)/Makefile ]; then \                 @@\
  1323.     echo "  $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak"; \ @@\
  1324.     $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; \ @@\
  1325.     else exit 0; fi                         @@\
  1326.     cd $(MAKEFILE_SUBDIR); $(IMAKE_CMD) -DTOPDIR=$(UPPREFIX)$(UPPREFIX)$(UPPREFIX)$(UPPREFIX)$(TOP) -DCURDIR=$(NEW_CURRENT_DIR); \  @@\
  1327.     $(MAKE) $(MFLAGS) Makefiles
  1328. #endif /* MakeNsubdirMakefiles */
  1329.  
  1330.  
  1331. /*
  1332.  * MakefileSubdirs - generate rules to create Makefiles.
  1333.  */
  1334. #ifndef MakefileSubdirs
  1335. #define MakefileSubdirs(dirs)                                           @@\
  1336. MakeMakeSubdirs(dirs,Makefiles)                                         @@\
  1337.                                     @@\
  1338. MakeNsubdirMakefiles()
  1339. #endif /* MakefileSubdirs */
  1340.  
  1341.  
  1342. /*
  1343.  * CppScriptTarget - generate rules to create a shell script by running the
  1344.  * input through cpp.  If the ExecableScripts configuration parameter is not
  1345.  * set, then make sure that the first line begins with a colon.
  1346.  */
  1347. #ifndef CppScriptTarget
  1348. #if ExecableScripts        /* can use #! instead of colon */
  1349. #define CppScriptTarget(dst,src,defs,deplist)                           @@\
  1350. dst::  src deplist                            @@\
  1351.     $(RM) $@                                                        @@\
  1352.     $(CPP) defs <src | \                                            @@\
  1353.         sed -e '/^#  *[0-9][0-9]*  *.*$$/d' >$@                 @@\
  1354.     chmod a+x $@
  1355. #else
  1356. #define CppScriptTarget(dst,src,defs,deplist)                           @@\
  1357. dst::  src deplist                            @@\
  1358.     $(RM) $@                                                        @@\
  1359.     echo \: >$@                            @@\
  1360.     sed '1d' src | $(CPP) defs  | \                                 @@\
  1361.         sed -e '/^#  *[0-9][0-9]*  *.*$$/d' >>$@                @@\
  1362.     chmod a+x $@
  1363. #endif /* ExecableScripts */
  1364. #endif /* CppScriptTarget */
  1365.  
  1366.  
  1367. /*
  1368.  * MakeScriptFromCpp - generate rules to create a script from a file with a
  1369.  * .cpp suffix.
  1370.  */
  1371. #ifndef MakeScriptFromCpp
  1372. #define MakeScriptFromCpp(name,defs)                                    @@\
  1373. CppScriptTarget(name,name.cpp,defs, /**/)
  1374. #endif /* MakeScriptFromCpp */
  1375.  
  1376.  
  1377. /*
  1378.  * MakeDirectories - generate rules to create a hierarchy of directories.
  1379.  */
  1380. #ifndef MakeDirectories
  1381. #define MakeDirectories(step,dirs)                                      @@\
  1382. step::                                    @@\
  1383.     $(MKDIRHIER) dirs
  1384. #endif /* MakeDirectories */
  1385.  
  1386.  
  1387. /*
  1388.  * MakeFonts - generate rules to build font databases.
  1389.  */
  1390. #ifndef MakeFonts
  1391. #define MakeFonts()                                                     @@\
  1392. all::  $(OBJS) fonts.dir                                                @@\
  1393.                                     @@\
  1394. fonts.dir:  $(OBJS)                                                     @@\
  1395.     $(MKFONTDIR) .                                                  @@\
  1396.                                     @@\
  1397. clean::                                 @@\
  1398.     $(RM) *.snf fonts.dir
  1399. #endif /* MakeFonts */
  1400.  
  1401.  
  1402. /*
  1403.  * InstallFonts - generate rules to install font files
  1404.  */
  1405. #ifndef InstallFonts
  1406. #define InstallFonts(dest)                                              @@\
  1407. InstallMultipleFlags($(OBJS),dest,$(INSTDATFLAGS))                      @@\
  1408.                                     @@\
  1409. install::  fonts.dir                            @@\
  1410.     $(INSTALL) -c $(INSTDATFLAGS) fonts.dir dest
  1411. #endif /* InstallFonts */
  1412.  
  1413.  
  1414. /*
  1415.  * InstallFontAliases - generate rules to install font aliases databases.
  1416.  */
  1417. #ifndef InstallFontAliases
  1418. #define InstallFontAliases(dest)                                        @@\
  1419. install::  fonts.alias                            @@\
  1420.     $(INSTALL) -c $(INSTDATFLAGS) fonts.alias dest
  1421. #endif /* InstallFontAliases */
  1422.  
  1423.  
  1424. /*
  1425.  * FontTarget - generate rules to convert a .bdf file into a .snf file.
  1426.  */
  1427. #ifndef FontTarget
  1428. #define FontTarget(basename)                                            @@\
  1429. basename.snf:  basename.bdf                        @@\
  1430.     $(FONTC) $(FONTCFLAGS) $? >$@
  1431. #endif /* FontTarget */
  1432.  
  1433.  
  1434. /*
  1435.  * CompressedFontTarget - generate rules to convert a .bdf file into a
  1436.  * compressed .snf file.
  1437.  */
  1438. #ifndef CompressedFontTarget
  1439. #define CompressedFontTarget(basename)                                  @@\
  1440. basename.snf.Z:  basename.bdf                        @@\
  1441.     $(FONTC) $(FONTCFLAGS) $? >basename.snf                         @@\
  1442.     $(COMPRESS) basename.snf                                        @@\
  1443.     rm -f basename.snf
  1444. #endif /* CompressedFontTarget */
  1445.  
  1446.  
  1447. /*
  1448.  * AllTarget - generate rules to build necessary things during make all.
  1449.  */
  1450. #ifndef AllTarget
  1451. #define AllTarget(depends)                                              @@\
  1452. all:: depends
  1453. #endif /* AllTarget */
  1454.