xref: /freebsd/tools/kerneldoc/subsys/Makefile (revision d4eeb02986980bf33dd56c41ceb9fc5f180c0d47)
1#
2# $FreeBSD$
3#
4
5_ALL!=	cd ${.CURDIR} && ls Doxyfile-*
6ALL=	${_ALL:C/Doxyfile-//g}
7PDF_ALL=${_ALL:C/Doxyfile/pdf/g}
8
9TARGET_ARCH?=	${MACHINE_ARCH}
10S?=/usr/src/sys
11LOCALBASE?=/usr/local
12
13MFILES!= find ${S} -name \*.m | egrep '/(dev|libkern|kgssapi|opencrypto|isa|geom|kern|xen|net|${TARGET_ARCH})/' | sed -e 's:${S}/::g'
14HFILES=	${MFILES:T:S/.m$/.h/}
15AWK?=	awk
16
17.MAIN:	usage
18
19usage:
20	@echo "Possible targets are:"
21.for entry in ${ALL}
22	@echo "	${entry}"
23	@echo "	pdf-${entry}"
24	@echo "	clean-${entry}"
25.endfor
26	@echo
27	@echo "	all"
28	@echo "	pdf-all"
29	@echo "	clean"
30
31all:	${ALL}
32pdf-all:${PDF_ALL}
33
34mfiles: ${HFILES:S/^/${.OBJDIR}\/include\//}
35
36DOXYGEN_DEST_PATH?=	${.OBJDIR}
37DOXYGEN_LATEX_DEST_PATH?=${.OBJDIR}
38DOXYGEN_PDF_DEST_PATH?=	${.OBJDIR}
39
40.if exists(${S}/${TARGET_ARCH}/linux)
41DOXYGEN_LINUX_PATH=	${S}/${TARGET_ARCH}/linux
42.endif
43.if exists(${S}/${TARGET_ARCH}/linux32)
44DOXYGEN_LINUX_PATH+=	${S}/${TARGET_ARCH}/linux32
45.endif
46
47#
48# generate the necessary targets
49#
50.for target in ${ALL}
51${target}:	mfiles ${.OBJDIR}/${target}/${target}.tag
52
53${.OBJDIR}/${target}/${target}.tag:
54	@mkdir -p ${.OBJDIR}/${target}
55	@cd ${.OBJDIR} && \
56		env DOXYGEN_INCLUDE_PATH=${.CURDIR} \
57		    DOXYGEN_SRC_PATH=${S}  \
58		    DOXYGEN_DEST_PATH=${DOXYGEN_DEST_PATH} \
59		    DOXYGEN_SRC_INCLUDE_PATH="${S}/sys ${S}/../include ${S}/${TARGET_ARCH}/include ${.OBJDIR}/include" \
60		    DOXYGEN_TARGET_ARCH=${TARGET_ARCH} \
61		    DOXYGEN_LINUX_PATH="${DOXYGEN_LINUX_PATH}" \
62		    NOTREVIEWED=${.CURDIR}/notreviewed.dox \
63		    PATH=${LOCALBASE}/bin:${PATH} \
64			doxygen ${.CURDIR}/Doxyfile-${target}
65	@echo "API docs for ${target} are now available in ${DOXYGEN_DEST_PATH}/${target}/." | /usr/bin/fmt
66
67pdf-${target}:	${.OBJDIR}/${target}/${target}.tag
68	@cd ${DOXYGEN_LATEX_DEST_PATH}/${target}/latex && ${MAKE} refman.pdf && cp refman.pdf ${DOXYGEN_PDF_DEST_PATH}/${target}.pdf
69	@echo "API docs for ${target} are now available in ${DOXYGEN_PDF_DEST_PATH}/." | /usr/bin/fmt
70
71CLEANDIRS+=	${DOXYGEN_DEST_PATH}/${target}
72CLEANDIRS+=	${.OBJDIR}/${target}/
73CLEANFILES+=	${DOXYGEN_PDF_DEST_PATH}/${target}.pdf
74clean-${target}:
75	rm -rf ${DOXYGEN_DEST_PATH}/${target} ${.OBJDIR}/${target}
76.endfor
77
78CLEANDIRS+=	${.OBJDIR}/include
79.for file in ${MFILES}
80CLEANFILES+=     ${.OBJDIR}/include/${file:T:S/.m$/.h/}
81${.OBJDIR}/include/${file:T:S/.m$/.h/}: ${S}/${file}
82	@mkdir -p ${.OBJDIR}/include
83	cd ${.OBJDIR}/include && ${AWK} -f $S/tools/makeobjops.awk ${S}/${file} -h
84.endfor
85
86#
87# update target for the config files {config syntax change}
88#
89update-doxys:
90.for config_file in ${_ALL}
91	@doxygen -u ${config_file}
92.endfor
93
94.include "Dependencies"
95.include <bsd.obj.mk>
96