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