dsp_gen.pl
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:12k
- #!/usr/bin/perl
- #
- # Copyright Statement:
- # --------------------
- # This software is protected by Copyright and the information contained
- # herein is confidential. The software may not be copied and the information
- # contained herein may not be used or disclosed except with the written
- # permission of MediaTek Inc. (C) 2005
- #
- # BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
- # THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
- # RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
- # AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
- # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
- # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
- # NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
- # SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
- # SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
- # THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
- # NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
- # SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
- #
- # BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
- # LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
- # AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
- # OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
- # MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
- #
- # THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
- # WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
- # LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
- # RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
- # THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
- #
- #
- #!/user/bin/perl
- chdir "./plutommi/mmi/";
- #system("dir");
- $|=1;
- use strict;
- use DirHandle;
- $ENV{PERLIO}="crlf";
- my %WIN32_FILE_LIST;
- my %UN_WIN32_FILE_LIST;
- my %FORCE_WIN32_FILE_LIST;
- my $MAKE_PATH="../../make";
- my $MCU_ROOT="..\..\";
- my $LOOP_CNT=0;
- my %file_list_table;
- my %added_file_list_table;
- my $added_file_list_table_cnt=0;
- $WIN32_FILE_LIST{'plutommi'}.="..\..\custom\common\custom_ems_context.cn";
- $WIN32_FILE_LIST{'plutommi'}.="..\..\custom\common\mmi_msg_context.cn";
- $WIN32_FILE_LIST{'plutommi'}.="..\..\plutommi\Customer\CustResource\gui_wrapper.cn";
- $WIN32_FILE_LIST{'plutommi'}.="..\..\plutommi\Customer\CustResource\KeyMapDeclare.cn";
- $WIN32_FILE_LIST{'plutommi'}.="..\..\plutommi\Customer\CustResource\CustMiscData.cn";
- $WIN32_FILE_LIST{'plutommi'}.="..\..\plutommi\Customer\CustResource\resource_world_clock_city.cn";
- $WIN32_FILE_LIST{'plutommi'}.="..\..\plutommi\Customer\CustResource\resource_calc_coordinates.cn";
- $WIN32_FILE_LIST{'plutommi'}.="..\..\plutommi\Customer\CustResource\resource_shortcuts.cn";
- $WIN32_FILE_LIST{'plutommi'}.="..\..\plutommi\Customer\CustResource\resource_audply_skins.cn";
- $WIN32_FILE_LIST{'plutommi'}.="..\..\plutommi\Customer\CustResource\resource_camera_skins.cn";
- $WIN32_FILE_LIST{'plutommi'}.="..\..\plutommi\Customer\CustResource\resource_video_skins.cn";
- $WIN32_FILE_LIST{'plutommi'}.="..\..\plutommi\Customer\CustResource\resource_barcodereader_skins.cn";
- $WIN32_FILE_LIST{'plutommi'}.="..\..\plutommi\Customer\CustResource\resource_fmradio_skins.cn";
- $WIN32_FILE_LIST{'plutommi'}.="..\..\plutommi\Customer\CustResource\resource_fmschedulerec_skins.cn";
- $WIN32_FILE_LIST{'plutommi'}.="..\..\plutommi\Customer\CustResource\resource_abrepeat_skins.cn";
- $WIN32_FILE_LIST{'plutommi'}.="..\..\plutommi\Customer\CustResource\resource_aud_eq_values.cn";
- # $WIN32_FILE_LIST{'plutommi'}.="..\..\plutommi\Customer\Resources\mtk_icon.ICOn";
- # $WIN32_FILE_LIST{'plutommi'}.="..\..\plutommi\Customer\Resources\mtk_simulator.ICOn";
- # $WIN32_FILE_LIST{'plutommi'}.="..\..\plutommi\Customer\Resources\small.icon";
- $WIN32_FILE_LIST{'plutommi'}.="..\..\plutommi\MMI\DebugLevels\DebugLevelSrc\Debug.cppn";
- $WIN32_FILE_LIST{'plutommi'}.="..\..\plutommi\MMI\DebugLevels\DebugLevelSrc\DebugPCTrc.cn";
- $WIN32_FILE_LIST{'plutommi'}.="..\..\plutommi\MMI\Framework\Osl\OslSrc\MMI.cppn";
- $WIN32_FILE_LIST{'plutommi'}.="..\..\plutommi\MMI\Framework\Osl\OslSrc\mainlcd.cn";
- $WIN32_FILE_LIST{'plutommi'}.="..\..\plutommi\MMI\Framework\Osl\OslSrc\KeyMap.cppn";
- $WIN32_FILE_LIST{'plutommi'}.="..\..\plutommi\MMI\Framework\Osl\OslSrc\UpdateWindow.cppn";
- $WIN32_FILE_LIST{'plutommi'}.="..\..\plutommi\MMI\Resource\StandaloneRes.cn";
- $WIN32_FILE_LIST{'plutommi'}.="..\..\plutommi\MMI\Framework\FileSystem\FileSystemSrc\FileSystemDummy.cn";
- $WIN32_FILE_LIST{'plutommi'}.="..\..\plutommi\MMI\Framework\FileSystem\FileSystemSrc\filesystemsrc.cn";
- $WIN32_FILE_LIST{'plutommi'}.="..\..\MoDIS\FileSystem\FileSystemSrc\FSSim_core.cn";
- $WIN32_FILE_LIST{'plutommi'}.="..\..\MoDIS\FileSystem\FileSystemSrc\FSSim_data.cn";
- $WIN32_FILE_LIST{'plutommi'}.="..\..\MoDIS\FileSystem\FileSystemSrc\FSSim_supplemental.cn";
- $WIN32_FILE_LIST{'plutommi'}.="..\..\custom\ps\$ARGV[0]\custom_poc_config.cn";
- $WIN32_FILE_LIST{'plutommi'}.="..\..\applib\mem\src\app_mem.cn";
- $WIN32_FILE_LIST{'plutommi'}.="..\..\applib\misc\src\app_crc.cn";
- $WIN32_FILE_LIST{'mtkapp'}.="..\..\plutommi\MtkApp\MtkAppSrc\soc_win32.cn";
- # add dummy files for BT and USB in WIN32
- $WIN32_FILE_LIST{'mtkapp'}.="..\..\plutommi\MtkApp\Connectivity\ConnectivitySrc\ExtDeviceDummySrc.cn";
- #$UN_WIN32_FILE_LIST{'mtkapp'} .= " AudioPlayerMainScreen.c AudioPlayerMsgHandler.c AudioPlayerSrc.c AudioPlayerPlayList.c";
- $UN_WIN32_FILE_LIST{'mtkapp'} .= " ctk.c mmiapi_main.c mmiapi_sms.c mmiapi_sms_msg.c mmiapi_ui.c";
- $UN_WIN32_FILE_LIST{'mtkapp'} .= " vObjects.c vCalendar.c vCard.c";
- #$UN_WIN32_FILE_LIST{'mtkapp'} .= " FileMgr.c FileMgrCore.c FileManagerSrc.c FileMgrUI.c";
- # Need to force existing, because verno will be created after the desp_gen
- $FORCE_WIN32_FILE_LIST{'verno'} .= " verno.c";
- sub is_in_list1;
- sub create_file_table;
- sub create_lib_project;
- # add for DLT
- my @target_lib = ("plutommi", "mtkapp", "xmlp", "verno");
- print "Generating PC simulator project file...";
- foreach my $lib (@target_lib){
- #print "$libn";
- ########################################################################################################
- ## read filelist
- my $lis_filename = "$MAKE_PATH/$lib/$lib.lis";
- my $library_filename = "../../mtk_lib/$lib.lib";
- if (! -e $lis_filename)
- {
- print "Can't find $lis_filenamen";
- next;
- } elsif (-e $library_filename) {
- print "$library_filename exits!n";
- next;
- }
-
- open F,"<$lis_filename" or die "Can't read $lis_filename";
- my $list = "";
- my %list_hash;
- my @list_set;
- my @tmp_set;
- push @list_set,split("n",$WIN32_FILE_LIST{'global'}) if(defined($WIN32_FILE_LIST{'global'}));
- push @list_set,split("n",$WIN32_FILE_LIST{$lib}) if(defined($WIN32_FILE_LIST{$lib}));
- @tmp_set = <F>;
- push @list_set,@tmp_set;
- close F;
- foreach my $file (@list_set)
- {
- $file =~ s/^s+//gs;
- $file =~ s/s+$//gs;
- next if($file !~ /S+/);
- next if($list_hash{lc($file)});
-
- #print "$filen";
- if(!is_in_list1($file,$UN_WIN32_FILE_LIST{'global'})
- && !is_in_list1($file,$UN_WIN32_FILE_LIST{$lib}))
- {
- if($file =~ /^./)
- {
- if (! -e $file)
- {
- if(is_in_list1($file,$FORCE_WIN32_FILE_LIST{'verno'}))
- {
- print "force $filen";
- }
- else
- {
- print "Can't find $filen";
- next;
- }
- }
- $list .= $file ."n"
- }
- else
- {
- my $tmp_file = $MCU_ROOT . $file;
- if (! -e $tmp_file)
- {
- if(is_in_list1($file,$FORCE_WIN32_FILE_LIST{'verno'}))
- {
- print "force $filen";
- }
- else
- {
- print "Can't find $filen";
- next;
- }
- }
- $list .= $tmp_file ."n"
- }
- $list_hash{lc($file)} = 1;
- }
- }
- $list = join("n",sort(split("n",$list))) . "n";
- ##
- create_file_table($lib,$list);
- }
- ## write .dep file
- create_lib_project(
- "plutommi",
- "MMI.tmp",
- "MMI.dsp"
- );
- print "nGenerating PC simulator project file done!n";
- ############ Main procedure ends here ################
- sub create_group_source_tree
- {
- my $level = shift;
- my $fullpath = shift;
- my $path = shift;
- my $dir = new DirHandle();
- my $result = "";
- $level++;
- $result .= "# Begin Group "$path"n" if($level>1);
- #print "level = $level, $fullpath";
- #foreach my $file (sort keys %file_list_table )
- #{
- # print "$filen";
- #}
- #while(<STDIN>){}
-
- opendir $dir,"$fullpath";
- foreach my $node (sort readdir($dir))
- {
- next if($node eq '.');
- next if($node eq '..');
- if(-d "$fullpath/$node")
- {
- #print "directory $noden";
-
- # remove customer project information
- if(lc($fullpath) =~ /^..\..\plutommi\customer\custresource/)
- {
- print "skip directory $fullpath/$noden";
- }
- else
- {
- my $file_counter = $added_file_list_table_cnt;
- my $content = create_group_source_tree($level,"$fullpath\$node",$node);
- #print "$content";
- $result .= $content if($file_counter < $added_file_list_table_cnt);
- }
- }
- else
- {
- next if($node =~ /.c$/ && !defined($file_list_table{lc("$fullpath\$node")}));
- next if($node =~ /.cpp$/ && !defined($file_list_table{lc("$fullpath\$node")}));
- next if(defined($added_file_list_table{lc("$fullpath\$node")}));
- if($node =~ /.h$/i
- || $node =~ /.c$/i
- || $node =~ /.cpp$/i
- #|| $node =~ /.txt$/i
- #|| $node =~ /.bat$/i
- )
- {
- #print "file $fullpath\$noden";
-
- $added_file_list_table{lc("$fullpath\$node")} = 1;
- $result .= "# Begin Source File n";
- $result .= "SOURCE=$fullpath\$noden";
- $result .= "# End Source File n";
- $added_file_list_table_cnt ++;
- }
- }
- }
- closedir $dir;
- $result .= "# End Group "$path"n" if($level>1);
- $level--;
- #print "$resultnnn";
-
- return $result;
- }
- my $trace_tree = 0;
- sub create_file_list
- {
- my $lib = shift;
-
- my $list_set = "";
- my @unsort;
- foreach my $file (sort keys %file_list_table)
- {
- #next if(! -e "$lib/$file");
- next if(defined($added_file_list_table{lc($file)}));
- if(($file =~ /^(.*?\$lib)\/i) && ($trace_tree != 1))
- {
- my $root = $1;
- #print "root = $root, $filen";
-
- $list_set .= create_group_source_tree(0,$root,$lib);
- #print "$list_set";
- $trace_tree = 1;
- }
- if(!defined($added_file_list_table{lc($file)}))#else
- {
- push @unsort,$file;
- }
- }
- $list_set .= "# Begin Group "Misc"n";
- foreach my $file (sort @unsort)
- {
- $list_set .= "# Begin Source File n";
- $list_set .= "SOURCE=$filen";
- $list_set .= "# End Source File n";
- }
- $list_set .= "# End Group "Misc"n";
-
- my $result;
- $result = <<__STRING__
- # Begin Group "$lib"n
- $list_set
- # End Group "$lib"n
- # End Target
- # End Project
- __STRING__
- ;
- return $result;
- }
- sub create_file_table
- {
- my $lib = shift;
- my $file_list = lc(shift);
- foreach my $file (split("n",$file_list))
- {
- $file_list_table{lc($file)} = 1;
- #print "$filen";
- }
- }
- sub create_lib_project
- {
- my $root = shift;
- my $src_filename = shift;
- my $des_filename = shift;
-
- my @S_data;
- my $line;
- my $result = '';
- open S, "<$src_filename" or die "Can't open $src_filename";
- @S_data = <S>;
- close S;
- foreach $line (@S_data){
- $result .= $line;
- }
- $result .= create_file_list($root);
-
- #print "Write $dep_filenamen";
- open F,">$des_filename" or die "Can't open $des_filename";
-
- print F $result;
- close F;
- }
- sub is_in_list1
- {
- my $item = shift;
- my $list = shift;
- return 0 if(!defined($list));
- while( $list =~ /(S+)/g)
- {
- my $i=$1;
- return 1 if( $item =~ /^$iW/is);
- return 1 if( $item =~ /^$i$/is);
- return 1 if( $item =~ /W$i$/si);
- return 1 if( $item =~ /W$iW/si);
- }
- return 0;
- }