our
@ISA
=
'Mpp::CommandParser::Gcc'
;
use
Mpp::File
qw(file_info absolute_filename)
;
sub
new {
my
$self
=
&Mpp::CommandParser::Gcc::new_no_gcc
;
$self
->{SCANNER} = new Mpp::Scanner::Esqlc(
$self
->rule,
$self
->dir);
$self
;
}
sub
parse_arg {
my
(
undef
,
undef
,
$words
,
$files
) =
@_
;
my
$scanner
=
$_
[0]{SCANNER};
for
(
$_
[1] ) {
if
( s/^(sys_?)?include=//i ) {
my
$sys
= $1;
for
( /^\((.+)\)$/ ?
split
(
','
, $1 ) :
$_
) {
$scanner
->add_include_dir(
user
=>
$_
);
$scanner
->add_include_dir(
sys
=>
$_
)
if
$sys
;
}
}
elsif
( s/^iname=//i ) {
push
@$files
,
Mpp::File::exists_or_can_be_built( file_info
$_
) ? $1 :
"$1.pc"
;
}
elsif
( s/^define=//i ) {
unshift
@$words
,
"-D$_"
;
}
elsif
( ::is_windows ? s/^config=(?=(\/|[a-z]:)?)//i : s/^config=(?=(\/)?)//i ) {
$_
[0]->add_simple_dependency(
$_
);
substr
$_
, 0, 0,
&Mpp::CommandParser::dirinfo
->{FULLNAME} .
'/'
unless
defined
$1;
Mpp::Subs::prebuild file_info(
$_
),
$_
[0]{RULE}{MAKEFILE},
$_
[0]{RULE}{RULE_SOURCE};
if
(
open
my
$fh
,
$_
) {
while
( <
$fh
> ) {
chomp
;
parse_arg(
$_
[0],
$_
,
$words
,
$files
);
}
}
else
{
warn
"config file `$_' not found"
;
}
}
elsif
( /\.(?:[eps]|pg)c$/ ) {
push
@$files
,
$_
;
}
}
}
sub
parse_opt {
my
$words
=
$_
[2];
my
$scanner
=
$_
[0]{SCANNER};
for
(
$_
[1] ) {
if
( s/^E(?=[DU].+)// || s/^Y// ) {
unshift
@$words
,
"-$_"
;
}
}
}
my
@suffix_list
= (
''
,
'.h'
);
sub
xparse_command {
$_
[0]{SCANNER}->add_include_suffix_list(
user
=> \
@suffix_list
);
goto
&Mpp::CommandParser::Gcc::xparse_command
;
}
1;