Home | History | Annotate | Download | only in arm11
      1 /*
      2  * Copyright (C) 2007-2008 ARM Limited
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  *
     16  */
     17 #!/usr/bin/perl
     18 #
     19 # 
     20 # File Name:  build_vc.pl
     21 # OpenMAX DL: v1.0.2
     22 # Revision:   9641
     23 # Date:       Thursday, February 7, 2008
     24 # 
     25 # 
     26 # 
     27 #
     28 # This file builds the OpenMAX DL vc domain library omxVC.o.
     29 #
     30 
     31 use File::Spec;
     32 use strict;
     33 
     34 my ($CC, $CC_OPTS, $AS, $AS_OPTS, $LIB, $LIB_OPTS, $LIB_TYPE);
     35 
     36 $CC       = 'armcc';
     37 $CC_OPTS  = '--no_unaligned_access --cpu ARM1136J-S -c';
     38 $AS       = 'armasm';
     39 $AS_OPTS  = '--no_unaligned_access --cpu ARM1136J-S';
     40 # $LIB      = 'armlink';
     41 # $LIB_OPTS = '--partial -o';
     42 # $LIB_TYPE = '.o';
     43 $LIB      = 'armar';
     44 $LIB_OPTS = '--create -r';
     45 $LIB_TYPE = '.a';
     46 
     47 #------------------------
     48 
     49 my (@headerlist, @filelist, $hd, $file, $ofile, $command, $objlist, $libfile, $h);
     50 
     51 # Define the list of directories containing included header files.
     52 @headerlist = qw(api vc/api vc/m4p2/api vc/m4p10/api);
     53 
     54 # Define the list of source files to compile.
     55 open(FILES, '<filelist_vc.txt') or die("Can't open source file list\n");
     56 @filelist = <FILES>;
     57 close(FILES);
     58 
     59 # Fix the file separators in the header paths
     60 foreach $h (@headerlist)
     61 {
     62         $h = File::Spec->canonpath($h);
     63 }
     64 
     65 # Create the include path to be passed to the compiler
     66 $hd = '-I' . join(' -I', @headerlist);
     67 
     68 # Create the build directories "/lib/" and "/obj/" (if they are not there already)
     69 mkdir "obj", 0777 if (! -d "obj");
     70 mkdir "lib", 0777 if (! -d "lib");
     71 
     72 $objlist = '';
     73 
     74 # Compile each file
     75 foreach $file (@filelist)
     76 {
     77 	my $f;
     78 	my $base;
     79 	my $ext;
     80 	my $objfile;
     81 
     82 	chomp($file);
     83 	$file = File::Spec->canonpath($file);
     84 
     85 	(undef, undef, $f) = File::Spec->splitpath($file);
     86 	if(($base, $ext) = $f =~ /(.+)\.(\w)$/)
     87 	{
     88 		$objfile = File::Spec->catfile('obj', $base.'.o');
     89 
     90 		if($ext eq 'c')
     91 		{
     92 			$objlist .= "$objfile ";
     93 			$command = $CC.' '.$CC_OPTS.' '.$hd.' -o '.$objfile.' '.$file;
     94 			print "$command\n";
     95 			system($command);
     96 		}
     97 		elsif($ext eq 's')
     98 		{
     99 			$objlist .= "$objfile ";
    100 			$command = $AS.' '.$AS_OPTS.' '.$hd.' -o '.$objfile.' '.$file;
    101 			print "$command\n";
    102 			system($command);
    103 		}
    104 		else
    105 		{
    106 			print "Ignoring file: $f\n";
    107 		}
    108 	}
    109 	else
    110 	{
    111 		die "No file extension found: $f\n";
    112 	}
    113 }
    114 
    115 # Do the final link stage to create the libraries.
    116 $libfile = File::Spec->catfile('lib', 'omxVC'.$LIB_TYPE);
    117 $command = $LIB.' '.$LIB_OPTS.' '.$libfile.' '.$objlist;
    118 print "$command\n";
    119 (system($command) == 0) and print "Build successful\n";
    120 
    121 
    122 
    123 
    124 
    125 
    126 
    127