[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.5.16 `makefile-script' - create makefile script

Usage: (makefile-script text)
This function will take ordinary shell script text and reformat it so that it will work properly inside of a makefile shell script. Not every shell construct can be supported; the intent is to have most ordinary scripts work without much, if any, alteration.

The following transformations are performed on the source text:

  1. Trailing whitespace on each line is stripped.

  2. Except for the last line, the string, " ; \\" is appended to the end of every line that does not end with a backslash, semi-colon, conjunction operator or pipe. Note that this will mutilate multi-line quoted strings, but make renders it impossible to use multi-line constructs anyway.

  3. If the line ends with a backslash, it is left alone.

  4. If the line ends with one of the excepted operators, then a space and backslash is added.

  5. The dollar sign character is doubled, unless it immediately precedes an opening parenthesis or the single character make macros '*', '<', '@', '?' or '%'. Other single character make macros that do not have enclosing parentheses will fail. For shell usage of the "$@", "$?" and "$*" macros, you must enclose them with curly braces, e.g., "${?}". The ksh construct $(<command>) will not work. Though some makes accept ${var} constructs, this function will assume it is for shell interpretation and double the dollar character. You must use $(var) for all make substitutions.

  6. Double dollar signs are replaced by four before the next character is examined.

  7. Every line is prefixed with a tab, unless the first line already starts with a tab.

  8. The newline character on the last line, if present, is suppressed.

  9. Blank lines are stripped.

This function is intended to be used approximately as follows:

<+ (out-push-new) +>
....mostly arbitrary shell script text....
<+ (makefile-script (out-pop #t)) +>

text - the text of the script

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated by Bruce Korb on May 5, 2003 using texi2html

Viewable With Any Browser   AutoGen Home