Home | History | Annotate | Line # | Download | only in rescue
      1 #	$NetBSD: Makefile,v 1.47 2025/12/28 19:07:42 thorpej Exp $
      2 
      3 NOLIBCSANITIZER=	# defined
      4 NOSANITIZER=		# defined
      5 
      6 .include <bsd.own.mk>
      7 .include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
      8 
      9 WARNS=		1
     10 # XXX
     11 .if ${MACHINE_ARCH} != "m68000"
     12 DBG+=		-Os
     13 .endif
     14 
     15 CRUNCHGEN_FLAGS+=-V DBG="${DBG}"
     16 
     17 .if ${MKSTATICPIE:Uno} == "yes"
     18 CFLAGS+=-fPIE
     19 CRUNCHGEN_FLAGS+=-V LDSTATIC="-static -pie"
     20 .else
     21 CRUNCHGEN_FLAGS+=-V LDSTATIC="-static" -V NOPIE=
     22 .endif
     23 
     24 CRUNCHGEN_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)
     32 LIBDO.ssh!=	cd ${NETBSDSRCDIR}/crypto/external/bsd/openssh/lib && \
     33 		${PRINTOBJDIR}
     34 .MAKEOVERRIDES+=LIBDO.ssh
     35 .endif
     36 CRUNCHGEN_FLAGS+=-L ${LIBDO.ssh}
     37 .endif		# MKSSH != "no"
     38 
     39 RESCUEDIR=	/rescue
     40 CRUNCHBIN=	rescue
     41 CRUNCHENV=	RESCUEDIR=${RESCUEDIR}
     42 SMALLPROG=	0
     43 LISTS=		${.CURDIR}/list
     44 TARGETDIR=	${DESTDIR}/rescue
     45 PARSELISTENV+=  TARGETDIR=${TARGETDIR:Q}
     46 
     47 .for f in pdisk
     48 PROG_${f}!=	cd ${NETBSDSRCDIR}/external/bsd/${f}/bin && ${MAKE} -V PROG
     49 .if (${PROG_${f}} != "")
     50 LISTS+=		${.CURDIR}/list.${f}
     51 .endif
     52 .endfor
     53 
     54 RESCUEFSLIST=	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")
     59 LISTS+=		${.CURDIR}/list.${f}
     60 .endif
     61 .endfor
     62 
     63 .if ${USE_INET6} != "no"
     64 LISTS+=		${.CURDIR}/list.inet6
     65 .endif
     66 
     67 .if ${MKIPSEC} != "no"
     68 LISTS+=		${.CURDIR}/list.ipsec
     69 .endif
     70 
     71 .if ${MKSSH} != "no"
     72 LISTS+=		${.CURDIR}/list.ssh
     73 CRUNCHENV+=	MKKERBEROS=no		# for ssh
     74 .endif
     75 
     76 .if ${MKUSB} != "no"
     77 LISTS+=		${.CURDIR}/list.usb
     78 .endif
     79 
     80 LISTS+=		${.CURDIR}/list.crypto
     81 
     82 LISTS+=		${.CURDIR}/list.ldd
     83 LDD_ELF32DIR!=	cd ${NETBSDSRCDIR}/usr.bin/ldd/elf32 && ${PRINTOBJDIR}
     84 LDD_ELF64DIR!=	cd ${NETBSDSRCDIR}/usr.bin/ldd/elf64 && ${PRINTOBJDIR}
     85 PARSELISTENV+=	LDD_ELF32DIR=${LDD_ELF32DIR} LDD_ELF64DIR=${LDD_ELF64DIR}
     86 
     87 #	Specially built objects to override the behaviour of
     88 #	various library functions
     89 #
     90 
     91 OVERRIDEOBJS=	rcmd.o
     92 .PATH:	${NETBSDSRCDIR}/lib/libc/net
     93 CPPFLAGS.rcmd.c+=-I${NETBSDSRCDIR}/lib/libc/include -DRESCUEDIR=\"${RESCUEDIR}\"
     94 
     95 LIBOVERRIDE=	liboverride.o
     96 ${LIBOVERRIDE}: ${OVERRIDEOBJS}
     97 	${_MKTARGET_LINK}
     98 	${LD} -r -o $@ ${OVERRIDEOBJS}
     99 
    100 CLEANFILES+=	${OVERRIDEOBJS} ${LIBOVERRIDE}
    101 
    102 ${CRUNCHBIN}:	${LIBOVERRIDE}
    103 
    104 
    105 #	The primary target ...
    106 #
    107 
    108 CLEANFILES+=	rescue.unstripped
    109 
    110 .include "${DISTRIBDIR}/common/Makefile.crunch"
    111 
    112 realall: ${CRUNCHBIN}
    113 
    114 install: ${CRUNCHBIN}
    115 # XXX this MKMSG doesn't line up
    116 	${_MKMSG} "populate ${TARGETDIR}"
    117 	${PARSELIST} -v mode=install ${LISTS} | ${MAKE} -f - install
    118 
    119 .include <bsd.prog.mk>
    120