Added documentation about proper use of pdb2gmx -ter.
[gromacs/rigid-bodies.git] / admin / mknroff.pl
blobdd885db335eb731d952d579283d3dfb41428aa76
1 #!/usr/bin/perl -w
3 # This script will generate all manual pages
4 # in the current directory. It is recommeded that
5 # you run it from the man/man1 subdirectory under
6 # your GROMACS source tree. The manual pages will
7 # be installed by the "make install" command.
9 $bindir = shift || die("Error: provide the binary directory as first argument.");
10 $ptxt = shift || die("give me the location of the programs.txt file");
12 printf "Generating unix manual for GROMACS programs\n";
13 printf "Man pages will be written in the current dir.\n";
14 printf "-------------------------------------------\n";
16 $mam = "Makefile.am";
17 open(MAM,">$mam") || die("Opening $mam for writing");
18 printf(MAM "# This file has been generated by mknroff.pl. Don't edit it.\n");
19 printf(MAM "man_MANS = ");
21 $dir = `pwd`;
22 chomp $dir;
24 @exclude = ( "my_dssp", "copyrgt", "addquote", "GMXRC", "completion.csh",
25 "completion.zsh", "average", "completion.bash", "luck",
26 "xplor2gmx.pl", "mptest", "ffscan", "demux.pl", "gentop", "mkyaw",
27 "tune_dip", "tune_pol", "hrefify", "options", "genvsites",
28 "pdtest", "bastat", "ehole", "GMXRC.bash", "GMXRC.csh",
29 "GMXRC.zsh" );
31 %desc = ();
32 open(PPP,"$ptxt") || die("Can't open $ptxt");
33 $npp = 0;
34 while($line = <PPP>) {
35 if ((index($line,"\|") > 0) && (index($line,"HEAD") < 0)) {
36 $line =~ s/ -/ \\-/g;
37 @tmp = split('\|',$line);
38 if ($#tmp == 1) {
39 if (!defined $desc{$tmp[0]}) {
40 $desc{$tmp[0]} = $tmp[1];
41 $npp++;
43 else {
44 printf("Multiple entries for $tmp[0] in $ptxt\n");
49 printf("npp = $npp\n");
50 close PPP;
52 chdir $bindir;
53 @PROGRAMS = glob("[a-z]*");
54 chdir $dir;
56 $prev = "";
57 foreach $program ( @PROGRAMS ) {
58 $cont = 1;
59 foreach $exc ( @exclude ) {
60 if ( $exc eq $program ) {
61 $cont = 0;
64 # Kick out the double precision variants
65 if ($program ne "${prev}_d" ) {
66 if ($cont && ( -x "$bindir/$program" )) {
67 printf " $program";
68 system("$bindir/$program -quiet -man nroff >& /dev/null");
69 $pn = "${program}.nroff";
70 $p1 = "${program}.1";
71 if ( -f $pn) {
72 open(PN,"$pn") || die("Opening $pn");
73 open(P1,">$p1") || die("Opening $p1 for writing");
74 while($line = <PN>) {
75 chomp $line;
76 if ($line eq $program) {
77 if (defined $desc{$program}) {
78 printf("\n");
79 printf(P1 "$program - $desc{$program}\n");
81 else {
82 printf (" - please add description in $ptxt\n");
83 printf (P1 "$program\n");
86 else {
87 printf(P1 "%s\n",$line);
90 close PN;
91 close P1;
92 unlink $pn;
93 printf(MAM " \\\n\t$p1");
97 $prev = $program;
99 printf(MAM "\n\nEXTRA_DIST = \${man_MANS}\n\n");
100 close MAM;
101 printf("\n");