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