1#         $NetBSD: Makefile.nbincludes,v 1.13 2025/03/29 23:37:00 tsutsui 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_FSDIR:=  ${.PARSEDIR}/../sys/fs
10_SUBDIR!= cd ${_ARCHDIR} && ${MAKE} -V SUBDIR
11
12.if make(depend) || make(all) || make(dependall) || make(install)
13# There's no need to run these commands for "make cleandir" or "make obj",
14# and TOOL_SED will not yet have been built.
15_UFS_INCS!=         cd ${_UFSDIR} && find ffs ufs -name '*.h'
16_FS_INCS!=          cd ${_FSDIR} && find cd9660 -name '*.h'
17_FS_INCS+=          unicode.h
18_ARCH_INCS!=        ${TOOL_SED} -e 's/^\#.*//' ${.PARSEDIR}/headerlist 2> /dev/null || true
19.endif
20
21_ARCH_INCS+=        ews4800mips/include/pdinfo.h ews4800mips/include/vtoc.h
22
23# for sh3/include/elf_machdep.h
24.for sh3mach in dreamcast evbsh3 hpcsh landisk mmeye sh3
25_ARCH_INCS+=        ${sh3mach}/include/endian_machdep.h
26.endfor
27
28_INCS=              disktab.h
29_SYSINCS= bootblock.h \
30                    disklabel.h disklabel_acorn.h disklabel_gpt.h disklabel_rdb.h \
31                    dkbad.h \
32                    exec_elf.h exec_ecoff.h
33
34HOST_CPPFLAGS+=     -I${TOOLDIR}/include -I${TOOLDIR}/include/nbinclude
35
36beforedepend:
37          ${HOST_INSTALL_DIR} ${TOOLDIR}/include/nbinclude
38          ${HOST_INSTALL_DIR} ${TOOLDIR}/include/nbinclude/sys
39          ${HOST_INSTALL_DIR} ${TOOLDIR}/include/nbinclude/ufs
40          ${HOST_INSTALL_DIR} ${TOOLDIR}/include/nbinclude/fs
41          ${HOST_INSTALL_DIR} ${TOOLDIR}/include/nbinclude/fs/cd9660
42          cd ${_ARCHDIR} && \
43              ${TOOL_PAX} -s /include\\/// -rw ${_ARCH_INCS} \
44              ${TOOLDIR}/include/nbinclude
45          cd ${_INCDIR} && \
46              ${TOOL_PAX} -rw ${_INCS} ${TOOLDIR}/include/nbinclude
47          cd ${_SYSDIR} && \
48              ${TOOL_PAX} -rw ${_SYSINCS} ${TOOLDIR}/include/nbinclude/sys
49          cd ${_UFSDIR} && \
50              ${TOOL_PAX} -rw ${_UFS_INCS} ${TOOLDIR}/include/nbinclude/ufs
51          cd ${_FSDIR} && \
52              ${TOOL_PAX} -rw ${_FS_INCS} ${TOOLDIR}/include/nbinclude/fs
53          cd ${TOOLDIR}/include/nbinclude && rm -f machine && \
54              ${HOST_INSTALL_SYMLINK} ${MACHINE} machine
55