1ifndef MKDIR
2MKDIR=mkdir -p
3endif
4ifndef CP
5CP=cp -Rfpl
6endif
7RM:=rm -rf
8
9ifndef LAZBUILD
10LAZBUILD=$(firstword $(wildcard ../../lazbuild) $(wildcard /usr/bin/lazbuild))
11endif
12
13ifndef FPC
14FPC=/usr/bin/fpc
15endif
16
17build: htmldocs
18
19htmldocs: build_lcl_docs
20	./$< --outfmt html
21
22chmdocs: build_lcl_docs
23	./$< --outfmt chm
24
25build_lcl_docs: build_lcl_docs.lpi build_lcl_docs.lpr
26ifeq ($(realpath ${LAZBUILD}),)
27	echo 'Executable "lazbuild" not found, trying direct FPC call.'
28	${FPC}  -FU. $(addprefix -Fu../../,components/lazutils lcl) -o$@ build_lcl_docs.lpr
29else
30	${LAZBUILD} $<
31endif
32
33clean:
34	${RM} build_lcl_docs lcl lazutils *.o *.ppu *.rst
35
36htmlinstall chminstall:
37	install -d ${INSTALL_DOCDIR}
38	${CP} -t ${INSTALL_DOCDIR} \
39		lcl
40
41.PHONY: build clean install htmldocs chmdocs
42