commit 518d7cbdc4950808395bbdd255676fb0973a2d1a parent 045a00e6396379588b77071ab1bf514d019218ac Author: Kyle Milz <kyle@0x30.net> Date: Thu, 29 Dec 2016 14:37:42 -0700 Jam: switch Stringize from sed to perl implementation Diffstat:
M | Jamrules.tail | | | 16 | +++++++++------- |
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/Jamrules.tail b/Jamrules.tail @@ -14,11 +14,13 @@ rule Stringize actions Stringize { - # Quote the entire original source file and put it in the destination. - sed -e ' s/\\/\\\\/g; s/"/\\"/g; s/^/"/; s/$/\\n"/; ' < $(>) > $(<) - echo ";" >> $(<) - - # Add the declaration to the start of the file. - sed -e '1s/^/static const char *$(1:B) = /' -i.bak $(<) - rm $(<).bak + perl -e 'print "static const char *$(1:B) = "; + while (<>) { + $_ =~ s/\\/\\\\/g ; + $_ =~ s/"/\\"/g; + $_ =~ s/^/"/; + $_ =~ s/$/\\n"/; + print + } + print ";" ' < $(>) > $(<) }