package Midas
::Configure
;
our @EXPORT = qw(configure init_config add_cpp_defines);
diagroot
=> ['verif/diag/assembly/include'],
cpp_defines
=> [ 'GOLDFINGER=1'
diagroot
=> ['verif/diag'],
diagroot
=> ['verif/diag/c'],
diagroot
=> ['verif/diag/c/include'],
# Default build directory (this is used as a default for the State
# version, which is the one that really gets used). Can be full
# path or relative to starting directory.
# Full path or relative to build_dir
local_ldscr
=> 'diag*.ld_scr',
local_exe
=> 'diag*.exe',
local_image
=> 'mem.image',
local_events
=> 'diag.ev',
local_symtab
=> 'symbol.tbl',
local_goldfinger
=> 'diag.goldfinger',
local_directives
=> 'diag.midas',
local_cmdfile
=> '.midas_args',
local_oldcmdfile
=> '.midas_args.old',
local_oldm4
=> '.midas.diag.m4.old',
intermed_files
=> [qw(local_src local_s local_pl local_cpp local_m4
local_ldscr local_goldfinger local_directives
allow_tsb_conflicts
=> 0,
allow_empty_sections
=> 0,
allow_illegal_page_sizes
=> 0,
allow_duplicate_tags
=> 0,
allow_misaligned_tsb_base
=> 0,
goldfinger_cmd
=> 'goldfinger',
goldfinger_version
=> '1.07',
default_radix
=> 'decimal',
required
=> [qw(local_s local_image local_events
local_symtab local_exe)],
optional
=> [qw(local_pl)],
clean
=> [qw(local_image local_events
local_symtab local_exe)],
# If 1, use only full paths. Otherwise use relative paths wherever
# possible to make output more clear.
tsbtagfmt
=> 'tagaccess',
as_opt
=> ['-xarch=v9b'],
ld_opt
=> ['-b elf64-sparc', '-no-warn-mismatch',
gcc_opt
=> ['-m64', '-nostdinc', '-fno-common', '-fno-builtin'],
##############################################################################
my $def_config= \
%default_config;
Midas
::Command
::chat
"init_config, project is $PROJECT.\n";
my $dumper = Data
::Dumper
->new([$def_config]);
$dumper->Purity(1)->Deepcopy(1);
my $new_config = eval "no strict; " . $dumper->Dump;
Midas
::Command
::fatal
("Deepcopy of config failed!: $@\n", M_CODE
) if $@
;
%CONFIG = %{ $new_config };
unless(my $return = do $Midas::Globals
::CONFIG_FILE
) {
("WARNING! Can't parse config file ".
"'$Midas::Globals::CONFIG_FILE': $@\n".
"Using defaults.\n", 1) if $@
;
("WARNING! Can't find config file ".
"'$Midas::Globals::CONFIG_FILE': $!\n".
"Using defaults.\n", 1) unless defined $return;
if(exists $PROJ_CONFIG{$Midas::Globals
::PROJECT
}) {
("Setting project defaults for project ".
"'$Midas::Globals::PROJECT'.\n");
foreach my $key (keys %{ $PROJ_CONFIG{$Midas::Globals
::PROJECT
} } ) {
$Midas::Globals
::CONFIG
{$key} =
$PROJ_CONFIG{$Midas::Globals
::PROJECT
}{$key};
Midas
::Command
::chat
("WARNING! No project config for project ".
"'$Midas::Globals::PROJECT'.\n".
(my $MAJOR_VERSION = $Midas::VERSION
) =~ s/\..*$//;
(my $MINOR_VERSION = $Midas::VERSION
) =~ s/^.*\.//;
"MIDAS_VERSION=$Midas::VERSION",
"MIDAS_MAJOR_VERS=$MAJOR_VERSION",
"MIDAS_MINOR_VERS=$MINOR_VERSION"
# Make Path's version of full_paths a *reference* to the Configure version.
# This way, when one changes, they both change. Ditto for verbose.
Midas
::Paths
::configure
(full_paths
=> \
$CONFIG{full_paths
});
Midas
::Command
::configure
(verbose
=> \
$CONFIG{verbose
});
##############################################################################
foreach my $key (keys %args) {
$CONFIG{$key} = $args{$key};
##############################################################################
$CONFIG{cpp_includes
}{abs} = [] unless exists $CONFIG{cpp_includes
}{abs};
unshift @
{$CONFIG{cpp_includes
}{abs}}, @includes;
##############################################################################
$CONFIG{m4_includes
}{abs} = [] unless exists $CONFIG{m4_includes
}{abs};
unshift @
{$CONFIG{m4_includes
}{abs}}, @includes;
##############################################################################
$CONFIG{link_path
}{abs} = [] unless exists $CONFIG{link_path
}{abs};
unshift @
{$CONFIG{link_path
}{abs}}, @includes;
##############################################################################
$CONFIG{csrc_includes
}{abs} = [] unless exists $CONFIG{csrc_includes
}{abs};
unshift @
{$CONFIG{csrc_includes
}{abs}}, @includes;
##############################################################################
push @
{$CONFIG{cpp_defines
}}, @defines;
##############################################################################
push @
{$CONFIG{pal_diag_args
}}, @args;
##############################################################################
sub append_configuration
{
foreach my $key (keys %args) {
if(ref $CONFIG{$key} eq 'ARRAY') {
push @
{$CONFIG{$key}}, @
{$args{$key}};
("Only know how to append configuration to arrays (not $key).\n");
Midas
::Command
::fatal
("Can't append to scalar key $key\n", M_CODE
);
##############################################################################
##############################################################################