Home | History | Annotate | Download | only in arm_neon
      1 #!/usr/bin/perl
      2 #
      3 # 
      4 # File Name:  build_vc.pl
      5 # OpenMAX DL: v1.0.2
      6 # Revision:   12290
      7 # Date:       Wednesday, April 9, 2008
      8 # 
      9 # (c) Copyright 2007-2008 ARM Limited. All Rights Reserved.
     10 # 
     11 # 
     12 #
     13 # This file builds the OpenMAX DL vc domain library omxVC.o.
     14 #
     15 
     16 use File::Spec;
     17 use strict;
     18 
     19 my ($CC, $CC_OPTS, $AS, $AS_OPTS, $LIB, $LIB_OPTS, $LIB_TYPE);
     20 
     21 $CC       = 'armcc';
     22 $CC_OPTS  = '--no_unaligned_access --cpu Cortex-A8 -c';
     23 $AS       = 'armasm';
     24 $AS_OPTS  = '--no_unaligned_access --cpu Cortex-A8';
     25 # $LIB      = 'armlink';
     26 # $LIB_OPTS = '--partial -o';
     27 # $LIB_TYPE = '.o';
     28 $LIB      = 'armar';
     29 $LIB_OPTS = '--create -r';
     30 $LIB_TYPE = '.a';
     31 
     32 #------------------------
     33 
     34 my (@headerlist, @filelist, $hd, $file, $ofile, $command, $objlist, $libfile, $h);
     35 
     36 # Define the list of directories containing included header files.
     37 @headerlist = qw(api vc/api vc/m4p2/api vc/m4p10/api);
     38 
     39 # Define the list of source files to compile.
     40 open(FILES, '<filelist_vc.txt') or die("Can't open source file list\n");
     41 @filelist = <FILES>;
     42 close(FILES);
     43 
     44 # Fix the file separators in the header paths
     45 foreach $h (@headerlist)
     46 {
     47         $h = File::Spec->canonpath($h);
     48 }
     49 
     50 # Create the include path to be passed to the compiler
     51 $hd = '-I' . join(' -I', @headerlist);
     52 
     53 # Create the build directories "/lib/" and "/obj/" (if they are not there already)
     54 mkdir "obj", 0777 if (! -d "obj");
     55 mkdir "lib", 0777 if (! -d "lib");
     56 
     57 $objlist = '';
     58 
     59 # Compile each file
     60 foreach $file (@filelist)
     61 {
     62 	my $f;
     63 	my $base;
     64 	my $ext;
     65 	my $objfile;
     66 
     67 	chomp($file);
     68 	$file = File::Spec->canonpath($file);
     69 
     70 	(undef, undef, $f) = File::Spec->splitpath($file);
     71     $f=~s/[\n\f\r]//g; # Remove any end-of-line characters
     72 
     73 	if(($base, $ext) = $f =~ /(.+)\.(\w)$/)
     74 	{
     75 		$objfile = File::Spec->catfile('obj', $base.'.o');
     76 
     77 		if($ext eq 'c')
     78 		{
     79 			$objlist .= "$objfile ";
     80 			$command = $CC.' '.$CC_OPTS.' '.$hd.' -o '.$objfile.' '.$file;
     81 			print "$command\n";
     82 			system($command);
     83 		}
     84 		elsif($ext eq 's')
     85 		{
     86 			$objlist .= "$objfile ";
     87 			$command = $AS.' '.$AS_OPTS.' '.$hd.' -o '.$objfile.' '.$file;
     88 			print "$command\n";
     89 			system($command);
     90 		}
     91 		else
     92 		{
     93 			print "Ignoring file: $f\n";
     94 		}
     95 	}
     96 	else
     97 	{
     98 		die "No file extension found: $f\n";
     99 	}
    100 }
    101 
    102 # Do the final link stage to create the libraries.
    103 $libfile = File::Spec->catfile('lib', 'omxVC'.$LIB_TYPE);
    104 $command = $LIB.' '.$LIB_OPTS.' '.$libfile.' '.$objlist;
    105 print "$command\n";
    106 (system($command) == 0) and print "Build successful\n";
    107 
    108 
    109 
    110 
    111 
    112 
    113 
    114