summaryrefslogtreecommitdiff
path: root/doc/Makefile.am
blob: cbad38097940e71f500e97e99323b04d6981b0c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
SUBDIRS = api figures

#
# The intention of these macros, targets, rules, and variables is the
# following:
#
# A distribution tarball should have the manuals (HTML, PDF, PS) included.
# Only if the user has the software to re-build the manuals from the
# docbook source, should we delete or re-create the created docs.
#

# distribute manual Portable Document Format (PDF) if possible
manual_pdf = @manual_pdf@

# distribute manual in PostScript (PS) format if possible
manual_ps = @manual_ps@

# build HTML manual if possible
manual_html = @manual_html@

CLEAN_FILES = $(manual_pdf) $(manual_ps) figures-stamp

EXTRA_DIST = DAEMON build_OS2.txt 					\
	camlib_devel.lyx 						\
	camlib_devel-portmon.eps camlib_devel-repeater.eps 		\
	camlib_devel.sgml camlib_devel.txt camlib_devel-y.eps 		\
	frontend_devel.lyx frontend_devel.sgml frontend_devel.txt 	\
	gphoto2-cli.txt							\
	gphoto2.xml $(man_MANS) $(manual_pdf) $(manual_ps)		\
	FAQ

man_MANS = gphoto2.1 gphoto2.3 gphoto2_port.3

docdir = @DOC_DIR@

doc_DATA = gphoto2-cli.txt FAQ $(manual_pdf) $(manual_ps)

figures-stamp:
	$(MAKE) -C figures
	touch $@

########################################################################
# The following rules are for regenerating man pages, pdf, html and ps
# docs from gphoto2.xml. This is only done when xmlto is found, which
# can be obtained from <URL:http://cyberelk.net/tim/xmlto/>.
#
# We should not forget the alternative dummy targets, as otherwise
# the build process will barf when xmlto is not present.
########################################################################


########################################################################
if XMLTOPDF
gphoto2.pdf: gphoto2.xml figures-stamp
	test -e $$(basename $<) || ln -s $< # symlink file from srcdir to builddir if required
	$(XMLTO) pdf $$(basename $<) # work on local file or symlink
endif
########################################################################


########################################################################
if XMLTOPS
# doesn't work if builddir != srcdir
gphoto2.ps: gphoto2.xml figures-stamp
	test -e $$(basename $<) || ln -s $< # symlink file from srcdir to builddir if required
	$(XMLTO) ps $$(basename $<) # work on local file or symlink
endif
########################################################################


########################################################################
if XMLTOMAN
# works if builddir != srcdir
$(man_MANS): gphoto2.xml
	$(XMLTO) man $<
endif
########################################################################


.PHONY: clean-local-manual
.PHONY: install-data-local-manual
.PHONY: dist-hook-manual


########################################################################
if XMLTOHTML
# doesn't work correctly if builddir != srcdir

# do not empty this variable
htmldir=@HTML_DIR@

TARGET_DIR=$(htmldir)/manual

manual: gphoto2.xml
	$(XMLTO) html -o "$@" "$<"
	cd $@ && rm -f figures && ln -s ../figures figures # to view docs in src tree
	touch "$@"

clean_local_manual = clean-local-manual
clean-local-manual:
	rm -rf "manual/"

install_data_local_manual = install-data-local-manual
install-data-local-manual: manual figures-stamp
	$(INSTALL) -d -m 0755 $(DESTDIR)$(TARGET_DIR)
	$(INSTALL_DATA) ./manual/*.html $(DESTDIR)$(TARGET_DIR)
if ENABLE_FIGURES
	$(INSTALL) -d -m 0755 $(DESTDIR)$(TARGET_DIR)/figures
	$(INSTALL_DATA) ./figures/*.png $(DESTDIR)$(TARGET_DIR)/figures
endif

# copy HTML manual to distribution
# FIXME: Use $(INSTALL_DATA) instead of $(AMTAR)
dist_hook_manual = dist-hook-manual
dist-hook-manual: manual figures-stamp
	$(AMTAR) cf - manual/*.html | (cd $(distdir); $(AMTAR) xvf -)
if ENABLE_FIGURES
	$(AMTAR) cf - figures/*.png | (cd $(distdir)/manual/; $(AMTAR) xvf -)
endif
endif
########################################################################



########################################################################
clean-local: $(clean_local_manual)
	@echo "Dummy $@ target"

install-data-local: $(install_data_local_manual)
	@echo "Dummy $@ target"

dist-hook: $(dist_hook_manual)
	@echo "Dummy $@ target"

all-local: $(man_MANS) $(manual_pdf) $(manual_ps) $(manual_html)
	@echo "Dummy $@ target"