1Below is some sample configuration stuff showing how to incorporate msub 2support into your imake configuration files. 3 41) Put the following in Imake.tmpl or Project.tmpl to define an MSUB 5parameter: 6 7#ifndef MsubCmd 8#define MsubCmd msub 9#endif 10 11MSUB = MsubCmd 12 132) Add the following rules to Imake.rules. These actually are not 14msub-specific; they allow you to create scripts using templates by 15passing them through some arbitrary filter. To use them with msub, 16invoke them, e.g., like this: 17 18For non-executable script: 19ScriptFromTemplateTarget(script,template,$(MSUB),deps) 20For executable script (here, a shell script): 21ExecScriptFromTemplateTarget($(SHELL),dst,src,$(MSUB),deps) 22 23Note that AllTarget() generates an all:: target for its argument, 24StuffToClean() generates a clean:: target for its argument, and 25HasExecableScripts is equivalent to X11R5's ExecableScripts. If you don't 26have them, look at the end of this file. 27 28/* 29 Create a target by running a template through some filter. 30*/ 31 32#ifndef ScriptFromTemplateTarget 33#define ScriptFromTemplateTarget(dst,src,command,deps) @@\ 34AllTarget(dst) @@\ 35StuffToClean(dst) @@\ 36dst:: src deps @@\ 37 command src > $@ 38#endif 39 40 41/* 42 Create an executable target for some arbitrary program by running a 43 template through some filter. prog must be a full pathname. 44 45 If the HasExecableScripts configuration parameter is not YES, make sure 46 the first line begins with a colon and write the script into a temp 47 file, have the program execute that, and remove the temp file when 48 done. Ugly ugly ugly. 49*/ 50 51#ifndef ExecScriptFromTemplateTarget 52#if HasExecableScripts /* can use #! */ 53#define ExecScriptFromTemplateTarget(prog,dst,src,command,deps) @@\ 54AllTarget(dst) @@\ 55StuffToClean(dst) @@\ 56dst:: src deps @@\ 57 $(RM) $@ @@\ 58 echo "#!"prog > $@ @@\ 59 command src >> $@ @@\ 60 chmod a+x $@ 61#else 62#define ExecScriptFromTemplateTarget(prog,dst,src,command,deps) @@\ 63AllTarget(dst) @@\ 64StuffToClean(dst) @@\ 65dst:: src deps @@\ 66 $(RM) $@ @@\ 67 echo \: > $@ @@\ 68 echo 'x=/tmp/xx$$$$' >> $@ @@\ 69 echo "cat > "'$$x'" << 'EOF'" >> $@ @@\ 70 command src >> $@ @@\ 71 echo EOF >> $@ @@\ 72 echo prog '$$x' '$$@' >> $@ @@\ 73 echo $(RM) '$$x' >> $@ @@\ 74 chmod a+x $@ 75#endif /* HasExecableScripts */ 76#endif /* ExecScriptFromTemplateTarget */ 77 78 79#ifndef StuffToClean 80#define StuffToClean(extra) @@\ 81clean:: @@\ 82 $(RM) extra 83#endif /* StuffToClean */ 84 85#ifndef AllTarget 86#define AllTarget(depends) @@\ 87all:: depends 88#endif /* AllTarget */ 89