128 } |
128 } |
129 |
129 |
130 generate() { |
130 generate() { |
131 echo "Generating $2..." |
131 echo "Generating $2..." |
132 # Everything above the !!FILES!! marker |
132 # Everything above the !!FILES!! marker |
133 RES="`cat \"$ROOT_DIR/projects/$2\".in | tr '\r' '\n' | awk ' |
133 cat "$ROOT_DIR/projects/$2".in | tr '\r' '\n' | awk ' |
134 /^$/ { next } |
134 /^$/ { next } |
135 /!!FILES!!/ { stop = 1; } |
135 /!!FILES!!/ { stop = 1; } |
136 { |
136 { |
137 if (stop == 0) { print $0 } |
137 if (stop == 0) { print $0 } |
138 } |
138 } |
139 ' > \"$ROOT_DIR/projects/$2\"`" |
139 ' > "$ROOT_DIR/projects/$2" |
140 |
140 |
141 # The files-list |
141 # The files-list |
142 if [ "$3" = "msvc2003" ]; then |
142 echo "$1" | awk -v type="$3" ' |
143 echo "$1" | sed 's@\
\
@\n@' >> "$ROOT_DIR/projects/$2" |
143 /
/ { |
144 else |
144 if (type == "msvc2003") gsub("
", "\n", $0); |
145 echo "$1" | sed ' |
145 } |
146 s@Filter="">@>@; |
146 /Filter="">/ { |
147 s@^\([ ]*\)\([^ <].*[^/]\)>$@\1\2\n\1>@g; |
147 if (type == "msvc2005") gsub("Filter=\"\">", ">", $0); |
148 s@^ \([ ]*\)\([^ <].*\)/>$@ \1\2\n\1/>@g; |
148 } |
149 ' >> "$ROOT_DIR/projects/$2" |
149 /"\/>/ { |
150 fi |
150 if (type == "msvc2005") gsub("/>", "\n" substr($0, 1, index($0, $1) - 2) "/>", $0); |
|
151 } |
|
152 /">/ { |
|
153 if (type == "msvc2005") gsub(">", "\n" substr($0, 1, index($0, $1) - 1) ">", $0); |
|
154 } |
|
155 { print $0 } |
|
156 ' >> "$ROOT_DIR/projects/$2" |
151 |
157 |
152 # Everything below the !!FILES!! marker |
158 # Everything below the !!FILES!! marker |
153 RES="`cat \"$ROOT_DIR/projects/$2\".in | tr '\r' '\n' | awk ' |
159 cat "$ROOT_DIR/projects/$2".in | tr '\r' '\n' | awk ' |
154 BEGIN { stop = 1; } |
160 BEGIN { stop = 1; } |
155 /^$/ { next } |
161 /^$/ { next } |
156 /!!FILES!!/ { stop = 2; } |
162 /!!FILES!!/ { stop = 2; } |
157 { |
163 { |
158 if (stop == 0) { print $0 } |
164 if (stop == 0) { print $0 } |
159 if (stop == 2) { stop = 0 } |
165 if (stop == 2) { stop = 0 } |
160 } |
166 } |
161 ' >> \"$ROOT_DIR/projects/$2\"`" |
167 ' >> "$ROOT_DIR/projects/$2" |
162 } |
168 } |
163 |
169 |
164 load_main_data "$ROOT_DIR/source.list" openttd |
170 load_main_data "$ROOT_DIR/source.list" openttd |
165 load_lang_data "$ROOT_DIR/src/lang/*.txt" lang |
171 load_lang_data "$ROOT_DIR/src/lang/*.txt" lang |
166 |
172 |