diff options
author | schnetter <schnetter@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2005-11-21 04:40:32 +0000 |
---|---|---|
committer | schnetter <schnetter@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2005-11-21 04:40:32 +0000 |
commit | 35319b632668f2f9604fe175af937a7d3ba3e3fb (patch) | |
tree | 18bb5c4561e3ffd132a4fad4d44028ef412a63da /lib/sbin/CreateConfigurationBindings.pl | |
parent | 8067154285e2db16b977dfc3a5296a85f7ca2e0b (diff) |
Correct handling of newline characters and spaces when writing the
configuration bindings.
When reading the configuration settings from the output of the
configuration scripts (that provide capabilities), new lines were lost
in certain circumstances. This lead to makefile fragments like
PETSC_DIR = /usr/local/apps/petscPETSC_ARCH = linux
which are obviously incorrect (since these should be two lines, not
one), although this does not lead to errors or warnings.
This patch makes sure that all configuration settings have newline
characters appended or blanks prepended as they are concatenated into
the internal database (ConfigScriptParser.pl). When the database is
read out, the strings can just be printed to the file
(CreateConfigurationBindings.pl).
While doing this, this patch also removes some superfluous blanks and
newline characters from the output of the configuration settings.
This patch also removes a perl idiosyncracy when appending newline
characters to a string. It changes code like "#endif" . "\n" to
"#endif\n".
Tested on Mac OS and Red Hat Linux.
git-svn-id: http://svn.cactuscode.org/flesh/trunk@4199 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'lib/sbin/CreateConfigurationBindings.pl')
-rw-r--r-- | lib/sbin/CreateConfigurationBindings.pl | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/lib/sbin/CreateConfigurationBindings.pl b/lib/sbin/CreateConfigurationBindings.pl index dc967c5d..fb46629c 100644 --- a/lib/sbin/CreateConfigurationBindings.pl +++ b/lib/sbin/CreateConfigurationBindings.pl @@ -78,7 +78,7 @@ sub CreateConfigurationBindings foreach $providedcap (split (' ', $cfg->{"\U$thorn\E PROVIDES"})) { $providedcaplist .= "$providedcap "; - $temp = "\n"; + $temp = ''; # put include_dirs and make.definition in one file: make.capability.defn if ($cfg->{"\U$thorn $providedcap\E INCLUDE_DIRECTORY"}) { @@ -87,34 +87,33 @@ sub CreateConfigurationBindings if ($cfg->{"\U$thorn $providedcap\E MAKE_DEFINITION"}) { - $temp .= $cfg->{"\U$thorn $providedcap\E MAKE_DEFINITION"} . "\n"; + $temp .= $cfg->{"\U$thorn $providedcap\E MAKE_DEFINITION"}; } &WriteFile("Capabilities/make.\U$providedcap\E.defn",\$temp); - $temp = "\n"; + $temp = ''; # put include and DEFINE in one file: capability.h if ($cfg->{"\U$thorn $providedcap\E INCLUDE"}) { - $temp .= $cfg->{"\U$thorn $providedcap\E INCLUDE"} . "\n"; + $temp .= $cfg->{"\U$thorn $providedcap\E INCLUDE"}; } if ($cfg->{"\U$thorn $providedcap\E DEFINE"}) { - $temp .= "#define " . $cfg->{"\U$thorn $providedcap\E DEFINE"} . "\n"; + $temp .= "#define " . $cfg->{"\U$thorn $providedcap\E DEFINE"}; } &WriteFile("Capabilities/\U$providedcap\E.h",\$temp); - $temp = "\n"; + $temp = ''; # 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"; + $temp .= $cfg->{"\U$thorn $providedcap\E MAKE_DEPENDENCY"}; } &WriteFile("Capabilities/make.\U$providedcap\E.deps",\$temp); - $temp = "\n"; if ( $cfg->{"\U$thorn $providedcap\E LIBRARY"} ) { @@ -148,9 +147,9 @@ sub CreateConfigurationBindings foreach $providedcap (split (' ', $cfg->{"\U$thorn\E REQUIRES"})) { # 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"; + $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"; } } @@ -161,10 +160,10 @@ sub CreateConfigurationBindings 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"; + $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"; } } } @@ -177,8 +176,8 @@ sub CreateConfigurationBindings } # Sort the linker thorns - $linkerdirs = "LIBDIRS += "; - $linkerlibs = "LIBS += "; + $linkerdirs = 'LIBDIRS +='; + $linkerlibs = 'LIBS +='; $linker_list = &TopoSort(\%linker_thorns, \%linker_cfg); foreach $thorn (split (' ', $linker_list)) @@ -189,20 +188,20 @@ sub CreateConfigurationBindings $linkerlibs .= ' ' . $cfg->{"\U$thorn $providedcap\E LIBRARY"}; } } - $temp = $linkerdirs . "\n" . $linkerlibs; + $temp = $linkerdirs . "\n" . $linkerlibs . "\n"; &WriteFile("make.link",\$temp); # 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"; + $temp = ''; foreach $thorn (sort keys %thorns) { if ($cfg->{"\U$thorn\E REQUIRES"} || $cfg->{"\U$thorn\E OPTIONAL"}) { + $temp .= "#ifdef THORN_IS_$thorn\n"; + $temp .= "#include \"../Configuration/Thorns/$thorn.h\"\n"; + $temp .= "#endif\n"; $temp .= "\n"; - $temp .= "#ifdef THORN_IS_$thorn" . "\n"; - $temp .= "#include \"../Configuration/Thorns/$thorn.h\"" . "\n"; - $temp .= '#endif' . "\n"; } } &WriteFile("../include/cctki_Capabilities.h",\$temp); |