5c7a450b186f81548fd4cf5ba2c257d6f852dd9c
[platform/upstream/groff.git] / src / roff / grog / Makefile.sub
1 # Makefile.sub for `grog'
2
3 # File position: <groff-source>/src/roff/grog/Makefile.sub
4
5 # Copyright (C) 1993-2014  Free Software Foundation, Inc.
6
7 # This file is part of `grog' which is part of `groff'.
8
9 # `groff' is free software; you can redistribute it and/or modify it
10 # under the terms of the GNU General Public License as published by
11 # the Free Software Foundation, either version 3 of the License, or
12 # (at your option) any later version.
13
14 # `groff' is distributed in the hope that it will be useful, but
15 # WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 # General Public License for more details.
18
19 # You should have received a copy of the GNU General Public License
20 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21
22 ########################################################################
23
24 MAN1=grog.n
25 MOSTLYCLEANADD=grog $(MAN1)
26
27 # not all make programs have $(RM) predefined.
28 RM=rm -f
29
30 all: grog $(MAN1)
31
32 # lib .pl-files
33 GROG=$(srcdir)/subs.pl
34 GROG_=`echo $(GROG) | sed 's|$(srcdir)/||g'`
35
36
37 # Perl version works for all parts of `groff'.
38
39 grog: grog.pl $(GROG) $(SH_DEPS_SED_SCRIPT)
40         $(RM) $@
41         sed -f "$(SH_DEPS_SED_SCRIPT)" \
42             -e "1s|^\(#! \).*perl|\\1$(PERL)|" \
43             -e "s|@g@|$(g)|g" \
44             -e "s|@BINDIR@|$(DESTDIR)$(bindir)|g" \
45             -e "s|@grog_dir@|$(DESTDIR)$(grog_dir)|g" \
46             -e "s|@EGREP@|$(EGREP)|g" \
47             -e "s|@VERSION@|$(version)$(revision)|" \
48             -e "$(SH_SCRIPT_SED_CMD)" \
49             $(srcdir)/grog.pl >$@
50         chmod +x $@
51
52 .PHONY: install_data
53 install_data: grog
54         -test -d $(DESTDIR)$(bindir) || $(mkinstalldirs) $(DESTDIR)$(bindir)
55         $(RM) $(DESTDIR)$(bindir)/grog
56         $(INSTALL_SCRIPT) grog $(DESTDIR)$(bindir)/grog
57         -test -d $(DESTDIR)$(grog_dir) || $(mkinstalldirs) $(DESTDIR)$(grog_dir)
58         for f in $(GROG_); do \
59           $(RM) $(DESTDIR)$(grog_dir)/$$f; \
60           $(INSTALL_SCRIPT) $(srcdir)/$$f $(DESTDIR)$(grog_dir)/$$f; \
61         done
62
63 .PHONY: uninstall_data
64 uninstall_sub:
65         $(RM) $(DESTDIR)$(bindir)/grog
66         -for f in $(GROG_); do \
67           $(RM) $(DESTDIR)$(grog_dir)/$$f; \
68         done
69         -d=$(DESTDIR)$(grog_dir);\
70           if test -d $$d; then rmdir $$d; fi
71
72
73 ########################################################################
74 # Emacs settings
75 ########################################################################
76 #
77 # Local Variables:
78 # mode: makefile
79 # End: