1#!/usr/bin/perl 2# 3# 4# File Name: build_vc.pl 5# OpenMAX DL: v1.0.2 6# Revision: 9641 7# Date: Thursday, February 7, 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 16use File::Spec; 17use strict; 18 19my ($CC, $CC_OPTS, $AS, $AS_OPTS, $LIB, $LIB_OPTS, $LIB_TYPE); 20 21$CC = 'armcc'; 22$CC_OPTS = '--no_unaligned_access --cpu ARM1136J-S -c'; 23$AS = 'armasm'; 24$AS_OPTS = '--no_unaligned_access --cpu ARM1136J-S'; 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 34my (@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. 40open(FILES, '<filelist_vc.txt') or die("Can't open source file list\n"); 41@filelist = <FILES>; 42close(FILES); 43 44# Fix the file separators in the header paths 45foreach $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) 54mkdir "obj", 0777 if (! -d "obj"); 55mkdir "lib", 0777 if (! -d "lib"); 56 57$objlist = ''; 58 59# Compile each file 60foreach $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 if(($base, $ext) = $f =~ /(.+)\.(\w)$/) 72 { 73 $objfile = File::Spec->catfile('obj', $base.'.o'); 74 75 if($ext eq 'c') 76 { 77 $objlist .= "$objfile "; 78 $command = $CC.' '.$CC_OPTS.' '.$hd.' -o '.$objfile.' '.$file; 79 print "$command\n"; 80 system($command); 81 } 82 elsif($ext eq 's') 83 { 84 $objlist .= "$objfile "; 85 $command = $AS.' '.$AS_OPTS.' '.$hd.' -o '.$objfile.' '.$file; 86 print "$command\n"; 87 system($command); 88 } 89 else 90 { 91 print "Ignoring file: $f\n"; 92 } 93 } 94 else 95 { 96 die "No file extension found: $f\n"; 97 } 98} 99 100# Do the final link stage to create the libraries. 101$libfile = File::Spec->catfile('lib', 'omxVC'.$LIB_TYPE); 102$command = $LIB.' '.$LIB_OPTS.' '.$libfile.' '.$objlist; 103print "$command\n"; 104(system($command) == 0) and print "Build successful\n"; 105 106 107 108 109 110 111 112