1# $FreeBSD$
2
3.PATH: ${.CURDIR}/../../include
4
5LIB=		egacy
6SRC=
7INCSGROUPS=	INCS SYSINCS
8INCS=
9
10SYSINCSDIR=	${INCLUDEDIR}/sys
11
12BOOTSTRAPPING?=	0
13
14_WITH_PWCACHEDB!= grep -c pwcache_groupdb /usr/include/grp.h || true
15.if ${_WITH_PWCACHEDB} == 0
16.PATH: ${.CURDIR}/../../contrib/libc-pwcache
17CFLAGS+=	-I${.CURDIR}/../../contrib/libc-pwcache \
18		-I${.CURDIR}/../../lib/libc/include
19SRCS+=		pwcache.c
20.endif
21
22_WITH_STRSVIS!=	grep -c strsvis /usr/include/vis.h || true
23.if ${_WITH_STRSVIS} == 0
24.PATH: ${.CURDIR}/../../contrib/libc-vis
25SRCS+=		vis.c
26CFLAGS+=	-I${.CURDIR}/../../contrib/libc-vis \
27		-I${.CURDIR}/../../lib/libc/include
28.endif
29
30_WITH_REALLOCARRAY!= grep -c reallocarray /usr/include/stdlib.h || true
31.if ${_WITH_REALLOCARRAY} == 0
32.PATH: ${.CURDIR}/../../lib/libc/stdlib
33INCS+=		stdlib.h
34SRCS+=		reallocarray.c
35CFLAGS+=	-I${.CURDIR}/../../lib/libc/include
36.endif
37
38_WITH_UTIMENS!= grep -c utimensat /usr/include/sys/stat.h || true
39.if ${_WITH_UTIMENS} == 0
40SYSINCS+=	stat.h
41SRCS+=		futimens.c utimensat.c
42.endif
43
44_WITH_EXPLICIT_BZERO!= grep -c explicit_bzero /usr/include/strings.h || true
45.if ${_WITH_EXPLICIT_BZERO} == 0
46.PATH: ${SRCTOP}/sys/libkern
47INCS+=		strings.h
48SRCS+=		explicit_bzero.c
49.endif
50
51.if empty(SRCS)
52SRCS=		dummy.c
53.endif
54
55.if defined(CROSS_BUILD_TESTING)
56SUBDIR=		cross-build
57.endif
58
59# Needed to build config (since it uses libnv)
60SYSINCS+=	${SRCTOP}/sys/sys/nv.h ${SRCTOP}/sys/sys/cnv.h
61
62
63# Create all the directories that are needed during the legacy, bootstrap-tools
64# and cross-tools stages. We do this here using mkdir since mtree may not exist
65# yet (this happens if we are crossbuilding from Linux/Mac).
66installdirs:
67.for _dir in bin sbin usr/bin usr/sbin usr/lib usr/include lib/geom lib/casper
68	mkdir -p "${DESTDIR}/${_dir}"
69.endfor
70
71.for _group in ${INCSGROUPS:NINCS}
72	mkdir -p "${DESTDIR}/${${_group}DIR}"
73.endfor
74
75.include <bsd.lib.mk>
76