📄 imake.rules
字号:
do \ @@\ (cd $$i ; echo verb "in $(CURRENT_DIR)/$$i..."; \ @@\ $(MAKE) $(MFLAGS) flags subname); \ @@\ done#endif/* * NamedMakeSubdirs - generate rules to do makes in the given subdirectories. * If you want CDEBUGFLAGS passed along to subdirectories, provide a line like * the following in the appropriate Imakefile * * #define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)' */#ifndef NamedMakeSubdirs#define NamedMakeSubdirs(name,dirs) \NamedTargetSubdirs(name,dirs,"making" name,PassCDebugFlags,all)#endif /* NamedMakeSubdirs */#ifndef MakeSubdirs#define MakeSubdirs(dirs) @@\NamedMakeSubdirs(all,dirs)#endif /* MakeSubdirs *//* * DependSubdirs - generate rules to recursively compute dependencies as * part of the make depend step. */#ifndef DependSubdirs#define DependSubdirs(dirs) \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. */#ifndef InstallSubdirs#define InstallSubdirs(dirs) \NamedTargetSubdirs(install,dirs,"installing",DESTDIR='$(DESTDIR)',install)#endif /* InstallSubdirs *//* * InstallManSubdirs - generate rules to recursively install manual pages. */#ifndef InstallManSubdirs#define InstallManSubdirs(dirs) \NamedTargetSubdirs(install.man,dirs,"installing man pages",DESTDIR='$(DESTDIR)',install.man)#endif /* InstallManSubdirs *//* * IncludesSubdirs - generate rules to recursively put include files in build */#ifndef IncludesSubdirs#define IncludesSubdirs(dirs) \NamedTargetSubdirs(includes,dirs,including,NullParameter,includes)#endif/* * CleanSubdirs - generate rules to recursively clean out garbage files. */#ifndef NamedCleanSubdirs#define NamedCleanSubdirs(name,dirs) \NamedTargetSubdirs(name,dirs,"cleaning",RM_CMD='$(RM_CMD)',clean)#endif /* NamedCleanSubdirs */#ifndef CleanSubdirs#define CleanSubdirs(dirs) \NamedCleanSubdirs(clean,dirs)#endif/* * TagSubdirs - generate rules to recursively create tags files. */#ifndef NamedTagSubdirs#define NamedTagSubdirs(name,dirs) \NamedTargetSubdirs(name,dirs,"tagging",TAGS='$(TAGS)',tags)#endif /* TagSubdirs */#ifndef TagSubdirs#define TagSubdirs(dirs) \NamedTagSubdirs(tags,dirs)#endif/* * MakeLintSubdirs - generate rules to recursively lint directories as part * of the named step. */#ifndef MakeLintSubdirs#define MakeLintSubdirs(dirs,target,subtarget) \NamedTargetSubdirs(target,dirs,"linting" for target and subtarget,DESTDIR='$(DESTDIR)' LINTOPTS='$(LINTOPTS)',subtarget)#endif /* MakeLintSubdirs *//* * LintSubdirs - generate rules to recursively lint directories as part of * the make lint step. */#ifndef LintSubdirs#define LintSubdirs(dirs) @@\MakeLintSubdirs(dirs,lint,lint)#endif /* LintSubdirs *//* * MakeLintLibSubdirs - generate rules to recursively create lint libraries. */#ifndef MakeLintLibSubdirs#define MakeLintLibSubdirs(dirs) @@\MakeLintSubdirs(dirs,lintlib,lintlib)#endif /* MakeLintLibSubdirs *//* * MakeMakeSubdirs - generate rules to recursively recreate Makefiles as part * of the specified step in the build. If $(TOP) is set to an absolute path, * 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; \ @@\ for i in dirs ;\ @@\ do \ @@\ echo "making Makefiles in $(CURRENT_DIR)/$$i..."; \ @@\ case "$$i" in \ @@\ ./?*/?*/?*/?*) 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 \ @@\ /?*) newtop= upprefix= ;; \ @@\ *) upprefix=../ ;; \ @@\ esac; \ @@\ $(MAKE) $${sub}dirMakefiles UPPREFIX=$$upprefix NEWTOP=$$newtop \ @@\ MAKEFILE_SUBDIR=$$i NEW_CURRENT_DIR=$(CURRENT_DIR)/$$i;\ @@\ done#endif /* MakeMakeSubdirs *//* * 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 *//* * MakefileSubdirs - generate rules to create Makefiles. */#ifndef MakefileSubdirs#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 * input through cpp. If the ExecableScripts configuration parameter is not * set, then make sure that the first line begins with a colon. */#ifndef CppScriptTarget#if ExecableScripts /* can use #! instead of colon */#define CppScriptTarget(dst,src,defs,deplist) @@\dst:: src deplist @@\ $(RM) $@ @@\ $(CPP) defs <src | CppSedMagic >$@ @@\ chmod a+x $@#else#define CppScriptTarget(dst,src,defs,deplist) @@\dst:: src deplist @@\ $(RM) $@ @@\ echo \: >$@ @@\ sed '1d' src | $(CPP) defs | CppSedMagic >>$@ @@\ chmod a+x $@#endif /* ExecableScripts */#endif /* CppScriptTarget *//* * MakeScriptFromCpp - generate rules to create a script from a file with a * .cpp suffix. */#ifndef MakeScriptFromCpp#define MakeScriptFromCpp(name,defs) @@\CppScriptTarget(name,name.cpp,defs,NullParameter)#endif /* MakeScriptFromCpp */#ifndef CppFileTarget#define CppFileTarget(dst,src,defs,deplist) @@\dst:: src deplist @@\ $(RM) $@ @@\ $(CPP) defs <src | CppSedMagic >$@#endif /* CppFileTarget *//* * MakeDirectories - generate rules to create a hierarchy of directories. */#ifndef MakeDirectories#define MakeDirectories(step,dirs) @@\step:: @@\ @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 *//* * AllTarget - generate rules to build necessary things during make all. */#ifndef AllTarget#define AllTarget(depends) @@\all:: depends#endif /* AllTarget *//* * BuildProgram() generates entries to build, remove, and * lint a single program. May be invoked multiple times * in the same Imakefile. * * Arguments: * prog program name * srcs program's source files * objs program's object files * linklibs libraries needed to link program * deplibs libraries to check as dependencies * (must be given as pathnames) * * Targets produced: * all build prog (and all others in Imakefile) * prog build prog only * clean remove all programs in Imakefile * lint lint all programs in Imakefile * lint.prog lint prog only */#ifndef BuildProgram#define BuildProgram(prog,srcs,objs,linklibs,deplibs) @@\AllTarget(prog) @@\prog: objs deplibs @@\ $(CC) -o prog objs $(LOADOPTS) linklibs $(LOADLIBS) @@\StuffToClean(prog) @@\LintSources(prog,srcs)#endif /* BuildProgram */#ifndef StuffToClean#define StuffToClean(stuff) @@\clean:: @@\ $(RM) stuff#endif /* StuffToClean */#ifndef LintSources#define LintSources(prog,srcs) @@\lint:: lint.prog @@\lint.prog: @@\ $(LINT) $(LINTFLAGS) srcs $(LINTLIBS)#endif /* LintSources */#ifndef BuildLibrary#define BuildLibrary(name,objlist) @@\AllTarget(Concat(lib,name.a)) @@\Concat(lib,name.a): objlist @@\ $(RM) $@ @@\ $(AR) $@ objlist @@\ RanLibrary($@) @@\StuffToClean(Concat(lib,name.a))#endif /* BuildLibrary *//* * Installation support */#ifndef InstallTarget#define InstallTarget(file,dir,flags) @@\install:: install.file @@\install.file:: file @@\ MakeDir(dir) @@\ $(INSTALL) -c flags file dir#endif /* InstallTarget */#ifndef InstallProgram#define InstallProgram(file,dir) @@\InstallTarget(file,dir,$(INSTPROGFLAGS))#endif /* InstallProgram */#ifndef InstallScript#define InstallScript(file,dir) @@\InstallTarget(file,dir,$(INSTSCRIPTFLAGS))#endif /* InstallScript */#ifndef InstallData#define InstallData(file,dir) @@\InstallTarget(file,dir,$(INSTDATFLAGS))#endif /* InstallData */#ifndef InstallManPage#define InstallManPage(file,dir) @@\InstallTarget(file,dir,$(INSTMANFLAGS))#endif /* InstallManPage */#ifndef InstallLibrary#define InstallLibrary(name,dir) @@\InstallTarget(Concat(lib,name.a),dir,$(INSTLIBFLAGS)) @@\install.Concat(lib,name.a):: Concat(lib,name.a) @@\ RanLibrary(Concat(dir/lib,name.a))#endif /* InstallLibrary */#ifndef BuildAndInstallProgram#define BuildAndInstallProgram(prog,srcs,objs,linklibs,deplibs) @@\BuildProgram(prog,srcs,objs,linklibs,deplibs) @@\InstallProgram(prog,$(BINDIR))#endif /* BuildAndInstallProgram */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -