1cdf0e10cSrcweir: 2cdf0e10cSrcweireval 'exec perl -wS $0 ${1+"$@"}' 3cdf0e10cSrcweir if 0; 47e90fac2SAndrew Rist#************************************************************** 5cdf0e10cSrcweir# 67e90fac2SAndrew Rist# Licensed to the Apache Software Foundation (ASF) under one 77e90fac2SAndrew Rist# or more contributor license agreements. See the NOTICE file 87e90fac2SAndrew Rist# distributed with this work for additional information 97e90fac2SAndrew Rist# regarding copyright ownership. The ASF licenses this file 107e90fac2SAndrew Rist# to you under the Apache License, Version 2.0 (the 117e90fac2SAndrew Rist# "License"); you may not use this file except in compliance 127e90fac2SAndrew Rist# with the License. You may obtain a copy of the License at 13cdf0e10cSrcweir# 147e90fac2SAndrew Rist# http://www.apache.org/licenses/LICENSE-2.0 15cdf0e10cSrcweir# 167e90fac2SAndrew Rist# Unless required by applicable law or agreed to in writing, 177e90fac2SAndrew Rist# software distributed under the License is distributed on an 187e90fac2SAndrew Rist# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 197e90fac2SAndrew Rist# KIND, either express or implied. See the License for the 207e90fac2SAndrew Rist# specific language governing permissions and limitations 217e90fac2SAndrew Rist# under the License. 22cdf0e10cSrcweir# 237e90fac2SAndrew Rist#************************************************************** 247e90fac2SAndrew Rist 257e90fac2SAndrew Rist 26cdf0e10cSrcweir# 27cdf0e10cSrcweiruse XML::Parser; 28cdf0e10cSrcweir# ------------------------------------------------------------------------ 29cdf0e10cSrcweir# Other global stuff 30*0e7a4e4fSArrigo Marchiori$is_debug = exists $ENV{'debug'}; 31*0e7a4e4fSArrigo Marchiori$enable_symbols = exists $ENV{'ENABLE_SYMBOLS'}; 32cdf0e10cSrcweirmy $path = $ENV{'INPATH'} . "/"; 33cdf0e10cSrcweirmy $quot = '"'; 34cdf0e10cSrcweirmy %template_hash=(); 35b0de3218SArrigo Marchiorimy $architecture = "x86"; 36cdf0e10cSrcweirmy %vcproj_hash=(); 37cdf0e10cSrcweir# ------------------------------------------------------------------------ 38cdf0e10cSrcweir# Global stuff for parsing the *.vcproj files (XML::Parser) 39cdf0e10cSrcweir# 40cdf0e10cSrcweirmy $ConfigurationGlobal = 1; # Release = 1, Debug=0 41cdf0e10cSrcweirmy $Configuration = undef; 42cdf0e10cSrcweirmy %configelements = (); 43cdf0e10cSrcweirmy %files = (); 44cdf0e10cSrcweirmy %files2copy = (); 45cdf0e10cSrcweirmy %files_special = (); 46cdf0e10cSrcweirmy $Release = 1; 47cdf0e10cSrcweir # Release = 1, Debug = 0, undef = 2 48cdf0e10cSrcweirmy $file_tmp = ""; # temporary storage for file name 49cdf0e10cSrcweirmy $CustomSection = 0; 50cdf0e10cSrcweir# ------------------------------------------------------------------------ 51cdf0e10cSrcweir# ------------------------------------------------------------------------ 52cdf0e10cSrcweir# e.g. %object_hash with Key = blabla.cpp 53cdf0e10cSrcweir# contains a Hash: 54cdf0e10cSrcweir# Header: "..\\common\\unicode\\utypes.h ..\\common\\unicode\\uset.h" 55cdf0e10cSrcweir# CFlags: Common (set in templates file) or special sequence 56cdf0e10cSrcweir# CDefs: Common (set in templates file) or special sequence 57cdf0e10cSrcweir# ------------------------------------------------------------------------ 58cdf0e10cSrcweirmy $configfile = shift; 59cdf0e10cSrcweirmy $sourcePath = shift; 60cdf0e10cSrcweirif ( !$configfile ) { 61cdf0e10cSrcweir $configfile = "createmak.cfg"; 62cdf0e10cSrcweir} 63cdf0e10cSrcweirif ( !$sourcePath ) { 64cdf0e10cSrcweir $inpath = $ENV{"INPATH"}; 65cdf0e10cSrcweir $sourcePath = $inpath . "\\misc\\build\\icu\\source"; 66cdf0e10cSrcweir} 67cdf0e10cSrcweir$dir = ""; 68cdf0e10cSrcweir$header = ""; 69cdf0e10cSrcweir$sep = "\\\\"; 70cdf0e10cSrcweir 71cdf0e10cSrcweir%project_by_id =(); 72cdf0e10cSrcweir%project_by_name = (); 73cdf0e10cSrcweir%project_dependencies = (); 74cdf0e10cSrcweirmy @builddeps = prepare_allinone_all_mak(\%project_by_id,\%project_by_name,\%project_dependencies,$sourcePath); 75cdf0e10cSrcweir 76cdf0e10cSrcweirfillTemplateHash($configfile); 77b0de3218SArrigo Marchiori# The architecture is indicated in the configuration file 78b0de3218SArrigo Marchiori$architecture=${$template_hash{"Architecture"}}[0]; 79b0de3218SArrigo Marchiorichomp $architecture; 80b0de3218SArrigo Marchioriprint "Architecture: $architecture\n" if ($is_debug); 81cdf0e10cSrcweir 82cdf0e10cSrcweircreate_allinone_all_mak(\@builddeps,\%project_by_id,$sourcePath); 83cdf0e10cSrcweirmy @dirs = (); 84cdf0e10cSrcweirforeach $projectname(keys %project_by_name) 85cdf0e10cSrcweir{ 86cdf0e10cSrcweir my $dir = $project_by_name{$projectname}[1]; 87cdf0e10cSrcweir $dir =~ /\.\.\\(.+)\\(.+)\.vcproj/; 88cdf0e10cSrcweir my $dir1 = $1; 89cdf0e10cSrcweir my $dir2 = $2; 90cdf0e10cSrcweir if ( $dir1 !~ /$dir2$/ ) { 91cdf0e10cSrcweir $dir1 .= "\.$dir2"; 92cdf0e10cSrcweir } 93cdf0e10cSrcweir print "$dir1 - $dir2\n" if ($is_debug); 94cdf0e10cSrcweir push @dirs, $dir1; 95cdf0e10cSrcweir} 96cdf0e10cSrcweir 97cdf0e10cSrcweir# set nonpro switch (linking against debug runtime if nonpro=1) 98cdf0e10cSrcweirmy $nonpro = ($ENV{"PROEXT"} ne ".pro"); 99cdf0e10cSrcweirprint "Non Product Build" if ($nonpro); 100cdf0e10cSrcweir 101cdf0e10cSrcweirforeach $dir(@dirs) 102cdf0e10cSrcweir{ 103cdf0e10cSrcweir next if ($dir eq "data.makedata"); # very special don't overwrite this file 104cdf0e10cSrcweir # ------------------------------------------------------------------------ 105cdf0e10cSrcweir # Reset global stuff for parsing the *.vcproj files (XML::Parser) 106cdf0e10cSrcweir # 107cdf0e10cSrcweir $Configuration = $ConfigurationGlobal; # Release = 1, Debug=0 108cdf0e10cSrcweir %configelements = (); 109cdf0e10cSrcweir %files = (); 110cdf0e10cSrcweir # contains all relevant *.c,*.cpp,*.h,*.rc files 111cdf0e10cSrcweir %files2copy = (); 112cdf0e10cSrcweir %files_special = (); 113cdf0e10cSrcweir $Release = 2; 114cdf0e10cSrcweir # Release = 1, Debug = 0, undef = 2 115cdf0e10cSrcweir $file_tmp = ""; # temporary storage for file name 116cdf0e10cSrcweir $CustomSection = 0; 117cdf0e10cSrcweir # ------------------------------------------------------------------------ 118cdf0e10cSrcweir 119cdf0e10cSrcweir my $extra_mak = ""; 120cdf0e10cSrcweir ($dir, $extra_mak) = handle_extra_mak_files($dir); # handle e.g. tools/genrb.derb entires 121cdf0e10cSrcweir 122cdf0e10cSrcweir my @mak=(); # Array for make file *.mak 123cdf0e10cSrcweir my %deps=(); 124cdf0e10cSrcweir my %object_hash=(); 125cdf0e10cSrcweir my %collected_header=(); 126cdf0e10cSrcweir my %collect_header_target_hash=(); 127cdf0e10cSrcweir my %collect_object_target_hash=(); 128cdf0e10cSrcweir my $vcproj_file = ""; 129cdf0e10cSrcweir my $resource_file = ""; 130cdf0e10cSrcweir 131cdf0e10cSrcweir # $dir : common,i18n,... 132cdf0e10cSrcweir chomp $dir; 133cdf0e10cSrcweir next if ( $dir eq "" ); 134cdf0e10cSrcweir my $fullpath = $sourcePath . "\\" . $dir; 135cdf0e10cSrcweir if ( $extra_mak eq "" ) { 136cdf0e10cSrcweir if ($dir =~ /(.+)+\\(.+)$/) 137cdf0e10cSrcweir { 138cdf0e10cSrcweir $vcproj_file = $fullpath ."\\$2.vcproj"; 139cdf0e10cSrcweir } else 140cdf0e10cSrcweir { 141cdf0e10cSrcweir $vcproj_file = $fullpath ."\\$dir.vcproj"; 142cdf0e10cSrcweir } 143cdf0e10cSrcweir } else 144cdf0e10cSrcweir { 145cdf0e10cSrcweir $vcproj_file = $fullpath . "\\" . $extra_mak . ".vcproj"; 146cdf0e10cSrcweir } 147cdf0e10cSrcweir 148cdf0e10cSrcweir 149cdf0e10cSrcweir # Parse the *.vcproj file 150cdf0e10cSrcweir my $parser = new XML::Parser(ErrorContext => 2); 151cdf0e10cSrcweir $parser->setHandlers(Start => \&start_handler, 152cdf0e10cSrcweir Char => \&char_handler); 153cdf0e10cSrcweir $parser->parsefile($vcproj_file); 154cdf0e10cSrcweir if ( $file_tmp ) { 155cdf0e10cSrcweir # save a file which hasn't been saved yet 156cdf0e10cSrcweir $files{ $file_tmp } = 1; # save it now 157cdf0e10cSrcweir $file_tmp = ""; # has been saved now reset it 158cdf0e10cSrcweir } 159cdf0e10cSrcweir 160cdf0e10cSrcweir # is there a resource file? 161cdf0e10cSrcweir foreach $i (keys %files) 162cdf0e10cSrcweir { 163cdf0e10cSrcweir if ($i =~ /\.rc/) 164cdf0e10cSrcweir { 165cdf0e10cSrcweir $resource_file = $i; 166cdf0e10cSrcweir } 167cdf0e10cSrcweir } 168cdf0e10cSrcweir # Fill hash %deps for dependencies for all files in directory ($testdir) 169cdf0e10cSrcweir # %files contains all relevant files from *.vcproj 170cdf0e10cSrcweir 171cdf0e10cSrcweir getAllFilesDeps($fullpath,\%deps,\%files); 172cdf0e10cSrcweir my $includedir = $configelements{"Release"}{"OutputDirectory"}; # e.g. OutputDirectory = ..\..\lib 173cdf0e10cSrcweir $includedir =~ s/lib/include/; 174cdf0e10cSrcweir foreach $file( sort keys %deps) 175cdf0e10cSrcweir { 176cdf0e10cSrcweir $file =~ /(.+)\.(.+)/; 177cdf0e10cSrcweir my $name = $1; 178cdf0e10cSrcweir my $ext = $2; 179cdf0e10cSrcweir next if (!defined $name); 180cdf0e10cSrcweir $object = "\$(INTDIR)\\" . "$name.obj"; 181cdf0e10cSrcweir $collect_object_target_hash{$object}=1; 182cdf0e10cSrcweir 183cdf0e10cSrcweir createMakDepSection($dir,$name,$ext,$deps{$file},\@mak,\%files_special); 184cdf0e10cSrcweir } 185cdf0e10cSrcweir my %all_target_hash=(); 186cdf0e10cSrcweir foreach $header(sort keys %files2copy) 187cdf0e10cSrcweir { 188cdf0e10cSrcweir my $dir; 189cdf0e10cSrcweir my $file; 190cdf0e10cSrcweir #$pathdepth = "..\\.."; 191cdf0e10cSrcweir $file = $header; 192cdf0e10cSrcweir $header =~ s/^\.\\//; 193cdf0e10cSrcweir $inputpath = $file; 194cdf0e10cSrcweir $target = $includedir . "\\" . $header; 195cdf0e10cSrcweir $target =~ /.+\\(.+)\\.+$/; 196cdf0e10cSrcweir $targetpath = $configelements{"Release"}{"CommandLine"}; 197cdf0e10cSrcweir chomp $targetpath; 198cdf0e10cSrcweir # set %all_target_hash and @mak 199cdf0e10cSrcweir createCopySection($file,$inputpath,$target,$targetpath,\@mak,\%all_target_hash); 200cdf0e10cSrcweir $collect_header_target_hash{$target}=1; 201cdf0e10cSrcweir } 202cdf0e10cSrcweir my $test = $configelements{"Release"}{"OutputFile"}; 203cdf0e10cSrcweir $all_target_hash{$test}=1; 204cdf0e10cSrcweir 205cdf0e10cSrcweir # set name of the *.mak file 206cdf0e10cSrcweir my $mak_file=""; 207cdf0e10cSrcweir if ( $extra_mak eq "" ) { 208cdf0e10cSrcweir $mak_file = $vcproj_file; 209cdf0e10cSrcweir $mak_file =~ s/vcproj/mak/; 210cdf0e10cSrcweir } else 211cdf0e10cSrcweir { 212cdf0e10cSrcweir # extra_mak eg. derb, stringperf 213cdf0e10cSrcweir $mak_file = $fullpath . "\\$extra_mak" . "\.mak"; 214cdf0e10cSrcweir } 215cdf0e10cSrcweir 216cdf0e10cSrcweir # generate the content of the *.mak file 217cdf0e10cSrcweir # in @mak array 218cdf0e10cSrcweir print "extra_mak=$extra_mak\n" if ($is_debug); 219cdf0e10cSrcweir print "mak_file=$mak_file\n" if ($is_debug); 220cdf0e10cSrcweir open(MAKFILE, ">$mak_file") || die "Can't open $mak_file\n"; 221cdf0e10cSrcweir print_all_target($fullpath, \%all_target_hash); 222cdf0e10cSrcweir 223cdf0e10cSrcweir # $extra_mak handles further *.mak files in a directory 224cdf0e10cSrcweir print_flags($dir,$extra_mak,'CFlags',$nonpro); # depends on directory 225cdf0e10cSrcweir print_simple_flag("Rules"); 226cdf0e10cSrcweir print_simple_flag("Link"); 227cdf0e10cSrcweir print_common_linkflags(); 228cdf0e10cSrcweir# print_flags($fullpath,$extra_mak,'LinkFlags'); # depends on directory 229cdf0e10cSrcweir# print_lib32_objs($fullpath,$extra_mak,\%collect_object_target_hash,$resource_file); 230cdf0e10cSrcweir print_flags($dir,$extra_mak,'LinkFlags'); # depends on directory 231cdf0e10cSrcweir print_lib32_objs($dir,$extra_mak,\%collect_object_target_hash,$resource_file); 232cdf0e10cSrcweir 233cdf0e10cSrcweir # write @mak array into the *.mak file 234cdf0e10cSrcweir foreach $line(@mak) 235cdf0e10cSrcweir { 236cdf0e10cSrcweir print MAKFILE $line; 237cdf0e10cSrcweir } 238cdf0e10cSrcweir $|=1; 239cdf0e10cSrcweir print "."; # user entertainment 240cdf0e10cSrcweir $|=0; 241cdf0e10cSrcweir} 242cdf0e10cSrcweirprint "\ndone\n"; 243cdf0e10cSrcweirexit; 244cdf0e10cSrcweir 245cdf0e10cSrcweir############################################################################ 246cdf0e10cSrcweirsub getKey #01.04.2008 09:46 247cdf0e10cSrcweir############################################################################ 248cdf0e10cSrcweir { 249cdf0e10cSrcweir my $line = shift; 250cdf0e10cSrcweir $line =~ /\[(.+)\]/; 251cdf0e10cSrcweir return $1; 252cdf0e10cSrcweir} ##getKey 253cdf0e10cSrcweir 254cdf0e10cSrcweir############################################################################ 255cdf0e10cSrcweirsub fillTemplateHash #01.04.2008 10:48 256cdf0e10cSrcweir############################################################################ 257cdf0e10cSrcweir { 258cdf0e10cSrcweir my $file = shift; 259cdf0e10cSrcweir open (TEMPLATE, "< $file") || die "Can't open template file $file\n"; 260cdf0e10cSrcweir my $key = ""; 261cdf0e10cSrcweir while ( $line=<TEMPLATE> ) { 262cdf0e10cSrcweir if ( $line =~ /\[.+\]/ ) { 263cdf0e10cSrcweir print $line if ($is_debug); 264cdf0e10cSrcweir if ( $key ne "" ) { 265cdf0e10cSrcweir $template_hash{$key}=[@cmdlines]; 266cdf0e10cSrcweir @cmdlines=""; 267cdf0e10cSrcweir $key=""; 268cdf0e10cSrcweir } 269cdf0e10cSrcweir $key = getKey( $line ); 270cdf0e10cSrcweir } else 271cdf0e10cSrcweir { 272cdf0e10cSrcweir push @cmdlines, $line; 273cdf0e10cSrcweir } 274cdf0e10cSrcweir } # while 275cdf0e10cSrcweir} ##fillTemplateHash 276cdf0e10cSrcweir 277cdf0e10cSrcweir############################################################################ 278cdf0e10cSrcweirsub createCopySection #01.04.2008 11:37 279cdf0e10cSrcweir############################################################################ 280cdf0e10cSrcweir { 281cdf0e10cSrcweir my $header = shift; 282cdf0e10cSrcweir my $inputpath = shift; 283cdf0e10cSrcweir my $target = shift; 284cdf0e10cSrcweir my $targetpath = shift; 285cdf0e10cSrcweir my $ref_make_file = shift; # Array written later to make file *.mak 286cdf0e10cSrcweir my $ref_all_target_hash = shift; # reference to fill all_target_hash; 287cdf0e10cSrcweir if ( $target !~ /\\include/ && $target !~ /\\bin/) { 288cdf0e10cSrcweir return; # $target contains nonsense 289cdf0e10cSrcweir } 290cdf0e10cSrcweir if ( !$targetpath ) { 291cdf0e10cSrcweir # $targetpath is empty! (Due to missing entry in *.vcproj file) 292cdf0e10cSrcweir # Generate $targetpath here from $target 293cdf0e10cSrcweir my $t = $target; 294cdf0e10cSrcweir $t =~ /(.+)\\(.+)$/; 295cdf0e10cSrcweir $targetpath = "copy \"\$(InputPath)\" " . $1; 296cdf0e10cSrcweir chomp $targetpath; 297cdf0e10cSrcweir } 298cdf0e10cSrcweir $targetpath =~ s/\r$//; # remove x0A from EOL if the is one 299cdf0e10cSrcweir my @template = @{$template_hash{"Copy"}}; 300cdf0e10cSrcweir my $line = ""; 301cdf0e10cSrcweir foreach $line(@template) 302cdf0e10cSrcweir { 303cdf0e10cSrcweir $line =~ s/<HEADER>/$header/g; 304cdf0e10cSrcweir $line =~ s/<INPUTPATH>/$inputpath/g; 305cdf0e10cSrcweir $line =~ s/<TARGET>/$target/g; 306cdf0e10cSrcweir $line =~ s/<TARGETPATH>/$targetpath/; 307cdf0e10cSrcweir push @{$ref_make_file}, $line; # from template 308cdf0e10cSrcweir $$ref_all_target_hash{$target} = 1; # "\"$target\" "; 309cdf0e10cSrcweir # save for target ALL: 310cdf0e10cSrcweir } 311cdf0e10cSrcweir} ##createCopySection 312cdf0e10cSrcweir 313cdf0e10cSrcweir############################################################################ 314cdf0e10cSrcweirsub createMakDepSection #01.04.2008 13:36 315cdf0e10cSrcweir############################################################################ 316cdf0e10cSrcweir { 317cdf0e10cSrcweir # creates the dependency section in the make file 318cdf0e10cSrcweir my $dir = shift; 319cdf0e10cSrcweir my $source = shift; 320cdf0e10cSrcweir my $extension = shift; 321cdf0e10cSrcweir my $ref_header_list = shift; 322cdf0e10cSrcweir my $ref_make_file = shift; # Array written later to make file *.mak 323cdf0e10cSrcweir my $ref_special_file = shift; # hash for special files (compiler flags, include paths) 324cdf0e10cSrcweir my $header_list = ""; 325cdf0e10cSrcweir my $special_flag = 0; 326cdf0e10cSrcweir 327cdf0e10cSrcweir return if ( !defined $source ); 328cdf0e10cSrcweir foreach $header(@{$ref_header_list}) 329cdf0e10cSrcweir { 330cdf0e10cSrcweir if ( ($header =~ /^\.\.\\.+/) && (-e $header )) { 331cdf0e10cSrcweir $header_list = $header_list . " " . $header; # this header is located in an other directory 332cdf0e10cSrcweir } else 333cdf0e10cSrcweir { 334cdf0e10cSrcweir $header_list = $header_list . " .\\" . $header; 335cdf0e10cSrcweir } 336cdf0e10cSrcweir } 337cdf0e10cSrcweir 338cdf0e10cSrcweir #special handling 339cdf0e10cSrcweir # compile this file with other compiler switches 340cdf0e10cSrcweir my $file = $source . "\." . $extension; 341cdf0e10cSrcweir $dir =~ s/\\/_/; 342cdf0e10cSrcweir my @template = @{$template_hash{"CFlags_$dir"}}; 343cdf0e10cSrcweir if ( defined $$ref_special_file{"AdditionalIncludeDirectories"}{$file} ) { 344cdf0e10cSrcweir $special_flag = 1; 345cdf0e10cSrcweir my $includepath = $$ref_special_file{"AdditionalIncludeDirectories"}{$file}; 346cdf0e10cSrcweir $includepath =~ s/\;/\/I /g; # subst ; with /I for multiple paths 347cdf0e10cSrcweir $line = "CPP_SWITCH_INCLUDE=/I $includepath\n"; 348cdf0e10cSrcweir push @{$ref_make_file}, $line; 349cdf0e10cSrcweir foreach $line(@template) 350cdf0e10cSrcweir { 351cdf0e10cSrcweir if ( $line =~ /CPP_PROJ/) 352cdf0e10cSrcweir { 353cdf0e10cSrcweir $line =~ s/CPP_PROJ=/CPPX_PROJ=/; 354cdf0e10cSrcweir $line =~ s/\$\(CDEFS\)/\$\(CDEFS\) \$\(CPP_SWITCH_INCLUDE\)/; # include $(CPP_SWITCH_INCLUDE) 355cdf0e10cSrcweir push @{$ref_make_file}, $line; 356cdf0e10cSrcweir } 357cdf0e10cSrcweir } 358cdf0e10cSrcweir } 359cdf0e10cSrcweir if ( $$ref_special_file{"DisableLanguageExtensions"}{$file} ) 360cdf0e10cSrcweir { 361cdf0e10cSrcweir # FALSE = /Ze 362cdf0e10cSrcweir $special_flag = 1; 363cdf0e10cSrcweir foreach $line(@template) 364cdf0e10cSrcweir { 365cdf0e10cSrcweir if ( $line =~ /CPP_PROJ/) 366cdf0e10cSrcweir { 367cdf0e10cSrcweir $line =~ s/CPP_PROJ=/CPPX_PROJ=/; 368cdf0e10cSrcweir $line =~ s/-Za/-Ze/; 369cdf0e10cSrcweir if ( $nonpro ) 370cdf0e10cSrcweir { 371cdf0e10cSrcweir # if non product link against debug libraries 372cdf0e10cSrcweir $line =~ s/-MD/-MDd/; 373cdf0e10cSrcweir $line =~ s/-MT/-MTd/; 374cdf0e10cSrcweir } 375cdf0e10cSrcweir push @{$ref_make_file}, $line; 376cdf0e10cSrcweir } 377cdf0e10cSrcweir } 378cdf0e10cSrcweir } 379cdf0e10cSrcweir 380cdf0e10cSrcweir @template = @{$template_hash{"Deps"}}; 381cdf0e10cSrcweir my $line = ""; 382cdf0e10cSrcweir foreach $line(@template) 383cdf0e10cSrcweir { 384cdf0e10cSrcweir $line =~ s/<SOURCEFILE>/$source/g; 385cdf0e10cSrcweir $line =~ s/<EXT>/$extension/g; 386cdf0e10cSrcweir $line =~ s/<HEADER_LIST>/$header_list/g; 387cdf0e10cSrcweir push @{$ref_make_file}, $line; 388cdf0e10cSrcweir } 389cdf0e10cSrcweir 390cdf0e10cSrcweir if ( $special_flag ) 391cdf0e10cSrcweir { 392cdf0e10cSrcweir pop @{$ref_make_file}; # remove empty line 393cdf0e10cSrcweir push @{$ref_make_file},"\t\$(CPP) @<<\n"; 394cdf0e10cSrcweir push @{$ref_make_file},"\t\$(CPPX_PROJ) \$(SOURCE)\n"; 395cdf0e10cSrcweir push @{$ref_make_file},"<<\n\n"; 396cdf0e10cSrcweir $special_flag = 0; 397cdf0e10cSrcweir } 398cdf0e10cSrcweir 399cdf0e10cSrcweir} ##createMakDepSection 400cdf0e10cSrcweir 401cdf0e10cSrcweir 402cdf0e10cSrcweir############################################################################ 403cdf0e10cSrcweirsub getFilenameFromPath #10.04.2008 13:03 404cdf0e10cSrcweir############################################################################ 405cdf0e10cSrcweir{ 406cdf0e10cSrcweir my $path = shift; 407cdf0e10cSrcweir $path =~ /.+\\(.+)$/; 408cdf0e10cSrcweir return $1; 409cdf0e10cSrcweir} ##getFilenameFromPath 410cdf0e10cSrcweir 411cdf0e10cSrcweir############################################################################ 412cdf0e10cSrcweirsub getAllFilesDeps #08.04.2008 09:39 413cdf0e10cSrcweir############################################################################ 414cdf0e10cSrcweir{ 415cdf0e10cSrcweir my $path = shift; 416cdf0e10cSrcweir my $ref_deps = shift; 417cdf0e10cSrcweir my $ref_allfiles = shift; # contains all relevant files from *.vcproj 418cdf0e10cSrcweir my %local_header_hash=(); # contains all local header 419cdf0e10cSrcweir 420cdf0e10cSrcweir my @all_files = keys %{$ref_allfiles}; 421cdf0e10cSrcweir 422cdf0e10cSrcweir # collect lokal header names in %header_hash 423cdf0e10cSrcweir foreach $file(@all_files) 424cdf0e10cSrcweir { 425cdf0e10cSrcweir if ( $file =~ /.+\.h/ ) { 426cdf0e10cSrcweir chomp $file; 427cdf0e10cSrcweir $local_header_hash{$file} = 1; 428cdf0e10cSrcweir } 429cdf0e10cSrcweir } 430cdf0e10cSrcweir 431cdf0e10cSrcweir foreach $file(@all_files) 432cdf0e10cSrcweir { 433cdf0e10cSrcweir my @header_deps=(); 434cdf0e10cSrcweir my $skip = 0; 435cdf0e10cSrcweir 436cdf0e10cSrcweir $file =~ s/^\.\\//; # remove leading .\ 437cdf0e10cSrcweir 438cdf0e10cSrcweir # exclude sub directories and several file extensions 439cdf0e10cSrcweir # *.dep,*.h,*.in,*.mak,*.pl,*.txt,*.vcproj.*.rc and origs of patch files (*.*~) and 440cdf0e10cSrcweir # .cvsignore (files beginning with .) 441cdf0e10cSrcweir next if ( (-d "$path$sep$file") || ($file =~ /.+(_|\~|dep|h|in|mak|pl|txt|vcproj|rc)$/) || ($file =~ /^\.+./)); 442cdf0e10cSrcweir parse_header_deps($path,$file,\@header_deps,\%local_header_hash); 443cdf0e10cSrcweir handle_dep_to_other_directory($path,$file,\@header_deps,$$ref_vcproj{$file}) if ($$ref_vcproj{$file}); 444cdf0e10cSrcweir $$ref_deps{$file}=[@header_deps]; 445cdf0e10cSrcweir } 446cdf0e10cSrcweir} ##getAllFilesDeps 447cdf0e10cSrcweir 448cdf0e10cSrcweir ############################################################################ 449cdf0e10cSrcweir sub parse_header_deps #14.06.2006 18:04 450cdf0e10cSrcweir ############################################################################ 451cdf0e10cSrcweir { 452cdf0e10cSrcweir # get includes from c/cpp file 453cdf0e10cSrcweir # call create_deps(path,file,\$link_obj) 454cdf0e10cSrcweir # 455cdf0e10cSrcweir my $path = shift; 456cdf0e10cSrcweir my $cfile = shift; 457cdf0e10cSrcweir my $ref_header_deps = shift; 458cdf0e10cSrcweir my $ref_local_header_hash = shift; 459cdf0e10cSrcweir 460cdf0e10cSrcweir my $fullpath = $path . $sep . $cfile; 461cdf0e10cSrcweir my $unicodedep=""; 462cdf0e10cSrcweir open(IN, "<$fullpath") || die "can't open $fullpath\n"; 463cdf0e10cSrcweir while ( $line = <IN> ) { 464cdf0e10cSrcweir next if ($line !~ /^.?\#include.+/); # handle include lines only 465cdf0e10cSrcweir if ($line =~ /.+?\s(.+)/) 466cdf0e10cSrcweir { 467cdf0e10cSrcweir $header = $1; 468cdf0e10cSrcweir if ( ($header !~ /^<.+/) && ($header !~ /.+\.c.+$/) ) { 469cdf0e10cSrcweir # no <stdio> etc. header 470cdf0e10cSrcweir $header =~ s/\s+\/\*.+\*\///; # delete <blanks>/* ... */ 471cdf0e10cSrcweir $header =~ s/\s+\/\/.+//; # delete <blanks>//...... 472cdf0e10cSrcweir $header =~ s/\//\\/; # subst. / with \ 473cdf0e10cSrcweir $header =~ s/^\"/\".\\/; 474cdf0e10cSrcweir $header =~ s/\"//g; 475cdf0e10cSrcweir $header =~ s/\.\\//; 476cdf0e10cSrcweir my $test = $$ref_local_header_hash{$header}; 477cdf0e10cSrcweir my $header_fullpath = $path . "\\" . $header; 478cdf0e10cSrcweir if ( $test || (($header =~ /\\/) && (-e $header_fullpath))) { 479cdf0e10cSrcweir push @{$ref_header_deps}, $header; 480cdf0e10cSrcweir } 481cdf0e10cSrcweir } 482cdf0e10cSrcweir } 483cdf0e10cSrcweir } 484cdf0e10cSrcweir } ##parse_header_deps 485cdf0e10cSrcweir 486cdf0e10cSrcweir############################################################################ 487cdf0e10cSrcweirsub handle_dep_to_other_directory #16.04.2008 15:11 488cdf0e10cSrcweir############################################################################ 489cdf0e10cSrcweir{ 490cdf0e10cSrcweir # there has been an additional include directoy detected 491cdf0e10cSrcweir # now try to find out which header (parsed from c/cpp-file) 492cdf0e10cSrcweir # comes from this directory by checking: does it exist there? 493cdf0e10cSrcweir my $path = shift; 494cdf0e10cSrcweir my $file = shift; 495cdf0e10cSrcweir my $ref_header_deps = shift; 496cdf0e10cSrcweir my $path_additional = shift; 497cdf0e10cSrcweir my $search_path = $path . "\\" . $path_additional; 498cdf0e10cSrcweir my $counter = 0; 499cdf0e10cSrcweir foreach $header(@{$ref_header_deps}) 500cdf0e10cSrcweir { 501cdf0e10cSrcweir my $full_path = $search_path . "\\" . $header; 502cdf0e10cSrcweir if ( -e "$full_path" ) 503cdf0e10cSrcweir { 504cdf0e10cSrcweir $$ref_header_deps[$counter] = $path_additional . "\\" . $header; 505cdf0e10cSrcweir } 506cdf0e10cSrcweir $counter++ 507cdf0e10cSrcweir } 508cdf0e10cSrcweir} ##handle_dep_to_other_directory 509cdf0e10cSrcweir 510cdf0e10cSrcweir############################################################################ 511cdf0e10cSrcweirsub print_lib32_objs #18.04.2008 12:54 512cdf0e10cSrcweir############################################################################ 513cdf0e10cSrcweir { 514cdf0e10cSrcweir # generate Link section 515cdf0e10cSrcweir my $path = shift; 516cdf0e10cSrcweir my $extra_mak = shift; 517cdf0e10cSrcweir my $ref_objecthash = shift; 518cdf0e10cSrcweir my $resource_file = shift; 519cdf0e10cSrcweir # output link objects 520cdf0e10cSrcweir print MAKFILE "LINK32_OBJS= \\\n"; 521cdf0e10cSrcweir # print objects 522cdf0e10cSrcweir foreach $object(sort keys %{$ref_objecthash}) 523cdf0e10cSrcweir { 524cdf0e10cSrcweir print MAKFILE "\t$object \\\n"; 525cdf0e10cSrcweir } 526cdf0e10cSrcweir 527cdf0e10cSrcweir # print *.res if *.rc exists 528cdf0e10cSrcweir if ( $resource_file ne "" ) { 529cdf0e10cSrcweir my $res_file = $resource_file; 530cdf0e10cSrcweir $res_file =~ s/\.rc/\.res/; 531cdf0e10cSrcweir $res_file =~ /(.+)\\(.+)$/; 532cdf0e10cSrcweir $res_file = $2; 533cdf0e10cSrcweir print MAKFILE "\t\$(INTDIR)\\$res_file \\\n"; 534cdf0e10cSrcweir } 535cdf0e10cSrcweir 536cdf0e10cSrcweir # add import libs and res files 537cdf0e10cSrcweir print_flags($path,$extra_mak,"AdditionalLinkObjects"); 538cdf0e10cSrcweir my $outfile = $configelements{"Release"}{"OutputFile"}; 539cdf0e10cSrcweir 540cdf0e10cSrcweir # section for linking 541cdf0e10cSrcweir print_link_template($path,$outfile); 542cdf0e10cSrcweir 543cdf0e10cSrcweir # section for creating res files 544cdf0e10cSrcweir # setting for rsc, res target etc. 545cdf0e10cSrcweir print "resource_file=$resource_file\n" if ($is_debug); 546cdf0e10cSrcweir print_rsc_template($resource_file) if ($resource_file); 547cdf0e10cSrcweir print_simple_flag("Special_extra_uconv") if ($outfile =~ /uconv/); 548cdf0e10cSrcweir} ##print_lib32_objs 549cdf0e10cSrcweir 550cdf0e10cSrcweir############################################################################ 551cdf0e10cSrcweirsub print_all_target #26.06.2008 13:27 552cdf0e10cSrcweir############################################################################ 553cdf0e10cSrcweir { 554cdf0e10cSrcweir my $path = shift; 555cdf0e10cSrcweir my $ref_all_target_hash = shift; 556cdf0e10cSrcweir my $filename = getFilenameFromPath($path); 557cdf0e10cSrcweir my $outdir = $configelements{"Release"}{"OutputDirectory"}; 558cdf0e10cSrcweir print MAKFILE "NULL=\n"; 559cdf0e10cSrcweir print MAKFILE "OUTDIR=$outdir\n"; 560cdf0e10cSrcweir print MAKFILE "OutDir=$outdir\n"; 561cdf0e10cSrcweir print MAKFILE "INTDIR=.\\Release\n\n"; 562cdf0e10cSrcweir print MAKFILE "ALL: "; 563cdf0e10cSrcweir foreach $target(sort keys %{$ref_all_target_hash}) 564cdf0e10cSrcweir { 565cdf0e10cSrcweir if ( $target =~ /\.exe/ ) { 566cdf0e10cSrcweir my $out = $target; 567b0de3218SArrigo Marchiori $out =~ s/\.\\((x64|x86)\\)?Release/\.\.\\\.\.\\\.\.\\$1bin/; 568cdf0e10cSrcweir $out =~ s/\$\(OutDir\)/\.\.\\\.\.\\\.\.\\bin/; 569cdf0e10cSrcweir $out =~ s/\//\\/; # convert / to \ 570cdf0e10cSrcweir $target = $out; 571cdf0e10cSrcweir } 572cdf0e10cSrcweir print MAKFILE "\"$target\" "; 573cdf0e10cSrcweir } 574cdf0e10cSrcweir 575cdf0e10cSrcweir # Append [Target_<dir>] item e.g. ../../icuxy36.dll 576cdf0e10cSrcweir my $targetkey = "Target_" . $filename; 577cdf0e10cSrcweir my @target = (); 578cdf0e10cSrcweir if ( exists $template_hash{$targetkey} ) { 579cdf0e10cSrcweir @target = @{$template_hash{$targetkey}}; 580*0e7a4e4fSArrigo Marchiori print "target: @target from cfg key $targetkey\n" if ($is_debug); 581*0e7a4e4fSArrigo Marchiori } else { 582*0e7a4e4fSArrigo Marchiori print "No cfg key for target $targetkey\n" if ($is_debug); 583cdf0e10cSrcweir } 584cdf0e10cSrcweir my $additional_target=""; 585cdf0e10cSrcweir foreach $additional_target(@target) 586cdf0e10cSrcweir { 587cdf0e10cSrcweir print MAKFILE $additional_target if ($additional_target ne ""); 588cdf0e10cSrcweir } 589cdf0e10cSrcweir print MAKFILE "\n\n"; 590cdf0e10cSrcweir print MAKFILE "\"\$(OUTDIR)\" : \n"; 591cdf0e10cSrcweir print MAKFILE "\tif not exist \"\$(OUTDIR)/\$(NULL)\" mkdir \"\$(OUTDIR)\"\n\n"; 592cdf0e10cSrcweir print MAKFILE "!IF \"\$(OUTDIR)\" != \"\$(INTDIR)\"\n"; 593cdf0e10cSrcweir print MAKFILE "\"\$(INTDIR)\" : \n"; 594cdf0e10cSrcweir print MAKFILE "\tif not exist \"\$(INTDIR)/\$(NULL)\" mkdir \"\$(INTDIR)\"\n"; 595cdf0e10cSrcweir print MAKFILE "!ENDIF\n"; 596cdf0e10cSrcweir print MAKFILE "\n\n"; 597cdf0e10cSrcweir} ##print_all_target 598cdf0e10cSrcweir 599cdf0e10cSrcweir############################################################################ 600cdf0e10cSrcweirsub print_simple_flag #18.04.2008 13:39 601cdf0e10cSrcweir############################################################################ 602cdf0e10cSrcweir{ 603cdf0e10cSrcweir my $simple_flag = shift; 604cdf0e10cSrcweir my @template = @{$template_hash{$simple_flag}}; 605cdf0e10cSrcweir foreach $line(@template) 606cdf0e10cSrcweir { 607cdf0e10cSrcweir print MAKFILE $line; 608cdf0e10cSrcweir } 609cdf0e10cSrcweir} ##print_rules 610cdf0e10cSrcweir 611cdf0e10cSrcweir############################################################################ 612cdf0e10cSrcweirsub print_link_template #18.04.2008 13:39 613cdf0e10cSrcweir############################################################################ 614cdf0e10cSrcweir{ 615cdf0e10cSrcweir my $dir = shift; 616cdf0e10cSrcweir my $outfile = shift; 617cdf0e10cSrcweir my $manifest; 618cdf0e10cSrcweir # set resource id for manifest file 619cdf0e10cSrcweir if ( $outfile =~ /\.exe/ ) { 620cdf0e10cSrcweir $manifest = 1; 621cdf0e10cSrcweir } else 622cdf0e10cSrcweir { 623cdf0e10cSrcweir $manifest = 2; 624cdf0e10cSrcweir } 625cdf0e10cSrcweir my @template = (); 626cdf0e10cSrcweir if ($dir =~ /stubdata/ ) { 627cdf0e10cSrcweir @template = @{$template_hash{"Special_stubdata"}}; 628cdf0e10cSrcweir } else 629cdf0e10cSrcweir { 630cdf0e10cSrcweir @template = @{$template_hash{"LinkTemplate"}}; 631cdf0e10cSrcweir } 632cdf0e10cSrcweir 633cdf0e10cSrcweir print MAKFILE "\n"; # insert blank line 634cdf0e10cSrcweir foreach $line(@template) 635cdf0e10cSrcweir { 636cdf0e10cSrcweir $line =~ s/<OUTFILE>/$outfile/; 637cdf0e10cSrcweir $line =~ s/<MANIFEST>/$manifest/; 638cdf0e10cSrcweir print MAKFILE $line; 639cdf0e10cSrcweir } 640cdf0e10cSrcweir 641cdf0e10cSrcweir # insert special stuff for 642cdf0e10cSrcweir # extras/uconv/uconv.mak 643cdf0e10cSrcweir if ( $dir =~ /uconv/ ) { 644cdf0e10cSrcweir print_flags($dir,"","Special"); 645cdf0e10cSrcweir } 646cdf0e10cSrcweir 647cdf0e10cSrcweir # for *.exe files an additional 648cdf0e10cSrcweir # copy section is required to get 649b0de3218SArrigo Marchiori # the stuff into the per-arch bin directory 650cdf0e10cSrcweir my %dummy = (); 651cdf0e10cSrcweir my @mak = (); 652b0de3218SArrigo Marchiori my $arch = ""; 653b0de3218SArrigo Marchiori if ( $out =~ /x64/ ) { 654b0de3218SArrigo Marchiori $arch = "x64\\"; 655b0de3218SArrigo Marchiori } elsif ( $out =~ /x86/ ) { 656b0de3218SArrigo Marchiori $arch = "x86\\"; 657b0de3218SArrigo Marchiori } 658cdf0e10cSrcweir if( $manifest ==1 ) 659cdf0e10cSrcweir { 660cdf0e10cSrcweir # source,inputpath,target,action 661cdf0e10cSrcweir my $out = $outfile; 662b0de3218SArrigo Marchiori $out =~ s/\.\\((x64|x86)\\)?Release/\.\.\\\.\.\\\.\.\\$1bin/; 663cdf0e10cSrcweir $out =~ s/\$\(OutDir\)/\.\.\\\.\.\\\.\.\\bin/; 664cdf0e10cSrcweir $out =~ s/\//\\/; # subst / with \ 665cdf0e10cSrcweir $outfile =~ s/\//\\/; # subst / with \ 666b0de3218SArrigo Marchiori createCopySection($outfile,$outfile,$out,"copy \"\$(InputPath)\" .\\..\\..\\..\\${arch}bin",\@mak,\%dummy); 667cdf0e10cSrcweir foreach $line(@mak) 668cdf0e10cSrcweir { 669cdf0e10cSrcweir print MAKFILE $line; 670cdf0e10cSrcweir } 671cdf0e10cSrcweir } 672cdf0e10cSrcweir} ##print_rules 673cdf0e10cSrcweir 674cdf0e10cSrcweir############################################################################ 675cdf0e10cSrcweirsub print_rsc_template #04.11.2008 14:48 676cdf0e10cSrcweir############################################################################ 677cdf0e10cSrcweir { 678cdf0e10cSrcweir # print resource compiler setting + resource target 679cdf0e10cSrcweir my $resourcefile = shift; 680cdf0e10cSrcweir # skip this if no res file required 681cdf0e10cSrcweir 682cdf0e10cSrcweir return if (!$resourcefile); 683cdf0e10cSrcweir $resfile = $resourcefile; 684cdf0e10cSrcweir #remove file extension (.res) 685cdf0e10cSrcweir $resfile =~ /(.+)\\(.+)\.(.+)/; 686cdf0e10cSrcweir $resfile = $2; 687cdf0e10cSrcweir 688cdf0e10cSrcweir my @template = @{$template_hash{"RSC_Template"}}; 689cdf0e10cSrcweir print MAKFILE "\n"; # insert blank line 690cdf0e10cSrcweir foreach $line(@template) 691cdf0e10cSrcweir { 692cdf0e10cSrcweir $line =~ s/<FILE>/$resourcefile/; 693cdf0e10cSrcweir $line =~ s/<FILEOUT>/$resfile/; 694*0e7a4e4fSArrigo Marchiori $line =~ s/\/d \"NDEBUG\"/\/d \"DEBUG\"/ if ($enable_symbols || 695*0e7a4e4fSArrigo Marchiori $is_debug); 696cdf0e10cSrcweir print MAKFILE $line; 697cdf0e10cSrcweir } 698cdf0e10cSrcweir} ##print_rsc_template 699cdf0e10cSrcweir 700cdf0e10cSrcweir############################################################################ 701cdf0e10cSrcweirsub print_flags #18.04.2008 14:19 702cdf0e10cSrcweir############################################################################ 703cdf0e10cSrcweir{ 704cdf0e10cSrcweir # CFlags, LinkFlags 705cdf0e10cSrcweir my $dir = shift; 706cdf0e10cSrcweir my $extra_mak = shift; # eg. derb.mak, stringperf.mak 707cdf0e10cSrcweir my $flag = shift; 708cdf0e10cSrcweir my $nonpro = shift; 709cdf0e10cSrcweir my @template = (); 710cdf0e10cSrcweir my $switch = ""; 711cdf0e10cSrcweir $dir =~ s/\\/_/g if ($dir); # change \ to _ 712cdf0e10cSrcweir $switch = "$flag" . "_" . "$dir" if ($dir); 713cdf0e10cSrcweir handle_CFlags() if ($flag eq "CFlags"); # get and print Preprocessor defines 714cdf0e10cSrcweir $switch .= "\." . $extra_mak if ( $extra_mak ne "" ) ; 715cdf0e10cSrcweir if ( exists $template_hash{$switch} ) { 716*0e7a4e4fSArrigo Marchiori print "Reading switches from cfg section $switch\n" if ($is_debug); 717cdf0e10cSrcweir @template = @{$template_hash{$switch}}; 718cdf0e10cSrcweir foreach $line(@template) 719cdf0e10cSrcweir { 720cdf0e10cSrcweir if ( $nonpro ) 721cdf0e10cSrcweir { 722cdf0e10cSrcweir # if non product link against debug libraries 723cdf0e10cSrcweir $line =~ s/-MD/-MDd/; 724cdf0e10cSrcweir $line =~ s/-MT/-MTd/; 725cdf0e10cSrcweir } 726cdf0e10cSrcweir print MAKFILE $line; 727cdf0e10cSrcweir } 728*0e7a4e4fSArrigo Marchiori } else { 729*0e7a4e4fSArrigo Marchiori print "No cfg section $switch -> no switches\n" if ($is_debug); 730cdf0e10cSrcweir } 731cdf0e10cSrcweir} ##print_flags 732cdf0e10cSrcweir 733cdf0e10cSrcweir############################################################################ 734cdf0e10cSrcweirsub handle_CFlags #28.01.2009 11:20 735cdf0e10cSrcweir############################################################################ 736cdf0e10cSrcweir { 737cdf0e10cSrcweir 738cdf0e10cSrcweir my $ppdefs = $configelements{"Release"}{"PreprocessorDefinitions"}; 739cdf0e10cSrcweir my $ppinc = $configelements{"Release"}{"AdditionalIncludeDirectories"}; 740cdf0e10cSrcweir my @template = @{$template_hash{"General_CFlags"}}; 741cdf0e10cSrcweir $ppdefs =~ s/;/ -D/g; # subst ; with -D switch 742cdf0e10cSrcweir $ppdefs = "-D" . $ppdefs; 743cdf0e10cSrcweir $ppinc =~ s/(;|,)/ -I/g; # subst ; with -I switch 744cdf0e10cSrcweir $ppinc = "-I" . $ppinc; 745cdf0e10cSrcweir print "ppdefs=$ppdefs\n" if ($is_debug); 746cdf0e10cSrcweir print "ppinc =$ppinc\n" if ($is_debug); 747cdf0e10cSrcweir foreach $line(@template) 748cdf0e10cSrcweir { 749cdf0e10cSrcweir $line =~ s/<AddIncDirs>/$ppinc/; 750cdf0e10cSrcweir $line =~ s/<PreProcDefs>/$ppdefs/; 751*0e7a4e4fSArrigo Marchiori $line =~ s/-DNDEBUG/\-Zi/ if ($enable_symbols || $is_debug); 752cdf0e10cSrcweir print MAKFILE $line; 753cdf0e10cSrcweir } 754cdf0e10cSrcweir} ##handle_CFlags 755cdf0e10cSrcweir 756cdf0e10cSrcweir############################################################################ 757cdf0e10cSrcweirsub print_common_linkflags #21.11.2008 11:47 758cdf0e10cSrcweir############################################################################ 759cdf0e10cSrcweir { 760cdf0e10cSrcweir my @template = @{$template_hash{"CommonLinkFlags"}}; 761cdf0e10cSrcweir my $outfile = $configelements{"Release"}{"OutputFile"}; 762cdf0e10cSrcweir my $pdbfile = $configelements{"Release"}{"ProgramDatabaseFile"}; 763cdf0e10cSrcweir $pdbfile =~ s/\//\\/; # subst / with \ 764cdf0e10cSrcweir $outfile =~ s/\//\\/; # subst / with \ 765cdf0e10cSrcweir print "PATH=$path OUTFILE=$outfile\n" if ($is_debug); 766cdf0e10cSrcweir foreach $line(@template) 767cdf0e10cSrcweir { 768cdf0e10cSrcweir $line =~ s/<OUTFILE>/$outfile/; 769cdf0e10cSrcweir $line =~ s/<PDBFILE>/$pdbfile/; 770cdf0e10cSrcweir print MAKFILE $line; 771cdf0e10cSrcweir } 772cdf0e10cSrcweir} ##print_common_linkflags 773cdf0e10cSrcweir 774cdf0e10cSrcweir############################################################################ 775cdf0e10cSrcweirsub handle_extra_mak_files #25.08.2008 14:32 776cdf0e10cSrcweir############################################################################ 777cdf0e10cSrcweir{ 778cdf0e10cSrcweir # extract extra filename for *.mak file 779cdf0e10cSrcweir # e.g input: tools\genrb.derb 780cdf0e10cSrcweir # output: derb 781cdf0e10cSrcweir my $direntry = shift; 782cdf0e10cSrcweir my $out = ""; 783cdf0e10cSrcweir my $dir = ""; 784cdf0e10cSrcweir if ( $direntry =~ /(.+)\.(.+)$/ ) { 785cdf0e10cSrcweir $dir = $1; 786cdf0e10cSrcweir $out = $2; 787cdf0e10cSrcweir } else 788cdf0e10cSrcweir { 789cdf0e10cSrcweir $dir = $direntry; 790cdf0e10cSrcweir } 791cdf0e10cSrcweir return ($dir,$out); 792cdf0e10cSrcweir} ##handle_extra_mak_files 793cdf0e10cSrcweir 794cdf0e10cSrcweir############################################################################ 795cdf0e10cSrcweirsub prepare_allinone_all_mak 796cdf0e10cSrcweir############################################################################ 797cdf0e10cSrcweir{ 798cdf0e10cSrcweir # Read in allinone.sln 799cdf0e10cSrcweir # Fills hashes and returns an array with build order 800cdf0e10cSrcweir # uses topographical sorting 801cdf0e10cSrcweir 802cdf0e10cSrcweir my $href_project_by_id = shift; 803cdf0e10cSrcweir my $href_project_by_name = shift; 804cdf0e10cSrcweir my $href_project_dependencies = shift; 805cdf0e10cSrcweir my $sourcePath = shift; 806cdf0e10cSrcweir 807cdf0e10cSrcweir my $allslnfile = $sourcePath . "\\allinone\\allinone.sln"; 808cdf0e10cSrcweir my @projectdeps; 809cdf0e10cSrcweir my $projectname; 810cdf0e10cSrcweir my $projectpath; 811cdf0e10cSrcweir my $projectid; 812cdf0e10cSrcweir 813cdf0e10cSrcweir # fill hash tables 814cdf0e10cSrcweir open (SLN, "< $allslnfile") || die "Can't open $allslnfile\n"; 815cdf0e10cSrcweir while ($line = <SLN>) 816cdf0e10cSrcweir { 817cdf0e10cSrcweir my @project = (); 818cdf0e10cSrcweir if ( $line =~ /^Project\(/ ) { 819cdf0e10cSrcweir @project = split( /,/, $line); 820cdf0e10cSrcweir if ( $#project ) { 821cdf0e10cSrcweir $projectname = ""; 822cdf0e10cSrcweir $projectpath = ""; 823cdf0e10cSrcweir $projectid = ""; 824cdf0e10cSrcweir @projectdeps = (); 825cdf0e10cSrcweir my @subarray = (); 826cdf0e10cSrcweir @subarray = split( /=/, $project[0]); 827cdf0e10cSrcweir $projectname = $subarray[1]; 828cdf0e10cSrcweir $projectname =~ s/\"//g; # remove " 829cdf0e10cSrcweir $projectpath = $project[1]; 830cdf0e10cSrcweir $projectid = $project[2]; 831cdf0e10cSrcweir $projectid =~ s/\"//g; # remove " 832cdf0e10cSrcweir $projectid =~ s/.+\{//g; # remove til { 833cdf0e10cSrcweir $projectid =~ s/\}\n//g; # remove }<CR> 834cdf0e10cSrcweir my @pnp = ($projectname,$projectpath); 835cdf0e10cSrcweir my @pip = ($projectid,$projectpath); 836cdf0e10cSrcweir $$href_project_by_id{$projectid}=[@pnp]; 837cdf0e10cSrcweir $$href_project_by_name{$projectname} =[@pip]; 838cdf0e10cSrcweir } 839cdf0e10cSrcweir } # $line =~ /^Project\(/ 840cdf0e10cSrcweir if ( $line =~ /ProjectSection\(/ ) { 841cdf0e10cSrcweir $psect = 1; 842cdf0e10cSrcweir next; 843cdf0e10cSrcweir } 844cdf0e10cSrcweir if ( $line =~ /EndProjectSection/ ) { 845cdf0e10cSrcweir $psect = 0; 846cdf0e10cSrcweir $$href_project_dependencies{$projectid}=[@projectdeps]; 847cdf0e10cSrcweir next; 848cdf0e10cSrcweir } 849cdf0e10cSrcweir if ( $psect ) { 850cdf0e10cSrcweir my @tarray = split(/=/, $line); 851cdf0e10cSrcweir $depends_on_id = $tarray[0]; 852cdf0e10cSrcweir $depends_on_id =~ s/.+\{//g; 853cdf0e10cSrcweir $depends_on_id =~ s/\}.+//g; 854cdf0e10cSrcweir print "+$depends_on_id-\n" if ($is_debug); 855cdf0e10cSrcweir 856cdf0e10cSrcweir push @projectdeps, $depends_on_id; 857cdf0e10cSrcweir } 858cdf0e10cSrcweir } 859cdf0e10cSrcweir ######################################## 860cdf0e10cSrcweir # sort here and generate build order 861cdf0e10cSrcweir ######################################## 862cdf0e10cSrcweir $objektzahl=0; 863cdf0e10cSrcweir %hashindex=(); 864cdf0e10cSrcweir 865cdf0e10cSrcweir foreach $projectid(keys %{$href_project_by_id}) 866cdf0e10cSrcweir { 867cdf0e10cSrcweir if ( $$href_project_dependencies{$projectid} ) 868cdf0e10cSrcweir { 869cdf0e10cSrcweir @deps = @{$$href_project_dependencies{$projectid}}; 870cdf0e10cSrcweir } else 871cdf0e10cSrcweir { 872cdf0e10cSrcweir @deps = (); 873cdf0e10cSrcweir } 874cdf0e10cSrcweir for $counter(0..$#deps) 875cdf0e10cSrcweir { 876cdf0e10cSrcweir $v = find_or_create_element($deps[$counter]); 877cdf0e10cSrcweir $n = find_or_create_element($projectid); 878cdf0e10cSrcweir push @{$nachfolgerliste[$v]},$n; 879cdf0e10cSrcweir } 880cdf0e10cSrcweir } 881cdf0e10cSrcweir 882cdf0e10cSrcweir for $n (0..$objektzahl-1) 883cdf0e10cSrcweir { 884cdf0e10cSrcweir $vorgaengerzahl[$n]=0; 885cdf0e10cSrcweir } 886cdf0e10cSrcweir for $v (0..$objektzahl-1) 887cdf0e10cSrcweir { 888cdf0e10cSrcweir for $n (@{$nachfolgerliste[$v]}) 889cdf0e10cSrcweir { 890cdf0e10cSrcweir ++$vorgaengerzahl[$n]; 891cdf0e10cSrcweir } 892cdf0e10cSrcweir } 893cdf0e10cSrcweir 894cdf0e10cSrcweir @hilfsliste=(); 895cdf0e10cSrcweir for $n (0..$objektzahl-1) 896cdf0e10cSrcweir { 897cdf0e10cSrcweir push(@hilfsliste,$n) if ($vorgaengerzahl[$n]==0) 898cdf0e10cSrcweir } 899cdf0e10cSrcweir 900cdf0e10cSrcweir $ausgabe=0; 901cdf0e10cSrcweir @builddep =(); 902cdf0e10cSrcweir while (defined($v=pop(@hilfsliste))) 903cdf0e10cSrcweir { 904cdf0e10cSrcweir push @builddep, $name[$v]; # save build order by project_id; 905cdf0e10cSrcweir ++$ausgabe; 906cdf0e10cSrcweir for $n (@{$nachfolgerliste[$v]}) 907cdf0e10cSrcweir { 908cdf0e10cSrcweir --$vorgaengerzahl[$n]; 909cdf0e10cSrcweir push(@hilfsliste,$n) if ($vorgaengerzahl[$n]==0); 910cdf0e10cSrcweir } 911cdf0e10cSrcweir } # while 912cdf0e10cSrcweir die "Cyclic dependencies found! Stopping now.\n" if $ausgabe<$objektzahl; 913cdf0e10cSrcweir ############################################################## 914cdf0e10cSrcweir # End of sorting stuff 915cdf0e10cSrcweir ############################################################## 916cdf0e10cSrcweir 917cdf0e10cSrcweir return @builddep; 918cdf0e10cSrcweir ############################################################### 919cdf0e10cSrcweir ########################### 920cdf0e10cSrcweir # sub for sorting only 921cdf0e10cSrcweir ########################### 922cdf0e10cSrcweir sub find_or_create_element 923cdf0e10cSrcweir { 924cdf0e10cSrcweir my ($str)=@_; 925cdf0e10cSrcweir my ($idx)=$hashindex{$str}; 926cdf0e10cSrcweir if (!defined($idx)) { # new element ... 927cdf0e10cSrcweir $idx=$objektzahl++; 928cdf0e10cSrcweir $hashindex{$str}=$idx; 929cdf0e10cSrcweir $name[$idx]=$str; 930cdf0e10cSrcweir @{$nachfolgerliste[$idx]}=(); 931cdf0e10cSrcweir } 932cdf0e10cSrcweir return $idx; 933cdf0e10cSrcweir } # find_or_create_element 934cdf0e10cSrcweir} # prepare_allinone_all_mak 935cdf0e10cSrcweir 936cdf0e10cSrcweir############################################################################ 937cdf0e10cSrcweirsub create_allinone_all_mak #09.02.2009 09:22 938cdf0e10cSrcweir############################################################################ 939cdf0e10cSrcweir{ 940cdf0e10cSrcweir my $ref_buildorder = shift; 941cdf0e10cSrcweir my $href_project_by_id = shift; 942cdf0e10cSrcweir my $sourcePath = shift; 943cdf0e10cSrcweir my $allmakfile = $sourcePath . "\\allinone\\all.mak"; 944cdf0e10cSrcweir open (ALLMAK, ">$allmakfile") || die "Can't write to $allmakfile \n"; 945cdf0e10cSrcweir print ALLMAK "ALL: "; 946cdf0e10cSrcweir foreach $proj(@{$ref_buildorder}) 947cdf0e10cSrcweir { 948cdf0e10cSrcweir print ALLMAK $$href_project_by_id{$proj}[0]; 949cdf0e10cSrcweir } 950cdf0e10cSrcweir print ALLMAK "\n\n"; 951cdf0e10cSrcweir 952cdf0e10cSrcweir foreach $proj( @{$ref_buildorder} ) 953cdf0e10cSrcweir { 954cdf0e10cSrcweir print "$proj $$href_project_by_id{$proj}[0] $$href_project_by_id{$proj}[1]\n"; 955cdf0e10cSrcweir my $prjdir = $$href_project_by_id{$proj}[1]; 956cdf0e10cSrcweir $prjdir =~ /(.+)\\(.+)$/; 957cdf0e10cSrcweir $prjdir = $1; 958cdf0e10cSrcweir $prjname = $2; 959cdf0e10cSrcweir $prjdir =~ s/^.+\"//; 960cdf0e10cSrcweir $prjname =~ s/\"$//; 961cdf0e10cSrcweir $prjname =~ s/vcproj/mak/; 962cdf0e10cSrcweir $allinonehelpstring = $prjdir; 963cdf0e10cSrcweir $allinonehelpstring =~ s/^\.+\\//; # remove ..\ 964cdf0e10cSrcweir my $backcount = ""; 965a893be29SPedro Giffuni while ($allinonehelpstring=~ /.+\\/g) # counts the occurring \ 966cdf0e10cSrcweir { 967cdf0e10cSrcweir $backcount .= "..\\"; 968cdf0e10cSrcweir } 969cdf0e10cSrcweir $allinonedir = $backcount . "..\\allinone"; 970cdf0e10cSrcweir 971cdf0e10cSrcweir # write all.mak 972cdf0e10cSrcweir $$href_project_by_id{$proj}[0] =~ s/^\s+//; 973cdf0e10cSrcweir if ( $$href_project_by_id{$proj}[0] ne "makedata" ) 974cdf0e10cSrcweir { 975cdf0e10cSrcweir my @template = @{$template_hash{"AllInOnePrj"}}; 976cdf0e10cSrcweir foreach $line(@template) 977cdf0e10cSrcweir { 978cdf0e10cSrcweir $line =~ s/<PRJ>/$$href_project_by_id{$proj}[0]/; 979cdf0e10cSrcweir $line =~ s/<PRJDIR>/$prjdir/; 980cdf0e10cSrcweir $line =~ s/<PRJMAK>/$prjname/; 981cdf0e10cSrcweir $line =~ s/<ALLINONEDIR>/$allinonedir/; 982cdf0e10cSrcweir print ALLMAK $line; 983cdf0e10cSrcweir } 984cdf0e10cSrcweir } else 985cdf0e10cSrcweir { 986cdf0e10cSrcweir #special code snippet 987cdf0e10cSrcweir print ALLMAK "makedata : \n"; 988cdf0e10cSrcweir print ALLMAK " cd \"..\\data\"\n"; 989b0de3218SArrigo Marchiori print ALLMAK " nmake /f makedata.mak icumake=\$(MAKEDIR)\\..\\data cfg=$architecture/Release\n"; 990cdf0e10cSrcweir print ALLMAK " cd \"..\\allinone\"\n\n"; 991cdf0e10cSrcweir } 992cdf0e10cSrcweir } 993cdf0e10cSrcweir close ALLMAK; 994cdf0e10cSrcweir} ##create_allinone_all_mak 995cdf0e10cSrcweir 996cdf0e10cSrcweir############################################################################ 997cdf0e10cSrcweir 998cdf0e10cSrcweir# ------------------------------------------------------------------------ 999cdf0e10cSrcweir# XML parser handling 1000cdf0e10cSrcweir# ------------------------------------------------------------------------ 1001cdf0e10cSrcweir 1002cdf0e10cSrcweir############################################################################ 1003cdf0e10cSrcweirsub start_handler 1004cdf0e10cSrcweir############################################################################ 1005cdf0e10cSrcweir{ 1006cdf0e10cSrcweir my $p = shift; # pointer to parser 1007cdf0e10cSrcweir my $el = shift; # element 1008cdf0e10cSrcweir 1009cdf0e10cSrcweir # Deal with attributes 1010cdf0e10cSrcweir 1011cdf0e10cSrcweir my $CompilerSection = 0; 1012cdf0e10cSrcweir my $LinkerSection = 0; 1013cdf0e10cSrcweir my $ConfigSection = ($el eq "Configuration"); 1014cdf0e10cSrcweir 1015cdf0e10cSrcweir while (@_) 1016cdf0e10cSrcweir { 1017cdf0e10cSrcweir # shift if ( $el eq "FileConfiguration" ); 1018cdf0e10cSrcweir my $att = shift; 1019cdf0e10cSrcweir my $val = shift; 1020cdf0e10cSrcweir $CustomSection = 0; 1021cdf0e10cSrcweir if ($special_file && defined $att & $att ne "Name") 1022cdf0e10cSrcweir { 1023cdf0e10cSrcweir print "$special_file - $att - $val\n"; 1024cdf0e10cSrcweir my @param = ($att,$val); 1025cdf0e10cSrcweir $files_special{ $special_file } = [@param]; # files with special compiler switch 1026cdf0e10cSrcweir @test = @{$files_special{ $special_file }}; 1027cdf0e10cSrcweir print "test=@test\n"; 1028cdf0e10cSrcweir $special_file=""; 1029cdf0e10cSrcweir } 1030cdf0e10cSrcweir if ( $ConfigSection && $att eq "Name" && $val eq "Release|Win32" ) { 1031b0de3218SArrigo Marchiori if ( $architecture eq "x86" ) { 1032cdf0e10cSrcweir $Release = 1; 1033cdf0e10cSrcweir $config = "Release"; # Release 1034b0de3218SArrigo Marchiori } else { 1035b0de3218SArrigo Marchiori print "Ignoring Configuration $val\n" if ($is_debug); 1036b0de3218SArrigo Marchiori $Release = 2; 1037b0de3218SArrigo Marchiori $config = "Ignored"; 1038b0de3218SArrigo Marchiori } 1039cdf0e10cSrcweir } 1040cdf0e10cSrcweir if ( $ConfigSection && $att eq "Name" && $val eq "Debug|Win32" ) { 1041b0de3218SArrigo Marchiori if ( $architecture eq "x86" ) { 1042cdf0e10cSrcweir $Release = 0; # Debug 1043cdf0e10cSrcweir $config = "Debug"; 1044b0de3218SArrigo Marchiori } else { 1045b0de3218SArrigo Marchiori print "Ignoring Configuration $val\n" if ($is_debug); 1046b0de3218SArrigo Marchiori $Release = 2; 1047b0de3218SArrigo Marchiori $config = "Ignored"; 1048b0de3218SArrigo Marchiori } 1049b0de3218SArrigo Marchiori } 1050b0de3218SArrigo Marchiori if ( $ConfigSection && $att eq "Name" && $val eq "Release|x64" ) { 1051b0de3218SArrigo Marchiori if ( $architecture eq "x64" ) { 1052b0de3218SArrigo Marchiori $Release = 1; 1053b0de3218SArrigo Marchiori $config = "Release"; # Release 1054b0de3218SArrigo Marchiori } else { 1055b0de3218SArrigo Marchiori print "Ignoring Configuration $val\n" if ($is_debug); 1056b0de3218SArrigo Marchiori $Release = 2; 1057b0de3218SArrigo Marchiori $config = "Ignored"; 1058b0de3218SArrigo Marchiori } 1059b0de3218SArrigo Marchiori } 1060b0de3218SArrigo Marchiori if ( $ConfigSection && $att eq "Name" && $val eq "Debug|x64" ) { 1061b0de3218SArrigo Marchiori if ( $architecture eq "x64" ) { 1062b0de3218SArrigo Marchiori $Release = 0; # Debug 1063b0de3218SArrigo Marchiori $config = "Debug"; 1064b0de3218SArrigo Marchiori } else { 1065b0de3218SArrigo Marchiori print "Ignoring Configuration $val\n" if ($is_debug); 1066b0de3218SArrigo Marchiori $Release = 2; 1067b0de3218SArrigo Marchiori $config = "Ignored"; 1068b0de3218SArrigo Marchiori } 1069cdf0e10cSrcweir } 1070cdf0e10cSrcweir if ( $att eq "Name" && $val eq "VCCLCompilerTool" ) { 1071cdf0e10cSrcweir $CompilerSection = 1; 1072cdf0e10cSrcweir } 1073cdf0e10cSrcweir if ( $att eq "Name" && $val eq "VCLinkerTool" ) { 1074cdf0e10cSrcweir $LinkerSection = 1; 1075cdf0e10cSrcweir } 1076cdf0e10cSrcweir if ( $att eq "Name" && $val eq "VCCustomBuildTool" ) { 1077cdf0e10cSrcweir $CustomSection = 1; 1078cdf0e10cSrcweir } 1079cdf0e10cSrcweir 1080cdf0e10cSrcweir # For Configuration Infos like compiler defines etc. 1081cdf0e10cSrcweir if ( $att eq "PreprocessorDefinitions" && $CompilerSection ) { 1082cdf0e10cSrcweir $configelements{$config}{$att} = $val; 1083cdf0e10cSrcweir } 1084cdf0e10cSrcweir if ( $att eq "AdditionalIncludeDirectories" && $CompilerSection ) { 1085cdf0e10cSrcweir #$configelements{$config}{$att} = $val; 1086cdf0e10cSrcweir if ( ($file_tmp ne "") && ($val ne "") ) { 1087cdf0e10cSrcweir $files{ $file_tmp } = 1; # save it now 1088cdf0e10cSrcweir $file_tmp =~ s/^\.\\//; # remove leading .\ 1089cdf0e10cSrcweir $files_special{"AdditionalIncludeDirectories"}{$file_tmp} = $val; 1090cdf0e10cSrcweir print "Include $val: $file_tmp\n" if ($is_debug); 1091cdf0e10cSrcweir $file_tmp = ""; # has been saved now reset it 1092cdf0e10cSrcweir } else 1093cdf0e10cSrcweir { 1094cdf0e10cSrcweir $configelements{$config}{$att} = $val; 1095cdf0e10cSrcweir } 1096cdf0e10cSrcweir } 1097cdf0e10cSrcweir if ( ($att eq "DisableLanguageExtensions") && $CompilerSection ) { 1098cdf0e10cSrcweir #$configelements{$config}{$att} = $val; 1099cdf0e10cSrcweir if ( ($file_tmp ne "") && ($val ne "")) { 1100cdf0e10cSrcweir $files{ $file_tmp } = 1; # save it now 1101cdf0e10cSrcweir $file_tmp =~ s/^\.\\//; # remove leading .\ 1102cdf0e10cSrcweir $files_special{"DisableLanguageExtensions"}{$file_tmp} = $val; 1103cdf0e10cSrcweir print "-Ze: $file_tmp\n" if ($is_debug); 1104cdf0e10cSrcweir $file_tmp = ""; # has been saved now reset it 1105cdf0e10cSrcweir } 1106cdf0e10cSrcweir } 1107cdf0e10cSrcweir if ( $att eq "OutputDirectory" ) { 1108cdf0e10cSrcweir $configelements{$config}{$att} = $val; 1109cdf0e10cSrcweir } 1110cdf0e10cSrcweir if ( $att eq "OutputFile" && $LinkerSection ) { 1111b0de3218SArrigo Marchiori if ($architecture eq "x64") { 1112b0de3218SArrigo Marchiori # We want the /bin/ subdirectory on all architectures 1113b0de3218SArrigo Marchiori $val =~ s/\\bin64\\/\\bin\\/; 1114b0de3218SArrigo Marchiori } 1115cdf0e10cSrcweir $configelements{$config}{$att} = $val; 1116cdf0e10cSrcweir } 1117cdf0e10cSrcweir if ( $att eq "ProgramDatabaseFile" ) { 1118cdf0e10cSrcweir $configelements{$config}{$att} = $val; 1119cdf0e10cSrcweir } 1120cdf0e10cSrcweir if ( $att eq "ImportLibrary" && $LinkerSection ) { 1121cdf0e10cSrcweir $configelements{$config}{$att} = $val; 1122cdf0e10cSrcweir } 1123cdf0e10cSrcweir if ($att eq "CommandLine") { 1124cdf0e10cSrcweir $configelements{$config}{$att} = $val; 1125cdf0e10cSrcweir } 1126cdf0e10cSrcweir if (($att eq "PreprocessorDefinitions") && $ConfigSection) { 1127cdf0e10cSrcweir $configelements{$config}{$att} = $val; 1128cdf0e10cSrcweir } 1129cdf0e10cSrcweir 1130cdf0e10cSrcweir # Is the file in the step before a header 1131cdf0e10cSrcweir # which has to be copied into the global 1132cdf0e10cSrcweir # include path? 1133cdf0e10cSrcweir if ( $file_tmp ne "" ) 1134cdf0e10cSrcweir { 1135cdf0e10cSrcweir $config = "Release"; 1136cdf0e10cSrcweir if ( ($att eq "CommandLine") && ($el eq "Tool") ) 1137cdf0e10cSrcweir { 1138cdf0e10cSrcweir if ( $file_tmp =~ /.+\.h$/ ) { 1139cdf0e10cSrcweir $files2copy{ $file_tmp } = $val; # unicode + layout header to copy 1140cdf0e10cSrcweir $file_tmp = ""; # has been saved now reset it 1141cdf0e10cSrcweir } 1142cdf0e10cSrcweir } 1143cdf0e10cSrcweir } # if $file_tmp 1144cdf0e10cSrcweir 1145cdf0e10cSrcweir # For files 1146cdf0e10cSrcweir if ( $att eq "RelativePath" ) { 1147cdf0e10cSrcweir if ( $file_tmp ) { 1148cdf0e10cSrcweir # no special file (include dir / compiler switch) 1149cdf0e10cSrcweir $files{ $file_tmp } = 1; # save it now 1150cdf0e10cSrcweir $file_tmp = ""; # has been saved now reset it 1151cdf0e10cSrcweir } 1152cdf0e10cSrcweir # store temporary the file name 1153cdf0e10cSrcweir $file_tmp = $val if ($val !~ /\.mk$/); # no *.mk files 1154cdf0e10cSrcweir } 1155cdf0e10cSrcweir } # while @_ 1156cdf0e10cSrcweir} # End start_handler 1157cdf0e10cSrcweir 1158cdf0e10cSrcweir############################################################################ 1159cdf0e10cSrcweirsub char_handler 1160cdf0e10cSrcweir############################################################################ 1161cdf0e10cSrcweir{ 1162cdf0e10cSrcweir} # End char_handler 1163