37 enable_directmusic="1" |
37 enable_directmusic="1" |
38 file_prefix="..\\\\src\\\\" |
38 file_prefix="..\\\\src\\\\" |
39 |
39 |
40 load_main_data() { |
40 load_main_data() { |
41 # Read the source.list and process it |
41 # Read the source.list and process it |
42 RES="`awk ' |
42 RES="`cat $1 | tr '\r' '\n' | awk ' |
43 /^( *)#end/ { if (deep == skip) { skip -= 1; } deep -= 1; next; } |
43 /^( *)#end/ { if (deep == skip) { skip -= 1; } deep -= 1; next; } |
44 /^( *)#else/ { if (deep == skip) { skip -= 1; } else if (deep - 1 == skip) { skip += 1; } next; } |
44 /^( *)#else/ { if (deep == skip) { skip -= 1; } else if (deep - 1 == skip) { skip += 1; } next; } |
45 /^( *)#if/ { |
45 /^( *)#if/ { |
46 gsub(" ", "", $0); |
46 gsub(" ", "", $0); |
47 gsub("^#if", "", $0); |
47 gsub("^#if", "", $0); |
126 } |
126 } |
127 |
127 |
128 generate() { |
128 generate() { |
129 echo "Generating $2..." |
129 echo "Generating $2..." |
130 # Everything above the !!FILES!! marker |
130 # Everything above the !!FILES!! marker |
131 RES="`awk ' |
131 RES="`cat \"$ROOT_DIR/projects/$2\".in | tr '\r' '\n' | awk ' |
|
132 /^$/ { next } |
132 /!!FILES!!/ { stop = 1; } |
133 /!!FILES!!/ { stop = 1; } |
133 { |
134 { |
134 if (stop == 0) { print $0 } |
135 if (stop == 0) { print $0 } |
135 } |
136 } |
136 ' < \"$ROOT_DIR/projects/$2\".in > \"$ROOT_DIR/projects/$2\"`" |
137 ' > \"$ROOT_DIR/projects/$2\"`" |
137 |
138 |
138 # The files-list |
139 # The files-list |
139 echo "$1" >> "$ROOT_DIR/projects/$2" |
140 echo "$1" >> "$ROOT_DIR/projects/$2" |
140 |
141 |
141 # Everything below the !!FILES!! marker |
142 # Everything below the !!FILES!! marker |
142 RES="`awk ' |
143 RES="`cat \"$ROOT_DIR/projects/$2\".in | tr '\r' '\n' | awk ' |
143 BEGIN { stop = 1; } |
144 BEGIN { stop = 1; } |
|
145 /^$/ { next } |
144 /!!FILES!!/ { stop = 2; } |
146 /!!FILES!!/ { stop = 2; } |
145 { |
147 { |
146 if (stop == 0) { print $0 } |
148 if (stop == 0) { print $0 } |
147 if (stop == 2) { stop = 0 } |
149 if (stop == 2) { stop = 0 } |
148 } |
150 } |
149 ' < \"$ROOT_DIR/projects/$2.in\" >> \"$ROOT_DIR/projects/$2\"`" |
151 ' >> \"$ROOT_DIR/projects/$2\"`" |
150 } |
152 } |
151 |
153 |
152 load_main_data "$ROOT_DIR/source.list" openttd |
154 load_main_data "$ROOT_DIR/source.list" openttd |
153 load_lang_data "$ROOT_DIR/src/lang/*.txt" lang |
155 load_lang_data "$ROOT_DIR/src/lang/*.txt" lang |
154 |
156 |