1285303Sgshapiro 290792Sgshapiro.include <src.opts.mk> 390792Sgshapiro.include <bsd.linker.mk> 490792Sgshapiro 590792SgshapiroPACKAGE=rescue 690792SgshapiroMAN= 790792SgshapiroMK_SSP= no 8266692Sgshapiro# Static-PIE is not supported so we should not be linking against _pie.a libs. 990792Sgshapiro# This is also needed to avoid linking against sanitizer-instrumented libraries 1090792Sgshapiro# since MK_ASAN/MK_UBSAN will instrument the .pieo object files. 1190792SgshapiroMK_PIE= no 1290792SgshapiroNO_SHARED= yes 1390792SgshapiroCRUNCH_BUILDOPTS+= MK_PIE=no NO_SHARED=yes 1490792Sgshapiro 1590792Sgshapiro# lld >= 16 became more strict about multiply defined symbols. Since there are 1690792Sgshapiro# many of those in crunchgen'd programs, turn off the check. 1790792Sgshapiro.if ${LINKER_TYPE} == "lld" && ${LINKER_VERSION} >= 160000 1890792SgshapiroLDFLAGS+= -Wl,--allow-multiple-definition 1990792Sgshapiro.endif 2090792Sgshapiro 2190792SgshapiroPROG= rescue 2290792SgshapiroBINDIR?=/rescue 2390792Sgshapiro 2490792SgshapiroSCRIPTS+= dhclient_FIXED 2590792SgshapiroSCRIPTSNAME_dhclient_FIXED= dhclient-script 2690792Sgshapirodhclient_FIXED: ../../sbin/dhclient/dhclient-script 2790792Sgshapiro sed '1s/\/bin\//\/rescue\//' ${.ALLSRC} > ${.TARGET} 2890792SgshapiroCLEANFILES+= dhclient_FIXED 2990792Sgshapiro 3090792Sgshapiro# The help which used to be here is now in mk/bsd.crunchgen.mk 3190792Sgshapiro 3290792Sgshapiro# Define Makefile variable RESCUE 3390792SgshapiroCRUNCH_BUILDOPTS+= -DRESCUE 3490792Sgshapiro# Define compile-time RESCUE symbol when compiling components 3590792SgshapiroCRUNCH_BUILDOPTS+= CRUNCH_CFLAGS=-DRESCUE 3690792Sgshapiro 3790792Sgshapiro# An experiment that failed: try overriding bsd.lib.mk and bsd.prog.mk 3890792Sgshapiro# rather than incorporating rescue-specific logic into standard files. 3990792Sgshapiro#MAKEFLAGS= -m ${.CURDIR} ${.MAKEFLAGS} 4090792Sgshapiro 4190792Sgshapiro# Hackery: 'librescue' exists merely as a tool for appropriately 42168515Sgshapiro# recompiling specific library entries. We _know_ they're needed, and 4390792Sgshapiro# regular archive searching creates ugly library ordering problems. 4490792Sgshapiro# Easiest fix: tell the linker to include them into the executable 4590792Sgshapiro# first, so they are guaranteed to override the regular lib entries. 4690792Sgshapiro# Note that if 'librescue' hasn't been compiled, we'll just get the 4790792Sgshapiro# regular lib entries from libc and friends. 4890792SgshapiroCRUNCH_LIBS+= ${.OBJDIR}/../librescue/*.o 4990792Sgshapiro 5090792Sgshapiro################################################################### 5190792Sgshapiro# Programs from stock /bin 52168515Sgshapiro# 5390792Sgshapiro# WARNING: Changing this list may require adjusting 5490792Sgshapiro# /usr/include/paths.h as well! You were warned! 5590792Sgshapiro# 5690792SgshapiroCRUNCH_SRCDIRS+= bin 5790792SgshapiroCRUNCH_PROGS_bin= cat chflags chio chmod cp date dd df echo \ 5890792Sgshapiro ed expr getfacl hostname kenv kill ln ls mkdir mv \ 5990792Sgshapiro pkill ps pwd realpath rm rmdir setfacl sh sleep stty \ 6090792Sgshapiro sync test 6190792SgshapiroCRUNCH_LIBS+= -lcrypt -ledit -ljail -lkvm -lelf -ltermcapw -lutil -lxo 6290792SgshapiroCRUNCH_BUILDTOOLS+= bin/sh 6390792Sgshapiro 6490792Sgshapiro# Additional options for specific programs 6590792SgshapiroCRUNCH_ALIAS_test= [ 6690792SgshapiroCRUNCH_ALIAS_sh= -sh 6790792Sgshapiro# The -sh alias shouldn't appear in /rescue as a hard link 6890792SgshapiroCRUNCH_SUPPRESS_LINK_-sh= 1 6990792SgshapiroCRUNCH_ALIAS_ln= link 7090792SgshapiroCRUNCH_ALIAS_rm= unlink 7190792SgshapiroCRUNCH_ALIAS_ed= red 7290792SgshapiroCRUNCH_ALIAS_pkill= pgrep 7390792Sgshapiro 7490792Sgshapiro.if ${MK_TCSH} != "no" 7590792SgshapiroCRUNCH_PROGS_bin+= csh 7690792SgshapiroCRUNCH_ALIAS_csh= -csh tcsh -tcsh 7790792SgshapiroCRUNCH_BUILDTOOLS+= bin/csh 7890792SgshapiroCRUNCH_SUPPRESS_LINK_-csh= 1 79168515SgshapiroCRUNCH_SUPPRESS_LINK_-tcsh= 1 8090792Sgshapiro.endif 8190792Sgshapiro 8290792Sgshapiro################################################################### 8390792Sgshapiro# Programs from standard /sbin 8490792Sgshapiro# 8590792Sgshapiro# WARNING: Changing this list may require adjusting 8690792Sgshapiro# /usr/include/paths.h as well! You were warned! 8790792Sgshapiro# 8890792Sgshapiro# Note that mdmfs have their own private 'pathnames.h' 8990792Sgshapiro# headers in addition to the standard 'paths.h' header. 9090792Sgshapiro# 9190792SgshapiroCRUNCH_SRCDIRS+= sbin 9290792SgshapiroCRUNCH_PROGS_sbin= \ 9390792Sgshapiro camcontrol clri devfs dmesg dump \ 9490792Sgshapiro dumpfs dumpon fsck fsck_ffs fsck_msdosfs fsdb \ 9590792Sgshapiro fsirand geom ifconfig init \ 9690792Sgshapiro kldconfig kldload kldstat kldunload ldconfig \ 9790792Sgshapiro md5 mdconfig mdmfs mknod mount mount_cd9660 \ 98168515Sgshapiro mount_msdosfs mount_nfs mount_nullfs \ 9990792Sgshapiro mount_udf mount_unionfs newfs \ 10090792Sgshapiro newfs_msdos nos-tun reboot \ 10190792Sgshapiro restore rcorder route savecore \ 10290792Sgshapiro shutdown swapon sysctl tunefs umount 10390792Sgshapiro 10490792Sgshapiro.if ${MK_CCD} != "no" 10590792SgshapiroCRUNCH_PROGS_sbin+= ccdconfig 10690792Sgshapiro.endif 10790792Sgshapiro 10890792Sgshapiro.if ${MK_INET} != "no" || ${MK_INET6} != "no" 10990792SgshapiroCRUNCH_PROGS_sbin+= ping 11090792Sgshapiro.endif 11190792Sgshapiro 11290792Sgshapiro.if ${MK_INET6_SUPPORT} != "no" 11390792SgshapiroCRUNCH_ALIAS_ping= ping6 11490792SgshapiroCRUNCH_PROGS_sbin+= rtsol 11590792Sgshapiro.endif 11690792Sgshapiro 11790792Sgshapiro.if ${MK_IPFILTER} != "no" 11890792SgshapiroCRUNCH_PROGS_sbin+= ipf 11990792SgshapiroCRUNCH_LIBS_ipf+= ${LIBIPF} 12090792Sgshapiro.endif 12190792Sgshapiro 12290792Sgshapiro.if ${MK_IPFW} != "no" 12390792SgshapiroCRUNCH_PROGS_sbin+= ipfw 12490792Sgshapiro.endif 12590792Sgshapiro 12690792Sgshapiro.if ${MK_PF} != "no" 12790792SgshapiroCRUNCH_PROGS_sbin+= pfctl 12890792SgshapiroCRUNCH_LIBS_pfctl+= ${LIBPFCTL} ${LIBNV} 12990792Sgshapiro.endif 13090792Sgshapiro 13190792Sgshapiro.if ${MK_ROUTED} != "no" 13290792SgshapiroCRUNCH_PROGS_sbin+= routed rtquery 13390792Sgshapiro.endif 13490792Sgshapiro 13590792Sgshapiro.if ${MK_ZFS} != "no" 13690792SgshapiroCRUNCH_PROGS_sbin+= bectl 13790792SgshapiroCRUNCH_PROGS_sbin+= zfs 138285303SgshapiroCRUNCH_PROGS_sbin+= zfsbootcfg 139285303SgshapiroCRUNCH_PROGS_sbin+= zpool 140285303SgshapiroCRUNCH_PROGS_usr.sbin+= zdb 141285303Sgshapiro.endif 142285303Sgshapiro 143285303Sgshapiro# crunchgen does not like C++ programs; this should be fixed someday 144285303Sgshapiro# CRUNCH_PROGS+= devd 145285303Sgshapiro 146285303SgshapiroCRUNCH_LIBS+= -l80211 -lalias -lcam -lncursesw -ldevstat -lipsec -llzma 147285303SgshapiroCRUNCH_LIBS_camcontrol+= ${LIBNVMF} 14890792Sgshapiro.if ${MK_ZFS} != "no" 149285303SgshapiroCRUNCH_LIBS+= -lavl -lpthread -luutil -lumem -ltpool -lspl -lrt 15090792SgshapiroCRUNCH_LIBS_zfs+= ${LIBBE} \ 15190792Sgshapiro ${LIBZPOOL} \ 15290792Sgshapiro ${LIBZFS} \ 153168515Sgshapiro ${LIBZUTIL} \ 15490792Sgshapiro ${LIBZFS_CORE} \ 15594334Sgshapiro ${LIBZFSBOOTENV} \ 15694334Sgshapiro ${LIBICP_RESCUE} \ 15794334Sgshapiro ${LIBNVPAIR} 15894334SgshapiroCRUNCH_LIBS_bectl+= ${CRUNCH_LIBS_zfs} 15994334SgshapiroCRUNCH_LIBS_zpool+= ${CRUNCH_LIBS_zfs} 16094334SgshapiroCRUNCH_LIBS_zdb+= ${CRUNCH_LIBS_zfs} ${LIBZDB} 16190792SgshapiroCRUNCH_LIBS_zfsbootcfg+=${LIBZFSBOOTENV} \ 162168515Sgshapiro ${LIBZPOOL} \ 163168515Sgshapiro ${LIBZFS} \ 164168515Sgshapiro ${LIBZUTIL} \ 16590792Sgshapiro ${LIBZFS_CORE} \ 16690792Sgshapiro ${LIBICP_RESCUE} \ 16790792Sgshapiro ${LIBNVPAIR} 16890792Sgshapiro.else 16990792Sgshapiro# liblzma needs pthread 17090792SgshapiroCRUNCH_LIBS+= -lpthread 17190792Sgshapiro.endif 17290792SgshapiroCRUNCH_LIBS+= -lgeom -lbsdxml -lkiconv 17390792Sgshapiro.if ${MK_OPENSSL} == "no" 17490792SgshapiroCRUNCH_LIBS+= -lmd 17590792Sgshapiro.endif 17690792SgshapiroCRUNCH_LIBS+= -lmt -lsbuf -lufs -lz 17790792Sgshapiro 17890792Sgshapiro.if ${MACHINE_CPUARCH} == "i386" 17990792SgshapiroCRUNCH_PROGS_sbin+= bsdlabel fdisk 18090792SgshapiroCRUNCH_ALIAS_bsdlabel= disklabel 18190792Sgshapiro#CRUNCH_PROGS+= mount_smbfs 18290792Sgshapiro#CRUNCH_LIBS+= -lsmb 18390792Sgshapiro.endif 18490792Sgshapiro 18590792Sgshapiro.if ${MACHINE_CPUARCH} == "amd64" 18690792SgshapiroCRUNCH_PROGS_sbin+= bsdlabel fdisk 18790792SgshapiroCRUNCH_ALIAS_bsdlabel= disklabel 18890792Sgshapiro.endif 18990792Sgshapiro 19090792SgshapiroCRUNCH_SRCDIR_rtquery= ${SRCTOP}/sbin/routed/rtquery 19190792SgshapiroCRUNCH_SRCDIR_ipf= ${SRCTOP}/sbin/ipf/ipf 19290792Sgshapiro.if ${MK_ZFS} != "no" 19390792SgshapiroCRUNCH_SRCDIR_zfs= ${SRCTOP}/cddl/sbin/zfs 19490792SgshapiroCRUNCH_SRCDIR_zpool= ${SRCTOP}/cddl/sbin/zpool 19590792SgshapiroCRUNCH_SRCDIR_zdb= ${SRCTOP}/cddl/usr.sbin/zdb 19690792Sgshapiro.endif 19790792SgshapiroCRUNCH_ALIAS_reboot= fastboot halt fasthalt nextboot 19890792SgshapiroCRUNCH_ALIAS_restore= rrestore 19990792SgshapiroCRUNCH_ALIAS_dump= rdump 20090792SgshapiroCRUNCH_ALIAS_fsck_ffs= fsck_4.2bsd fsck_ufs 20190792SgshapiroCRUNCH_ALIAS_geom= glabel gpart 20290792SgshapiroCRUNCH_ALIAS_shutdown= poweroff 20390792Sgshapiro 20490792Sgshapiro# dhclient has historically been troublesome... 20590792SgshapiroCRUNCH_PROGS_sbin+= dhclient 20690792Sgshapiro 20790792Sgshapiro################################################################## 20890792Sgshapiro# Programs from stock /usr/bin 20990792Sgshapiro# 21090792SgshapiroCRUNCH_SRCDIRS+= usr.bin 21190792Sgshapiro 21290792SgshapiroCRUNCH_PROGS_usr.bin= head mt sed tail tee 21390792Sgshapiro 21490792SgshapiroCRUNCH_PROGS_usr.bin+= gzip 21590792SgshapiroCRUNCH_ALIAS_gzip= gunzip gzcat zcat 21690792Sgshapiro 21790792SgshapiroCRUNCH_PROGS_usr.bin+= bzip2 21890792SgshapiroCRUNCH_ALIAS_bzip2= bunzip2 bzcat 21990792SgshapiroCRUNCH_LIBS+= -lbz2 22090792Sgshapiro 22190792SgshapiroCRUNCH_PROGS_usr.bin+= less 22290792SgshapiroCRUNCH_ALIAS_less= more 223168515Sgshapiro 22490792SgshapiroCRUNCH_PROGS_usr.bin+= xz 22590792SgshapiroCRUNCH_ALIAS_xz= unxz lzma unlzma xzcat lzcat 226168515Sgshapiro 22790792SgshapiroCRUNCH_PROGS_usr.bin+= zstd 22890792SgshapiroCRUNCH_ALIAS_zstd= unzstd zstdcat zstdmt 22990792SgshapiroCRUNCH_LIBS+= -lprivatezstd 23090792Sgshapiro 23190792SgshapiroCRUNCH_PROGS_usr.bin+= fetch 23290792SgshapiroCRUNCH_LIBS+= -lfetch 23390792Sgshapiro 23490792SgshapiroCRUNCH_PROGS_usr.bin+= tar 23590792SgshapiroCRUNCH_LIBS+= -larchive 23690792Sgshapiro.if ${MK_OPENSSL} != "no" 23790792SgshapiroCRUNCH_LIBS+= -lssl -lcrypto 23890792Sgshapiro.endif 23990792SgshapiroCRUNCH_LIBS+= -lmd 24090792Sgshapiro 24190792Sgshapiro.if ${MK_NETCAT} != "no" 242CRUNCH_PROGS_usr.bin+= nc 243.endif 244 245.if ${MK_VI} != "no" 246CRUNCH_PROGS_usr.bin+= vi 247CRUNCH_ALIAS_vi= ex 248.endif 249 250CRUNCH_PROGS_usr.bin+= id 251CRUNCH_ALIAS_id= groups whoami 252 253################################################################## 254# Programs from stock /usr/sbin 255# 256CRUNCH_SRCDIRS+= usr.sbin 257 258CRUNCH_PROGS_usr.sbin+= chroot 259 260CRUNCH_PROGS_usr.sbin+= chown 261CRUNCH_ALIAS_chown= chgrp 262################################################################## 263 264CRUNCH_LIBS+= ${OBJTOP}/lib/libifconfig/libifconfig.a 265CRUNCH_BUILDOPTS+= CRUNCH_CFLAGS+=-I${OBJTOP}/lib/libifconfig 266 267CRUNCH_LIBS_ifconfig+= ${LIBNV} 268 269CRUNCH_LIBS+= -lm 270 271.if ${MK_ISCSI} != "no" 272CRUNCH_PROGS_usr.bin+= iscsictl 273CRUNCH_PROGS_usr.sbin+= iscsid 274 275CRUNCH_LIBS+= ${OBJTOP}/lib/libiscsiutil/libiscsiutil.a 276CRUNCH_BUILDOPTS+= CRUNCH_CFLAGS+=-I${OBJTOP}/lib/libiscsiutil 277.endif 278 279.include <bsd.crunchgen.mk> 280.include <bsd.prog.mk> 281