aboutsummaryrefslogtreecommitdiff
path: root/tools/kerneldoc/subsys/Makefile
blob: b8397f810a0f6c8550c51f9b059460040175d95f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#
# $FreeBSD$
#

_ALL!=	cd ${.CURDIR} && ls Doxyfile-*
ALL=	${_ALL:C/Doxyfile-//g}
PDF_ALL=${_ALL:C/Doxyfile/pdf/g}

TARGET_ARCH?=	${MACHINE_ARCH}
S?=/usr/src/sys
LOCALBASE?=/usr/local

MFILES!= find ${S} -name \*.m | egrep '/(dev|libkern|kgssapi|opencrypto|isa|geom|kern|xen|net|${TARGET_ARCH})/' | sed -e 's:${S}/::g'
HFILES=	${MFILES:T:S/.m$/.h/}
AWK?=	awk

.MAIN:	usage

usage:
	@echo "Possible targets are:"
.for entry in ${ALL}
	@echo "	${entry}"
	@echo "	pdf-${entry}"
	@echo "	clean-${entry}"
.endfor
	@echo
	@echo "	all"
	@echo "	pdf-all"
	@echo "	clean"

all:	${ALL}
pdf-all:${PDF_ALL}

mfiles: ${HFILES:S/^/${.OBJDIR}\/include\//}

DOXYGEN_DEST_PATH?=	${.OBJDIR}
DOXYGEN_LATEX_DEST_PATH?=${.OBJDIR}
DOXYGEN_PDF_DEST_PATH?=	${.OBJDIR}

.if exists(${S}/${TARGET_ARCH}/linux)
DOXYGEN_LINUX_PATH=	${S}/${TARGET_ARCH}/linux
.endif
.if exists(${S}/${TARGET_ARCH}/linux32)
DOXYGEN_LINUX_PATH+=	${S}/${TARGET_ARCH}/linux32
.endif

#
# generate the necessary targets
#
.for target in ${ALL}
${target}:	mfiles ${.OBJDIR}/${target}/${target}.tag

${.OBJDIR}/${target}/${target}.tag:
	@mkdir -p ${.OBJDIR}/${target}
	@cd ${.OBJDIR} && \
		env DOXYGEN_INCLUDE_PATH=${.CURDIR} \
		    DOXYGEN_SRC_PATH=${S}  \
		    DOXYGEN_DEST_PATH=${DOXYGEN_DEST_PATH} \
		    DOXYGEN_SRC_INCLUDE_PATH="${S}/sys ${S}/../include ${S}/${TARGET_ARCH}/include ${.OBJDIR}/include" \
		    DOXYGEN_TARGET_ARCH=${TARGET_ARCH} \
		    DOXYGEN_LINUX_PATH="${DOXYGEN_LINUX_PATH}" \
		    NOTREVIEWED=${.CURDIR}/notreviewed.dox \
		    PATH=${LOCALBASE}/bin:${PATH} \
			doxygen ${.CURDIR}/Doxyfile-${target}
	@echo "API docs for ${target} are now available in ${DOXYGEN_DEST_PATH}/${target}/." | /usr/bin/fmt

pdf-${target}:	${.OBJDIR}/${target}/${target}.tag
	@cd ${DOXYGEN_LATEX_DEST_PATH}/${target}/latex && ${MAKE} refman.pdf && cp refman.pdf ${DOXYGEN_PDF_DEST_PATH}/${target}.pdf
	@echo "API docs for ${target} are now available in ${DOXYGEN_PDF_DEST_PATH}/." | /usr/bin/fmt

CLEANDIRS+=	${DOXYGEN_DEST_PATH}/${target}
CLEANDIRS+=	${.OBJDIR}/${target}/
CLEANFILES+=	${DOXYGEN_PDF_DEST_PATH}/${target}.pdf
clean-${target}:
	rm -rf ${DOXYGEN_DEST_PATH}/${target} ${.OBJDIR}/${target}
.endfor

CLEANDIRS+=	${.OBJDIR}/include
.for file in ${MFILES}
CLEANFILES+=     ${.OBJDIR}/include/${file:T:S/.m$/.h/}
${.OBJDIR}/include/${file:T:S/.m$/.h/}: ${S}/${file}
	@mkdir -p ${.OBJDIR}/include
	cd ${.OBJDIR}/include && ${AWK} -f $S/tools/makeobjops.awk ${S}/${file} -h
.endfor

#
# update target for the config files {config syntax change}
#
update-doxys:
.for config_file in ${_ALL}
	@doxygen -u ${config_file}
.endfor

.include "Dependencies"
.include <bsd.obj.mk>