Home | History | Annotate | Download | only in arm_neon
      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:   12290
     23 # Date:       Wednesday, April 9, 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 Cortex-A8 -c';
     38 $AS       = 'armasm';
     39 $AS_OPTS  = '--no_unaligned_access --cpu Cortex-A8';
     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     $f=~s/[\n\f\r]//g; # Remove any end-of-line characters
     87 
     88 	if(($base, $ext) = $f =~ /(.+)\.(\w)$/)
     89 	{
     90 		$objfile = File::Spec->catfile('obj', $base.'.o');
     91 
     92 		if($ext eq 'c')
     93 		{
     94 			$objlist .= "$objfile ";
     95 			$command = $CC.' '.$CC_OPTS.' '.$hd.' -o '.$objfile.' '.$file;
     96 			print "$command\n";
     97 			system($command);
     98 		}
     99 		elsif($ext eq 's')
    100 		{
    101 			$objlist .= "$objfile ";
    102 			$command = $AS.' '.$AS_OPTS.' '.$hd.' -o '.$objfile.' '.$file;
    103 			print "$command\n";
    104 			system($command);
    105 		}
    106 		else
    107 		{
    108 			print "Ignoring file: $f\n";
    109 		}
    110 	}
    111 	else
    112 	{
    113 		die "No file extension found: $f\n";
    114 	}
    115 }
    116 
    117 # Do the final link stage to create the libraries.
    118 $libfile = File::Spec->catfile('lib', 'omxVC'.$LIB_TYPE);
    119 $command = $LIB.' '.$LIB_OPTS.' '.$libfile.' '.$objlist;
    120 print "$command\n";
    121 (system($command) == 0) and print "Build successful\n";
    122 
    123 
    124 
    125 
    126 
    127 
    128 
    129