return @argv;
}
+sub arg_defines {
+ my ($self, %args) = @_;
+ s/"/\\"/g foreach values %args;
+ return map "-D$_=$args{$_}", keys %args;
+}
+
sub compile {
my ($self, %args) = @_;
my $cf = $self->{config};
$srcdir ||= File::Spec->curdir();
+ my @defines = $self->arg_defines( %{ $args{defines} || {} } );
+
my %spec = (
srcdir => $srcdir,
builddir => $srcdir,
cflags => [
$self->split_like_shell($cf->{ccflags}),
$self->split_like_shell($cf->{cccdlflags}),
+ $self->split_like_shell($cf->{extra_compiler_flags}),
],
optimize => [ $self->split_like_shell($cf->{optimize}) ],
- defines => [ '' ],
+ defines => \@defines,
includes => [ @{$args{include_dirs} || []} ],
perlinc => [
$self->perl_inc(),
=begin comment
The packages below implement functions for generating properly
-formated commandlines for the compiler being used. Each package
+formatted commandlines for the compiler being used. Each package
defines two primary functions 'format_linker_cmd()' &
'format_compiler_cmd()' that accepts a list of named arguments (a
-hash) and returns a list of formated options suitable for invoking the
+hash) and returns a list of formatted options suitable for invoking the
compiler. By default, if the compiler supports scripting of its
operation then a script file is built containing the options while
those options are removed from the commandline, and a reference to the
$spec{basename} . '.ccs' );
$self->add_to_cleanup($script);
-
print "Generating script '$script'\n" if !$self->{quiet};
open( SCRIPT, ">$script" )