From 899ffd9ba00e823c15fcbf5de602bac4898c2f9a Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 9 Sep 2005 11:03:53 +0000 Subject: r10112: - check attributes depending on the section type metze (This used to be commit d6af241d7b1459d81479205356c7422c4dcca0fb) --- source4/build/smb_build/config_mk.pm | 98 +++++++++++++++++++++++++++--------- 1 file changed, 74 insertions(+), 24 deletions(-) (limited to 'source4/build/smb_build/config_mk.pm') diff --git a/source4/build/smb_build/config_mk.pm b/source4/build/smb_build/config_mk.pm index 46b8bf76de..e5c8c293aa 100644 --- a/source4/build/smb_build/config_mk.pm +++ b/source4/build/smb_build/config_mk.pm @@ -11,27 +11,72 @@ use smb_build::input; use strict; -my %attribute_types = ( - "NOPROTO" => "bool", - "REQUIRED_SUBSYSTEMS" => "list", - "OUTPUT_TYPE" => "string", - "INIT_OBJ_FILES" => "list", - "ADD_OBJ_FILES" => "list", - "OBJ_FILES" => "list", - "SUBSYSTEM" => "string", - "CFLAGS" => "list", - "CPPFLAGS" => "list", - "LDFLAGS" => "list", - "INSTALLDIR" => "string", - "LIBS" => "list", - "INIT_FUNCTION" => "string", - "MAJOR_VERSION" => "string", - "MINOR_VERSION" => "string", - "RELEASE_VERSION" => "string", - "ENABLE" => "bool", - "CMD" => "string", - "MANPAGE" => "string" -); +my $section_types = { + "EXT_LIB" => { + "LIBS" => "list", + "CFLAGS" => "list", + "CPPFLAGS" => "list", + "LDFLAGS" => "list", + }, + "SUBSYSTEM" => { + "INIT_FUNCTION" => "string", + "INIT_OBJ_FILES" => "list", + "ADD_OBJ_FILES" => "list", + "OBJ_FILES" => "list", + + "REQUIRED_SUBSYSTEMS" => "list", + "TARGET_DEPS" => "list", + + "ENABLE" => "bool", + "NOPROTO" => "bool", + + "MANPAGE" => "string", + }, + "MODULE" => { + "SUBSYSTEM" => "string", + + "INIT_FUNCTION" => "string", + "INIT_OBJ_FILES" => "list", + "ADD_OBJ_FILES" => "list", + "OBJ_FILES" => "list", + + "REQUIRED_SUBSYSTEMS" => "list", + "TARGET_DEPS" => "list", + + "ENABLE" => "bool", + "NOPROTO" => "bool", + + "MANPAGE" => "string", + }, + "BINARY" => { + "OBJ_FILES" => "list", + + "REQUIRED_SUBSYSTEMS" => "list", + "TARGET_DEPS" => "list", + + "ENABLE" => "bool", + "NOPROTO" => "bool", + + "MANPAGE" => "string", + "INSTALLDIR" => "string", + }, + "LIBRARY" => { + "MAJOR_VERSION" => "string", + "MINOR_VERSION" => "string", + "RELEASE_VERSION" => "string", + + "OBJ_FILES" => "list", + + "REQUIRED_SUBSYSTEMS" => "list", + "TARGET_DEPS" => "list", + + "ENABLE" => "bool", + "NOPROTO" => "bool", + + "MANPAGE" => "string", + "INSTALLDIR" => "string", + } +}; use vars qw(@parsed_files); @@ -118,15 +163,20 @@ sub run_config_mk($$) foreach my $section (keys %{$result}) { my ($type, $name) = split(/::/, $section, 2); - + + my $sectype = $section_types->{$type}; + if (not defined($sectype)) { + die($filename.":[".$section."] unknown section type \"".$type."\"!"); + } + $input->{$name}{NAME} = $name; $input->{$name}{TYPE} = $type; foreach my $key (values %{$result->{$section}}) { $key->{VAL} = smb_build::input::strtrim($key->{VAL}); - my $vartype = $attribute_types{$key->{KEY}}; + my $vartype = $sectype->{$key->{KEY}}; if (not defined($vartype)) { - die("$filename:Unknown attribute $key->{KEY} with value $key->{VAL} in section $section"); + die($filename.":[".$section."]: unknown attribute type \"$key->{KEY}\"!"); } if ($vartype eq "string") { $input->{$name}{$key->{KEY}} = $key->{VAL}; -- cgit