diff options
author | tradke <tradke@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2005-03-08 11:18:32 +0000 |
---|---|---|
committer | tradke <tradke@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2005-03-08 11:18:32 +0000 |
commit | b79fad975cbf9369ea4cacf45a17381e99540e4f (patch) | |
tree | cb26c804f42a4a2eabec190a6857eb304a6f0934 /lib/sbin/CreateConfigurationBindings.pl | |
parent | 9ba214036ce3c06f7da6b4e0d006a82f52fae8e9 (diff) |
Undo last commit to
make/make.configuration
sbin/CreateConfigurationBindings.pl
because it broke compiling of capability-requiring thorns (eg. CactusIO/IOSDF).
git-svn-id: http://svn.cactuscode.org/flesh/trunk@3998 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'lib/sbin/CreateConfigurationBindings.pl')
-rw-r--r-- | lib/sbin/CreateConfigurationBindings.pl | 202 |
1 files changed, 70 insertions, 132 deletions
diff --git a/lib/sbin/CreateConfigurationBindings.pl b/lib/sbin/CreateConfigurationBindings.pl index dc967c5d..a8745d37 100644 --- a/lib/sbin/CreateConfigurationBindings.pl +++ b/lib/sbin/CreateConfigurationBindings.pl @@ -8,10 +8,11 @@ # @version $Header$ #@@*/ + require "$sbin_dir/CSTUtils.pl"; #/*@@ -# @routine CreateConfigurationBindings +# @routine CreateScheduleBindings # @date Thu Mar 25 14:25:13 2004 # @author Yaakoub Y El-Khamra # @desc @@ -21,8 +22,7 @@ require "$sbin_dir/CSTUtils.pl"; sub CreateConfigurationBindings { my($bindings_dir, $cfg, $thorns)=@_; - my($field, $providedcap, $providedcaplist, $thorn, $temp,$defs,$incs,$deps,$linkerflagdirs,$linkerflaglibs); - my(%linker_thorns, %linker_cfg, $linker_list, $linkerdirs, $linkerlibs); + my($field, $providedcap, $thorn, $temp); if(! $build_dir) { @@ -48,24 +48,27 @@ sub CreateConfigurationBindings mkdir('include', 0755) || die 'Unable to create include directory'; } - chdir 'Configuration'; - - if(! -d "Capabilities") + if(! -d "$build_dir") { - mkdir("Capabilities", 0755) || die "Unable to create Capabilities directory"; + mkdir("$build_dir", 0755) || die "Unable to create $build_dir"; } - if(! -d 'Thorns') + + foreach $thorn (sort keys %thorns) { - mkdir('Thorns', 0755) || die "Unable to create Thorns directory"; + if ($cfg->{"\U$thorn\E REQUIRES"} || $cfg->{"\U$thorn\E OPTIONAL"}) + { + if(! -d "$bindings_dir/Configuration/$thorn") + { + mkdir("$bindings_dir/Configuration/$thorn", 0755) || die "Unable to create Thorn $thorn Configuration directory"; + } + } } + # this string goes into the cactus executable directly + my @cap_libdirs = (); + my @cap_libs = (); - # this string goes into the cactus executable directly - $linkerflagdirs = ''; - $linkerflaglibs = ''; - - $providedcaplist = ''; - # here we put all the provided capabilities where they belong + # here we put all the PROVIDES to where they belong foreach $thorn (sort keys %thorns) { # we know that all the requirements have been satisfied @@ -73,139 +76,74 @@ sub CreateConfigurationBindings # and make references to them from the requirements and optional # since we can have multiple provides, we make each capability # separate - if ($cfg->{"\U$thorn\E PROVIDES"}) + foreach $providedcap (split (' ', $cfg->{"\U$thorn\E PROVIDES"})) { - foreach $providedcap (split (' ', $cfg->{"\U$thorn\E PROVIDES"})) - { - $providedcaplist .= "$providedcap "; - $temp = "\n"; - # put include_dirs and make.definition in one file: make.capability.defn - if ($cfg->{"\U$thorn $providedcap\E INCLUDE_DIRECTORY"}) - { - $temp .="INC_DIRS +=" . $cfg->{"\U$thorn $providedcap\E INCLUDE_DIRECTORY"} . "\n"; - } - - if ($cfg->{"\U$thorn $providedcap\E MAKE_DEFINITION"}) - { - $temp .= $cfg->{"\U$thorn $providedcap\E MAKE_DEFINITION"} . "\n"; - } - - &WriteFile("Capabilities/make.\U$providedcap\E.defn",\$temp); - - $temp = "\n"; - # put include and DEFINE in one file: capability.h - if ($cfg->{"\U$thorn $providedcap\E INCLUDE"}) - { - $temp .= $cfg->{"\U$thorn $providedcap\E INCLUDE"} . "\n"; - } - - if ($cfg->{"\U$thorn $providedcap\E DEFINE"}) - { - $temp .= "#define " . $cfg->{"\U$thorn $providedcap\E DEFINE"} . "\n"; - } - - &WriteFile("Capabilities/\U$providedcap\E.h",\$temp); - $temp = "\n"; - - # put make.capability.deps in one file: make.capabiltiy.deps - if ($cfg->{"\U$thorn $providedcap\E MAKE_DEPENDENCY"}) - { - $temp .= $cfg->{"\U$thorn $providedcap\E MAKE_DEPENDENCY"} . "\n"; - } - - &WriteFile("Capabilities/make.\U$providedcap\E.deps",\$temp); - $temp = "\n"; - - if ( $cfg->{"\U$thorn $providedcap\E LIBRARY"} ) - { - $linker_thorns{"$thorn"} = $thorn; - $linker_cfg{"\U$thorn\E USES"} = $cfg->{"\U$thorn\E USES THORNS"}; - } + my $thorn_providedcap = "\U$thorn $providedcap\E"; - if ( $cfg->{"\U$thorn $providedcap\E LIBRARY_DIRECTORY"} ) - { - $linker_thorns{"$thorn"} = $thorn; - $linker_cfg{"\U$thorn\E USES"} = $cfg->{"\U$thorn\E USES THORNS"}; - } - } - } - } - - # here we add the files to the thorns that require capabilities - foreach $thorn (sort keys %thorns) - { - # we know that all the requirements have been satisfied - # so all we need to do is make references to the capabilities - # from the requirements since we can have multiple provides, - # we make each capability separate - - $defs = ''; - $incs = ''; - $deps = ''; - - if ($cfg->{"\U$thorn\E REQUIRES"}) - { - foreach $providedcap (split (' ', $cfg->{"\U$thorn\E REQUIRES"})) + if ($cfg->{"$thorn_providedcap DEFINE"}) { - # put reference to provided capability - $defs .= "include $bindings_dir/Configuration/Capabilities/make.\U$providedcap\E.defn" . "\n"; - $incs .= "#include \"../Capabilities/\U$providedcap\E.h\"" . "\n"; - $deps .= "include $bindings_dir/Configuration/Capabilities/make.\U$providedcap\E.deps" . "\n"; + &WriteFile("include/\U$providedcap\E.h", + \$cfg->{"$thorn_providedcap DEFINE"}); } - } - - if ($cfg->{"\U$thorn\E OPTIONAL"}) - { - foreach $providedcap (split (' ', $cfg->{"\U$thorn\E OPTIONAL"})) + if ($cfg->{"$thorn_providedcap MAKE_DEFINITION"}) { - if ($providedcaplist =~ m/$providedcap/i) - { - $defs .= $providedcap . " = 1\n"; - $defs .= "include $bindings_dir/Configuration/Capabilities/make.\U$providedcap\E.defn" . "\n"; - $incs .= "#define " . $cfg->{"\U$thorn\E OPTIONAL \U$providedcap\E DEFINE"} . " 1\n"; - $incs .= "#include \"../Capabilities/\U$providedcap\E.h\"" . "\n"; - $deps .= "include $bindings_dir/Configuration/Capabilities/make.\U$providedcap\E.deps" . "\n"; - } + &WriteFile("Configuration/make.\U$providedcap\E.defn", + \$cfg->{"$thorn_providedcap MAKE_DEFINITION"}); + } + if ($cfg->{"$thorn_providedcap MAKE_DEPENDENCY"}) + { + &WriteFile("Configuration/make.\U$providedcap\E.deps", + \$cfg->{"$thorn_providedcap MAKE_DEPENDENCY"}); } - } - # write everything to file - &WriteFile("./Thorns/make.$thorn.defn",\$defs); - &WriteFile("./Thorns/$thorn.h",\$incs); - &WriteFile("./Thorns/make.$thorn.deps",\$deps); - + push (@cap_libs, $cfg->{"$thorn_providedcap LIBRARY"}); + push (@cap_libdirs, $cfg->{"$thorn_providedcap LIBRARY_DIRECTORY"}); + } } - # Sort the linker thorns - $linkerdirs = "LIBDIRS += "; - $linkerlibs = "LIBS += "; + $cap_ldflags = 'LIBDIRS += ' . join (' ', @cap_libdirs) . "\n"; + $cap_ldflags .= 'LIBS += ' . join (' ', @cap_libs); - $linker_list = &TopoSort(\%linker_thorns, \%linker_cfg); - foreach $thorn (split (' ', $linker_list)) - { - foreach $providedcap (split (' ', $cfg->{"\U$thorn\E PROVIDES"})) - { - $linkerdirs .= ' ' . $cfg->{"\U$thorn $providedcap\E LIBRARY_DIRECTORY"}; - $linkerlibs .= ' ' . $cfg->{"\U$thorn $providedcap\E LIBRARY"}; - } - } - $temp = $linkerdirs . "\n" . $linkerlibs; - &WriteFile("make.link",\$temp); + &WriteFile("Configuration/make.link",\$cap_ldflags); - # write cctki_Capabilities.h file to bindings/include - # this file adds the if_i_am_thorn stuff - $temp = "#ifdef __cplusplus\nextern \"C\"\n#endif\n"; + # here we gather all the REQUIRES and OPTIONAL capabilities for each thorn foreach $thorn (sort keys %thorns) { - if ($cfg->{"\U$thorn\E REQUIRES"} || $cfg->{"\U$thorn\E OPTIONAL"}) + my $thornDefnFile = ''; + my $thornDepsFile = ''; + my $requires_optional = $cfg->{"\U$thorn\E REQUIRES"} . ' ' . + $cfg->{"\U$thorn\E OPTIONAL"}; + foreach $requiredcap (split (' ', $requires_optional)) { - $temp .= "\n"; - $temp .= "#ifdef THORN_IS_$thorn" . "\n"; - $temp .= "#include \"../Configuration/Thorns/$thorn.h\"" . "\n"; - $temp .= '#endif' . "\n"; + foreach $provider (sort keys %thorns) + { + foreach $providedcap (split (' ', $cfg->{"\U$provider\E PROVIDES"})) + { + next if ($requiredcap ne $providedcap); + + my $cap = "\U$provider $providedcap\E"; + + if ($cfg->{"$cap MAKE_DEFINITION"}) + { + $thornDefnFile .= "-include \$(BINDINGS_DIR)/Configuration/make.\U$providedcap\E.defn\n"; + } + if ($cfg->{"$cap MAKE_DEPENDENCY"}) + { + $thornDepsFile .= "-include \$(BINDINGS_DIR)/Configuration/make.\U$providedcap\E.deps\n"; + } + if ($cfg->{"$cap INCLUDE_DIRECTORY"}) + { + $thornDefnFile .= 'INC_DIRS += ' . $cfg->{"$cap INCLUDE_DIRECTORY"} . "\n"; + } + } + } } + + &WriteFile("Configuration/$thorn/make.configuration.defn",\$thornDefnFile) + if ($thornDefnFile); + &WriteFile("Configuration/$thorn/make.configuration.deps",\$thornDepsFile) + if ($thornDepsFile); } - &WriteFile("../include/cctki_Capabilities.h",\$temp); } return 1; |