This will translate a file that consists of backslash-newline broken lines into a file with single long lines, and squash whitespace.
For example:
acpi_quirks.h optional acpi \ dependency "$S/tools/acpi_quirks2h.awk $S/dev/acpica/acpi_quirks" \ compile-with "${AWK} -f $S/tools/acpi_quirks2h.awk $S/dev/acpica/acpi_quirks" \ no-obj no-implicit-rule before-depend \ clean "acpi_quirks.h"
becomes
acpi_quirks.h optional acpi dependency "$S/tools/acpi_quirks2h.awk $S/dev/acpica/acpi_quirks" compile-with "${AWK} -f $S/tools/acpi_quirks2h.awk $S/dev/acpica/acpi_quirks" no-obj no-implicit-rule before-depend clean "acpi_quirks.h"
expand "${file}" | sed -ne ' s/#.*$//g # Strip out all comments, as they may interfere s/ *$// # Remove end-of-line whitespace /[^\\]$/ { # If the line doesn't end with a backslash, print the whole thing H # Append current line to hold s/.*//g # Clear pattern so that hold will be emptied x # Exchange (hold is empty, pattern has what we want) s/^\n//g # Remove initial newline, caused by appending to empty buffer s/\n/ /g # Change newlines to spaces s/ */ /g # Squash extra spaces p # Print } /\\$/ { # If the line ends with a backslash, append it to hold without backslash s/\\$// # Remove tailing backslash H # Append to hold }'