1## $Id: Makefile.am,v 1.22 2008/02/27 12:28:06 rlk Exp $
2## Copyright (C) 2001 Andy Stewart and Roger Leigh
3##
4## This program is free software; you can redistribute it and/or modify
5## it under the terms of the GNU General Public License as published by
6## the Free Software Foundation; either version 2, or (at your option)
7## any later version.
8##
9## This program is distributed in the hope that it will be useful,
10## but WITHOUT ANY WARRANTY; without even the implied warranty of
11## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12## GNU General Public License for more details.
13##
14## You should have received a copy of the GNU General Public License
15## along with this program; if not, write to the Free Software
16## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
18## Process this file with automake to produce Makefile.in.
19
20@SET_MAKE@
21
22include $(top_srcdir)/scripts/global.mk
23
24
25## Variables
26
27MANUAL_SRC_FILES = \
28	copying.xml \
29	dither.xml \
30	escp2.xml \
31	gutenprint.xml \
32	gpl-appendix.xml \
33	introduction.xml \
34	new-printer.xml \
35	problems.xml \
36	using.xml \
37	weave.xml
38
39HTMLDIR = reference-html
40
41STANDARD_TARGETS = html
42
43DISTHOOKDIRS = $(HTMLDIR)
44
45
46if MAINTAINER_MODE
47MAINT_MODE = true
48else
49MAINT_MODE = false
50endif
51
52if MAINTAINER_MODE
53ALL_LOCAL_TARGETS = docs
54else
55ALL_LOCAL_TARGETS = $(STANDARD_TARGETS)
56endif
57
58all-local: $(ALL_LOCAL_TARGETS)
59
60
61## Rules
62
63dist-hook: html-stamp
64	for dir in $(DISTHOOKDIRS) ; do \
65	  if test -d $(srcdir)/$$dir ; then \
66	    mkdir $(distdir)/$$dir; \
67	    for dirfile in $(srcdir)/$$dir/*; do \
68	      if test -f $$dirfile ; then \
69	        cp -p $$dirfile $(distdir)/$$dir ; \
70	      fi ; \
71	      if test -d $$dirfile ; then \
72	        cp -pR $$dirfile $(distdir)/$$dir ; \
73	      fi ; \
74	    done \
75	  fi \
76	done
77	for file in $(DISTHOOKFILES) ; do \
78	  if test -f $$file ; then \
79	    cp -p $$file $(distdir) ; \
80	fi ; \
81	done
82
83docs: html pdf
84
85pdf: gutenprint.pdf
86
87gutenprint.pdf:  $(MANUAL_SRC_FILES)
88	@if [ -z "$(DB2PDF)" ] ; then \
89	  echo "No db2pdf: cannot build documentation!"; \
90	  exit 1; \
91	fi
92	if test $(srcdir) = '.' ; then \
93	  : ; \
94	else \
95	  for file in $(MANUAL_SRC_FILES) ; do \
96	    if test -L $$file ; then \
97	      $(RM) -f $$file ; \
98	    fi ; \
99	    $(LN_S) -f $(srcdir)/$$file $$file ; \
100	  done ; \
101	fi ; \
102	$(DB2PDF) gutenprint.xml
103
104html: html-stamp
105
106# This ugly workaround with SOURCE is because db2html doesn't seem to like
107# "./users-guide.sgml".  Note that db2ps does not have the same limitation.
108# html-stamp should *only* be called by html--it's just a timestamp!
109
110html-stamp: $(MANUAL_SRC_FILES)
111	@if [ -z "$(DB2HTML)" ] ; then \
112	  echo "No db2html: cannot build documentation!"; \
113	  exit 1; \
114	fi
115	if test $(srcdir) = '.' ; then \
116	  : ; \
117	else \
118	  for file in $(MANUAL_SRC_FILES) ; do \
119	    if test -L $$file ; then \
120	      $(RM) -f $$file ; \
121	    fi ; \
122	    $(LN_S) -f $(srcdir)/$$file $$file ; \
123	  done ; \
124	fi
125	$(DB2HTML) gutenprint.xml
126	-$(RM) -rf $(HTMLDIR)
127	mv gutenprint $(HTMLDIR)
128	chmod a+rx $(HTMLDIR)
129	touch html-stamp
130
131install-data-local: $(STANDARD_TARGETS)
132	if test -n '$(STANDARD_TARGETS)' ; then \
133	  $(mkdir_p) $(DESTDIR)$(datadir)/$(PACKAGE)/doc/$(HTMLDIR) ; \
134	  if test -f gutenprint.pdf ; then \
135	    $(INSTALL_DATA) gutenprint.pdf $(DESTDIR)$(datadir)/$(PACKAGE)/doc ; \
136	  elif test -f $(srcdir)/gutenprint.pdf ; then \
137	    $(INSTALL_DATA) $(srcdir)/gutenprint.pdf $(DESTDIR)$(datadir)/$(PACKAGE)/doc ; \
138	  fi ; \
139	  if test -d $(HTMLDIR) ; then \
140	  HTMLGENDIR="$(HTMLDIR)" ; \
141	  elif test -d $(srcdir)/$(HTMLDIR) ; then \
142	    HTMLGENDIR="$(srcdir)/$(HTMLDIR)" ; \
143	  else \
144	    exit 1 ; \
145	  fi ; \
146	  for file in $$HTMLGENDIR/*.html $$HTMLGENDIR/*.css ; do \
147	    if test -f $$file ; then \
148	      $(INSTALL_DATA) $$file $(DESTDIR)$(datadir)/$(PACKAGE)/doc/$(HTMLDIR) ; \
149	    fi ; \
150	  done ; \
151	fi
152
153uninstall-local:
154	-$(RM) -r $(DESTDIR)$(datadir)/$(PACKAGE)/doc
155
156CLEAN_MANUALS = \
157	$(RM) -f gutenprint.pdf gutenprint.ps;	\
158	$(RM) -rf *html-stamp $(HTMLDIR)
159
160clean-local:
161	if test $(srcdir) = "." -a $(MAINT_MODE) = false ; then \
162	  echo "clean-local: Not removing $(HTMLDIR)" ; \
163	  echo 'clean-local: Not removing gutenprint.pdf' ; \
164	  echo 'clean-local: Not removing gutenprint.ps' ; \
165	else \
166	  $(CLEAN_MANUALS) ; \
167	fi
168	if test $(srcdir) = "." ; then \
169	  : ; \
170	else \
171	  $(RM) -f $(MANUAL_SRC_FILES) ; \
172	fi
173	-$(RM) -rf *.tex *.log *.aux *.dvi *.gz *.out *.junk *.out *.fot
174	-$(RM) -rf db2html* DB2HTML* CATALOG.local
175
176veryclean:
177	$(MAKE) MAINT_MODE=true clean
178
179maintainer-clean-local:
180	$(CLEAN_MANUALS)
181
182
183## Clean
184
185MAINTAINERCLEANFILES = Makefile.in *html-stamp
186
187
188EXTRA_DIST = \
189	$(MANUAL_SRC_FILES) \
190	gutenprint.pdf \
191	html-stamp
192
193.PHONY: docs html ps pdf
194