Makefile 3.32 KB
Newer Older
1 2 3 4
ALLMANPAGES = $(AVBASENAMES:%=%.1)
MANPAGES    = $(AVPROGS-yes:%=doc/%.1)
PODPAGES    = $(AVPROGS-yes:%=doc/%.pod)
HTMLPAGES   = $(AVPROGS-yes:%=doc/%.html)                               \
5 6
              doc/developer.html                                        \
              doc/faq.html                                              \
Luca Barbato's avatar
Luca Barbato committed
7
              doc/fate.html                                             \
8
              doc/general.html                                          \
9
              doc/git-howto.html                                        \
10
              doc/libavfilter.html                                      \
Luca Barbato's avatar
Luca Barbato committed
11
              doc/nut.html                                              \
12
              doc/platform.html                                         \
13

14
DOCS-$(CONFIG_POD2MAN)                          += $(MANPAGES) $(PODPAGES)
15 16
DOCS-$(CONFIG_TEXI2HTML)                        += $(HTMLPAGES)
DOCS = $(DOCS-yes)
17

18 19
DOC_EXAMPLES-$(CONFIG_AVCODEC_EXAMPLE)          += avcodec
DOC_EXAMPLES-$(CONFIG_METADATA_EXAMPLE)         += metadata
20
DOC_EXAMPLES-$(CONFIG_OUTPUT_EXAMPLE)           += output
21
DOC_EXAMPLES-$(CONFIG_TRANSCODE_AAC_EXAMPLE)    += transcode_aac
22
ALL_DOC_EXAMPLES = avcodec metadata output transcode_aac
23 24 25 26 27

DOC_EXAMPLES     := $(DOC_EXAMPLES-yes:%=doc/examples/%$(EXESUF))
ALL_DOC_EXAMPLES := $(ALL_DOC_EXAMPLES:%=doc/examples/%$(EXESUF))
PROGS            += $(DOC_EXAMPLES)

28
all: $(DOCS)
29

30
apidoc: doc/doxy/html
31 32
documentation: $(DOCS)

33 34
examples: $(DOC_EXAMPLES)

35 36
TEXIDEP = awk '/^@include/ { printf "$@: $(@D)/%s\n", $$2 }' <$< >$(@:%=%.d)

37 38 39 40
GENTEXI  = format codec
GENTEXI := $(GENTEXI:%=doc/avoptions_%.texi)

$(GENTEXI): TAG = GENTEXI
41
$(GENTEXI): doc/avoptions_%.texi: doc/print_options$(HOSTEXESUF)
42 43
	$(M)doc/print_options $* > $@

44
doc/%.html: TAG = HTML
45
doc/%.html: doc/%.texi $(SRC_PATH)/doc/t2h.init $(GENTEXI)
46
	$(Q)$(TEXIDEP)
47
	$(M)texi2html -I doc -monolithic --init-file $(SRC_PATH)/doc/t2h.init --output $@ $<
48 49

doc/%.pod: TAG = POD
50
doc/%.pod: doc/%.texi $(SRC_PATH)/doc/texi2pod.pl $(GENTEXI)
51
	$(Q)$(TEXIDEP)
52
	$(M)$(SRC_PATH)/doc/texi2pod.pl -Idoc $< $@
53 54

doc/%.1: TAG = MAN
55
doc/%.1: doc/%.pod $(GENTEXI)
56 57
	$(M)pod2man --section=1 --center=" " --release=" " $< > $@

58
$(DOCS) doc/doxy/html: | doc/
59
$(DOC_EXAMPLES:%$(EXESUF)=%.o): | doc/examples
60
OBJDIRS += doc/examples
61

62
DOXY_INPUT      = $(addprefix $(SRC_PATH)/, $(INSTHEADERS) $(DOC_EXAMPLES:%$(EXESUF)=%.c) $(LIB_EXAMPLES:%$(EXESUF)=%.c))
63 64 65
DOXY_TEMPLATES  = doxy_stylesheet.css footer.html header.html
DOXY_TEMPLATES := $(addprefix $(SRC_PATH)/doc/doxy/, $(DOXY_TEMPLATES))

66 67
doc/doxy/html: $(SRC_PATH)/doc/Doxyfile $(DOXY_INPUT) $(DOXY_TEMPLATES)
	$(M)$(SRC_PATH)/doc/doxy-wrapper.sh $(SRC_PATH) $< $(DOXY_INPUT)
68

69
install-progs-$(CONFIG_POD2MAN): install-man
70
install-progs-$(CONFIG_TEXI2HTML): install-doc
71 72 73 74

install-doc: $(HTMLPAGES)
	$(Q)mkdir -p "$(DOCDIR)"
	$(INSTALL) -m 644 $(HTMLPAGES) "$(DOCDIR)"
75 76 77 78 79

install-man: $(MANPAGES)
	$(Q)mkdir -p "$(MANDIR)/man1"
	$(INSTALL) -m 644 $(MANPAGES) "$(MANDIR)/man1"

80 81 82 83
uninstall: uninstall-doc uninstall-man

uninstall-doc:
	$(RM) -r "$(DOCDIR)"
84 85 86 87 88

uninstall-man:
	$(RM) $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES))

clean::
89 90 91
	$(RM) $(ALL_DOC_EXAMPLES)
	$(RM) $(CLEANSUFFIXES:%=doc/%) $(CLEANSUFFIXES:%=doc/examples/%)
	$(RM) doc/*.html doc/*.pod doc/*.1 doc/avoptions_*.texi
92
	$(RM) -r doc/doxy/html
93 94 95

-include $(wildcard $(DOCS:%=%.d))

96
.PHONY: apidoc documentation