summaryrefslogtreecommitdiff
path: root/projects/generate
diff options
context:
space:
mode:
authorglx <glx@openttd.org>2007-01-03 22:24:36 +0000
committerglx <glx@openttd.org>2007-01-03 22:24:36 +0000
commit9930b9890fb451f12dd68f79af2f17410596bfe8 (patch)
treebdb85f21db63d977fbf8fb70fb9fee80fc585e2f /projects/generate
parentac410d6f65c6140ecef42bb7e05bc54bfe940e61 (diff)
downloadopenttd-9930b9890fb451f12dd68f79af2f17410596bfe8.tar.xz
(svn r7809) -Fix: convert \r to \n before parsing files with awk in projects/generate so it works using mingw/msys
Diffstat (limited to 'projects/generate')
-rwxr-xr-xprojects/generate14
1 files changed, 8 insertions, 6 deletions
diff --git a/projects/generate b/projects/generate
index da431a901..b36a9602e 100755
--- a/projects/generate
+++ b/projects/generate
@@ -39,7 +39,7 @@ file_prefix="..\\\\src\\\\"
load_main_data() {
# Read the source.list and process it
- RES="`awk '
+ RES="`cat $1 | tr '\r' '\n' | awk '
/^( *)#end/ { if (deep == skip) { skip -= 1; } deep -= 1; next; }
/^( *)#else/ { if (deep == skip) { skip -= 1; } else if (deep - 1 == skip) { skip += 1; } next; }
/^( *)#if/ {
@@ -95,7 +95,7 @@ load_main_data() {
}
}
END { print " </Filter>"; }
- ' < $1`"
+ '`"
eval "$2=\"\$RES\""
}
@@ -128,25 +128,27 @@ load_lang_data() {
generate() {
echo "Generating $2..."
# Everything above the !!FILES!! marker
- RES="`awk '
+ RES="`cat \"$ROOT_DIR/projects/$2\".in | tr '\r' '\n' | awk '
+ /^$/ { next }
/!!FILES!!/ { stop = 1; }
{
if (stop == 0) { print $0 }
}
- ' < \"$ROOT_DIR/projects/$2\".in > \"$ROOT_DIR/projects/$2\"`"
+ ' > \"$ROOT_DIR/projects/$2\"`"
# The files-list
echo "$1" >> "$ROOT_DIR/projects/$2"
# Everything below the !!FILES!! marker
- RES="`awk '
+ RES="`cat \"$ROOT_DIR/projects/$2\".in | tr '\r' '\n' | awk '
BEGIN { stop = 1; }
+ /^$/ { next }
/!!FILES!!/ { stop = 2; }
{
if (stop == 0) { print $0 }
if (stop == 2) { stop = 0 }
}
- ' < \"$ROOT_DIR/projects/$2.in\" >> \"$ROOT_DIR/projects/$2\"`"
+ ' >> \"$ROOT_DIR/projects/$2\"`"
}
load_main_data "$ROOT_DIR/source.list" openttd