1# Copyright (C) 2002 Free Software Foundation, Inc.
2#      Written by Werner Lemberg (wl@gnu.org)
3#
4# This file is part of groff.
5#
6# groff is free software; you can redistribute it and/or modify it under
7# the terms of the GNU General Public License as published by the Free
8# Software Foundation; either version 2, or (at your option) any later
9# version.
10#
11# groff is distributed in the hope that it will be useful, but WITHOUT ANY
12# WARRANTY; without even the implied warranty of MERCHANTABILITY or
13# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14# for more details.
15#
16# You should have received a copy of the GNU General Public License along
17# with groff; see the file COPYING.  If not, write to the Free Software
18# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19
20groff_bin_dirs=\
21  $(top_builddir)/src/roff/groff \
22  $(top_builddir)/src/roff/troff \
23  $(top_builddir)/src/devices/grops
24groff_bin_path=`echo $(groff_bin_dirs) | sed -e 's|  *|:|g'`
25
26FFLAG=-F$(top_builddir)/font -F$(top_srcdir)/font
27TFLAG=-M$(top_builddir)/tmac -M$(top_srcdir)/tmac -M$(srcdir)
28
29GROFF=GROFF_COMMAND_PREFIX=''; \
30      export GROFF_COMMAND_PREFIX; \
31      GROFF_BIN_PATH=$(groff_bin_path); \
32      export GROFF_BIN_PATH; \
33      $(top_builddir)/src/roff/groff/groff $(FFLAG) $(TFLAG)
34
35MAN7=\
36  groff_mom.n
37
38NORMALFILES=\
39  mom.tmac \
40  om.tmac
41
42HTMLDOCFILES=\
43  momdoc/appendices.html \
44  momdoc/cover.html \
45  momdoc/definitions.html \
46  momdoc/docelement.html \
47  momdoc/docprocessing.html \
48  momdoc/goodies.html \
49  momdoc/headfootpage.html \
50  momdoc/inlines.html \
51  momdoc/intro.html \
52  momdoc/letters.html \
53  momdoc/rectoverso.html \
54  momdoc/reserved.html \
55  momdoc/toc.html \
56  momdoc/typemacdoc.html \
57  momdoc/typesetting.html \
58  momdoc/using.html
59
60EXAMPLEFILES=\
61  examples/letter.mom \
62  examples/macros.mom \
63  examples/typeset.mom \
64  examples/typewrite.mom \
65  examples/README.mom \
66  examples/elvis_syntax \
67  examples/penguin.ps
68
69PROCESSEDEXAMPLEFILES=\
70  examples/letter.ps \
71  examples/macros.ps \
72  examples/typeset.ps \
73  examples/typewrite.ps
74
75CLEANADD=\
76  penguin.ps \
77  $(PROCESSEDEXAMPLEFILES)
78
79.SUFFIXES: .mom .ps
80.mom.ps:
81	$(GROFF) -Tps -mom $< >$@
82
83
84all: make_examples
85
86.PHONY: make_examples
87make_examples: prepare_make_examples $(PROCESSEDEXAMPLEFILES)
88
89prepare_make_examples: examples/penguin.ps
90	test -d examples || $(mkinstalldirs) examples
91	test -f penguin.ps || cp $(srcdir)/examples/penguin.ps .
92
93install_data: $(NORMALFILES)
94	-test -d $(DESTDIR)$(tmacdir) || $(mkinstalldirs) $(DESTDIR)$(tmacdir)
95	for f in $(NORMALFILES); do \
96	  rm -f $(DESTDIR)$(tmacdir)/$$f; \
97	  $(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(tmacdir)/$$f; \
98	done
99
100install_doc: $(HTMLDOCFILES) $(EXAMPLEFILES) $(PROCESSEDEXAMPLEFILES)
101	-test -d $(DESTDIR)$(htmldocdir)/momdoc || $(mkinstalldirs) $(DESTDIR)$(htmldocdir)/momdoc
102	for f in $(HTMLDOCFILES); do \
103	  rm -f $(DESTDIR)$(htmldocdir)/$$f; \
104	  $(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(htmldocdir)/$$f; \
105	done
106	-test -d $(DESTDIR)$(exampledir) || $(mkinstalldirs) $(DESTDIR)$(exampledir)
107	for f in $(EXAMPLEFILES); do \
108	  rm -f $(DESTDIR)$(exampledir)/$$f; \
109	  $(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)$(exampledir)/$$(f#examples/); \
110	done
111	for f in $(PROCESSEDEXAMPLEFILES); do \
112	  rm -f $(DESTDIR)$(exampledir)/$$f; \
113	  $(INSTALL_DATA) $$f $(DESTDIR)$(exampledir)/$$(f#examples/); \
114	done
115
116uninstall_sub:
117	-for f in $(NORMALFILES); do \
118	  rm -f $(tmacdir)/$$f; \
119	done
120	-for f in $(HTMLDOCFILES); do \
121	  rm -f $(htmldocdir)/$$f; \
122	done
123	-rmdir $(htmldocdir)/momdoc
124	-for f in $(EXAMPLEFILES) $(PROCESSEDEXAMPLEFILES); do \
125	  rm -f $(docdir)/$$f; \
126	done
127