2 # grog - guess options for groff command
3 # Inspired by doctype script in Kernighan & Pike, Unix Programming
4 # Environment, pp 306-8.
6 # Source file position: <groff-source>/src/roff/grog/grog.pl
7 # Installed position: <prefix>/bin/grog
9 # Copyright (C) 1993-2014 Free Software Foundation, Inc.
10 # Written by James Clark, maintained by Werner Lemberg.
11 # Rewritten with Perl by Bernd Warken <groff-bernd.warken-72@web.de>.
12 # The macros for identifying the devices were taken from Ralph
13 # Corderoy's `grog.sh' from 2006.
15 # This file is part of `grog', which is part of `groff'.
17 # `groff' is free software; you can redistribute it and/or modify it
18 # under the terms of the GNU General Public License as published by
19 # the Free Software Foundation, either version 2 of the License, or
20 # (at your option) any later version.
22 # `groff' is distributed in the hope that it will be useful, but
23 # WITHOUT ANY WARRANTY; without even the implied warranty of
24 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25 # General Public License for more details.
27 # You should have received a copy of the GNU General Public License
28 # along with this program. If not, see
29 # <http://www.gnu.org/licenses/gpl-2.0.html>.
31 ########################################################################
38 # $Bin is the directory where this script is located
41 my $before_make; # script before run of `make'
44 $before_make = 1 if '@VERSION@' eq "${at}VERSION${at}";
51 if ($before_make) { # before installation
52 my $grog_source_dir = $FindBin::Bin;
53 $at_at{'BINDIR'} = $grog_source_dir;
54 # $grog_dir = $grog_source_dir;
56 my $top = $grog_source_dir . '/../../../';
57 open FILE, '<', $top . 'VERSION' ||
58 die 'Could not open top file VERSION.';
62 open FILE, '<', $top . 'REVISION' ||
63 die 'Could not open top file REVISION.';
64 my $revision = <FILE>;
66 $at_at{'GROFF_VERSION'} = $version . '.' . $revision;
67 } else { # after installation}
68 $at_at{'GROFF_VERSION'} = '@VERSION@';
69 $at_at{'BINDIR'} = '@BINDIR@';
70 $grog_dir = '@grog_dir@';
73 die "$grog_dir is not an existing directory;" unless -d $grog_dir;
79 unshift(@INC, $grog_dir);
87 &handle_file_ext(); # see $tmac_ext for gotten value
88 &handle_whole_files();
90 &make_groff_preproc();
91 &make_groff_tmac_man_ms() || &make_groff_tmac_others();
92 &make_groff_line_rest();
96 ########################################################################