1158961Snetchild#
2158961Snetchild# $FreeBSD$
3158961Snetchild#
4158961Snetchild
5158961Snetchild_ALL!=	cd ${.CURDIR} && ls Doxyfile-*
6158961SnetchildALL=	${_ALL:C/Doxyfile-//g}
7158961SnetchildPDF_ALL=${_ALL:C/Doxyfile/pdf/g}
8158961Snetchild
9158961SnetchildTARGET_ARCH?=	${MACHINE_ARCH}
10158961SnetchildS?=/usr/src/sys
11160922SnetchildLOCALBASE?=/usr/local
12158961Snetchild
13196511SnetchildMFILES!= find ${S} -name \*.m | sed -e 's:${S}/::g'
14158961SnetchildHFILES=	${MFILES:T:S/.m$/.h/}
15158961SnetchildAWK?=	awk
16158961Snetchild
17158961Snetchild.MAIN:	usage
18158961Snetchild
19158961Snetchildusage:
20158961Snetchild	@echo "Possible targets are:"
21158961Snetchild.for entry in ${ALL}
22158961Snetchild	@echo "	${entry}"
23158961Snetchild	@echo "	pdf-${entry}"
24158961Snetchild	@echo "	clean-${entry}"
25158961Snetchild.endfor
26158961Snetchild	@echo
27158961Snetchild	@echo "	all"
28158961Snetchild	@echo "	pdf-all"
29158961Snetchild	@echo "	clean"
30158961Snetchild
31158961Snetchildall:	${ALL}
32158961Snetchildpdf-all:${PDF_ALL}
33158961Snetchild
34196511Snetchildmfiles: ${HFILES:S/^/${.OBJDIR}\/include\//}
35158961Snetchild
36196511SnetchildDOXYGEN_DEST_PATH?=	${.OBJDIR}
37196511SnetchildDOXYGEN_LATEX_DEST_PATH?=${.OBJDIR}
38196511SnetchildDOXYGEN_PDF_DEST_PATH?=	${.OBJDIR}
39158961Snetchild
40196511Snetchild.if exists(${S}/${TARGET_ARCH}/linux)
41158961SnetchildDOXYGEN_LINUX_PATH=	${S}/${TARGET_ARCH}/linux
42158961Snetchild.endif
43196511Snetchild.if exists(${S}/${TARGET_ARCH}/linux32)
44158961SnetchildDOXYGEN_LINUX_PATH+=	${S}/${TARGET_ARCH}/linux32
45158961Snetchild.endif
46158961Snetchild
47158961Snetchild#
48158961Snetchild# generate the necessary targets
49158961Snetchild#
50158961Snetchild.for target in ${ALL}
51158961Snetchild${target}:	mfiles ${.OBJDIR}/${target}/${target}.tag
52158961Snetchild
53158961Snetchild${.OBJDIR}/${target}/${target}.tag:
54160922Snetchild	@mkdir -p ${.OBJDIR}/${target}
55158961Snetchild	@cd ${.OBJDIR} && \
56158961Snetchild		env DOXYGEN_INCLUDE_PATH=${.CURDIR} \
57158961Snetchild		    DOXYGEN_SRC_PATH=${S}  \
58158961Snetchild		    DOXYGEN_DEST_PATH=${DOXYGEN_DEST_PATH} \
59196511Snetchild		    DOXYGEN_SRC_INCLUDE_PATH="${S}/sys ${S}/../include ${S}/${TARGET_ARCH}/include ${.OBJDIR}/include" \
60158961Snetchild		    DOXYGEN_TARGET_ARCH=${TARGET_ARCH} \
61298129Snetchild		    DOXYGEN_LINUX_PATH="${DOXYGEN_LINUX_PATH}" \
62159010Snetchild		    NOTREVIEWED=${.CURDIR}/notreviewed.dox \
63160922Snetchild		    PATH=${LOCALBASE}/bin:${PATH} \
64158961Snetchild			doxygen ${.CURDIR}/Doxyfile-${target}
65196511Snetchild	@echo "API docs for ${target} are now available in ${DOXYGEN_DEST_PATH}/${target}/." | /usr/bin/fmt
66158961Snetchild
67158961Snetchildpdf-${target}:	${.OBJDIR}/${target}/${target}.tag
68158961Snetchild	@cd ${DOXYGEN_LATEX_DEST_PATH}/${target}/latex && ${MAKE} refman.pdf && cp refman.pdf ${DOXYGEN_PDF_DEST_PATH}/${target}.pdf
69158961Snetchild	@echo "API docs for ${target} are now available in ${DOXYGEN_PDF_DEST_PATH}/." | /usr/bin/fmt
70158961Snetchild
71158961SnetchildCLEANDIRS+=	${DOXYGEN_DEST_PATH}/${target}
72158961SnetchildCLEANDIRS+=	${.OBJDIR}/${target}/
73158961SnetchildCLEANFILES+=	${DOXYGEN_PDF_DEST_PATH}/${target}.pdf
74158961Snetchildclean-${target}:
75158961Snetchild	rm -rf ${DOXYGEN_DEST_PATH}/${target} ${.OBJDIR}/${target}
76158961Snetchild.endfor
77158961Snetchild
78196511SnetchildCLEANDIRS+=	${.OBJDIR}/include
79158961Snetchild.for file in ${MFILES}
80196511SnetchildCLEANFILES+=     ${.OBJDIR}/include/${file:T:S/.m$/.h/}
81196511Snetchild${.OBJDIR}/include/${file:T:S/.m$/.h/}: ${S}/${file}
82196511Snetchild	@mkdir -p ${.OBJDIR}/include
83196511Snetchild	cd ${.OBJDIR}/include && ${AWK} -f $S/tools/makeobjops.awk ${S}/${file} -h
84158961Snetchild.endfor
85158961Snetchild
86158961Snetchild#
87158961Snetchild# update target for the config files {config syntax change}
88158961Snetchild#
89158961Snetchildupdate-doxys:
90158961Snetchild.for config_file in ${_ALL}
91158961Snetchild	@doxygen -u ${config_file}
92158961Snetchild.endfor
93158961Snetchild
94158961Snetchild.include "Dependencies"
95158961Snetchild.include <bsd.obj.mk>
96