Convert-Binary-C
view release on metacpan or search on metacpan
Makefile.PL view on Meta::CPAN
ctlib/bitfields
ctlib/byteorder
ctlib/cterror
ctlib/ctparse
ctlib/cttags
ctlib/cttype
ctlib/fileinfo
ctlib/layout
ctlib/y_parser
ctlib/y_pragma
ucpp/assert
ucpp/cpp
ucpp/eval
ucpp/nhash
ucpp/lexer
ucpp/macro
ucpp/mem
util/hash
util/list
util/memalloc
);
@DBGOBJ = qw(
cbc/debug
ctlib/ctdebug
);
unshift @OBJECT, $MODULE =~ /([^:]+)$/;
# Files additionally to be removed on 'make realclean'
@REALCLEAN = qw(
ctlib/y_parser.output
ctlib/y_pragma.output
tests/debug.out
);
@CLEAN = qw(
$(OBJECT)
tests/*.vg
tests/*.vgo
tests/cache.cbc
);
@DEFINE = qw(
UCPP_CONFIG
UTIL_HAVE_CONFIG_H
);
# On AIX systems, this should be defined for ucpp
$^O eq 'aix' and push @DEFINE, qw( POSIX_JMP );
# Supported features, and flags to set when (e)nabled or (d)isabled
%FEATURES = (
debug => {
enabled => $Config{ccflags} =~ /-DDEBUGGING\b/ ? 1 : 0,
e_flags => [qw( CBC_DEBUGGING CTLIB_DEBUGGING DEBUG_MEMALLOC DEBUG_UTIL_HASH DEBUG_UTIL_LIST YYDEBUG=1 )],
d_flags => [qw( NDEBUG )],
},
ieeefp => {
enabled => undef,
e_flags => [qw( CBC_HAVE_IEEE_FP )],
d_flags => [qw()],
},
$Config{gccversion} ? (
'$format-check' => {
enabled => 0,
e_flags => [qw( CTLIB_FORMAT_CHECK UTIL_FORMAT_CHECK )],
d_flags => [qw()],
},
'$coverage' => {
enabled => 0,
e_flags => [qw()],
d_flags => [qw()],
}
) : (),
'$mem-check' => {
enabled => 0,
e_flags => [qw( MEM_DEBUG DEBUG_MEMALLOC TRACE_MEMALLOC AUTOPURGE_MEMALLOC )],
d_flags => [qw()],
},
);
# Automatically generated files
%EXAMPLES = (
map {
my $x=$_;
s/^bin/examples/;
s/PL$/pl/;
($x => $_)
} glob "bin/*.PL"
);
%GENERATE = (
%EXAMPLES,
'ctlib/arch.pl' => 'ctlib/arch.h',
);
push @REALCLEAN, map { ref $_ ? @$_ : $_ } values %GENERATE;
# Extract features/optimizations from the commandline arguments
@ARGV = map {
my $myopt = 0;
if( my($what, $feat) = /^(en|dis)able-(\S+)$/ ) {
for my $pre ('', '$', '~') {
if (exists $FEATURES{$pre.$feat}) {
warn "WARNING: Feature '$feat' is deprecated and will be removed!\n" if $pre eq '~';
$feat = $pre.$feat;
last;
}
}
unless (exists $FEATURES{$feat}) {
my @feat = join ', ', map { s/^[\$\~]//; "'$_'" } sort keys %FEATURES;
die "Invalid feature '$feat'. Use one of @feat.\n";
}
$FEATURES{$feat}{enabled} = $what eq 'en';
$myopt = 1;
}
elsif( /^help$/ ) {
die <<ENDUSAGE;
Makefile.PL view on Meta::CPAN
}
my $config = {
'CCFLAGS' => $Config{ccflags},
'DEFINE' => join(' ', map("-D$_", @DEFINE)),
'depend' => { find_depend( @INC_PATH ) },
};
if ($FEATURES{'$coverage'}{enabled}) {
$config->{'CCFLAGS'} .= ' -g -fprofile-arcs -ftest-coverage';
if ($Config{gccversion} =~ /(\d+)\.(\d+)\.(\d+)/ && ($1+1e-3*$2+1e-6*$3) >= 3.004) {
$config->{'LDLOADLIBS'} = '-lgcov'; # not a valid parameter, but works...
}
}
if ($FEATURES{'$format-check'}{enabled}) {
$config->{'CCFLAGS'} .= ' -Wformat=2';
}
if (eval $ExtUtils::MakeMaker::VERSION >= 6.64) {
$config->{'TEST_REQUIRES'} = {
'Test::More' => 0,
};
}
if (eval $ExtUtils::MakeMaker::VERSION >= 6) {
$config->{'AUTHOR'} = 'Marcus Holland-Moritz <mhx@cpan.org>';
$config->{'ABSTRACT_FROM'} = 'lib/Convert/Binary/C.pm';
}
if (eval $ExtUtils::MakeMaker::VERSION >= 6.45_01) {
$config->{'META_MERGE'} = {
'meta-spec' => { version => 2 },
no_index => {
file => [qw( bin/elf.PL )],
},
resources => {
homepage => 'https://metacpan.org/release/Convert-Binary-C',
bugtracker => {
web => 'https://github.com/mhx/Convert-Binary-C/issues',
},
repository => {
type => 'git',
url => 'https://github.com/mhx/Convert-Binary-C.git',
web => 'https://github.com/mhx/Convert-Binary-C',
},
},
};
$config->{'META_ADD'} = {
license => ['perl_5', 'bsd'],
};
}
$config;
}
sub MY::c_o
{
package MY;
my $c_o = shift->SUPER::c_o(@_);
if (!$ENV{CBC_MAKEFILE_DEBUG} and eval $ExtUtils::MakeMaker::VERSION >= 6.17) {
$c_o =~ s/^(\s+)(\$\(CCCMD\).*)$/$1\$(NOECHO) \$(ECHO) Compiling [\$(CC) \$(OPTIMIZE)] \$<\n$1\$(NOECHO) $2\n$1\$(NOECHO) \$(MV) \$(\@F) tmp\$(\@F)\n$1\$(NOECHO) \$(MV) tmp\$(\@F) \$\@/mg;
}
else {
$c_o =~ s/^\s+\$\(CCCMD\).*$/$&\n\t\$(MV) \$(\@F) tmp\$(\@F)\n\t\$(MV) tmp\$(\@F) \$\@/mg;
}
$c_o;
}
sub MY::constants
{
package MY;
shift->SUPER::constants(@_).<<END
# Yacc to generate parser
YACC = $::BISON
# GCC coverage analysis
GCOV = gcov
# Options for valgrind
VALGRIND_OPTIONS = --tool=memcheck \\
--leak-check=yes \\
--leak-resolution=high \\
--show-reachable=yes \\
--num-callers=50
END
}
sub MY::postamble
{
package MY;
my @spec = (
{
cmd => '$(YACC) -v -p c_ -o {dst} {src}',
src => 'ctlib/parser.y',
dst => ['ctlib/y_parser.c'],
},
{
cmd => '$(YACC) -v -p pragma_ -o {dst} {src}',
src => 'ctlib/pragma.y',
dst => ['ctlib/y_pragma.c'],
},
{
cmd => '$(PERL) {src} {dst}',
src => 'token/parser.pl',
dst => ['token/t_parser.c',
'token/t_keywords.c',
'token/t_ckeytok.c',
'token/t_basic.c'],
},
{
cmd => '$(PERL) {src} {dst}',
src => 'token/pragma.pl',
dst => ['token/t_pragma.c'],
},
{
cmd => '$(PERL) {src} {dst}',
src => 'token/config.pl',
dst => ['token/t_config.c',
( run in 0.712 second using v1.01-cache-2.11-cpan-e1769b4cff6 )