Makefile.inc revision 1.19 1 # $NetBSD: Makefile.inc,v 1.19 2019/06/04 15:07:55 hannken Exp $
2
3 .include <bsd.own.mk>
4
5 COMMON_DIR:=${.PARSEDIR}
6 COMMON_CODEDIRS=atomic gen gmon inet md misc net rpc stdlib string sys
7 COMMON_CODEDIRS+=hash/sha1 hash/sha2 hash/sha3 hash/rmd160 hash/murmurhash
8
9 .if defined(COMMON_MACHINE_ARCH) && !empty(COMMON_MACHINE_ARCH) && \
10 exists(${COMMON_DIR}/arch/${COMMON_MACHINE_ARCH})
11 COMMON_ARCHSUBDIR= ${COMMON_MACHINE_ARCH}
12 .elif defined(COMMON_MACHINE_CPU) && !empty(COMMON_MACHINE_CPU) && \
13 exists(${COMMON_DIR}/arch/${COMMON_MACHINE_CPU})
14 COMMON_ARCHSUBDIR= ${COMMON_MACHINE_CPU}
15 .elif defined(LIBKERN_ARCH) && !empty(LIBKERN_ARCH) && \
16 exists(${KERNDIR}/arch/${LIBKERN_ARCH})
17 COMMON_ARCHSUBDIR= ${LIBKERN_ARCH}
18 .elif exists(${COMMON_DIR}/arch/${MACHINE_ARCH})
19 COMMON_ARCHSUBDIR= ${MACHINE_ARCH}
20 .elif exists(${COMMON_DIR}/arch/${MACHINE_CPU})
21 COMMON_ARCHSUBDIR= ${MACHINE_CPU}
22 .endif
23
24 COMMON_ARCHDIR=${COMMON_DIR}/arch/${COMMON_ARCHSUBDIR}
25
26 .for i in ${COMMON_CODEDIRS}
27 .if exists(${COMMON_DIR}/$i)
28 .PATH.c: ${COMMON_DIR}/$i
29 .endif
30 .if exists(${COMMON_ARCHDIR}/${i}/Makefile.inc)
31 .include "${COMMON_ARCHDIR}/${i}/Makefile.inc"
32 .endif
33 .if !empty(CPPFLAGS:M-DLIBKERN_OPTIMISE_SPACE) && \
34 exists(${COMMON_ARCHDIR}/$i/small)
35 .PATH.S: ${COMMON_ARCHDIR}/$i/small
36 .endif
37
38 .if exists(${COMMON_ARCHDIR}/$i)
39 .PATH.c: ${COMMON_ARCHDIR}/$i
40 .PATH.S: ${COMMON_ARCHDIR}/$i
41 .endif
42 .endfor
43
44 CPPFLAGS+=-I${COMMON_DIR}/quad -I${COMMON_DIR}/string
45 .if defined(COMMON_ARCHSUBDIR)
46 CPPFLAGS+=-I${COMMON_ARCHDIR}/string
47 .endif
48