Makefile revision 1.46
1#	$NetBSD: Makefile,v 1.46 2025/12/28 18:43:25 thorpej Exp $
2
3NOLIBCSANITIZER=	# defined
4NOSANITIZER=		# defined
5
6.include <bsd.own.mk>
7.include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
8
9WARNS=		1
10# XXX
11.if ${MACHINE_ARCH} != "m68000"
12DBG+=		-Os
13.endif
14
15CRUNCHGEN_FLAGS+=-V DBG="${DBG}"
16
17.if ${MKSTATICPIE:Uno} == "yes"
18CFLAGS+=-fPIE
19CRUNCHGEN_FLAGS+=-V LDSTATIC="-static -pie"
20.else
21CRUNCHGEN_FLAGS+=-V LDSTATIC="-static" -V NOPIE=
22.endif
23
24CRUNCHGEN_FLAGS+=-V NOLIBCSANITIZER= -V NOSANITIZER= -V NOMAN=
25
26.if (${MKSSH} != "no")
27# libssh is private, so libssh.a is not installed in DESTDIR, so we
28# have to get it out of the objdir.
29#
30# XXX Should do this differently, and uniformly for all libraries.
31.if !defined(LIBDO.ssh)
32LIBDO.ssh!=	cd ${NETBSDSRCDIR}/crypto/external/bsd/openssh/lib && \
33		${PRINTOBJDIR}
34.MAKEOVERRIDES+=LIBDO.ssh
35.endif
36CRUNCHGEN_FLAGS+=-L ${LIBDO.ssh}
37.endif		# MKSSH != "no"
38
39RESCUEDIR=	/rescue
40CRUNCHBIN=	rescue
41CRUNCHENV=	RESCUEDIR=${RESCUEDIR}
42SMALLPROG=	0
43LISTS=		${.CURDIR}/list
44TARGETDIR=	${DESTDIR}/rescue
45PARSELISTENV+=  TARGETDIR=${TARGETDIR:Q}
46
47.for f in pdisk
48PROG_${f}!=	cd ${NETBSDSRCDIR}/external/bsd/${f}/bin && ${MAKE} -V PROG
49.if (${PROG_${f}} != "")
50LISTS+=		${.CURDIR}/list.${f}
51.endif
52.endfor
53
54RESCUEFSLIST=	adosfs cd9660fs efs ext2fs fdescfs filecorefs kernfs lfs \
55		msdosfs nfs ntfs nullfs overlayfs procfs tmpfs umapfs unionfs
56
57.for f in ${RESCUEFSLIST}
58.if (${MK${f:tu}} != "no")
59LISTS+=		${.CURDIR}/list.${f}
60.endif
61.endfor
62
63.if ${USE_INET6} != "no"
64LISTS+=		${.CURDIR}/list.inet6
65.endif
66
67.if ${MKIPSEC} != "no"
68LISTS+=		${.CURDIR}/list.ipsec
69.endif
70
71.if ${MKSSH} != "no"
72LISTS+=		${.CURDIR}/list.ssh
73CRUNCHENV+=	MKKERBEROS=no		# for ssh
74.endif
75
76LISTS+=		${.CURDIR}/list.crypto
77
78LISTS+=		${.CURDIR}/list.ldd
79LDD_ELF32DIR!=	cd ${NETBSDSRCDIR}/usr.bin/ldd/elf32 && ${PRINTOBJDIR}
80LDD_ELF64DIR!=	cd ${NETBSDSRCDIR}/usr.bin/ldd/elf64 && ${PRINTOBJDIR}
81PARSELISTENV+=	LDD_ELF32DIR=${LDD_ELF32DIR} LDD_ELF64DIR=${LDD_ELF64DIR}
82
83#	Specially built objects to override the behaviour of
84#	various library functions
85#
86
87OVERRIDEOBJS=	rcmd.o
88.PATH:	${NETBSDSRCDIR}/lib/libc/net
89CPPFLAGS.rcmd.c+=-I${NETBSDSRCDIR}/lib/libc/include -DRESCUEDIR=\"${RESCUEDIR}\"
90
91LIBOVERRIDE=	liboverride.o
92${LIBOVERRIDE}: ${OVERRIDEOBJS}
93	${_MKTARGET_LINK}
94	${LD} -r -o $@ ${OVERRIDEOBJS}
95
96CLEANFILES+=	${OVERRIDEOBJS} ${LIBOVERRIDE}
97
98${CRUNCHBIN}:	${LIBOVERRIDE}
99
100
101#	The primary target ...
102#
103
104CLEANFILES+=	rescue.unstripped
105
106.include "${DISTRIBDIR}/common/Makefile.crunch"
107
108realall: ${CRUNCHBIN}
109
110install: ${CRUNCHBIN}
111# XXX this MKMSG doesn't line up
112	${_MKMSG} "populate ${TARGETDIR}"
113	${PARSELIST} -v mode=install ${LISTS} | ${MAKE} -f - install
114
115.include <bsd.prog.mk>
116