|
1 @REM Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 @REM All rights reserved. |
|
3 @REM This component and the accompanying materials are made available |
|
4 @REM under the terms of the License "Eclipse Public License v1.0" |
|
5 @REM which accompanies this distribution, and is available |
|
6 @REM at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 @REM |
|
8 @REM Initial Contributors: |
|
9 @REM Nokia Corporation - initial contribution. |
|
10 @REM |
|
11 @REM Contributors: |
|
12 @REM |
|
13 @REM Description: |
|
14 @REM builds bld.bat files for subprojects within this component |
|
15 |
|
16 @if exist %0.bat perl -w -x %0.bat %1 %2 %3 %4 %5 |
|
17 @if exist %0 perl -w -x %0 %1 %2 %3 %4 %5 |
|
18 @GOTO End |
|
19 |
|
20 #!perl |
|
21 |
|
22 use strict; |
|
23 use Cwd; |
|
24 |
|
25 my $EPOCRoot; |
|
26 |
|
27 BEGIN { |
|
28 $EPOCRoot = $ENV{EPOCROOT}; |
|
29 die "ERROR: Must set the EPOCROOT environment variable\n" if (!defined($EPOCRoot)); |
|
30 $EPOCRoot =~ s-/-\\-go; # for those working with UNIX shells |
|
31 die "ERROR: EPOCROOT must be an absolute path\n" if ($EPOCRoot !~ /^\\/); |
|
32 die "ERROR: EPOCROOT must not be a UNC path\n" if ($EPOCRoot =~ /^\\\\/); |
|
33 die "ERROR: EPOCROOT must end with a backslash\n" if ($EPOCRoot !~ /\\$/); |
|
34 die "ERROR: EPOCROOT must specify an existing directory\n" if (!-d $EPOCRoot); |
|
35 } |
|
36 |
|
37 |
|
38 my $EPOCToolsPath="${EPOCRoot}epoc32\\tools"; |
|
39 |
|
40 my $EPOCToolsConfigFilePath="${EPOCRoot}epoc32\\tools\\compilation_config"; |
|
41 |
|
42 my $DocsPath="${EPOCRoot}epoc32\\EngDoc\\E32toolp"; |
|
43 |
|
44 my $TemplateFilePath="${EPOCRoot}epoc32\\tools\\makefile_templates"; |
|
45 |
|
46 my $ShellFilePath="${EPOCRoot}epoc32\\tools\\shell"; |
|
47 |
|
48 my $BinFilePath="${EPOCRoot}epoc32\\tools"; |
|
49 |
|
50 if (scalar @ARGV > 1) { |
|
51 die "Too many arguments for setupprj.bat\n"; |
|
52 } |
|
53 |
|
54 # only the secure platform is now supported, but keep the argument |
|
55 # checking as insurance against future developments. |
|
56 # |
|
57 my $secure = 1; |
|
58 if (scalar @ARGV == 1) { |
|
59 my $option = $ARGV[0]; |
|
60 if ($option !~ /^secure$/i) { |
|
61 die "Unknown option $ARGV[0] - did you mean \"secure\"?\n"; |
|
62 } |
|
63 } |
|
64 |
|
65 my $GroupDir=$0; # $0 is this script |
|
66 $GroupDir=~s-^\w:(.*)$-$1-o; # remove drive letter |
|
67 $GroupDir=~s-\/-\\-go; |
|
68 unless ($GroupDir=~m-^\\-o) |
|
69 { |
|
70 # $GroupDir is relative |
|
71 my $Cwd=cwd(); |
|
72 $Cwd=~s-^\w:(.*)$-$1-o; # remove drive letter |
|
73 $Cwd=~s-\/-\\-go; |
|
74 $Cwd=~s-^\\$--o; # make sure we don't end in a backslash |
|
75 $GroupDir="$Cwd\\$GroupDir"; # append relative group dir to absolute Cwd |
|
76 } |
|
77 $GroupDir=~s-^(.*\\)[^\\]+$-$1-o; # remove filename, leaving just path |
|
78 # strip the resulting path of excess occurrences of . and .. |
|
79 while ($GroupDir=~s-\\\.\\-\\-go) { } |
|
80 while ($GroupDir=~s-\\(?!\.{2}\\)[^\\]*\\\.{2}(?=\\)--go) { } |
|
81 |
|
82 my $GroupToRoot=&UpToRoot($GroupDir); |
|
83 chop $GroupToRoot; |
|
84 |
|
85 my $GroupToToolsPath="$GroupToRoot$EPOCToolsPath"; |
|
86 |
|
87 my $GroupToToolsConfigFilePath="$GroupToRoot$EPOCToolsConfigFilePath"; |
|
88 |
|
89 my $GroupToDocsPath="$GroupToRoot$DocsPath"; |
|
90 |
|
91 my $GroupToTemplatePath="$GroupToRoot$TemplateFilePath"; |
|
92 |
|
93 my $GroupToShellPath="$GroupToRoot$ShellFilePath"; |
|
94 |
|
95 my $GroupToBinPath="$GroupToRoot$BinFilePath"; |
|
96 |
|
97 $GroupDir=~s-\\$--o; # remove trailing backslash |
|
98 chdir "$GroupDir" or die "Can't cd to $GroupDir: $!\n"; |
|
99 |
|
100 my %Files=(); |
|
101 |
|
102 # read the component |
|
103 opendir E32TOOLP, ".." or die "ERROR: Can't open dir ..\n"; |
|
104 my $SubDir; |
|
105 foreach $SubDir (grep /^[^\.]/o, map lc $_, readdir E32TOOLP) { |
|
106 if ($SubDir!~/^(group|docs|test|binutils|maksym)$/o) { |
|
107 opendir SUBDIR, "..\\$SubDir" or die "ERROR: Can't open dir \"..\\$SubDir\"\n"; |
|
108 my @FileList = map lc $_, readdir SUBDIR; |
|
109 foreach my $file (grep /^[^_\.].+\.(pm|pl|bat|cmd|config|bsf|xml|cwlink|txt)$/o, @FileList) { |
|
110 $Files{$file} = "$SubDir\\$file"; |
|
111 } |
|
112 if ($secure) { |
|
113 # Look for additional files whose names start with _secure_ |
|
114 my @securefiles = grep /^_secure_.+\.(pm|pl|bat|cmd|config|bsf|xml|cwlink|txt)$/o, @FileList; |
|
115 foreach my $file (@securefiles) { |
|
116 my $dstfile = $file; |
|
117 $dstfile =~ s/^_secure_//; |
|
118 if (defined($Files{$dstfile})) { |
|
119 print "$dstfile: $SubDir\\$file overrides $Files{$dstfile}\n"; |
|
120 } |
|
121 $Files{$dstfile} = "$SubDir\\$file"; |
|
122 } |
|
123 } |
|
124 } |
|
125 } |
|
126 |
|
127 # read the compiler configuration files |
|
128 my @ConfigFiles; |
|
129 |
|
130 opendir CONFIGDIR, "..\\platform" or die "ERROR: Can't open dir \"..\\platform\"\n"; |
|
131 @ConfigFiles = grep /\.(mk|make)/i, readdir CONFIGDIR; |
|
132 |
|
133 closedir CONFIGDIR; |
|
134 |
|
135 opendir SUBDIR, "..\\Docs" or die "ERROR: Can't open dir \"..\\Docs\"\n"; |
|
136 my @Docs = map lc $_, readdir SUBDIR; |
|
137 @Docs = grep /^[^\.].+\.(rtf|doc|changes|txt|html|htm)$/o, @Docs; |
|
138 |
|
139 closedir SUBDIR; |
|
140 |
|
141 open TEMPLATEFILESUBDIR, "\"dir \/s \/b \/a-d ..\\..\\..\\toolsandutils\\buildsystem\\extension\" |"; |
|
142 my @TemplateFiles=(); |
|
143 my %TemplateDirs; |
|
144 while (<TEMPLATEFILESUBDIR>) |
|
145 { |
|
146 next if ($_ !~ /\.(mk|meta)$/i); |
|
147 $_ =~ s/^.*\\buildsystem\\extension\\//i; |
|
148 chomp $_; |
|
149 push @TemplateFiles, $_; |
|
150 $_ =~ /^(.*\\)/o; |
|
151 my $path = $1; |
|
152 $path =~ s/\\$//; |
|
153 $TemplateDirs{$path}=1; |
|
154 } |
|
155 close TEMPLATEFILESUBDIR; |
|
156 |
|
157 opendir SHELLFILESUBDIR, "..\\..\\..\\toolsandutils\\buildsystem\\shell" or die "ERROR: Can't open dir \"..\\buildsystem\\shell\"\n"; |
|
158 my @ShellFiles = map lc $_, readdir SHELLFILESUBDIR; |
|
159 @ShellFiles = grep /^[^\.].+\.(mk)$/o, @ShellFiles; |
|
160 closedir SHELLFILESUBDIR; |
|
161 |
|
162 open BINFILESUBDIR, "\"dir \/s \/b \/a-d ..\\..\\..\\toolsandutils\\buildsystem\\bin\" |"; |
|
163 my @BinFiles=(); |
|
164 my %BinDirs; |
|
165 while (<BINFILESUBDIR>) |
|
166 { |
|
167 next if ($_ !~ /\.(exe|jar)$/i); |
|
168 $_ =~ s/^.*\\buildsystem\\bin\\//i; |
|
169 chomp $_; |
|
170 push @BinFiles, $_; |
|
171 $_ =~ /^(.*\\)/o; |
|
172 my $path = $1; |
|
173 $path =~ s/\\$//; |
|
174 $BinDirs{$path}=1; |
|
175 } |
|
176 close BINFILESUBDIR; |
|
177 |
|
178 my $PrintGroupDir=$GroupDir; |
|
179 $PrintGroupDir=~s-\\-\\\\-go; |
|
180 |
|
181 # Create BLD.BAT |
|
182 my $OutTxt=''; |
|
183 &Output( |
|
184 "\@echo off\n", |
|
185 "\@goto invoke\n", |
|
186 "\n", |
|
187 "#!perl\n", |
|
188 "unless (\@ARGV==1 && \$ARGV[0]=~/^(deb|rel|clean)\$/io) {\n", |
|
189 " die\n", |
|
190 " \"E32TOOLP's bld.bat - usage\\n\",\n", |
|
191 " \"BLD [param]\\n\",\n", |
|
192 " \"where\\n\",\n", |
|
193 " \"param = DEB or REL or CLEAN\\n\"\n", |
|
194 " ;\n", |
|
195 "}\n", |
|
196 "my \$Param=lc \$ARGV[0];\n", |
|
197 "chdir \"$PrintGroupDir\";\n", |
|
198 "print \"..\\\\binutils\\\\make -s -f e32toolp.make \$Param\\n\";\n", |
|
199 "open PIPE, \"..\\\\binutils\\\\make -s -f e32toolp.make \$Param |\" or die \"Can't invoke make: \$!\\n\";\n", |
|
200 "while (<PIPE>) {}\n", |
|
201 "close PIPE;\n", |
|
202 "\n", |
|
203 "__END__\n", |
|
204 "\n", |
|
205 ":invoke\n", |
|
206 "perl -x $GroupDir\\bld.bat %1 %2\n" |
|
207 ); |
|
208 |
|
209 my $BLDFILE='bld.bat'; |
|
210 print "Creating File \"$BLDFILE\"\n"; |
|
211 open BLDFILE,">$BLDFILE" or die "\nERROR: Can't open or create Batch file \"$BLDFILE\"\n"; |
|
212 print BLDFILE "$OutTxt" or die "\nERROR: Can't write output to Batch file \"$BLDFILE\"\n"; |
|
213 close BLDFILE or die "\nERROR: Can't close Batch file \"$BLDFILE\"\n"; |
|
214 |
|
215 |
|
216 # Create the make file |
|
217 $OutTxt=''; |
|
218 &Output( |
|
219 "\n", |
|
220 "ifeq (\$(OS),Windows_NT)\n", |
|
221 "ERASE = \@erase 2>>nul\n", |
|
222 "else\n", |
|
223 "ERASE = \@erase\n", |
|
224 "endif\n", |
|
225 "\n", |
|
226 "\n", |
|
227 "$GroupToToolsPath :\n", |
|
228 "\t\@perl -w ..\\genutil\\emkdir.pl $GroupToToolsPath\n", |
|
229 "\n", |
|
230 "$GroupToTemplatePath :\n", |
|
231 "\t\@perl -w ..\\genutil\\emkdir.pl $GroupToTemplatePath\n", |
|
232 "\n" |
|
233 ); |
|
234 |
|
235 foreach (sort keys %TemplateDirs) { |
|
236 &Output( |
|
237 "$GroupToTemplatePath\\$_ :\n", |
|
238 "\t\@perl -w ..\\genutil\\emkdir.pl $GroupToTemplatePath\\$_\n", |
|
239 "\n" |
|
240 ); |
|
241 } |
|
242 |
|
243 foreach (sort keys %BinDirs) { |
|
244 &Output( |
|
245 "$GroupToBinPath\\$_ :\n", |
|
246 "\t\@perl -w ..\\genutil\\emkdir.pl $GroupToBinPath\\$_\n", |
|
247 "\n" |
|
248 ); |
|
249 } |
|
250 |
|
251 &Output( |
|
252 "$GroupToShellPath :\n", |
|
253 "\t\@perl -w ..\\genutil\\emkdir.pl $GroupToShellPath\n", |
|
254 "\n", |
|
255 "$GroupToToolsConfigFilePath :\n", |
|
256 "\t\@perl -w ..\\genutil\\emkdir.pl $GroupToToolsConfigFilePath\n", |
|
257 "\n", |
|
258 "$GroupToDocsPath :\n", |
|
259 "\t\@perl -w ..\\genutil\\emkdir.pl $GroupToDocsPath\n", |
|
260 "\n", |
|
261 "\n", |
|
262 "deb : $GroupToToolsPath $GroupToToolsConfigFilePath $GroupToDocsPath $GroupToTemplatePath $GroupToShellPath " |
|
263 ); |
|
264 |
|
265 foreach (sort keys %TemplateDirs) { |
|
266 &Output( |
|
267 "$GroupToTemplatePath\\$_ " |
|
268 ); |
|
269 } |
|
270 |
|
271 foreach (sort keys %BinDirs) { |
|
272 &Output( |
|
273 "$GroupToBinPath\\$_ " |
|
274 ); |
|
275 } |
|
276 |
|
277 &Output("\n"); |
|
278 |
|
279 my $File; |
|
280 foreach $File (keys %Files) { |
|
281 &Output( |
|
282 "\tcopy \"..\\$Files{$File}\" \"$GroupToToolsPath\\$File\" >nul\n" |
|
283 ); |
|
284 } |
|
285 |
|
286 my $ConfigFile; |
|
287 foreach $ConfigFile (@ConfigFiles) { |
|
288 &Output( |
|
289 "\tcopy \"..\\platform\\$ConfigFile\" \"$GroupToToolsConfigFilePath\\$ConfigFile\" >nul\n" |
|
290 ); |
|
291 } |
|
292 |
|
293 foreach $File (@Docs) { |
|
294 &Output( |
|
295 "\tcopy \"..\\Docs\\$File\" \"$GroupToDocsPath\\$File\" >nul\n" |
|
296 ); |
|
297 } |
|
298 |
|
299 my $tfile; |
|
300 foreach $tfile (@TemplateFiles) { |
|
301 &Output( |
|
302 "\tcopy \"..\\..\\..\\toolsandutils\\buildsystem\\extension\\$tfile\" \"$GroupToTemplatePath\\$tfile\" >nul\n" |
|
303 ); |
|
304 } |
|
305 |
|
306 my $bfile; |
|
307 foreach $bfile (@BinFiles) { |
|
308 &Output( |
|
309 "\tcopy \"..\\..\\..\\toolsandutils\\buildsystem\\bin\\$bfile\" \"$GroupToBinPath\\$bfile\" >nul\n" |
|
310 ); |
|
311 } |
|
312 |
|
313 my $sfile; |
|
314 foreach $sfile (@ShellFiles) { |
|
315 &Output( |
|
316 "\tcopy \"..\\..\\..\\toolsandutils\\buildsystem\\shell\\$sfile\" \"$GroupToShellPath\\$sfile\" >nul\n" |
|
317 ); |
|
318 } |
|
319 |
|
320 &Output( |
|
321 "\n", |
|
322 "\n", |
|
323 "rel : $GroupToToolsPath $GroupToToolsConfigFilePath $GroupToDocsPath $GroupToTemplatePath $GroupToShellPath " |
|
324 ); |
|
325 |
|
326 foreach (sort keys %TemplateDirs) { |
|
327 &Output( |
|
328 "$GroupToTemplatePath\\$_ " |
|
329 ); |
|
330 } |
|
331 |
|
332 foreach (sort keys %BinDirs) { |
|
333 &Output( |
|
334 "$GroupToBinPath\\$_ " |
|
335 ); |
|
336 } |
|
337 |
|
338 &Output("\n"); |
|
339 |
|
340 |
|
341 foreach $File (keys %Files) { |
|
342 &Output( |
|
343 "\t.\\perlprep.bat \"..\\$Files{$File}\" \"$GroupToToolsPath\\$File\"\n" |
|
344 ); |
|
345 } |
|
346 |
|
347 foreach $ConfigFile (@ConfigFiles) { |
|
348 &Output( |
|
349 "\tcopy \"..\\platform\\$ConfigFile\" \"$GroupToToolsConfigFilePath\\$ConfigFile\" >nul\n" |
|
350 ); |
|
351 } |
|
352 |
|
353 foreach $File (@Docs) { |
|
354 &Output( |
|
355 "\tcopy \"..\\Docs\\$File\" \"$GroupToDocsPath\\$File\" >nul\n" |
|
356 ); |
|
357 } |
|
358 |
|
359 foreach $tfile (@TemplateFiles) { |
|
360 &Output( |
|
361 "\tcopy \"..\\..\\..\\toolsandutils\\buildsystem\\extension\\$tfile\" \"$GroupToTemplatePath\\$tfile\" >nul\n" |
|
362 ); |
|
363 } |
|
364 foreach $bfile (@BinFiles) { |
|
365 &Output( |
|
366 "\tcopy \"..\\..\\..\\toolsandutils\\buildsystem\\bin\\$bfile\" \"$GroupToBinPath\\$bfile\" >nul\n" |
|
367 ); |
|
368 } |
|
369 foreach $sfile (@ShellFiles) { |
|
370 &Output( |
|
371 "\tcopy \"..\\..\\..\\toolsandutils\\buildsystem\\shell\\$sfile\" \"$GroupToShellPath\\$sfile\" >nul\n" |
|
372 ); |
|
373 } |
|
374 &Output( |
|
375 "\n", |
|
376 "rel deb : $GroupToToolsPath\\make.exe\n", |
|
377 "$GroupToToolsPath\\make.exe: ..\\binutils\\make.exe\n", |
|
378 "\tcopy \$\? \$\@\n" |
|
379 ); |
|
380 |
|
381 &Output( |
|
382 "\n", |
|
383 "rel deb : $GroupToToolsPath\\scpp.exe\n", |
|
384 "$GroupToToolsPath\\scpp.exe: ..\\binutils\\scpp.exe\n", |
|
385 "\tcopy \$\? \$\@\n" |
|
386 ); |
|
387 |
|
388 |
|
389 &Output( |
|
390 "\n", |
|
391 "clean :\n" |
|
392 ); |
|
393 foreach $File (keys %Files) { |
|
394 &Output( |
|
395 "\t-\$(ERASE) \"$GroupToToolsPath\\$File\"\n" |
|
396 ); |
|
397 } |
|
398 foreach $ConfigFile (@ConfigFiles) { |
|
399 &Output( |
|
400 "\t-\$(ERASE) \"$GroupToToolsConfigFilePath\\$ConfigFile\"\n" |
|
401 ); |
|
402 } |
|
403 foreach $File (@Docs) { |
|
404 &Output( |
|
405 "\t-\$(ERASE) \"$GroupToDocsPath\\$File\"\n" |
|
406 ); |
|
407 } |
|
408 foreach $tfile (@TemplateFiles) { |
|
409 &Output( |
|
410 "\t-\$(ERASE) \"$GroupToTemplatePath\\$tfile\"\n" |
|
411 ); |
|
412 } |
|
413 foreach $bfile (@BinFiles) { |
|
414 &Output( |
|
415 "\t-\$(ERASE) \"$GroupToBinPath\\$bfile\"\n" |
|
416 ); |
|
417 } |
|
418 foreach $sfile (@ShellFiles) { |
|
419 &Output( |
|
420 "\t-\$(ERASE) \"$GroupToShellPath\\$sfile\"\n" |
|
421 ); |
|
422 } |
|
423 |
|
424 my $MAKEFILE="e32toolp.make"; |
|
425 print "Creating File \"$MAKEFILE\"\n"; |
|
426 open MAKEFILE,">$MAKEFILE" or die "\nERROR: Can't open or create Batch file \"$MAKEFILE\"\n"; |
|
427 print MAKEFILE "$OutTxt" or die "\nERROR: Can't write output to Batch file \"$MAKEFILE\"\n"; |
|
428 close MAKEFILE or die "\nERROR: Can't close Batch file \"$MAKEFILE\"\n"; |
|
429 |
|
430 |
|
431 |
|
432 # this code autocreates the .rel file |
|
433 |
|
434 my @ToolsDst = ("make.exe", "scpp.exe"); |
|
435 my @DocsDst = @Docs; |
|
436 my @ConfigFilesDst = @ConfigFiles; |
|
437 my @TemplateFilesDst = @TemplateFiles; |
|
438 my @BinFilesDst = @BinFiles; |
|
439 my @ShellFilesDst = @ShellFiles; |
|
440 |
|
441 push @ToolsDst, keys %Files; |
|
442 |
|
443 # TOOLS.REL file |
|
444 |
|
445 my $RELFILE="tools.rel"; |
|
446 print "Creating File \"$RELFILE\"\n"; |
|
447 open RELFILE,">$RELFILE" or die "\nERROR: Can't open or create Rel file \"$RELFILE\"\n"; |
|
448 print RELFILE "${EPOCRoot}epoc32\\tools\\"; |
|
449 print RELFILE join("\n${EPOCRoot}epoc32\\tools\\", sort @ToolsDst); |
|
450 print RELFILE join("\n${EPOCRoot}epoc32\\tools\\compilation_config\\","", sort @ConfigFilesDst); |
|
451 print RELFILE join("\n${EPOCRoot}epoc32\\EngDoc\\E32toolp\\","", sort @DocsDst); |
|
452 close RELFILE or die "\nERROR: Can't close Rel file \"$RELFILE\"\n"; |
|
453 |
|
454 # Check MRP file - the modern equivalent of tools.rel |
|
455 |
|
456 my $NewMRPText = "component tools_e32toolp\n"; |
|
457 $NewMRPText .= "# This file is generated by setupprj.bat\n\n"; |
|
458 $NewMRPText .= "ipr T\n"; |
|
459 $NewMRPText .= "ipr O \\sf\\os\\buildtools\\sbsv1_os\\e32toolp\\binutils\n\n"; |
|
460 $NewMRPText .= "source \\sf\\os\\buildtools\\sbsv1_os\\e32toolp\n"; |
|
461 $NewMRPText .= "source \\sf\\os\\buildtools\\toolsandutils\\buildsystem\n"; |
|
462 $NewMRPText .= join("\nbinary \\epoc32\\tools\\", "",sort @ToolsDst); |
|
463 # Don't include EngDoc files in the MRP file |
|
464 $NewMRPText .= join("\nbinary \\epoc32\\tools\\compilation_config\\","", sort @ConfigFilesDst); |
|
465 $NewMRPText .= join("\nbinary \\epoc32\\tools\\makefile_templates\\","", sort @TemplateFilesDst); |
|
466 $NewMRPText .= join("\nbinary \\epoc32\\tools\\","", sort @BinFilesDst); |
|
467 $NewMRPText .= join("\nbinary \\epoc32\\tools\\shell\\","", sort @ShellFilesDst); |
|
468 $NewMRPText .= "\n\n"; |
|
469 $NewMRPText .= "notes_source \\component_defs\\release.src\n"; |
|
470 |
|
471 my $MRPFILE="tools_e32toolp.mrp"; |
|
472 open MRPFILE,"<$MRPFILE" or die "\nERROR: Can't read MRP file \"$MRPFILE\"\n"; |
|
473 my $OldMRPText = ""; |
|
474 sysread MRPFILE, $OldMRPText, 100000; # assumes MRP file is less than 100,000 bytes |
|
475 close MRPFILE or die "\nERROR: Can't close MRP file \"$MRPFILE\"\n"; |
|
476 |
|
477 if ($OldMRPText ne $NewMRPText) { |
|
478 print "REMARK: MRP file \"$MRPFILE\" differs from setupprj.bat generated content\n"; |
|
479 print "Creating suggested new MRP file \"$MRPFILE.new\"\n"; |
|
480 open MRPFILE,">$MRPFILE.new" or die "\nERROR: Can't open or create MRP file \"$MRPFILE.new\"\n"; |
|
481 print MRPFILE $NewMRPText; |
|
482 close MRPFILE or die "\nERROR: Can't close MRP file \"$MRPFILE.new\"\n"; |
|
483 } |
|
484 |
|
485 |
|
486 # SUBROUTINE SECTION |
|
487 #################### |
|
488 sub Output (@) { |
|
489 my $Txt; |
|
490 foreach $Txt (@_) { |
|
491 $OutTxt.=$Txt; |
|
492 } |
|
493 } |
|
494 |
|
495 sub UpToRoot ($) { #args: $_[0] Abs FilePath/Path |
|
496 # return the path that will lead from the directory the path passed into the function |
|
497 # specifies back up to the root directory |
|
498 return undef unless $_[0]=~m-^\\-o; |
|
499 my $Path=$_[0]; |
|
500 my $UpP; |
|
501 while ($Path=~m-\\-go) |
|
502 { |
|
503 $UpP.="..\\"; |
|
504 } |
|
505 undef $Path; |
|
506 $UpP=~s-^(.*)\.\.\\-$1-o; |
|
507 $UpP=".\\" unless $UpP; |
|
508 } |
|
509 |
|
510 |
|
511 |
|
512 __END__ |
|
513 |
|
514 :End |