From: Theodore Tso Date: Thu, 3 Jun 1993 11:51:51 +0000 (+0000) Subject: Lots of changes to bring the macros used closer to the X11 imake rules X-Git-Tag: krb5-1.0-beta3~257 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f3ae53d0b2ed66d6b1c585ed767493ed09aee9b3;p=krb5.git Lots of changes to bring the macros used closer to the X11 imake rules git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@2581 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/config/Imake.rules b/src/config/Imake.rules index c6570fe93..8ea815bb1 100644 --- a/src/config/Imake.rules +++ b/src/config/Imake.rules @@ -3,117 +3,153 @@ /**/# $Id$ /**/# -/**/########################################################################### -/**/# Imake rules for building libraries, programs, scripts, and data files -/**/# rules: $XConsortium: Imake.rules,v 1.67 89/12/18 17:14:15 jim Exp $ - +XCOMM ------------------------------------------------------------------------- +XCOMM Imake rules for building libraries, programs, scripts, and data files +XCOMM rules: $XConsortium: Imake.rules,v 1.123 91/09/16 20:12:16 rws Exp $ + /* * MACHINE-INDEPENDENT RULES; DO NOT MODIFY * - * Warning, when defining rules: make sure you don't include both a trailing + * Warning, when defining rules: make sure you do not include both a trailing * backslash and double ampersand backslash or else you will get an extra * backslash in the Makefile. * - * These macros are defined for the various templates and Imakefiles (for a - * list of the applicable make variables, see the template files): - * - * SaberProgramTarget (program,srclist,objlist,locallibs,syslibs) - * RemoveTargetProgram (program) - * BuildIncludes (srclist,dstdir) - * NormalProgramTarget (program,objects,deplibs,locallibs,syslibs) - * SimpleProgramTarget (program) - * ComplexProgramTarget (program) - * ComplexProgramTarget_1 (program,locallib,syslib) - * ComplexProgramTarget_2 (program,locallib,syslib) - * ComplexProgramTarget_3 (program,locallib,syslib) - * ServerTarget (server,subdirs,objects,libs,syslibs) - * InstallLibrary (libname,dest) - * InstallSharedLibrary (libname,rev,dest) - * InstallLibraryAlias (libname,alias,dest) - * InstallLintLibrary (libname,dest) - * InstallManPageLong (file,destdir,dest) - * InstallManPage (file,dest) - * InstallNonExec (file,dest) - * InstallProgram (program,dest) - * InstallProgramWithFlags (program,dest,flags) - * InstallScript (program,dest) - * LinkFileList (step,list,dir,sub) - * InstallMultipleDestFlags (step,list,dest,flags) - * InstallMultipleDest (step,list,dest) - * InstallMultiple (list,dest) - * InstallMultipleFlags (list,dest,flags) - * InstallMultipleMan (list,dest) - * InstallAppDefaults (class) - * DependDependency () - * DependTarget () - * CleanTarget () - * TagsTarget () - * ImakeDependency (target) - * BuildMakefileTarget (imakefile,imakeflags) - * MakefileTarget () - * NormalLibraryObjectRule () - * ProfiledLibraryObjectRule () - * DebuggedLibraryObjectRule () - * DebuggedAndProfiledLibraryObjectRule () - * SharedLibraryObjectRule () - * SharedAndDebuggedLibraryObjectRule () - * SpecialObjectRule (objs,depends,options) - * SpecialProfiledObjectRule (objs,depends,options) - * SpecialDebuggedObjectRule (objs,depends,options) - * SpecialDebuggedAndProfiledObjectRule (objs,depends,options) - * NormalLibraryTarget (libname,objlist) - * NormalSharedLibraryTarget (libname,rev,solist,salist) - * NormalLibraryTarget2 (libname,objlist1,objlist2) - * ProfiledLibraryTarget (libname,objlist) - * DebuggedLibraryTarget (libname,objlist) - * AliasedLibraryTarget (libname,alias) - * NormalRelocatableTarget (objname,objlist) - * ProfiledRelocatableTarget (objname,objlist) - * DebuggedRelocatableTarget (objname,objlist) - * LintLibraryTarget (libname,srclist) - * NormalLintTarget (srclist) - * LintTarget () - * MakeSubincludesForBuild (step,dir,srclist) - * NamedTargetSubdirs (name,dirs,verb,flags,subname) - * MakeSubdirs (dirs) - * NamedMakeSubdirs (name,dirs) - * DependSubdirs (dirs) - * InstallSubdirs (dirs) - * InstallManSubdirs (dirs) - * NamedIncludesSubdirs (name,dirs) - * IncludesSubdirs (dirs) - * NamedCleanSubdirs (name,dirs) - * CleanSubdirs (dirs) - * NamedTagSubdirs (name,dirs) - * TagSubdirs (dirs) - * MakeLintSubdirs (dirs,target,subtarget) - * LintSubdirs (dirs) - * MakeLintLibSubdirs (dirs) - * MakeMakeSubdirs (dirs,target) - * MakeNsubdirMakefiles () - * MakefileSubdirs (dirs) - * CppScriptTarget (dst,src,defs,deplist) - * MakeScriptFromCpp (name,defs) - * MakeDirectories (step,dirs) - * MakeFonts () - * InstallFonts (dest) - * InstallFontAliases (dest) - * FontTarget (basename) - * CompressedFontTarget (basename) - * AllTarget (depends) - * DoRanlib (flags,files) - * + * The following macros are defined for the various templates and Imakefiles + * (for a list of the applicable make variables, see the template files): * - * The general linking for building programs is: + * SaberProgramTarget (program,srclist,objlist,locallibs,syslibs) + * RemoveTargetProgram (program) + * MakeDir (dir) + * BuildIncludes (srclist,dstsubdir,dstupdir) + * NormalProgramTarget (program,objects,deplibs,locallibs,syslibs) + * SetUIDProgramTarget (program,objects,deplibs,locallibs,syslibs) + * SingleProgramTarget (program,objects,locallibs,syslibs) + * SimpleProgramTarget (program) + * ComplexProgramTarget (program) + * ComplexProgramTarget_1 (program,locallib,syslib) + * ComplexProgramTarget_2 (program,locallib,syslib) + * ComplexProgramTarget_3 (program,locallib,syslib) + * ServerTarget (server,subdirs,objects,libs,syslibs) + * RanLibrary (args) + * InstallLibrary (libname,dest) + * MergeIntoInstalledLibrary (tolib,fromlib) + * InstallLibraryAlias (libname,alias,dest) + * InstallLintLibrary (libname,dest) + * InstallManPageLong (file,destdir,dest) + * InstallManPage (file,destdir) + * InstallManPageAliases (file,destdir,aliases) + * InstallNamedNonExec (srcname,dstname,dest) + * InstallNonExecFile (file,dest) + * InstallNonExec (file,dest) + * InstallProgramWithFlags (program,dest,flags) + * InstallProgram (program,dest) + * InstallScript (program,dest) + * InstallNamedProg (srcname,dstname,dest) + * LinkFileList (step,list,dir,sub) + * InstallMultipleDestFlags (step,list,dest,flags) + * InstallMultipleDest (step,list,dest) + * InstallMultiple (list,dest) + * InstallMultipleFlags (list,dest,flags) + * InstallMultipleMan (list,dest) + * InstallAppDefaults (class) + * InstallAppDefaultsLong (file,class) + * DependDependency () + * DependTarget () + * DependTarget3 (srcs1,srcs2,srcs3) + * CleanTarget () + * TagsTarget () + * ImakeDependency (target) + * BuildMakefileTarget (notused,imakeflags) + * MakefileTarget () + * LibMkdir (dir) + * LibCleanDir (dir) + * ObjectCompile (options) + * NormalLibObjCompile (options) + * NormalSharedLibObjCompile (options) + * LibObjCompile (dir,options) + * DebuggedLibObjCompile (options) + * ProfiledLibObjCompile (options) + * SharedLibObjCompile (options) + * NormalLibraryObjectRule () + * NormalFortranObjectRule () + * ObjectFromSpecialSource (dst,src,flags) + * SpecialObjectRule (objs,depends,options) + * NormalLibraryTarget (libname,objlist) + * NormalLibraryTarget2 (libname,objlist1,objlist2) + * NormalLibraryTarget3 (libname,objlist1,objlist2,objlist3) + * NormalDepLibraryTarget (libname,deplist,objlist) + * SubdirLibraryRule (objlist) + * ProfiledLibraryTarget (libname,objlist) + * DebuggedLibraryTarget (libname,objlist) + * AliasedLibraryTarget (libname,alias) + * NormalRelocatableTarget (objname,objlist) + * ProfiledRelocatableTarget (objname,objlist) + * DebuggedRelocatableTarget (objname,objlist) + * LintLibraryTarget (libname,srclist) + * NormalLintTarget (srclist) + * LintTarget () + * LinkSourceFile (src,dir) + * LinkFile (tofile,fromfile) + * MakeSubincludesForBuild (step,dir,srclist) + * NamedTargetSubdirs (name,dirs,verb,flags,subname) + * NamedMakeSubdirs (name,dirs) + * MakeSubdirs (dirs) + * DependSubdirs (dirs) + * ForceSubdirs (dirs) + * InstallSubdirs (dirs) + * InstallManSubdirs (dirs) + * IncludesSubdirs (dirs) + * NamedCleanSubdirs (name,dirs) + * CleanSubdirs (dirs) + * NamedTagSubdirs (name,dirs) + * TagSubdirs (dirs) + * MakeLintSubdirs (dirs,target,subtarget) + * LintSubdirs (dirs) + * MakeLintLibSubdirs (dirs) + * MakeMakeSubdirs (dirs,target) + * MakeNsubdirMakefiles () + * MakefileSubdirs (dirs) + * CppScriptTarget (dst,src,defs,deplist) + * MakeScriptFromCpp (name,defs) + * CppFileTarget (dst,src,defs,deplist) + * MakeDirectories (step,dirs) + * MakeFontsDir (deplist) + * MakeFonts () + * InstallFontObjs (objs,dest) + * InstallFonts (dest) + * InstallFontAliases (dest) + * FontSrc (basename) + * FontBaseObj (basename) + * InstallFontScale (dest) + * UncompressedFontTarget (basename) + * UncompressedFontTarget (basename) + * CompressedFontTarget (basename) + * FontTarget (basename) + * FontObj (basename) + * AllTarget (depends) + * + * + * The following are in Imake.tmpl: + * + * Concat (a,b) + * Concat3 (a,b,c) * - * program-objects programlibs syslibs EXTRA_LIBRARIES systemlibs \ - * EXTRA_LOAD_FLAGS * - * where programlibs is LOCAL_LIBRARIES for ComplexProgramTarget - * and EXTRA comes with syslibs from the LDLIBS + * The following are in specific Lib.rules: + * + * SharedLibraryTarget (libname,rev,solist,down,up) + * SharedLibraryDataTarget (libname,rev,salist) + * InstallSharedLibrary (libname,rev,dest) + * InstallSharedLibraryData (libname,rev,dest) + * */ +#define NullParameter +/* if [ -d ] or [ ! -d ] causes make to fail, define this as - */ +#ifndef DirFailPrefix +#define DirFailPrefix +#endif /* * SaberProgramTarget - generate rules to make Saber-C read in sources and @@ -122,11 +158,11 @@ #ifndef SaberProgramTarget #if HasSaberC #define SaberProgramTarget(program,srclist,objlist,locallibs,syslibs) @@\ -saber_/**/program: @@\ - #load $(ALLDEFINES) srclist locallibs $(SYS_LIBRARIES) $(EXTRA_LIBRARIES) syslibs @@\ +Concat(saber_,program):: srclist @@\ + XCOMM load $(ALLDEFINES) srclist locallibs $(SYS_LIBRARIES) $(EXTRA_LIBRARIES) syslibs @@\ @@\ -osaber_/**/program: @@\ - #load $(ALLDEFINES) objlist locallibs $(SYS_LIBRARIES) $(EXTRA_LIBRARIES) syslibs +Concat(osaber_,program):: objlist @@\ + XCOMM load $(ALLDEFINES) objlist locallibs $(SYS_LIBRARIES) $(EXTRA_LIBRARIES) syslibs #else #define SaberProgramTarget(program,srclist,objlist,locallibs,syslibs) /**/ @@ -136,16 +172,21 @@ osaber_/**/program: @@\ #ifndef RemoveTargetProgram #if RemoveTargetProgramByMoving #define RemoveTargetProgram(program) \ -$(RM) program; if [ -f program ]; then $(MV) program program/**/~; fi +if [ -f program ]; then $(RM) Concat(program,~); $(MV) program Concat(program,~); fi #else #define RemoveTargetProgram(program) $(RM) program #endif #endif +#ifndef MakeDir +#define MakeDir(dir) DirFailPrefix@if [ -d dir ]; then set +x; \ @@\ + else (set -x; $(MKDIRHIER) dir); fi +#endif + #ifndef BuildIncludes #define BuildIncludes(srclist,dstsubdir,dstupdir) @@\ includes:: @@\ - $(MKDIRHIER) $(BUILDINCDIR)/dstsubdir @@\ + MakeDir($(BUILDINCDIR)/dstsubdir) @@\ @(set -x; cd $(BUILDINCDIR)/dstsubdir; for i in srclist; do \ @@\ $(RM) $$i; \ @@\ $(LN) $(BUILDINCTOP)/dstupdir/$(CURRENT_DIR)/$$i .; \ @@\ @@ -168,13 +209,18 @@ clean:: @@\ #endif /* NormalProgramTarget */ +#ifndef SetUIDProgramTarget +#define SetUIDProgramTarget NormalProgramTarget +#endif + + /* - * SingleProgramTarget - obsolete version of NormalProgramTarget that doesn't have - * deplibs. + * SingleProgramTarget - obsolete version of NormalProgramTarget that does + * not have deplibs. */ #ifndef SingleProgramTarget #define SingleProgramTarget(program,objects,locallibs,syslibs) @@\ -NormalProgramTarget(program,objects, /**/,locallibs,syslibs) +NormalProgramTarget(program,objects,NullParameter,locallibs,syslibs) #endif /* SingleProgramTarget */ /* @@ -208,7 +254,7 @@ program: $(OBJS) $(DEPLIBS) @@\ RemoveTargetProgram($@) @@\ $(CC) -o $@ $(OBJS) $(LDOPTIONS) $(LOCAL_LIBRARIES) $(LDLIBS) $(EXTRA_LOAD_FLAGS) @@\ @@\ -SaberProgramTarget(program,$(SRCS),$(OBJS),$(LOCAL_LIBRARIES), /**/) @@\ +SaberProgramTarget(program,$(SRCS),$(OBJS),$(LOCAL_LIBRARIES),NullParameter) @@\ @@\ InstallProgram(program,$(BINDIR)) @@\ InstallManPage(program,$(MANDIR)) @@\ @@ -289,14 +335,39 @@ InstallManPage(program,$(MANDIR)) #endif /* ComplexProgramTarget_3 */ + +/* + * ServerTarget - generate rules to compile, link, and relink an X server. + */ +#ifndef ServerTarget +#define ServerTarget(server,subdirs,objects,libs,syslibs) @@\ +server: subdirs objects libs @@\ + -@if [ -f server ]; then set -x; \ @@\ + $(MV) server server.bak; else exit 0; fi @@\ + $(CC) $(CDEBUGFLAGS) $(CCOPTIONS) -o server objects libs $(EXTRA_LIBRARIES) syslibs $(EXTRA_LOAD_FLAGS) @@\ + @@\ +Concat(load,server): @@\ + -@if [ -f server ]; then set -x; \ @@\ + $(MV) server server.bak; else exit 0; fi @@\ + $(CC) $(CDEBUGFLAGS) $(CCOPTIONS) -o server objects libs $(EXTRA_LIBRARIES) syslibs $(EXTRA_LOAD_FLAGS) +#endif /* ServerTarget */ + + +#if DoRanlibCmd +#define RanLibrary(args) $(RANLIB) args +#else +#define RanLibrary(args) /**/ +#endif + /* * InstallLibrary - generate rules to install the indicated library. */ #ifndef InstallLibrary #define InstallLibrary(libname,dest) @@\ -install:: lib/**/libname.a @@\ - $(INSTALL) -c $(INSTLIBFLAGS) lib/**/libname.a dest @@\ - $(RANLIB) $(RANLIBINSTFLAGS) dest/lib/**/libname.a +install:: Concat(lib,libname.a) @@\ + MakeDir($(DESTDIR)dest) @@\ + $(INSTALL) -c $(INSTLIBFLAGS) Concat(lib,libname.a) $(DESTDIR)dest @@\ + RanLibrary($(RANLIBINSTFLAGS) Concat($(DESTDIR)dest/lib,libname.a)) #endif /* InstallLibrary */ /* @@ -305,30 +376,9 @@ install:: lib/**/libname.a @@\ #ifndef MergeIntoInstalledLibrary #define MergeIntoInstalledLibrary(tolib,fromlib) @@\ install:: fromlib @@\ - $(SCRIPTSRC)/mergelib tolib fromlib + $(SCRIPTSRC)/mergelib $(DESTDIR)tolib fromlib #endif /* MergeIntoInstalledLibrary */ -/* - * InstallSharedLibrary - generate rules to install the shared library. - */ -#ifndef InstallSharedLibrary -#define InstallSharedLibrary(libname,rev,dest) @@\ -install:: lib/**/libname.so.rev @@\ - $(INSTALL) -c $(INSTLIBFLAGS) lib/**/libname.so.rev dest @@\ - -#endif /* InstallSharedLibrary */ - -/* - * InstallSharedLibraryData - generate rules to install the shared library data - */ -#ifndef InstallSharedLibraryData -#define InstallSharedLibraryData(libname,rev,dest) @@\ -install:: lib/**/libname.sa.rev @@\ - $(INSTALL) -c $(INSTLIBFLAGS) lib/**/libname.sa.rev dest - -#endif /* InstallSharedLibraryData */ - - /* * InstallLibraryAlias - generate rules to create a link from one library name * to another for the purposes of aliasing. @@ -336,7 +386,9 @@ install:: lib/**/libname.sa.rev @@\ #ifndef InstallLibraryAlias #define InstallLibraryAlias(libname,alias,dest) @@\ install:: @@\ - -(cd dest; $(LN) lib/**/libname.a lib/**/alias.a) + -(cd $(DESTDIR)dest; \ @@\ + $(RM) Concat(lib,alias.a); \ @@\ + $(LN) Concat(lib,libname.a) Concat(lib,alias.a)) #endif /* InstallLibraryAlias */ @@ -345,8 +397,9 @@ install:: @@\ */ #ifndef InstallLintLibrary #define InstallLintLibrary(libname,dest) @@\ -install.ln:: llib-l/**/libname.ln @@\ - $(INSTALL) -c $(INSTLIBFLAGS) llib-l/**/libname.ln dest +install.ln:: Concat(llib-l,libname.ln) @@\ + MakeDir($(DESTDIR)dest) @@\ + $(INSTALL) -c $(INSTLIBFLAGS) Concat(llib-l,libname.ln) $(DESTDIR)dest #endif /* InstallLintLibrary */ @@ -360,7 +413,8 @@ install.ln:: llib-l/**/libname.ln @@\ #ifndef InstallManPageLong #define InstallManPageLong(file,destdir,dest) @@\ install.man:: file.man @@\ - $(INSTALL) -c $(INSTMANFLAGS) file.man destdir/dest.ManSuffix + MakeDir($(DESTDIR)destdir) @@\ + $(INSTALL) -c $(INSTMANFLAGS) file.man $(DESTDIR)destdir/dest.$(MANSUFFIX) #endif /* InstallManPageLong */ @@ -368,19 +422,57 @@ install.man:: file.man @@\ * InstallManPage - generate rules to install the indicated manual page. */ #ifndef InstallManPage -#define InstallManPage(file,dest) @@\ -InstallManPageLong(file,dest,file) +#define InstallManPage(file,destdir) @@\ +InstallManPageLong(file,destdir,file) #endif /* InstallManPage */ /* - * InstallNonExec - generate rules to install a data file using any special - * install flags + * InstallManPageAliases - generate rules to install manual page aliases. + */ +#ifndef InstallManPageAliases +#define InstallManPageAliases(file,destdir,aliases) @@\ +install.man:: @@\ + @(TMP=/tmp/tmp.$$$$; \ @@\ + $(RM) $${TMP}; \ @@\ + echo .so `basename destdir`/file.$(MANSUFFIX) > $${TMP}; \ @@\ + for i in aliases; do (set -x; \ @@\ + $(INSTALL) -c $(INSTMANFLAGS) $${TMP} $(DESTDIR)destdir/$$i.$(MANSUFFIX)); \ @@\ + done; \ @@\ + $(RM) $${TMP}) +#endif /* InstallManPageAliases */ + + +/* + * InstallNamedNonExec - generate rules to install a data file + */ +#ifndef InstallNamedNonExec +#define InstallNamedNonExec(srcname,dstname,dest) @@\ +install:: srcname @@\ + MakeDir($(DESTDIR)dest) @@\ + $(INSTALL) -c $(INSTDATFLAGS) srcname $(DESTDIR)dest/dstname +#endif /* InstallNamedNonExec */ + + +/* + * InstallNonExecFile - generate rules to install a data file + */ +#ifndef InstallNonExecFile +#define InstallNonExecFile(file,dest) @@\ +install:: file @@\ + MakeDir($(DESTDIR)dest) @@\ + $(INSTALL) -c $(INSTDATFLAGS) file $(DESTDIR)dest +#endif /* InstallNonExecFile */ + + +/* + * InstallNonExec - generate rules to install a data file, but does not + * try to create the destination directory (deprecated) */ #ifndef InstallNonExec #define InstallNonExec(file,dest) @@\ install:: file @@\ - $(INSTALL) -c $(INSTDATFLAGS) file dest + $(INSTALL) -c $(INSTDATFLAGS) file $(DESTDIR)dest #endif /* InstallNonExec */ @@ -391,7 +483,8 @@ install:: file @@\ #ifndef InstallProgramWithFlags #define InstallProgramWithFlags(program,dest,flags) @@\ install:: program @@\ - $(INSTALL) -c $(INSTPGMFLAGS) flags program dest + MakeDir($(DESTDIR)dest) @@\ + $(INSTALL) -c $(INSTPGMFLAGS) flags program $(DESTDIR)dest #endif /* InstallProgramWithFlags */ @@ -401,22 +494,33 @@ install:: program @@\ */ #ifndef InstallProgram #define InstallProgram(program,dest) @@\ -InstallProgramWithFlags(program,dest/program, /**/) +InstallProgramWithFlags(program,dest,NullParameter) #endif /* InstallProgram */ /* - * InstallScript - install a shell script using special install flags set in - * $(INSTALLFLAGS). This macro has been superceeded by CppScriptTarget. + * InstallScript - install a shell script. */ #ifndef InstallScript #define InstallScript(program,dest) @@\ install:: program.script @@\ - $(INSTALL) -c $(INSTSCRFLAGS) program.script dest/program + MakeDir($(DESTDIR)dest) @@\ + $(INSTALL) -c $(INSTBINFLAGS) program.script $(DESTDIR)dest/program #endif /* InstallScript */ +/* + * InstallNamedProg - install a program with renaming and no stripping. + */ +#ifndef InstallNamedProg +#define InstallNamedProg(srcname,dstname,dest) @@\ +install:: srcname @@\ + MakeDir($(DESTDIR)dest) @@\ + $(INSTALL) -c $(INSTBINFLAGS) srcname $(DESTDIR)dest/dstname +#endif /* InstallNamedProg */ + + /* * LinkFileList - link a list of list of files from one place to another */ @@ -424,7 +528,8 @@ install:: program.script @@\ #define LinkFileList(step,list,dir,sub) @@\ step:: list @@\ @case '${MFLAGS}' in *[i]*) set +e;; esac; \ @@\ - echo " cd" dir; cd dir; for i in list; do (set -x; $(LN) sub/$$i .); done + echo " cd" dir; cd dir; \ @@\ + for i in list; do (set -x; $(RM) $$i; $(LN) sub/$$i .); done #endif @@ -436,9 +541,10 @@ step:: list @@\ #ifndef InstallMultipleDestFlags #define InstallMultipleDestFlags(step,list,dest,flags) @@\ step:: list @@\ + MakeDir($(DESTDIR)dest) @@\ @case '${MFLAGS}' in *[i]*) set +e;; esac; \ @@\ for i in list; do \ @@\ - (set -x; $(INSTALL) -c flags $$i dest); \ @@\ + (set -x; $(INSTALL) -c flags $$i $(DESTDIR)dest); \ @@\ done #endif /* InstallMultipleDestFlags */ @@ -480,10 +586,43 @@ InstallMultipleDestFlags(install,list,dest,flags) */ #ifndef InstallMultipleMan #define InstallMultipleMan(list,dest) @@\ -InstallMultipleDest(install.man,list,dest) +InstallMultipleDestFlags(install.man,list,dest,$(INSTMANFLAGS)) #endif /* InstallMultipleMan */ +/* + * InstallAppDefaults - generate rules to install appliation default files + * if the InstallAppDefFiles configuration parameter is set. + */ +#ifndef InstallAppDefaults +#if InstallAppDefFiles +#define InstallAppDefaults(class) @@\ +install:: class.ad @@\ + MakeDir($(DESTDIR)$(XAPPLOADDIR)) @@\ + $(INSTALL) -c $(INSTAPPFLAGS) class.ad $(DESTDIR)$(XAPPLOADDIR)/class +#else +#define InstallAppDefaults(class) +#endif /* InstallAppDefFiles */ +#endif /* InstallAppDefaults */ + +/* + * InstallAppDefaultsLong - generate rules to install appliation default files + * if the InstallAppDefFiles configuration parameter is set. + */ +#ifndef InstallAppDefaultsLong +#if InstallAppDefFiles +#define InstallAppDefaultsLong(file,class) @@\ +install:: file.ad @@\ + MakeDir($(DESTDIR)$(XAPPLOADDIR)) @@\ + $(INSTALL) -c $(INSTAPPFLAGS) file.ad $(DESTDIR)$(XAPPLOADDIR)/class +#else +#define InstallAppDefaultsLong(file,class) +#endif /* InstallAppDefFiles */ +#endif /* InstallAppDefaultsLong */ + + + + /* * DependDependency - generate rules to build the makedepend program if * this Imakefile is within the source tree. @@ -513,10 +652,24 @@ $(DEPEND): @@\ DependDependency() @@\ @@\ depend:: @@\ - $(DEPEND) -s "# DO NOT DELETE" -- $(ALLDEFINES) $(MDFLAGS) -- $(SRCS) + $(DEPEND) $(DEPENDFLAGS) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- $(SRCS) #endif /* DependTarget */ +/* + * DependTarget3 - generate rules to compute dependencies for all files given. + */ +#ifndef DependTarget3 +#define DependTarget3(srcs1,srcs2,srcs3) @@\ +DependDependency() @@\ + @@\ +depend:: @@\ + $(DEPEND) $(DEPENDFLAGS) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- srcs1 @@\ + $(DEPEND) -a $(DEPENDFLAGS) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- srcs2 @@\ + $(DEPEND) -a $(DEPENDFLAGS) -s "# DO NOT DELETE" -- $(ALLDEFINES) -- srcs3 +#endif /* DependTarget3 */ + + /* * CleanTarget - generate rules to remove any garbage files; the #* is here * instead of in the definition of RM_CMD because System V will treat the @@ -525,7 +678,7 @@ depend:: @@\ #ifndef CleanTarget #define CleanTarget() @@\ clean:: @@\ - $(RM_CMD) \#* + $(RM_CMD) "#"* #endif /* CleanTarget */ @@ -536,7 +689,7 @@ clean:: @@\ #define TagsTarget() @@\ tags:: @@\ $(TAGS) -w *.[ch] @@\ - $(ETAGS) *.[ch] + $(TAGS) -xw *.[ch] > TAGS #endif /* TagsTarget */ @@ -547,7 +700,7 @@ tags:: @@\ #ifndef ImakeDependency #ifdef UseImakeInstalled #define ImakeDependency(target) @@\ -target:: Imakefile +target:: #else #define ImakeDependency(target) @@\ $(IMAKE): @@\ @@ -557,7 +710,7 @@ $(IMAKE): @@\ $(MAKE) -f Makefile.ini BOOTSTRAPCFLAGS=$(BOOTSTRAPCFLAGS); fi; \ @@\ echo "okay, continuing in $(CURRENT_DIR)") @@\ @@\ -target:: $(IMAKE) Imakefile +target:: $(IMAKE) #endif /* UseImakeInstalled */ #endif /* ImakeDependency */ @@ -590,246 +743,118 @@ noop:: @@\ */ #ifndef MakefileTarget #define MakefileTarget() @@\ -BuildMakefileTarget(Imakefile, /**/) +BuildMakefileTarget(Imakefile,NullParameter) #endif /* MakefileTarget */ /* - * NormalLibraryObjectRule - generate make rules to build "normal" objects. + * LibMkdir - helper for creating library object subdirectories */ -#ifndef NormalLibraryObjectRule -#define NormalLibraryObjectRule() @@\ -.c.o: @@\ - $(RM) $@ @@\ - $(CC) -c $(CFLAGS) $(SRCDIR)$*.c -#endif /* NormalLibraryObjectRule */ - -#ifndef NormalFortranObjectRule -#define NormalFortranObjectRule() @@\ -.f.o: @@\ - $(RM) $@ @@\ - $(FC) -c $(FCFLAGS) $*.f +#ifndef LibMkdir +#define LibMkdir(dir) DirFailPrefix@if [ -d dir ]; then exit 0; else set -x; mkdir dir; fi #endif - /* - * ProfiledLibraryObjectRule - generate make rules to build both profiled - * and "normal" objects. + * LibCleanDir - helper for cleaning library object subdirectories */ -#ifndef ProfiledLibraryObjectRule -#define ProfiledLibraryObjectRule() @@\ -all:: @@\ - @if [ ! -d profiled ]; then mkdir profiled; else exit 0; fi @@\ - @@\ -.c.o: @@\ - $(RM) $@ profiled/$@ @@\ - $(CC) -pg -c $(CFLAGS) $(SRCDIR)$*.c @@\ - $(MV) $*.o profiled/$*.o @@\ - $(CC) -c $(CFLAGS) $(SRCDIR)$*.c @@\ - @@\ -clean:: @@\ - -@if [ -d profiled ]; then echo " $(RM) profiled/?*.o"; \ @@\ - $(RM) profiled/?*.o; else exit 0; fi @@\ - -#endif /* ProfiledLibraryObjectRule */ - +#ifndef LibCleanDir +#define LibCleanDir(dir) -@if [ -d dir ]; then \ @@\ + (set -x; cd dir; $(RM) *.o); else exit 0; fi +#endif /* - * DebuggedLibraryObjectRule - generate make rules to build both debuggable - * and "normal" objects. + * ObjectCompile - compile fragment for a normal object file */ -#ifndef DebuggedLibraryObjectRule -#define DebuggedLibraryObjectRule() @@\ -all:: @@\ - @if [ ! -d debugger ]; then mkdir debugger; else exit 0; fi @@\ - @@\ -.c.o: @@\ - $(RM) $@ debugger/$@ @@\ - $(CC) -g -c $(CFLAGS) $(SRCDIR)$*.c @@\ - $(MV) $*.o debugger/$*.o @@\ - $(CC) -c $(CFLAGS) $(SRCDIR)$*.c @@\ - @@\ -clean:: @@\ - -@if [ -d debugger ]; then echo " $(RM) debugger/?*.o"; \ @@\ - $(RM) debugger/?*.o; else exit 0; fi @@\ - -#endif /* DebuggedLibraryObjectRule */ - +#ifndef ObjectCompile +#define ObjectCompile(options) $(RM) $@ @@\ + $(CC) -c $(CFLAGS) options $*.c +#endif /* - * DebuggedAndProfiledLibraryOjbectRule - generate make rules to build - * debuggable, profiled, and "normal" objects. + * NormalLibObjCompile - compile fragment for a normal library object file */ -#ifndef DebuggedAndProfiledLibraryObjectRule -#define DebuggedAndProfiledLibraryObjectRule() @@\ -all:: @@\ - @if [ ! -d profiled ]; then mkdir profiled; else exit 0; fi @@\ - @if [ ! -d debugger ]; then mkdir debugger; else exit 0; fi @@\ - @@\ -.c.o: @@\ - $(RM) $@ profiled/$@ debugger/$@ @@\ - $(CC) -pg -c $(CFLAGS) $(SRCDIR)$*.c @@\ - $(MV) $*.o profiled/$*.o @@\ - $(CC) -g -c $(CFLAGS) $(SRCDIR)$*.c @@\ - $(MV) $*.o debugger/$*.o @@\ - $(CC) -c $(CFLAGS) $(SRCDIR)$*.c @@\ - @@\ -clean:: @@\ - -@if [ -d profiled ]; then echo " $(RM) profiled/?*.o"; \ @@\ - $(RM) profiled/?*.o; else exit 0; fi @@\ - -@if [ -d debugger ]; then echo " $(RM) debugger/?*.o"; \ @@\ - $(RM) debugger/?*.o; else exit 0; fi @@\ - -#endif /* DebuggedAndProfiledLibraryObjectRule */ - +#ifndef NormalLibObjCompile +#define NormalLibObjCompile(options) ObjectCompile(options) +#endif /* - * SharedLibraryObjectRule - generate make rules to build shared and "normal" - * object files. + * NormalSharedLibObjCompile - compile fragment for shared object when + * a normal library is not being built */ -#ifndef SharedLibraryObjectRule -#define SharedLibraryObjectRule() @@\ -all:: @@\ - @if [ ! -d shared ]; then mkdir shared; else exit 0; fi @@\ - @@\ -.c.o: @@\ - $(RM) $@ shared/$@ @@\ - $(CC) -pic -c $(SHAREDCODEDEF) $(SHLIBDEF) $(CFLAGS) $(SRCDIR)$*.c @@\ - $(MV) $*.o shared/$*.o @@\ - $(CC) -c $(SHLIBDEF) $(CFLAGS) $(SRCDIR)$*.c @@\ - @@\ -clean:: @@\ - -@if [ -d shared ]; then echo " $(RM) shared/?*.o"; \ @@\ - $(RM) shared/?*.o; else exit 0; fi @@\ - -#endif /* SharedLibraryObjectRule */ +#ifndef NormalSharedLibObjCompile +#define NormalSharedLibObjCompile(options) NormalLibObjCompile(options $(SHLIBDEF) $(SHAREDCODEDEF) $(PICFLAGS)) +#endif /* - * SharedAndDebuggedLibraryObjectRule - generate make rules to build shared, - * debuggable, and "normal" object files. + * LibObjCompile - compile fragment for shared/profiled/debugged objects */ -#ifndef SharedAndDebuggedLibraryObjectRule -#define SharedAndDebuggedLibraryObjectRule() @@\ -all:: @@\ - @if [ ! -d shared ]; then mkdir shared; else exit 0; fi @@\ - @if [ ! -d debugger ]; then mkdir debugger; else exit 0; fi @@\ - @@\ -.c.o: @@\ - $(RM) $@ shared/$@ debugger/$@ @@\ - $(CC) -pic -c $(SHAREDCODEDEF) $(SHLIBDEF) $(CFLAGS) $(SRCDIR)$*.c @@\ - $(MV) $*.o shared/$*.o @@\ - $(CC) -g -c $(SHLIBDEF) $(CFLAGS) $(SRCDIR)$*.c @@\ - $(MV) $*.o debugger/$*.o @@\ - $(CC) -c $(SHLIBDEF) $(CFLAGS) $(SRCDIR)$*.c @@\ - @@\ -clean:: @@\ - -@if [ -d shared ]; then echo " $(RM) shared/?*.o"; \ @@\ - $(RM) shared/?*.o; else exit 0; fi @@\ - -@if [ -d debugger ]; then echo " $(RM) debugger/?*.o"; \ @@\ - $(RM) debugger/?*.o; else exit 0; fi @@\ - -#endif /* SharedAndDebuggedLibraryObjectRule */ +#ifndef LibObjCompile +#define LibObjCompile(dir,options) $(RM) $@ dir/$@ @@\ + $(CC) -c $(CCOPTIONS) $(ALLDEFINES) options $*.c @@\ + $(MV) $@ dir/$@ +#endif /* - * SpecialSharedAndDebuggedObjectRule - generate rules to compile a file - * with special flags and to make shared and debuggable versions. + * DebuggedLibObjCompile - compile fragment for debugged objects */ -#ifndef SpecialSharedAndDebuggedObjectRule -#define SpecialSharedAndDebuggedObjectRule(objs,depends,options) @@\ -all:: @@\ - @if [ ! -d shared ]; then mkdir shared; else exit 0; fi @@\ - @if [ ! -d debugger ]; then mkdir debugger; else exit 0; fi @@\ - @@\ -objs: depends @@\ - $(RM) $@ shared/$@ debugger/$@ @@\ - $(CC) -pic -c $(SHAREDCODEDEF) $(SHLIBDEF) $(CFLAGS) options $*.c @@\ - $(MV) $*.o shared/$*.o @@\ - $(CC) -g -c $(SHLIBDEF) $(CFLAGS) options $*.c @@\ - $(MV) $*.o debugger/$*.o @@\ - $(CC) -c $(SHLIBDEF) $(CFLAGS) options $*.c -#endif /* SpecialDebuggedAndProfiledObjectRule */ - -/* - * SpecialSharedObjectRule - generate rules to compile a file - * with special flags and to make shared and debuggable versions. - */ -#ifndef SpecialSharedObjectRule -#define SpecialSharedObjectRule(objs,depends,options) @@\ -all:: @@\ - @if [ ! -d shared ]; then mkdir shared; else exit 0; fi @@\ - @@\ -objs: depends @@\ - $(RM) $@ shared/$@ @@\ - $(CC) -pic -c $(SHAREDCODEDEF) $(SHLIBDEF) $(CFLAGS) options $*.c @@\ - $(MV) $*.o shared/$*.o @@\ - $(CC) -c $(SHLIBDEF) $(CFLAGS) options $*.c -#endif /* SpecialDebuggedAndProfiledObjectRule */ - - +#ifndef DebuggedLibObjCompile +#define DebuggedLibObjCompile(options) LibObjCompile(debugger,-g options) +#endif /* - * SpecialObjectRule - generate rules to compile a file with special flags. + * ProfiledLibObjCompile - compile fragment for profiled objects */ -#ifndef SpecialObjectRule -#define SpecialObjectRule(objs,depends,options) @@\ -objs: depends @@\ - $(RM) $@ @@\ - $(CC) -c $(CFLAGS) options $*.c -#endif /* SpecialObjectRule */ - +#ifndef ProfiledLibObjCompile +#define ProfiledLibObjCompile(options) LibObjCompile(profiled,-pg options) +#endif /* - * SpecialProfiledObjectRule - generate rules to compile a file with special - * flags and to make a profiled version. + * SharedLibObjCompile - compile fragment for shared objects */ -#ifndef SpecialProfiledObjectRule -#define SpecialProfiledObjectRule(objs,depends,options) @@\ -all:: @@\ - @if [ ! -d profiled ]; then mkdir profiled; else exit 0; fi @@\ - @@\ -objs: depends @@\ - $(RM) $@ profiled/$@ @@\ - $(CC) -pg -c $(CFLAGS) options $*.c @@\ - $(MV) $*.o profiled/$*.o @@\ - $(CC) -c $(CFLAGS) options $*.c -#endif /* SpecialProfiledObjectRule */ - +#ifndef SharedLibObjCompile +#define SharedLibObjCompile(options) LibObjCompile(shared,options $(SHLIBDEF) $(SHAREDCODEDEF) $(PICFLAGS) $(CDEBUGFLAGS)) +#endif /* - * SpecialDebuggedObjectRule - generate rules to compile a file with special - * flags and to make a debuggable version. + * NormalLibraryObjectRule - for simple libraries */ -#ifndef SpecialDebuggedObjectRule -#define SpecialDebuggedObjectRule(objs,depends,options) @@\ -all:: @@\ - @if [ ! -d debugger ]; then mkdir debugger; else exit 0; fi @@\ - @@\ -objs: depends @@\ - $(RM) $@ debugger/$@ @@\ - $(CC) -g -c $(CFLAGS) options $*.c @@\ - $(MV) $*.o debugger/$*.o @@\ - $(CC) -c $(CFLAGS) options $*.c -#endif /* SpecialDebuggedObjectRule */ +#ifndef NormalLibraryObjectRule +#define NormalLibraryObjectRule() @@\ +.c.o: @@\ + ObjectCompile($(_NOOP_)) +#endif /* NormalLibraryObjectRule */ + +#ifndef NormalFortranObjectRule +#define NormalFortranObjectRule() @@\ +.f.o: @@\ + $(RM) $@ @@\ + $(FC) -c $(FCFLAGS) $*.f +#endif + +#ifndef ObjectFromSpecialSource +#define ObjectFromSpecialSource(dst,src,flags) @@\ +dst.c: src.c @@\ + $(RM) $@ @@\ + $(LN) $? $@ @@\ + @@\ +dst.o: dst.c @@\ + ObjectCompile(flags) @@\ + @@\ +depend:: dst.c @@\ + @@\ +clean:: @@\ + $(RM) dst.c +#endif /* ObjectFromSpecialSource */ /* - * SpecialDebuggedAndProfiledObjectRule - generate rules to compile a file - * with special flags and to make debuggable and profiled versions. + * SpecialObjectRule - generate rules to compile a file with special flags. */ -#ifndef SpecialDebuggedAndProfiledObjectRule -#define SpecialDebuggedAndProfiledObjectRule(objs,depends,options) @@\ -all:: @@\ - @if [ ! -d profiled ]; then mkdir profiled; else exit 0; fi @@\ - @if [ ! -d debugger ]; then mkdir debugger; else exit 0; fi @@\ - @@\ +#ifndef SpecialObjectRule +#define SpecialObjectRule(objs,depends,options) @@\ objs: depends @@\ - $(RM) $@ profiled/$@ debugger/$@ @@\ - $(CC) -pg -c $(CFLAGS) options $*.c @@\ - $(MV) $*.o profiled/$*.o @@\ - $(CC) -g -c $(CFLAGS) options $*.c @@\ - $(MV) $*.o debugger/$*.o @@\ - $(CC) -c $(CFLAGS) options $*.c -#endif /* SpecialDebuggedAndProfiledObjectRule */ + ObjectCompile(options) +#endif /* SpecialObjectRule */ /* @@ -837,73 +862,75 @@ objs: depends @@\ */ #ifndef NormalLibraryTarget #define NormalLibraryTarget(libname,objlist) @@\ -AllTarget(lib/**/libname.a) @@\ -DependTarget() @@\ +AllTarget(Concat(lib,libname.a)) @@\ @@\ -lib/**/libname.a: objlist @@\ +Concat(lib,libname.a): objlist @@\ $(RM) $@ @@\ $(AR) $@ objlist @@\ - $(RANLIB) $@ + RanLibrary($@) #endif /* NormalLibraryTarget */ /* - * NormalSharedLibraryTarget - generate rules to create a shared library; - * build it into a different name so that the we don't hose people by having - * the library gone for long periods. + * NormalLibraryTarget2 - generate rules to create a library in two steps. + * This is used to create libraries with large numbers of files. */ -#ifndef NormalSharedLibraryTarget -#define NormalSharedLibraryTarget(libname,rev,solist) @@\ -AllTarget(lib/**/libname.so.rev) @@\ - @@\ -lib/**/libname.so.rev: solist @@\ - $(RM) $@~ @@\ - (cd shared; $(LD) -o ../$@~ -assert pure-text solist) @@\ - $(RM) $@ @@\ - $(MV) $@~ $@ @@\ +#ifndef NormalLibraryTarget2 +#define NormalLibraryTarget2(libname,objlist1,objlist2) @@\ +AllTarget(Concat(lib,libname.a)) @@\ @@\ -clean:: @@\ - $(RM) lib/**/libname.so.rev +Concat(lib,libname.a): objlist1 objlist2 @@\ + $(RM) $@ @@\ + $(AR) $@ objlist1 @@\ + $(AR) $@ objlist2 @@\ + RanLibrary($@) +#endif /* NormalLibraryTarget2 */ -#endif /* - * NormalSharedLibraryDataTarget - generate rules to create shlib data file; - * build it into a different name so that the we don't hose people by having - * the library gone for long periods. + * NormalLibraryTarget3 - generate rules to create a library in three steps. + * This is used to create libraries with very large numbers of files. */ -#ifndef NormalSharedLibraryDataTarget -#define NormalSharedLibraryDataTarget(libname,rev,salist) @@\ -AllTarget(lib/**/libname.sa.rev) @@\ +#ifndef NormalLibraryTarget3 +#define NormalLibraryTarget3(libname,objlist1,objlist2,objlist3) @@\ +AllTarget(Concat(lib,libname.a)) @@\ @@\ -lib/**/libname.sa.rev: salist @@\ +Concat(lib,libname.a): objlist1 objlist2 objlist3 @@\ $(RM) $@ @@\ - $(AR) $@ salist @@\ - $(RANLIB) $@ @@\ - @@\ -clean:: @@\ - $(RM) lib/**/libname.sa.rev - -#endif /* NormalSharedLibraryTarget */ - + $(AR) $@ objlist1 @@\ + $(AR) $@ objlist2 @@\ + $(AR) $@ objlist3 @@\ + RanLibrary($@) +#endif /* NormalLibraryTarget3 */ +/* + * NormalDepLibraryTarget - generate rules to create a library. + */ +#ifndef NormalDepLibraryTarget +#define NormalDepLibraryTarget(libname,deplist,objlist) @@\ +AllTarget(Concat(lib,libname.a)) @@\ + @@\ +Concat(lib,libname.a): deplist @@\ + $(RM) $@ @@\ + $(AR) $@ objlist @@\ + RanLibrary($@) +#endif /* NormalDepLibraryTarget */ /* - * NormalLibraryTarget2 - generate rules to create a library in two steps. - * This is used to create libraries with large numbers of files. + * SubdirLibraryRule - */ -#ifndef NormalLibraryTarget2 -#define NormalLibraryTarget2(libname,objlist1,objlist2) @@\ -AllTarget(lib/**/libname.a) @@\ +#ifndef SubdirLibraryRule +#define SubdirLibraryRule(objlist) @@\ +all:: DONE @@\ @@\ -lib/**/libname.a: objlist1 objlist2 @@\ - $(RM) $@ @@\ - $(AR) $@ objlist1 @@\ - $(AR) $@ objlist2 @@\ - $(RANLIB) $@ -#endif /* NormalLibraryTarget2 */ +DONE: objlist @@\ + touch $@ @@\ + @@\ +clean:: @@\ + $(RM) DONE +#endif /* SubdirLibraryRule */ /* @@ -911,12 +938,12 @@ lib/**/libname.a: objlist1 objlist2 @@\ */ #ifndef ProfiledLibraryTarget #define ProfiledLibraryTarget(libname,objlist) @@\ -AllTarget(lib/**/libname/**/_p.a) @@\ +AllTarget(Concat3(lib,libname,_p.a)) @@\ @@\ -lib/**/libname/**/_p.a: objlist @@\ +Concat3(lib,libname,_p.a): objlist @@\ $(RM) $@ @@\ cd profiled; $(AR) ../$@ objlist @@\ - $(RANLIB) $@ + RanLibrary($@) #endif /* ProfiledLibraryTarget */ @@ -926,12 +953,12 @@ lib/**/libname/**/_p.a: objlist @@\ */ #ifndef DebuggedLibraryTarget #define DebuggedLibraryTarget(libname,objlist) @@\ -AllTarget(lib/**/libname/**/_d.a) @@\ +AllTarget(Concat3(lib,libname,_d.a)) @@\ @@\ -lib/**/libname/**/_d.a: objlist @@\ +Concat3(lib,libname,_d.a): objlist @@\ $(RM) $@ @@\ cd debugger; $(AR) ../$@ objlist @@\ - $(RANLIB) $@ + RanLibrary($@) #endif /* DebuggedLibraryTarget */ @@ -941,11 +968,11 @@ lib/**/libname/**/_d.a: objlist @@\ */ #ifndef AliasedLibraryTarget #define AliasedLibraryTarget(libname,alias) @@\ -AllTarget(lib/**/alias.a) @@\ +AllTarget(Concat(lib,alias.a)) @@\ @@\ -lib/**/alias.a: lib/**/libname.a @@\ +Concat(lib,alias.a): Concat(lib,libname.a) @@\ $(RM) $@ @@\ - $(LN) lib/**/libname.a $@ + $(LN) Concat(lib,libname.a) $@ #endif /* AliasedLibraryTarget */ @@ -969,9 +996,9 @@ objname.o: objlist @@\ */ #ifndef ProfiledRelocatableTarget #define ProfiledRelocatableTarget(objname,objlist) @@\ -AllTarget(objname/**/_p.o) @@\ +AllTarget(Concat(objname,_p.o)) @@\ @@\ -objname/**/_p.o: objlist @@\ +Concat(objname,_p.o): objlist @@\ $(RM) $@ @@\ $(LD) -X -r objlist -o $@ @@ -984,9 +1011,9 @@ objname/**/_p.o: objlist @@\ */ #ifndef DebuggedRelocatableTarget #define DebuggedRelocatableTarget(objname,objlist) @@\ -AllTarget(objname/**/_d.o) @@\ +AllTarget(Concat(objname,_d.o)) @@\ @@\ -objname/**/_d.o: objlist @@\ +Concat(objname,_d.o): objlist @@\ $(RM) $@ @@\ $(LD) -X -r objlist -o $@ @@ -999,11 +1026,11 @@ objname/**/_d.o: objlist @@\ */ #ifndef LintLibraryTarget #define LintLibraryTarget(libname,srclist) @@\ -lintlib:: llib-l/**/libname.ln @@\ +lintlib:: Concat(llib-l,libname.ln) @@\ @@\ -llib-l/**/libname.ln: srclist @@\ +Concat(llib-l,libname.ln): srclist @@\ $(RM) $@ @@\ - $(LINT) $(LINTLIBFLAG)/**/libname $(LINTFLAGS) srclist + $(LINT) Concat($(LINTLIBFLAG),libname) $(LINTFLAGS) srclist #endif /* LintLibraryTarget */ @@ -1040,6 +1067,16 @@ src: dir/src @@\ #endif +/* + * LinkFile - link a file + */ +#ifndef LinkFile +#define LinkFile(tofile,fromfile) @@\ +tofile:: fromfile @@\ + $(RM) $@ @@\ + $(LN) $? $@ +#endif + #ifndef MakeSubincludesForBuild #define MakeSubincludesForBuild(step,dir,srclist) @@\ @@ -1050,7 +1087,8 @@ step:: dir srclist @@\ (set -x; cd dir; $(LN) ../$$i .); \ @@\ done @@\ @@\ -MakeDirectories(dir,dir) @@\ +dir:: @@\ + $(MKDIRHIER) dir @@\ @@\ clean:: @@\ @-(if [ -d dir ]; then \ @@\ @@ -1098,10 +1136,22 @@ NamedMakeSubdirs(all,dirs) */ #ifndef DependSubdirs #define DependSubdirs(dirs) \ -NamedTargetSubdirs(depend,dirs,"depending", /**/,depend) +NamedTargetSubdirs(depend,dirs,"depending",NullParameter,depend) #endif /* DependSubdirs */ +/* + * ForceSubdirs - force make to build subdirectories + */ +#ifndef ForceSubdirs +#define ForceSubdirs(dirs) @@\ +dirs: FRC @@\ + @cd $@ ; echo "making all in $(CURRENT_DIR)/$@..."; \ @@\ + $(MAKE) $(MFLAGS) PassCDebugFlags all @@\ + @@\ +FRC: +#endif /* ForceSubdirs */ + /* * InstallSubdirs - generate rules to recursively install programs and files. */ @@ -1125,7 +1175,7 @@ NamedTargetSubdirs(install.man,dirs,"installing man pages",DESTDIR='$(DESTDIR)', */ #ifndef IncludesSubdirs #define IncludesSubdirs(dirs) \ -NamedTargetSubdirs(includes,dirs,including, /**/,includes) +NamedTargetSubdirs(includes,dirs,including,NullParameter,includes) #endif @@ -1148,7 +1198,7 @@ NamedCleanSubdirs(clean,dirs) */ #ifndef NamedTagSubdirs #define NamedTagSubdirs(name,dirs) \ -NamedTargetSubdirs(name,dirs,"tagging",TAGS='$(TAGS)' ETAGS='$(ETAGS)',tags) +NamedTargetSubdirs(name,dirs,"tagging",TAGS='$(TAGS)',tags) #endif /* TagSubdirs */ #ifndef TagSubdirs @@ -1188,70 +1238,95 @@ MakeLintSubdirs(dirs,lintlib,lintlib) /* * MakeMakeSubdirs - generate rules to recursively recreate Makefiles as part * of the specified step in the build. If $(TOP) is set to an absolute path, - * don't prepend the ../ prefix. This makes running things outside of the + * do not prepend the ../ prefix. This makes running things outside of the * source tree to be much easier. */ #ifndef MakeMakeSubdirs #define MakeMakeSubdirs(dirs,target) @@\ target:: @@\ @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ @@\ - case '${MFLAGS}' in *n*) executeit="no";; esac; \ @@\ for i in dirs ;\ @@\ do \ @@\ + echo "making Makefiles in $(CURRENT_DIR)/$$i..."; \ @@\ case "$$i" in \ @@\ - ./?*/?*/?*/?*) newtop=../../../..;; \ @@\ - ./?*/?*/?*) newtop=../../..;; \ @@\ - ./?*/?*) newtop=../..;; \ @@\ - ./?*) newtop=..;; \ @@\ - */?*/?*/?*) newtop=../../../..;; \ @@\ - */?*/?*) newtop=../../..;; \ @@\ - */?*) newtop=../..;; \ @@\ - *) newtop=..;; \ @@\ + ./?*/?*/?*/?*) newtop=../../../../ sub=subsubsubsub;; \ @@\ + ./?*/?*/?*) newtop=../../../ sub=subsubsub;; \ @@\ + ./?*/?*) newtop=../../ sub=subsub;; \ @@\ + ./?*) newtop=../ sub=sub;; \ @@\ + */?*/?*/?*) newtop=../../../../ sub=subsubsubsub;; \ @@\ + */?*/?*) newtop=../../../ sub=subsubsub;; \ @@\ + */?*) newtop=../../ sub=subsub;; \ @@\ + *) newtop=../ sub=sub;; \ @@\ esac; \ @@\ case "$(TOP)" in \ @@\ - /?*) imaketop=$(TOP) ; top=$(TOP) ; curdir=$(CURRENT_DIR)/;; \ @@\ - .) imaketop=$$newtop/ ; top=$$newtop ; curdir= ;; \ @@\ - *) imaketop=$$newtop/ ; top=$$newtop/$(TOP) ; curdir=$(CURRENT_DIR)/ ;; \ @@\ + /?*) newtop= upprefix= ;; \ @@\ + *) upprefix=../ ;; \ @@\ esac; \ @@\ - echo "making Makefiles in $${curdir}$$i..."; \ @@\ - cd $$i; \ @@\ - $(RM) Makefile.bak; \ @@\ - if [ -f Makefile ]; then \ @@\ - echo " $(MV) Makefile Makefile.bak"; \ @@\ - if [ "$$executeit" != "no" ]; then \ @@\ - $(MV) Makefile Makefile.bak; \ @@\ - fi; \ @@\ - fi; \ @@\ - if [ "$$executeit" != "no" ]; then \ @@\ - ImakeSubCmdHelper -DTOPDIR=$$top -DCURDIR=$${curdir}$$i -f$(SRCSUBDIR)Imakefile; \ @@\ - fi; \ @@\ - $(MAKE) $(MFLAGS) Makefiles; \ @@\ - cd $$newtop; \ @@\ + $(MAKE) $${sub}dirMakefiles UPPREFIX=$$upprefix NEWTOP=$$newtop \ @@\ + MAKEFILE_SUBDIR=$$i NEW_CURRENT_DIR=$(CURRENT_DIR)/$$i;\ @@\ done +#endif /* MakeMakeSubdirs */ -#ifdef SourceTop - SRCSUBDIR = SourceTop/$${curdir}$${i}/ -#endif -#ifdef UseImakeInstalled -#define ImakeSubCmdHelper $(IMAKE) -I$${imaketop}$(NEWTOP)$(IRULESRC) $(IMAKE_DEFINES) -#else -#ifdef UseInstalled -#define ImakeSubCmdHelper $(IMAKE_CMD) -#else -#define ImakeSubCmdHelper $${imaketop}$(NEWTOP)$(IMAKE) -I$${imaketop}$(NEWTOP)$(IRULESRC) $(IMAKE_DEFINES) -#endif -#endif +/* + * MakeNsubdirMakefiles - generate rules to create sub Makefiles. + */ +#ifndef MakeNsubdirMakefiles +#define MakeNsubdirMakefiles() @@\ +subdirMakefiles: @@\ + $(RM) $(MAKEFILE_SUBDIR)/Makefile.bak @@\ + -@if [ -f $(MAKEFILE_SUBDIR)/Makefile ]; then set -x; \ @@\ + $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; \ @@\ + else exit 0; fi @@\ + cd $(MAKEFILE_SUBDIR); $(IMAKE_CMD) -DTOPDIR=$(UPPREFIX)$(TOP) -DCURDIR=$(NEW_CURRENT_DIR); \ @@\ + $(MAKE) $(MFLAGS) Makefiles @@\ + @@\ +subsubdirMakefiles: @@\ + $(RM) $(MAKEFILE_SUBDIR)/Makefile.bak @@\ + -@if [ -f $(MAKEFILE_SUBDIR)/Makefile ]; then set -x; \ @@\ + $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; \ @@\ + else exit 0; fi @@\ + cd $(MAKEFILE_SUBDIR); $(IMAKE_CMD) -DTOPDIR=$(UPPREFIX)$(UPPREFIX)$(TOP) -DCURDIR=$(NEW_CURRENT_DIR); \ @@\ + $(MAKE) $(MFLAGS) Makefiles @@\ + @@\ +subsubsubdirMakefiles: @@\ + $(RM) $(MAKEFILE_SUBDIR)/Makefile.bak @@\ + -@if [ -f $(MAKEFILE_SUBDIR)/Makefile ]; then set -x; \ @@\ + $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; \ @@\ + else exit 0; fi @@\ + cd $(MAKEFILE_SUBDIR); $(IMAKE_CMD) -DTOPDIR=$(UPPREFIX)$(UPPREFIX)$(UPPREFIX)$(TOP) -DCURDIR=$(NEW_CURRENT_DIR); \ @@\ + $(MAKE) $(MFLAGS) Makefiles @@\ + @@\ +subsubsubsubdirMakefiles: @@\ + $(RM) $(MAKEFILE_SUBDIR)/Makefile.bak @@\ + -@if [ -f $(MAKEFILE_SUBDIR)/Makefile ]; then set -x; \ @@\ + $(MV) $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak; \ @@\ + else exit 0; fi @@\ + cd $(MAKEFILE_SUBDIR); $(IMAKE_CMD) -DTOPDIR=$(UPPREFIX)$(UPPREFIX)$(UPPREFIX)$(UPPREFIX)$(TOP) -DCURDIR=$(NEW_CURRENT_DIR); \ @@\ + $(MAKE) $(MFLAGS) Makefiles +#endif /* MakeNsubdirMakefiles */ -#endif /* MakeMakeSubdirs */ /* * MakefileSubdirs - generate rules to create Makefiles. */ #ifndef MakefileSubdirs -#define MakefileSubdirs(dirs) MakeMakeSubdirs(dirs,Makefiles) +#define MakefileSubdirs(dirs) @@\ +MakeMakeSubdirs(dirs,Makefiles) @@\ + @@\ +MakeNsubdirMakefiles() #endif /* MakefileSubdirs */ +/* + * Translate XCOMM into pound sign with sed, rather than passing -DXCOMM=XCOMM + * to cpp, because that trick does not work on all ANSI C preprocessors. + * Also delete line numbers from the cpp output (-P is not portable, I guess). + */ +#ifndef CppSedMagic +#define CppSedMagic sed -e '/^# *[0-9][0-9]* *.*$$/d' \ + -e '/^XCOMM$$/s//#/' \ + -e '/^XCOMM[^a-zA-Z0-9_]/s/^XCOMM/#/' +#endif /* CppSedMagic */ /* * CppScriptTarget - generate rules to create a shell script by running the @@ -1263,16 +1338,14 @@ target:: @@\ #define CppScriptTarget(dst,src,defs,deplist) @@\ dst:: src deplist @@\ $(RM) $@ @@\ - $(CPP) defs $@ @@\ + CppSedMagic $@ @@\ chmod a+x $@ #else #define CppScriptTarget(dst,src,defs,deplist) @@\ dst:: src deplist @@\ $(RM) $@ @@\ echo \: >$@ @@\ - sed '1d' src | $(CPP) defs | \ @@\ - sed -e '/^# *[0-9][0-9]* *.*$$/d' >>$@ @@\ + sed '1d' src | $(CPP) defs | CppSedMagic >>$@ @@\ chmod a+x $@ #endif /* ExecableScripts */ #endif /* CppScriptTarget */ @@ -1284,9 +1357,15 @@ dst:: src deplist @@\ */ #ifndef MakeScriptFromCpp #define MakeScriptFromCpp(name,defs) @@\ -CppScriptTarget(name,name.cpp,defs, /**/) +CppScriptTarget(name,name.cpp,defs,NullParameter) #endif /* MakeScriptFromCpp */ +#ifndef CppFileTarget +#define CppFileTarget(dst,src,defs,deplist) @@\ +dst:: src deplist @@\ + $(RM) $@ @@\ + $(CPP) defs $@ +#endif /* CppFileTarget */ /* * MakeDirectories - generate rules to create a hierarchy of directories. @@ -1294,9 +1373,128 @@ CppScriptTarget(name,name.cpp,defs, /**/) #ifndef MakeDirectories #define MakeDirectories(step,dirs) @@\ step:: @@\ - $(MKDIRHIER) dirs + @case '${MFLAGS}' in *[i]*) set +e;; esac; @@\ + DirFailPrefix@for i in dirs; do if [ -d $(DESTDIR)$$i ]; then \ @@\ + set +x; else (set -x; $(MKDIRHIER) $(DESTDIR)$$i); fi \ @@\ + done #endif /* MakeDirectories */ + +/* + * MakeFontsDir - generate rules to build fonts.dir database. + */ +#ifndef MakeFontsDir +#define MakeFontsDir(deplist) @@\ +all:: fonts.dir @@\ + @@\ +fonts.dir: deplist @@\ + $(MKFONTDIR) . @@\ + @@\ +clean:: @@\ + $(RM) fonts.dir +#endif /* MakeFontsDir */ + + +/* + * MakeFonts - generate rules to build font database. + */ +#ifndef MakeFonts +#define MakeFonts() @@\ +all:: $(OBJS) @@\ + @@\ +MakeFontsDir($(OBJS)) @@\ + @@\ +clean:: @@\ + $(RM) *.snf *.snf.Z *.pcf *.pcf.Z +#endif /* MakeFonts */ + + +/* + * InstallFontObjs - generate rules to install font files + */ +#ifndef InstallFontObjs +#define InstallFontObjs(objs,dest) @@\ +InstallMultipleFlags(objs,dest,$(INSTDATFLAGS)) @@\ + @@\ +install:: fonts.dir @@\ + MakeDir($(DESTDIR)dest) @@\ + $(INSTALL) -c $(INSTDATFLAGS) fonts.dir $(DESTDIR)dest +#endif /* InstallFontObjs */ + + +/* + * InstallFonts - generate rules to install font files + */ +#ifndef InstallFonts +#define InstallFonts(dest) @@\ +InstallFontObjs($(OBJS),dest) +#endif /* InstallFonts */ + + +/* + * InstallFontAliases - generate rules to install font aliases databases. + */ +#ifndef InstallFontAliases +#define InstallFontAliases(dest) @@\ +install:: fonts.alias @@\ + MakeDir($(DESTDIR)dest) @@\ + $(INSTALL) -c $(INSTDATFLAGS) fonts.alias $(DESTDIR)dest +#endif /* InstallFontAliases */ + +#ifndef FontSrc +#define FontSrc(basename) basename.bdf +#endif + +#ifndef FontBaseObj +#ifdef SnfFonts +#define FontBaseObj(basename)basename.snf +#else +#define FontBaseObj(basename)basename.pcf +#endif +#endif + +/* + * InstallFontScale - generate rules to install font scale database. + */ +#ifndef InstallFontScale +#define InstallFontScale(dest) @@\ +install:: fonts.scale @@\ + MakeDir($(DESTDIR)dest) @@\ + $(INSTALL) -c $(INSTDATFLAGS) fonts.scale $(DESTDIR)dest +#endif /* InstallFontScale */ + +/* + * UncompressedFontTarget + */ +#ifndef UncompressedFontTarget +#ifdef SnfFonts +#define UncompressedFontTarget(basename) @@\ +FontBaseObj(basename): FontSrc(basename) @@\ + $(FONTC) $(FONTCFLAGS) $? >$@ +#else +#define UncompressedFontTarget(basename) @@\ +FontBaseObj(basename): FontSrc(basename) @@\ + $(FONTC) $(FONTCFLAGS) $? -o $@ +#endif +#endif /* CompressedFontTarget */ + +/* + * CompressedFontTarget + */ +#ifndef CompressedFontTarget +#define CompressedFontTarget(basename) @@\ +FontBaseObj(basename).Z: FontSrc(basename) @@\ + $(FONTC) $(FONTCFLAGS) $? | $(COMPRESS) > $@ +#endif /* CompressedFontTarget */ + +#ifdef CompressAllFonts +#define FontTarget(basename) CompressedFontTarget(basename) +#define FontObj(basename) FontBaseObj(basename).Z +#else +#define FontTarget(basename) UncompressedFontTarget(basename) +#define FontObj(basename) FontBaseObj(basename) +#endif /* CompressAllFonts */ + /* * AllTarget - generate rules to build necessary things during make all. */ @@ -1304,3 +1502,7 @@ step:: @@\ #define AllTarget(depends) @@\ all:: depends #endif /* AllTarget */ + +#ifdef DefineOldLibraryRules +#include +#endif