summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/codecs/on2/h264dec/omxdl/reference/build_vc.pl
blob: e59cded03a7117cfbf6b3faeea267f08c80d8a0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/*
 * Copyright (C) 2007-2008 ARM Limited
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */
#!/usr/bin/perl
#
# 
# File Name:  build_vc.pl
# OpenMAX DL: v1.0.2
# Revision:   9641
# Date:       Thursday, February 7, 2008
# 
# 
# 
#
# This file builds the OpenMAX DL vc domain library omxVC.o.
#

use File::Spec;
use strict;

my ($CC, $CC_OPTS, $AS, $AS_OPTS, $LIB, $LIB_OPTS, $LIB_TYPE);

$CC       = 'armcc';
$CC_OPTS  = '--no_unaligned_access --cpu ARM7TDMI -c';
$AS       = 'armasm';
$AS_OPTS  = '--no_unaligned_access --cpu ARM7TDMI';
# $LIB      = 'armlink';
# $LIB_OPTS = '--partial -o';
# $LIB_TYPE = '.o';
$LIB      = 'armar';
$LIB_OPTS = '--create -r';
$LIB_TYPE = '.a';

#------------------------

my (@headerlist, @filelist, $hd, $file, $ofile, $command, $objlist, $libfile, $h);

# Define the list of directories containing included header files.
@headerlist = qw(api vc/api vc/m4p2/api vc/m4p10/api);

# Define the list of source files to compile.
open(FILES, '<filelist_vc.txt') or die("Can't open source file list\n");
@filelist = <FILES>;
close(FILES);

# Fix the file separators in the header paths
foreach $h (@headerlist)
{
        $h = File::Spec->canonpath($h);
}

# Create the include path to be passed to the compiler
$hd = '-I' . join(' -I', @headerlist);

# Create the build directories "/lib/" and "/obj/" (if they are not there already)
mkdir "obj", 0777 if (! -d "obj");
mkdir "lib", 0777 if (! -d "lib");

$objlist = '';

# Compile each file
foreach $file (@filelist)
{
	my $f;
	my $base;
	my $ext;
	my $objfile;

	chomp($file);
	$file = File::Spec->canonpath($file);

	(undef, undef, $f) = File::Spec->splitpath($file);
	if(($base, $ext) = $f =~ /(.+)\.(\w)$/)
	{
		$objfile = File::Spec->catfile('obj', $base.'.o');

		if($ext eq 'c')
		{
			$objlist .= "$objfile ";
			$command = $CC.' '.$CC_OPTS.' '.$hd.' -o '.$objfile.' '.$file;
			print "$command\n";
			system($command);
		}
		elsif($ext eq 's')
		{
			$objlist .= "$objfile ";
			$command = $AS.' '.$AS_OPTS.' '.$hd.' -o '.$objfile.' '.$file;
			print "$command\n";
			system($command);
		}
		else
		{
			print "Ignoring file: $f\n";
		}
	}
	else
	{
		die "No file extension found: $f\n";
	}
}

# Do the final link stage to create the libraries.
$libfile = File::Spec->catfile('lib', 'omxVC'.$LIB_TYPE);
$command = $LIB.' '.$LIB_OPTS.' '.$libfile.' '.$objlist;
print "$command\n";
(system($command) == 0) and print "Build successful\n";