mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
r8690: Code cleanups, improvements necessary for dependencies (not added yet)
(This used to be commit 7384b3c4a1
)
This commit is contained in:
parent
2a65d17e06
commit
c84512f0e1
@ -2535,8 +2535,7 @@ sub _Lexer($)
|
||||
{
|
||||
my($parser)=shift;
|
||||
|
||||
$parser->YYData->{INPUT}
|
||||
or return('',undef);
|
||||
$parser->YYData->{INPUT} or return('',undef);
|
||||
|
||||
again:
|
||||
$parser->YYData->{INPUT} =~ s/^[ \t]*//;
|
||||
@ -2587,8 +2586,7 @@ again:
|
||||
|
||||
sub parse_idl($$)
|
||||
{
|
||||
my $self = shift;
|
||||
my $filename = shift;
|
||||
my ($self,$filename) = @_;
|
||||
|
||||
my $saved_delim = $/;
|
||||
undef $/;
|
||||
|
@ -362,8 +362,7 @@ sub _Lexer($)
|
||||
{
|
||||
my($parser)=shift;
|
||||
|
||||
$parser->YYData->{INPUT}
|
||||
or return('',undef);
|
||||
$parser->YYData->{INPUT} or return('',undef);
|
||||
|
||||
again:
|
||||
$parser->YYData->{INPUT} =~ s/^[ \t]*//;
|
||||
@ -414,8 +413,7 @@ again:
|
||||
|
||||
sub parse_idl($$)
|
||||
{
|
||||
my $self = shift;
|
||||
my $filename = shift;
|
||||
my ($self,$filename) = @_;
|
||||
|
||||
my $saved_delim = $/;
|
||||
undef $/;
|
||||
|
@ -154,8 +154,7 @@ sub _parse_config_mk($)
|
||||
|
||||
sub import_file($$)
|
||||
{
|
||||
my $input = shift;
|
||||
my $filename = shift;
|
||||
my ($input, $filename) = @_;
|
||||
|
||||
my $result = _parse_config_mk($filename);
|
||||
|
||||
|
@ -15,40 +15,26 @@ my $srcdir = ".";
|
||||
|
||||
sub strtrim($)
|
||||
{
|
||||
my $str = shift;
|
||||
my @ar = ();
|
||||
|
||||
$str =~ s/^[\t\n ]*//g;
|
||||
|
||||
$str =~ s/[\t\n ]*$//g;
|
||||
|
||||
return $str;
|
||||
$_ = shift;
|
||||
s/^[\t\n ]*//g;
|
||||
s/[\t\n ]*$//g;
|
||||
return $_;
|
||||
}
|
||||
|
||||
sub str2array($)
|
||||
{
|
||||
my $str = shift;
|
||||
my @ar = ();
|
||||
$_ = shift;
|
||||
s/^[\t\n ]*//g;
|
||||
s/[\t\n ]*$//g;
|
||||
s/([\t\n ]+)/ /g;
|
||||
|
||||
$str =~ s/^[\t\n ]*//g;
|
||||
|
||||
$str =~ s/[\t\n ]*$//g;
|
||||
|
||||
$str =~ s/([\t\n ]+)/ /g;
|
||||
|
||||
if (length($str)==0) {
|
||||
return ();
|
||||
}
|
||||
|
||||
@ar = split(/[ \t\n]/,$str);
|
||||
|
||||
return @ar;
|
||||
return () if (length($_)==0);
|
||||
return split /[ \t\n]/;
|
||||
}
|
||||
|
||||
sub check_subsystem($$)
|
||||
{
|
||||
my $INPUT = shift;
|
||||
my $subsys = shift;
|
||||
my ($INPUT, $subsys) = @_;
|
||||
if ($subsys->{ENABLE} ne "YES") {
|
||||
printf("Subsystem: %s disabled!\n",$subsys->{NAME});
|
||||
return;
|
||||
@ -61,8 +47,7 @@ sub check_subsystem($$)
|
||||
|
||||
sub check_module($$)
|
||||
{
|
||||
my $INPUT = shift;
|
||||
my $mod = shift;
|
||||
my ($INPUT, $mod) = @_;
|
||||
|
||||
die("Module $mod->{NAME} does not have a SUBSYSTEM set") if not defined($mod->{SUBSYSTEM});
|
||||
|
||||
@ -105,8 +90,7 @@ sub check_module($$)
|
||||
|
||||
sub check_library($$)
|
||||
{
|
||||
my $INPUT = shift;
|
||||
my $lib = shift;
|
||||
my ($INPUT, $lib) = @_;
|
||||
|
||||
if ($lib->{ENABLE} ne "YES") {
|
||||
printf("Library: %s...disabled\n",$lib->{NAME});
|
||||
@ -118,8 +102,7 @@ sub check_library($$)
|
||||
|
||||
sub check_target($$)
|
||||
{
|
||||
my $INPUT = shift;
|
||||
my $bin = shift;
|
||||
my ($INPUT, $bin) = @_;
|
||||
|
||||
if (!defined($bin->{CMD})) {
|
||||
print "CMD not defined for target!\n";
|
||||
@ -130,8 +113,7 @@ sub check_target($$)
|
||||
|
||||
sub check_binary($$)
|
||||
{
|
||||
my $INPUT = shift;
|
||||
my $bin = shift;
|
||||
my ($INPUT, $bin) = @_;
|
||||
|
||||
if ($bin->{ENABLE} ne "YES") {
|
||||
printf("Binary: %s...disabled\n",$bin->{NAME});
|
||||
@ -143,10 +125,10 @@ sub check_binary($$)
|
||||
$bin->{OUTPUT_TYPE} = "BINARY";
|
||||
}
|
||||
|
||||
sub calc_unique_deps
|
||||
sub calc_unique_deps($$)
|
||||
{
|
||||
my $deps = shift;
|
||||
my $udeps = shift;
|
||||
sub calc_unique_deps($$);
|
||||
my ($deps, $udeps) = @_;
|
||||
|
||||
foreach my $dep (@{$deps}) {
|
||||
if (not defined($udeps->{$$dep->{NAME}})) {
|
||||
@ -157,8 +139,6 @@ sub calc_unique_deps
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
###########################################################
|
||||
# This function checks the input from the configure script
|
||||
#
|
||||
|
@ -18,15 +18,17 @@ my $config_list = "config.list";
|
||||
|
||||
sub smb_build_main($$)
|
||||
{
|
||||
my $INPUT = shift;
|
||||
my $settings = shift;
|
||||
my ($INPUT, $settings) = @_;
|
||||
|
||||
my @mkfiles = split('\n', `grep -v ^# $config_list`);
|
||||
open(IN, $config_list) or die("Can't open $config_list: $!");
|
||||
my @mkfiles = grep{!/^#/} <IN>;
|
||||
close(IN);
|
||||
|
||||
$| = 1;
|
||||
|
||||
for my $mkfile (@mkfiles) {
|
||||
config_mk::import_file($INPUT, $mkfile);
|
||||
foreach (@mkfiles) {
|
||||
s/\n//g;
|
||||
config_mk::import_file($INPUT, $_);
|
||||
}
|
||||
|
||||
my $DEPEND = input::check($INPUT);
|
||||
|
@ -252,16 +252,12 @@ __EOD__
|
||||
sub array2oneperline($)
|
||||
{
|
||||
my $array = shift;
|
||||
my $i;
|
||||
my $output = "";
|
||||
|
||||
foreach my $str (@{$array}) {
|
||||
if (!defined($str)) {
|
||||
next;
|
||||
}
|
||||
foreach (@$array) {
|
||||
next unless defined($_);
|
||||
|
||||
$output .= " \\\n\t\t";
|
||||
$output .= $str;
|
||||
$output .= " \\\n\t\t$_";
|
||||
}
|
||||
|
||||
return $output;
|
||||
@ -273,13 +269,10 @@ sub array2oneline($)
|
||||
my $i;
|
||||
my $output = "";
|
||||
|
||||
foreach my $str (@{$array}) {
|
||||
if (!defined($str)) {
|
||||
next;
|
||||
}
|
||||
foreach (@{$array}) {
|
||||
next unless defined($_);
|
||||
|
||||
$output .= $str;
|
||||
$output .= " ";
|
||||
$output .= "$_ ";
|
||||
}
|
||||
|
||||
return $output;
|
||||
@ -298,8 +291,7 @@ sub array2oneline($)
|
||||
# $output - the resulting output buffer
|
||||
sub _prepare_obj_list($$)
|
||||
{
|
||||
my $var = shift;
|
||||
my $ctx = shift;
|
||||
my ($var,$ctx) = @_;
|
||||
|
||||
my $tmplist = array2oneperline($ctx->{OBJ_LIST});
|
||||
|
||||
@ -312,8 +304,7 @@ __EOD__
|
||||
|
||||
sub _prepare_cflags($$)
|
||||
{
|
||||
my $var = shift;
|
||||
my $ctx = shift;
|
||||
my ($var,$ctx) = @_;
|
||||
|
||||
my $tmplist = array2oneperline($ctx->{CFLAGS});
|
||||
|
||||
@ -354,7 +345,6 @@ sub _prepare_shared_library_rule($)
|
||||
my $output;
|
||||
|
||||
$tmpdepend = array2oneperline($ctx->{DEPEND_LIST});
|
||||
|
||||
$tmpshlink = array2oneperline($ctx->{LINK_LIST});
|
||||
$tmpshflag = array2oneperline($ctx->{LINK_FLAGS});
|
||||
|
||||
@ -401,14 +391,10 @@ sub _prepare_objlist_rule($)
|
||||
my $tmpdepend = array2oneperline($ctx->{DEPEND_LIST});
|
||||
my $output;
|
||||
|
||||
if (! $ctx->{TARGET}) {
|
||||
return "";
|
||||
}
|
||||
return "" unless $ctx->{TARGET};
|
||||
|
||||
$output = "$ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST = $tmpdepend\n";
|
||||
|
||||
$output .= "$ctx->{TARGET}: ";
|
||||
|
||||
$output .= "\$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_OBJS)\n";
|
||||
$output .= "\t\@touch $ctx->{TARGET}\n";
|
||||
|
||||
@ -444,7 +430,6 @@ sub _prepare_static_library_rule($)
|
||||
my $output;
|
||||
|
||||
$tmpdepend = array2oneperline($ctx->{DEPEND_LIST});
|
||||
|
||||
$tmpstlink = array2oneperline($ctx->{LINK_LIST});
|
||||
$tmpstflag = array2oneperline($ctx->{LINK_FLAGS});
|
||||
|
||||
@ -524,8 +509,9 @@ bin/.TARGET_$ctx->{NAME}:
|
||||
";
|
||||
}
|
||||
|
||||
sub _prepare_proto_rules()
|
||||
sub _prepare_proto_rules($)
|
||||
{
|
||||
my $settings = shift;
|
||||
my $output = "";
|
||||
|
||||
$output .= << '__EOD__';
|
||||
@ -775,13 +761,14 @@ __EOD__
|
||||
return $output;
|
||||
}
|
||||
|
||||
sub _prepare_rule_lists($)
|
||||
sub _prepare_rule_lists($$)
|
||||
{
|
||||
my $depend = shift;
|
||||
my $settings = shift;
|
||||
my $output = "";
|
||||
|
||||
foreach my $key (values %{$depend}) {
|
||||
next if not defined $key->{OUTPUT_TYPE};
|
||||
next unless defined $key->{OUTPUT_TYPE};
|
||||
|
||||
($output .= _prepare_objlist_rule($key)) if $key->{OUTPUT_TYPE} eq "OBJLIST";
|
||||
($output .= _prepare_static_library_rule($key)) if $key->{OUTPUT_TYPE} eq "STATIC_LIBRARY";
|
||||
@ -792,9 +779,7 @@ sub _prepare_rule_lists($)
|
||||
|
||||
my $idl_ctx;
|
||||
$output .= _prepare_IDL($idl_ctx);
|
||||
|
||||
$output .= _prepare_proto_rules();
|
||||
|
||||
$output .= _prepare_proto_rules($settings);
|
||||
$output .= _prepare_install_rules($depend);
|
||||
|
||||
return $output;
|
||||
@ -810,8 +795,7 @@ sub _prepare_rule_lists($)
|
||||
# $output - the resulting output buffer
|
||||
sub _prepare_makefile_in($$)
|
||||
{
|
||||
my $CTX = shift;
|
||||
my $settings = shift;
|
||||
my ($CTX, $settings) = @_;
|
||||
my $output;
|
||||
|
||||
$output = "########################################\n";
|
||||
@ -835,7 +819,6 @@ sub _prepare_makefile_in($$)
|
||||
$output .= _prepare_SUFFIXES($suffix_ctx);
|
||||
|
||||
$output .= _prepare_dummy_MAKEDIR();
|
||||
|
||||
$output .= _prepare_std_CC_rule("c","o",'@PICFLAG@',"Compiling","Rule for std objectfiles");
|
||||
$output .= _prepare_std_CC_rule("h","h.gch",'@PICFLAG@',"Precompiling","Rule for precompiled headerfiles");
|
||||
|
||||
@ -843,12 +826,9 @@ sub _prepare_makefile_in($$)
|
||||
$output .= _prepare_man_rule("3");
|
||||
$output .= _prepare_man_rule("5");
|
||||
$output .= _prepare_man_rule("7");
|
||||
|
||||
$output .= _prepare_manpages($CTX);
|
||||
|
||||
$output .= _prepare_target_settings($CTX);
|
||||
|
||||
$output .= _prepare_rule_lists($CTX);
|
||||
$output .= _prepare_rule_lists($CTX, $settings);
|
||||
|
||||
my @all = ();
|
||||
|
||||
@ -872,9 +852,7 @@ sub _prepare_makefile_in($$)
|
||||
# $output - the resulting output buffer
|
||||
sub create_makefile_in($$$)
|
||||
{
|
||||
my $CTX = shift;
|
||||
my $settings = shift;
|
||||
my $file = shift;
|
||||
my ($CTX, $settings,$file) = @_;
|
||||
|
||||
open(MAKEFILE_IN,">$file") || die ("Can't open $file\n");
|
||||
print MAKEFILE_IN _prepare_makefile_in($CTX, $settings);
|
||||
|
@ -99,16 +99,13 @@ sub _prepare_smb_build_h($)
|
||||
# $output - the resulting output buffer
|
||||
sub create_smb_build_h($$)
|
||||
{
|
||||
my $CTX = shift;
|
||||
my $file = shift;
|
||||
my ($CTX, $file) = @_;
|
||||
my $output = "/* autogenerated by config.smb_build.pl */\n";
|
||||
|
||||
$output .= _prepare_smb_build_h($CTX);
|
||||
|
||||
open(SMB_BUILD_H,"> $file") || die ("Can't open $file\n");
|
||||
|
||||
print SMB_BUILD_H $output;
|
||||
|
||||
close(SMB_BUILD_H);
|
||||
|
||||
print "config.smb_build.pl: creating $file\n";
|
||||
|
@ -148,7 +148,7 @@ extern int errno;
|
||||
|
||||
/***** automatically generated prototypes *****/
|
||||
#define _PRINTF_ATTRIBUTE(a1, a2) PRINTF_ATTRIBUTE(a1, a2)
|
||||
#include "proto.h"
|
||||
#include "include/proto.h"
|
||||
#undef _PRINTF_ATTRIBUTE
|
||||
#define _PRINTF_ATTRIBUTE(a1, a2)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user