1# Copyright (C) 2002, 2003, 2004, 2005 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, 51 Franklin St - Fifth Floor, Boston, MA 02110-1301, USA.
19
20# These may be overridden if cross-compiling.
21GROFFBIN=$(top_builddir)/src/roff/groff/groff
22GROFF_BIN_PATH=`echo $(groff_bin_dirs) | sed -e 's|  *|$(SH_SEP)|g'`
23
24groff_bin_dirs=\
25  $(top_builddir)/src/roff/groff \
26  $(top_builddir)/src/roff/troff \
27  $(top_builddir)/src/devices/grops
28
29FFLAG=-F$(top_builddir)/font -F$(top_srcdir)/font
30TFLAG=-M$(top_builddir)/tmac -M$(top_srcdir)/tmac -M$(srcdir)
31
32GROFF=GROFF_COMMAND_PREFIX=''; \
33      export GROFF_COMMAND_PREFIX; \
34      GROFF_BIN_PATH=$(GROFF_BIN_PATH); \
35      export GROFF_BIN_PATH; \
36      $(GROFFBIN) $(FFLAG) $(TFLAG)
37
38MAN7=\
39  groff_mom.n
40
41NORMALFILES=\
42  mom.tmac \
43  om.tmac
44
45HTMLDOCFILES=\
46  momdoc/appendices.html \
47  momdoc/color.html \
48  momdoc/cover.html \
49  momdoc/definitions.html \
50  momdoc/docelement.html \
51  momdoc/docprocessing.html \
52  momdoc/goodies.html \
53  momdoc/headfootpage.html \
54  momdoc/inlines.html \
55  momdoc/intro.html \
56  momdoc/letters.html \
57  momdoc/macrolist.html \
58  momdoc/rectoverso.html \
59  momdoc/refer.html \
60  momdoc/reserved.html \
61  momdoc/toc.html \
62  momdoc/typemacdoc.html \
63  momdoc/typesetting.html \
64  momdoc/using.html
65
66EXAMPLEFILES=\
67  examples/letter.mom \
68  examples/sample_docs.mom \
69  examples/typesetting.mom \
70  examples/README.txt \
71  examples/elvis_syntax \
72  examples/elvis_syntax.new \
73  examples/penguin.ps
74
75PROCESSEDEXAMPLEFILES=\
76  examples/letter.ps \
77  examples/sample_docs.ps \
78  examples/typesetting.ps
79
80HTMLDOCFILES_=`echo $(HTMLDOCFILES) | sed 's|momdoc/||g'`
81EXAMPLEFILES_=`echo $(EXAMPLEFILES) | sed 's|examples/||g'`
82PROCESSEDEXAMPLEFILES_=`echo $(PROCESSEDEXAMPLEFILES) | sed 's|examples/||g'`
83
84CLEANADD=\
85  penguin.ps \
86  $(PROCESSEDEXAMPLEFILES) \
87  examples/stamp
88
89.SUFFIXES: .mom .ps
90.mom.ps:
91	$(GROFF) -Tps -mom $< >$@
92
93
94all: $(PROCESSEDEXAMPLEFILES)
95
96$(PROCESSEDEXAMPLEFILES): penguin.ps examples/stamp
97
98penguin.ps:
99	cp $(srcdir)/examples/penguin.ps .
100
101examples/stamp:
102	test -d examples || $(mkinstalldirs) examples
103	touch $@
104
105install_data: $(NORMALFILES) $(HTMLDOCFILES) \
106              $(EXAMPLEFILES) $(PROCESSEDEXAMPLEFILES)
107	-test -d $(tmacdir) || $(mkinstalldirs) $(tmacdir)
108	for f in $(NORMALFILES); do \
109	  rm -f $(tmacdir)/$$f; \
110	  $(INSTALL_DATA) $(srcdir)/$$f $(tmacdir)/$$f; \
111	done
112	-test -d $(htmldocdir)/mom || $(mkinstalldirs) $(htmldocdir)/mom
113	for f in $(HTMLDOCFILES_); do \
114	  rm -f $(htmldocdir)/mom/$$f; \
115	  $(INSTALL_DATA) $(srcdir)/momdoc/$$f $(htmldocdir)/mom/$$f; \
116	done
117	-test -d $(exampledir)/mom || $(mkinstalldirs) $(exampledir)/mom
118	for f in $(EXAMPLEFILES_); do \
119	  rm -f $(exampledir)/mom/$$f; \
120	  $(INSTALL_DATA) $(srcdir)/examples/$$f $(exampledir)/mom/$$f; \
121	done
122	for f in $(PROCESSEDEXAMPLEFILES_); do \
123	  rm -f $(exampledir)/mom/$$f; \
124	  $(INSTALL_DATA) examples/$$f $(exampledir)/mom/$$f; \
125	done
126
127uninstall_sub:
128	-for f in $(NORMALFILES); do \
129	  rm -f $(tmacdir)/$$f; \
130	done
131	-for f in $(HTMLDOCFILES_); do \
132	  rm -f $(htmldocdir)/mom/$$f; \
133	done
134	-rmdir $(htmldocdir)/mom
135	-for f in $(EXAMPLEFILES_) $(PROCESSEDEXAMPLEFILES_); do \
136	  rm -f $(exampledir)/mom/$$f; \
137	done
138	-rmdir $(exampledir)/mom
139