1 # $NetBSD: Makefile,v 1.48 2026/08/01 20:48:02 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 ${MKRAID} != "no" 72 LISTS+= ${.CURDIR}/list.raid 73 .endif 74 75 .if ${MKSSH} != "no" 76 LISTS+= ${.CURDIR}/list.ssh 77 CRUNCHENV+= MKKERBEROS=no # for ssh 78 .endif 79 80 .if ${MKUSB} != "no" 81 LISTS+= ${.CURDIR}/list.usb 82 .endif 83 84 LISTS+= ${.CURDIR}/list.crypto 85 86 LISTS+= ${.CURDIR}/list.ldd 87 LDD_ELF32DIR!= cd ${NETBSDSRCDIR}/usr.bin/ldd/elf32 && ${PRINTOBJDIR} 88 LDD_ELF64DIR!= cd ${NETBSDSRCDIR}/usr.bin/ldd/elf64 && ${PRINTOBJDIR} 89 PARSELISTENV+= LDD_ELF32DIR=${LDD_ELF32DIR} LDD_ELF64DIR=${LDD_ELF64DIR} 90 91 # Specially built objects to override the behaviour of 92 # various library functions 93 # 94 95 OVERRIDEOBJS= rcmd.o 96 .PATH: ${NETBSDSRCDIR}/lib/libc/net 97 CPPFLAGS.rcmd.c+=-I${NETBSDSRCDIR}/lib/libc/include -DRESCUEDIR=\"${RESCUEDIR}\" 98 99 LIBOVERRIDE= liboverride.o 100 ${LIBOVERRIDE}: ${OVERRIDEOBJS} 101 ${_MKTARGET_LINK} 102 ${LD} -r -o $@ ${OVERRIDEOBJS} 103 104 CLEANFILES+= ${OVERRIDEOBJS} ${LIBOVERRIDE} 105 106 ${CRUNCHBIN}: ${LIBOVERRIDE} 107 108 109 # The primary target ... 110 # 111 112 CLEANFILES+= rescue.unstripped 113 114 .include "${DISTRIBDIR}/common/Makefile.crunch" 115 116 realall: ${CRUNCHBIN} 117 118 install: ${CRUNCHBIN} 119 # XXX this MKMSG doesn't line up 120 ${_MKMSG} "populate ${TARGETDIR}" 121 ${PARSELIST} -v mode=install ${LISTS} | ${MAKE} -f - install 122 123 .include <bsd.prog.mk> 124