Home | History | Annotate | Line # | Download | only in rescue
Makefile revision 1.46
      1 #	$NetBSD: Makefile,v 1.46 2025/12/28 18:43:25 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 LISTS+=		${.CURDIR}/list.crypto
     77 
     78 LISTS+=		${.CURDIR}/list.ldd
     79 LDD_ELF32DIR!=	cd ${NETBSDSRCDIR}/usr.bin/ldd/elf32 && ${PRINTOBJDIR}
     80 LDD_ELF64DIR!=	cd ${NETBSDSRCDIR}/usr.bin/ldd/elf64 && ${PRINTOBJDIR}
     81 PARSELISTENV+=	LDD_ELF32DIR=${LDD_ELF32DIR} LDD_ELF64DIR=${LDD_ELF64DIR}
     82 
     83 #	Specially built objects to override the behaviour of
     84 #	various library functions
     85 #
     86 
     87 OVERRIDEOBJS=	rcmd.o
     88 .PATH:	${NETBSDSRCDIR}/lib/libc/net
     89 CPPFLAGS.rcmd.c+=-I${NETBSDSRCDIR}/lib/libc/include -DRESCUEDIR=\"${RESCUEDIR}\"
     90 
     91 LIBOVERRIDE=	liboverride.o
     92 ${LIBOVERRIDE}: ${OVERRIDEOBJS}
     93 	${_MKTARGET_LINK}
     94 	${LD} -r -o $@ ${OVERRIDEOBJS}
     95 
     96 CLEANFILES+=	${OVERRIDEOBJS} ${LIBOVERRIDE}
     97 
     98 ${CRUNCHBIN}:	${LIBOVERRIDE}
     99 
    100 
    101 #	The primary target ...
    102 #
    103 
    104 CLEANFILES+=	rescue.unstripped
    105 
    106 .include "${DISTRIBDIR}/common/Makefile.crunch"
    107 
    108 realall: ${CRUNCHBIN}
    109 
    110 install: ${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