1#	$NetBSD: Makefile.nbincludes,v 1.10 2024/04/01 02:18:30 christos Exp $
2
3.include <bsd.hostinit.mk>
4
5_ARCHDIR:=	${.PARSEDIR}/../sys/arch
6_INCDIR:=	${.PARSEDIR}/../include
7_SYSDIR:=	${.PARSEDIR}/../sys/sys
8_UFSDIR:=	${.PARSEDIR}/../sys/ufs
9_SUBDIR!=	cd ${_ARCHDIR} && ${MAKE} -V SUBDIR
10
11.if make(depend) || make(all) || make(dependall) || make(install)
12# There's no need to run these commands for "make cleandir" or "make obj",
13# and TOOL_SED will not yet have been built.
14_UFS_INCS!=	cd ${_UFSDIR} && find ffs ufs -name '*.h'
15_ARCH_INCS!=	${TOOL_SED} -e 's/^\#.*//' ${.PARSEDIR}/headerlist
16.endif
17
18_ARCH_INCS+=	ews4800mips/include/pdinfo.h ews4800mips/include/vtoc.h
19
20# for sh3/include/elf_machdep.h
21.for sh3mach in dreamcast evbsh3 hpcsh landisk mmeye sh3
22_ARCH_INCS+=	${sh3mach}/include/endian_machdep.h
23.endfor
24
25_INCS=		disktab.h
26_SYSINCS=	bootblock.h \
27		disklabel.h disklabel_acorn.h disklabel_gpt.h disklabel_rdb.h \
28		dkbad.h \
29		exec_elf.h exec_ecoff.h
30
31HOST_CPPFLAGS+=	-I${TOOLDIR}/include -I${TOOLDIR}/include/nbinclude
32
33beforedepend: 
34	${HOST_INSTALL_DIR} ${TOOLDIR}/include/nbinclude
35	${HOST_INSTALL_DIR} ${TOOLDIR}/include/nbinclude/sys
36	${HOST_INSTALL_DIR} ${TOOLDIR}/include/nbinclude/ufs
37	cd ${_ARCHDIR} && \
38	    ${TOOL_PAX} -s /include\\/// -rw ${_ARCH_INCS} \
39	    ${TOOLDIR}/include/nbinclude
40	cd ${_INCDIR} && \
41	    ${TOOL_PAX} -rw ${_INCS} ${TOOLDIR}/include/nbinclude
42	cd ${_SYSDIR} && \
43	    ${TOOL_PAX} -rw ${_SYSINCS} ${TOOLDIR}/include/nbinclude/sys
44	cd ${_UFSDIR} && \
45	    ${TOOL_PAX} -rw ${_UFS_INCS} ${TOOLDIR}/include/nbinclude/ufs
46	cd ${TOOLDIR}/include/nbinclude && rm -f machine && \
47	    ${HOST_INSTALL_SYMLINK} ${MACHINE} machine
48