Lines 23-29
Link Here
|
23 |
# VI. Open the output file. |
23 |
# VI. Open the output file. |
24 |
# VII. Writing the data to the output file. |
24 |
# VII. Writing the data to the output file. |
25 |
# VIII. Closing output file. |
25 |
# VIII. Closing output file. |
26 |
# IX. Sourcing the output file. |
26 |
# IX. Creating importenv.mk. |
27 |
# X. Set up the build environment. |
27 |
# X. Set up the build environment. |
28 |
# XI. Moving the output file to the build home directory. |
28 |
# XI. Moving the output file to the build home directory. |
29 |
# |
29 |
# |
Lines 31-36
Link Here
|
31 |
# |
31 |
# |
32 |
use strict; # pragma |
32 |
use strict; # pragma |
33 |
use File::Basename; |
33 |
use File::Basename; |
|
|
34 |
use File::Path; |
34 |
|
35 |
|
35 |
|
36 |
|
36 |
# |
37 |
# |
Lines 38-43
Link Here
|
38 |
# IIa. Declaring variables for the system commands, etc. |
39 |
# IIa. Declaring variables for the system commands, etc. |
39 |
#-------------------------------------------------------- |
40 |
#-------------------------------------------------------- |
40 |
# |
41 |
# |
|
|
42 |
|
43 |
# Used for the importenv.mk generation |
44 |
my ( $importenvdir, $extraimportfile, $noimportfile); |
45 |
my %no_import = (); |
46 |
my @extra_import = (); |
47 |
my @no_import = (); |
48 |
my @env_import = (); |
49 |
my @env_import_tmp = (); |
50 |
|
41 |
my ( $outfile, $outfile_sh, $outfile_bat, $bootfile, $newline, $comment, $comment4nt, $compiler, $unsetenv, $setenv, $unset, $set, $ds, $ps, $cur_dir, |
51 |
my ( $outfile, $outfile_sh, $outfile_bat, $bootfile, $newline, $comment, $comment4nt, $compiler, $unsetenv, $setenv, $unset, $set, $ds, $ps, $cur_dir, |
42 |
$par_dir, $I, $L, $D, $buildenv, $answer, $tmp, $MINGW, $platform, |
52 |
$par_dir, $I, $L, $D, $buildenv, $answer, $tmp, $MINGW, $platform, |
43 |
$cygwinver, $empty, $no_ant, $no_stl, $no_gcc_include, |
53 |
$cygwinver, $empty, $no_ant, $no_stl, $no_gcc_include, |
Lines 1922-1930
Link Here
|
1922 |
} |
1932 |
} |
1923 |
# |
1933 |
# |
1924 |
#------------------------------ |
1934 |
#------------------------------ |
1925 |
# IX. Sourcing the output file. |
1935 |
# IX. Creating importenv.mk |
1926 |
#------------------------------ |
1936 |
#------------------------------ |
1927 |
# |
1937 |
# |
|
|
1938 |
$importenvdir = $SOLARVERSION.$ds.$INPATH.$INC; |
1939 |
$importenvdir =~ s/(\$\{?\w+\}?)/$1/eeg ; # expand the variables |
1940 |
$extraimportfile = $SOLARENV.$INC.$ds."dmakeextraimport.lst"; |
1941 |
$noimportfile = $SOLARENV.$INC.$ds."dmakenoimport.lst"; |
1942 |
print(":".$importenvdir.":\n"); |
1943 |
mkpath($importenvdir) unless -d $importenvdir; |
1944 |
open( IMPENVOUT, ">$importenvdir".$ds."importenv.mk" ) || |
1945 |
die "Cannot open $importenvdir".$ds."importenv.mk: $!\n"; |
1946 |
|
1947 |
print IMPENVOUT "# Generated import list of environment variables for dmake\n"; |
1948 |
print IMPENVOUT "# Do not edit!\n"; |
1949 |
print IMPENVOUT "#\n"; |
1950 |
print IMPENVOUT ".IMPORT .IGNORE :"; |
1951 |
|
1952 |
readVarList(\@extra_import, $extraimportfile); |
1953 |
readVarList(\@no_import, $noimportfile); |
1954 |
for (@no_import) { |
1955 |
$no_import{$_} = "1"; |
1956 |
} |
1957 |
|
1958 |
for my $ele (@env_import) { |
1959 |
unless( $no_import{$ele} ) { |
1960 |
push @env_import_tmp,$ele; |
1961 |
} |
1962 |
} |
1963 |
for my $ele (@extra_import) { |
1964 |
push @env_import_tmp,$ele; |
1965 |
} |
1966 |
@env_import = sort @env_import_tmp; |
1967 |
for (@env_import) { |
1968 |
print IMPENVOUT " ".$_; |
1969 |
} |
1970 |
print IMPENVOUT "\n"; |
1971 |
|
1972 |
close( IMPENVOUT ) || print "Can't close importenv.mk: $!"; |
1973 |
|
1974 |
# |
1928 |
#--------------------------------- |
1975 |
#--------------------------------- |
1929 |
# X. Set up the build environment. |
1976 |
# X. Set up the build environment. |
1930 |
#--------------------------------- |
1977 |
#--------------------------------- |
Lines 2101-2107
Link Here
|
2101 |
#--------------------------------------------------------- |
2148 |
#--------------------------------------------------------- |
2102 |
sub ToFile |
2149 |
sub ToFile |
2103 |
{ if ( $_[ 2 ] eq "e" ) |
2150 |
{ if ( $_[ 2 ] eq "e" ) |
2104 |
{ # Write an environment variable to file. |
2151 |
{ # Add variable to dmake import list |
|
|
2152 |
push @env_import, $_[ 0 ]; |
2153 |
|
2154 |
# Write an environment variable to file. |
2105 |
if (defined $_[ 1 ] && $_[ 1 ] ne "" ) |
2155 |
if (defined $_[ 1 ] && $_[ 1 ] ne "" ) |
2106 |
{ printf("%-12s %-17s %-10s %s\n", "The variable", $_[ 0 ], "is set to:", $_[ 1 ]) ; # to stdout |
2156 |
{ printf("%-12s %-17s %-10s %s\n", "The variable", $_[ 0 ], "is set to:", $_[ 1 ]) ; # to stdout |
2107 |
print OUT "$setenv $_[ 0 ] \"$_[ 1 ]\"$newline"; # to tcsh file |
2157 |
print OUT "$setenv $_[ 0 ] \"$_[ 1 ]\"$newline"; # to tcsh file |
Lines 2176-2182
Link Here
|
2176 |
print OUT_BAT "$_[ 0 ] $newline" if defined($outfile_bat); |
2226 |
print OUT_BAT "$_[ 0 ] $newline" if defined($outfile_bat); |
2177 |
} |
2227 |
} |
2178 |
elsif ( $_[ 2 ] eq "j" ) |
2228 |
elsif ( $_[ 2 ] eq "j" ) |
2179 |
{ |
2229 |
{ # Add variable to dmake import list |
|
|
2230 |
push @env_import, $_[ 0 ]; |
2231 |
|
2180 |
if ((defined $_[ 1 ]) and ( $platform =~ m/cygwin/ )) |
2232 |
if ((defined $_[ 1 ]) and ( $platform =~ m/cygwin/ )) |
2181 |
{ printf("%-12s %-17s %-10s %-39s\n", "The variable", $_[ 0 ], "is set to:", $_[ 1 ]) ; # to stdout |
2233 |
{ printf("%-12s %-17s %-10s %-39s\n", "The variable", $_[ 0 ], "is set to:", $_[ 1 ]) ; # to stdout |
2182 |
$win_format_var = WinFormat( $_[ 1 ] ); #Filter for Windows |
2234 |
$win_format_var = WinFormat( $_[ 1 ] ); #Filter for Windows |
Lines 2446-2451
Link Here
|
2446 |
$Warning = $Warning."* - set_soenv: warning: $arg1 $newline"; # add the warning |
2498 |
$Warning = $Warning."* - set_soenv: warning: $arg1 $newline"; # add the warning |
2447 |
} |
2499 |
} |
2448 |
} |
2500 |
} |
|
|
2501 |
|
2502 |
#--------------------------------------------------------- |
2503 |
# Function name: readVarList |
2504 |
# Description: Read the variable names from a file into an array. |
2505 |
# Arguments: 1. Reference to the target array |
2506 |
# 2. File name |
2507 |
# Return value: void |
2508 |
#--------------------------------------------------------- |
2509 |
sub readVarList |
2510 |
{ |
2511 |
my $ArrayRef = shift; |
2512 |
my $FileName = shift; |
2513 |
my $FileContent; |
2514 |
if (open ($FileContent, $FileName)) { |
2515 |
while (<$FileContent>) { |
2516 |
my $line = $_; |
2517 |
my @vars; |
2518 |
chomp $line; |
2519 |
$line =~ s/#.+$//; |
2520 |
$line =~ s/^\s+//; |
2521 |
$line =~ s/\s+$//; |
2522 |
@vars = split(/\s+/, $line); |
2523 |
for (@vars) { |
2524 |
push @{$ArrayRef}, $_; |
2525 |
} |
2526 |
} |
2527 |
close ($FileContent); |
2528 |
} |
2529 |
} |
2530 |
|
2449 |
#------------------- |
2531 |
#------------------- |
2450 |
# That's all folks! |
2532 |
# That's all folks! |
2451 |
#------------------- |
2533 |
#------------------- |