Makefile 3.45 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                                              \
7
              doc/fate.html                                             \
8
              doc/general.html                                          \
9
              doc/git-howto.html                                        \
10
              doc/libavfilter.html                                      \
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
DOC_EXAMPLES-$(CONFIG_AVCODEC_EXAMPLE)          += avcodec
19
DOC_EXAMPLES-$(CONFIG_FILTER_AUDIO_EXAMPLE)     += filter_audio
20
DOC_EXAMPLES-$(CONFIG_METADATA_EXAMPLE)         += metadata
21
DOC_EXAMPLES-$(CONFIG_OUTPUT_EXAMPLE)           += output
22
DOC_EXAMPLES-$(CONFIG_QSVDEC_EXAMPLE)           += qsvdec
23
DOC_EXAMPLES-$(CONFIG_TRANSCODE_AAC_EXAMPLE)    += transcode_aac
24
ALL_DOC_EXAMPLES = avcodec filter_audio metadata output transcode_aac
25 26 27 28 29

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

30
all: $(DOCS)
31

32
apidoc: doc/doxy/html
33 34
documentation: $(DOCS)

35 36
examples: $(DOC_EXAMPLES)

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

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

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

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

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

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

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

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

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

71
install-progs-$(CONFIG_POD2MAN): install-man
72
install-progs-$(CONFIG_TEXI2HTML): install-doc
73 74 75 76

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

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

82 83 84 85
uninstall: uninstall-doc uninstall-man

uninstall-doc:
	$(RM) -r "$(DOCDIR)"
86 87 88 89 90

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

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

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

98
.PHONY: apidoc documentation