endif()
if(GMX_BUILD_MANPAGES)
- # create gromacs.7
- FILE(READ "${CMAKE_SOURCE_DIR}/admin/programs.txt" contents)
-
- # Convert file contents into a CMake list. First escape ;
- STRING(REGEX REPLACE ";" "\\\\;" contents "${contents}")
- STRING(REGEX REPLACE "\n" ";" contents "${contents}")
-
- set(PROGMANPAGES "")
- foreach(line ${contents})
- if (${line} MATCHES "^HEAD\\|")
- string(REGEX REPLACE "^HEAD\\|" "" DESC ${line})
- set(PROGMANPAGES "${PROGMANPAGES}.Sh \"${DESC}\"\n.IX Subsection \"${DESC}\"\n.Vb\n.ta 16n\n")
- elseif(${line} MATCHES "^END$")
- set(PROGMANPAGES "${PROGMANPAGES}.Ve\n")
- elseif(${line} MATCHES "\\|")
- string(REGEX REPLACE "\\|" "\t" line ${line})
- set(PROGMANPAGES "${PROGMANPAGES}\\& ${line}\n")
- else()
- message(WARNING "Incorrectly formated line \"${line}\" in programs.txt")
- endif()
- endforeach()
- configure_file(man7/gromacs.7.cmakein man7/gromacs.7)
- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/man7/gromacs.7
- DESTINATION ${MAN_INSTALL_DIR}/man7
- COMPONENT man)
-
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/man1)
+ file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/man7)
+ file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/man7/gromacs.7.in
+ DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/man7)
# TODO: It could be nicer to not do this as part of the ALL target,
# but instead on demand as part of make install.
add_custom_target(man ALL
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/man1
DESTINATION ${MAN_INSTALL_DIR}
COMPONENT man)
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/man7/gromacs.7
+ DESTINATION ${MAN_INSTALL_DIR}/man7
+ COMPONENT man)
set_directory_properties(PROPERTIES
ADDITIONAL_MAKE_CLEAN_FILES man1)
.\" ========================================================================
.\"
.IX Title "GROMACS 7"
-.TH GROMACS 7 "" "${PROJECT_VERSION}" "GROMACS Manual"
+.TH GROMACS 7 "" "@VERSION@" "GROMACS Manual"
.SH "NAME"
gromacs \- molecular dynamics simulation suite
.SH "DESCRIPTION"
.PP
The following commands make up the GROMACS suite. Please refer to their
individual man pages for further details.
-${PROGMANPAGES}
+@PROGMANPAGES@
.PP
.SH "ADDITIONAL DOCUMENTATION"
.IX Header "ADDITIONAL DOCUMENTATION"
introduction to molecular dynamics in general and GROMACS in particular,
as well as an overview of the individual programs.
.PP
-The shorter HTML reference and GROMACS FAQ are available in \fB/usr/share/doc/gromacs/html/\fR .
-.PP
-Tutorial files and other miscellaneous references are stored in \fB/usr/share/gromacs/\fR .
+The shorter HTML reference is available in \fB/usr/share/doc/gromacs/html/\fR .
.SH "REFERENCES"
.IX Header "REFERENCES"
The development of GROMACS is mainly funded by academic research grants.
const std::string &displayName);
virtual void finishModuleExport() {}
- virtual void startModuleGroupExport() {}
- virtual void exportModuleGroup(const char * /*title*/,
- const ModuleGroupContents & /*modules*/) {}
- virtual void finishModuleGroupExport() {}
+ virtual void startModuleGroupExport();
+ virtual void exportModuleGroup(const char *title,
+ const ModuleGroupContents &modules);
+ virtual void finishModuleGroupExport();
private:
- HelpLinks links_;
+ HelpLinks links_;
+ boost::scoped_ptr<File> man7File_;
+ std::string man7Footer_;
};
void HelpExportMan::exportModuleHelp(
file.writeLine("More information about \\fBGROMACS\\fR is available at <\\fIhttp://www.gromacs.org/\\fR>.");
}
+void HelpExportMan::startModuleGroupExport()
+{
+ const char *const programListPlaceholder = "@PROGMANPAGES@";
+
+ const std::string man7Template = gmx::File::readToString("man7/gromacs.7.in");
+ const size_t index = man7Template.find(programListPlaceholder);
+ GMX_RELEASE_ASSERT(index != std::string::npos,
+ "gromacs.7.in must contain a @PROGMANPAGES@ line");
+ std::string header = man7Template.substr(0, index);
+ man7Footer_ = man7Template.substr(index + std::strlen(programListPlaceholder));
+ header = replaceAll(header, "@VERSION@", GromacsVersion());
+ man7File_.reset(new File("man7/gromacs.7", "w"));
+ man7File_->writeLine(header);
+}
+
+void HelpExportMan::exportModuleGroup(const char *title,
+ const ModuleGroupContents &modules)
+{
+ man7File_->writeLine(formatString(".Sh \"%s\"", title));
+ man7File_->writeLine(formatString(".IX Subsection \"%s\"", title));
+ man7File_->writeLine(".Vb");
+ man7File_->writeLine(".ta 16n");
+
+ ModuleGroupContents::const_iterator module;
+ for (module = modules.begin(); module != modules.end(); ++module)
+ {
+ const std::string &tag(module->first);
+ man7File_->writeLine(formatString("\\& %s\t%s",
+ tag.c_str(), module->second));
+ }
+
+ man7File_->writeLine(".Ve");
+}
+
+void HelpExportMan::finishModuleGroupExport()
+{
+ man7File_->writeLine(man7Footer_);
+ man7File_->close();
+}
+
/********************************************************************
* HelpExportHtml
*/
void writeHtmlHeader(File *file, const std::string &title) const;
void writeHtmlFooter(File *file) const;
- boost::scoped_ptr<File> indexFile_;
HelpLinks links_;
+ boost::scoped_ptr<File> indexFile_;
std::string header_;
std::string footer_;
};