xref: /freebsd/rescue/rescue/Makefile (revision 93b09f58)
1884c25d1SGordon Tetlow#$FreeBSD$
2884c25d1SGordon Tetlow#	@(#)Makefile	8.1 (Berkeley) 6/2/93
3884c25d1SGordon Tetlow
4c6063d0dSWarner Losh.include <src.opts.mk>
54af3fa14SWarner Losh
6ca832df4SGlen BarberPACKAGE=rescue
74af3fa14SWarner LoshMAN=
8d9ca85fcSRuslan ErmilovMK_SSP=	no
9e1fe3dbaSRuslan Ermilov
10884c25d1SGordon TetlowPROG=	rescue
11884c25d1SGordon TetlowBINDIR?=/rescue
12884c25d1SGordon Tetlow
13884c25d1SGordon Tetlow# Shell scripts need #! line to be edited from /bin/sh to /rescue/sh
14884c25d1SGordon TetlowSCRIPTS= nextboot_FIXED
1504ddb211SJohn BaldwinSCRIPTSNAME_nextboot_FIXED= nextboot
16884c25d1SGordon Tetlownextboot_FIXED: ../../sbin/reboot/nextboot.sh
17884c25d1SGordon Tetlow	sed '1s/\/bin\//\/rescue\//' ${.ALLSRC} > ${.TARGET}
18884c25d1SGordon TetlowCLEANFILES+= nextboot_FIXED
19884c25d1SGordon Tetlow
20d4208689SBrooks DavisSCRIPTS+= dhclient_FIXED
21d4208689SBrooks DavisSCRIPTSNAME_dhclient_FIXED= dhclient-script
22d4208689SBrooks Davisdhclient_FIXED: ../../sbin/dhclient/dhclient-script
23d4208689SBrooks Davis	sed '1s/\/bin\//\/rescue\//' ${.ALLSRC} > ${.TARGET}
24d4208689SBrooks DavisCLEANFILES+= dhclient_FIXED
25884c25d1SGordon Tetlow
26169733f4SAdrian Chadd# The help which used to be here is now in mk/bsd.crunchgen.mk
27884c25d1SGordon Tetlow
28884c25d1SGordon Tetlow# Define Makefile variable RESCUE
29884c25d1SGordon TetlowCRUNCH_BUILDOPTS+= -DRESCUE
30884c25d1SGordon Tetlow# Define compile-time RESCUE symbol when compiling components
31884c25d1SGordon TetlowCRUNCH_BUILDOPTS+= CRUNCH_CFLAGS=-DRESCUE
32884c25d1SGordon Tetlow
334d938af0SGordon Tetlow# An experiment that failed: try overriding bsd.lib.mk and bsd.prog.mk
344d938af0SGordon Tetlow# rather than incorporating rescue-specific logic into standard files.
35884c25d1SGordon Tetlow#MAKEFLAGS= -m ${.CURDIR} ${.MAKEFLAGS}
36884c25d1SGordon Tetlow
37884c25d1SGordon Tetlow# Hackery:  'librescue' exists merely as a tool for appropriately
38884c25d1SGordon Tetlow# recompiling specific library entries.  We _know_ they're needed, and
39884c25d1SGordon Tetlow# regular archive searching creates ugly library ordering problems.
40884c25d1SGordon Tetlow# Easiest fix: tell the linker to include them into the executable
41884c25d1SGordon Tetlow# first, so they are guaranteed to override the regular lib entries.
42884c25d1SGordon Tetlow# Note that if 'librescue' hasn't been compiled, we'll just get the
43884c25d1SGordon Tetlow# regular lib entries from libc and friends.
44884c25d1SGordon TetlowCRUNCH_LIBS+= ${.OBJDIR}/../librescue/*.o
45884c25d1SGordon Tetlow
46884c25d1SGordon Tetlow###################################################################
47884c25d1SGordon Tetlow# Programs from stock /bin
48884c25d1SGordon Tetlow#
49884c25d1SGordon Tetlow# WARNING: Changing this list may require adjusting
50884c25d1SGordon Tetlow# /usr/include/paths.h as well!  You were warned!
51884c25d1SGordon Tetlow#
52d60d0f81SGordon TetlowCRUNCH_SRCDIRS+= bin
5339ae372dSDavid E. O'BrienCRUNCH_PROGS_bin= cat chflags chio chmod cp date dd df echo 	\
5421be3b31SYaroslav Tykhiy	 ed expr getfacl hostname kenv kill ln ls mkdir mv	\
55e8b00d3dSXin LI	 pkill ps pwd realpath rm rmdir setfacl sh sleep stty	\
56e8b00d3dSXin LI	 sync test
577f911abeSJohn BaldwinCRUNCH_LIBS+= -lcrypt -ledit -ljail -lkvm -lelf -ll -ltermcapw -lutil -lxo
58169733f4SAdrian ChaddCRUNCH_BUILDTOOLS+= bin/sh
59884c25d1SGordon Tetlow
60884c25d1SGordon Tetlow# Additional options for specific programs
61884c25d1SGordon TetlowCRUNCH_ALIAS_test= [
62884c25d1SGordon TetlowCRUNCH_ALIAS_sh= -sh
63884c25d1SGordon Tetlow# The -sh alias shouldn't appear in /rescue as a hard link
64884c25d1SGordon TetlowCRUNCH_SUPPRESS_LINK_-sh= 1
65884c25d1SGordon TetlowCRUNCH_ALIAS_ln= link
66884c25d1SGordon TetlowCRUNCH_ALIAS_rm= unlink
67884c25d1SGordon TetlowCRUNCH_ALIAS_ed= red
68eb4e4048SYaroslav TykhiyCRUNCH_ALIAS_pkill= pgrep
69eb4e4048SYaroslav Tykhiy
70e1fe3dbaSRuslan Ermilov.if ${MK_TCSH} != "no"
71d60d0f81SGordon TetlowCRUNCH_PROGS_bin+= csh
72884c25d1SGordon TetlowCRUNCH_ALIAS_csh= -csh tcsh -tcsh
73169733f4SAdrian ChaddCRUNCH_BUILDTOOLS+= bin/csh
74884c25d1SGordon TetlowCRUNCH_SUPPRESS_LINK_-csh= 1
75884c25d1SGordon TetlowCRUNCH_SUPPRESS_LINK_-tcsh= 1
76884c25d1SGordon Tetlow.endif
77884c25d1SGordon Tetlow
78884c25d1SGordon Tetlow###################################################################
79884c25d1SGordon Tetlow# Programs from standard /sbin
80884c25d1SGordon Tetlow#
81884c25d1SGordon Tetlow# WARNING: Changing this list may require adjusting
82884c25d1SGordon Tetlow# /usr/include/paths.h as well!  You were warned!
83884c25d1SGordon Tetlow#
8439ae372dSDavid E. O'Brien# Note that mdmfs have their own private 'pathnames.h'
85884c25d1SGordon Tetlow# headers in addition to the standard 'paths.h' header.
86884c25d1SGordon Tetlow#
87d60d0f81SGordon TetlowCRUNCH_SRCDIRS+= sbin
8893b09f58SKonstantin BelousovCRUNCH_PROGS_sbin= 						\
895673173eSEnji Cooper	camcontrol clri devfs dmesg dump			\
90cc795cb4SMarius Strobl	dumpfs dumpon fsck fsck_ffs fsck_msdosfs fsdb		\
912f161397SMarcel Moolenaar	fsirand gbde geom ifconfig init 			\
9239ae372dSDavid E. O'Brien	kldconfig kldload kldstat kldunload ldconfig 		\
93c89454cbSCraig Rodrigues	md5 mdconfig mdmfs mknod mount mount_cd9660		\
94a42ac676SAttilio Rao	mount_msdosfs mount_nfs mount_nullfs			\
95534046e3SRong-En Fan	mount_udf mount_unionfs newfs				\
96043fc269SPoul-Henning Kamp	newfs_msdos nos-tun ping reboot				\
974ab40004SEnji Cooper	restore rcorder route savecore		 		\
986a6050acSEnji Cooper	shutdown spppcontrol swapon sysctl tunefs umount
9940353969SPoul-Henning Kamp
1005673173eSEnji Cooper.if ${MK_CCD} != "no"
1015673173eSEnji CooperCRUNCH_PROGS_sbin+= ccdconfig
1025673173eSEnji Cooper.endif
1035673173eSEnji Cooper
104e1fe3dbaSRuslan Ermilov.if ${MK_INET6_SUPPORT} != "no"
10540353969SPoul-Henning KampCRUNCH_PROGS_sbin+= ping6
1064ab40004SEnji CooperCRUNCH_PROGS_sbin+= rtsol
10740353969SPoul-Henning Kamp.endif
10840353969SPoul-Henning Kamp
109e1fe3dbaSRuslan Ermilov.if ${MK_IPFILTER} != "no"
110cf4ee2c9SDarren ReedCRUNCH_PROGS_sbin+= ipf
1115433713cSDavid E. O'Brien.endif
1125673173eSEnji Cooper
1135673173eSEnji Cooper.if ${MK_ROUTED} != "no"
1145673173eSEnji CooperCRUNCH_PROGS_sbin+= routed rtquery
1155673173eSEnji Cooper.endif
1165673173eSEnji Cooper
11787820315SKip Macy.if ${MK_ZFS} != "no"
11887820315SKip MacyCRUNCH_PROGS_sbin+= zfs
11987820315SKip MacyCRUNCH_PROGS_sbin+= zpool
1204c75e226SXin LICRUNCH_PROGS_usr.sbin+= zdb
12187820315SKip Macy.endif
1225433713cSDavid E. O'Brien
123884c25d1SGordon Tetlow# crunchgen does not like C++ programs; this should be fixed someday
124884c25d1SGordon Tetlow# CRUNCH_PROGS+= devd
125884c25d1SGordon Tetlow
126a2a45f90SEnji CooperCRUNCH_LIBS+= -l80211 -lalias -lcam -lncursesw -ldevstat -lipsec -llzma
12787820315SKip Macy.if ${MK_ZFS} != "no"
1284c75e226SXin LICRUNCH_LIBS+= -lavl -lzpool -lzfs_core -lzfs -lnvpair -lpthread -luutil -lumem
12953200025SRui Paulo.else
13053200025SRui Paulo# liblzma needs pthread
13153200025SRui PauloCRUNCH_LIBS+= -lpthread
13287820315SKip Macy.endif
13302b6306fSDimitry AndricCRUNCH_LIBS+= -lgeom -lbsdxml -lkiconv
13402b6306fSDimitry Andric.if ${MK_OPENSSL} == "no"
13502b6306fSDimitry AndricCRUNCH_LIBS+= -lmd
13602b6306fSDimitry Andric.endif
13743518607SKenneth D. MerryCRUNCH_LIBS+= -lmt -lsbuf -lufs -lz
138884c25d1SGordon Tetlow
13925faff34SWarner Losh.if ${MACHINE_CPUARCH} == "i386"
1402f161397SMarcel MoolenaarCRUNCH_PROGS_sbin+= bsdlabel sconfig fdisk
1419b6e332fSGordon TetlowCRUNCH_ALIAS_bsdlabel= disklabel
142237abf0cSDavide Italiano#CRUNCH_PROGS+= mount_smbfs
143237abf0cSDavide Italiano#CRUNCH_LIBS+= -lsmb
144884c25d1SGordon Tetlow.endif
145884c25d1SGordon Tetlow
14625faff34SWarner Losh.if ${MACHINE_CPUARCH} == "sparc64"
1472f161397SMarcel MoolenaarCRUNCH_PROGS_sbin+= bsdlabel sunlabel
148884c25d1SGordon Tetlow.endif
149884c25d1SGordon Tetlow
15025faff34SWarner Losh.if ${MACHINE_CPUARCH} == "amd64"
1512f161397SMarcel MoolenaarCRUNCH_PROGS_sbin+= bsdlabel fdisk
1529b6e332fSGordon TetlowCRUNCH_ALIAS_bsdlabel= disklabel
153884c25d1SGordon Tetlow.endif
154884c25d1SGordon Tetlow
15523583802SWarner LoshCRUNCH_SRCDIR_rtquery= ${SRCTOP}/sbin/routed/rtquery
15623583802SWarner LoshCRUNCH_SRCDIR_ipf= ${SRCTOP}/sbin/ipf/ipf
15787820315SKip Macy.if ${MK_ZFS} != "no"
15823583802SWarner LoshCRUNCH_SRCDIR_zfs= ${SRCTOP}/cddl/sbin/zfs
15923583802SWarner LoshCRUNCH_SRCDIR_zpool= ${SRCTOP}/cddl/sbin/zpool
16023583802SWarner LoshCRUNCH_SRCDIR_zdb= ${SRCTOP}/cddl/usr.sbin/zdb
16187820315SKip Macy.endif
162884c25d1SGordon TetlowCRUNCH_ALIAS_reboot= fastboot halt fasthalt
163884c25d1SGordon TetlowCRUNCH_ALIAS_restore= rrestore
164884c25d1SGordon TetlowCRUNCH_ALIAS_dump= rdump
165884c25d1SGordon TetlowCRUNCH_ALIAS_fsck_ffs= fsck_4.2bsd fsck_ufs
16608910321SRuslan ErmilovCRUNCH_ALIAS_geom= glabel gpart
1676a6050acSEnji CooperCRUNCH_ALIAS_shutdown= poweroff
168884c25d1SGordon Tetlow
169884c25d1SGordon Tetlow# dhclient has historically been troublesome...
170d4208689SBrooks DavisCRUNCH_PROGS_sbin+= dhclient
171d4208689SBrooks DavisCRUNCH_BUILDOPTS_dhclient= -DRELEASE_CRUNCH -Dlint
172884c25d1SGordon Tetlow
173884c25d1SGordon Tetlow##################################################################
174884c25d1SGordon Tetlow# Programs from stock /usr/bin
175884c25d1SGordon Tetlow#
176d60d0f81SGordon TetlowCRUNCH_SRCDIRS+= usr.bin
177884c25d1SGordon Tetlow
1784ab40004SEnji CooperCRUNCH_PROGS_usr.bin= head mt sed tail tee
179eb4e4048SYaroslav Tykhiy
1809a9ea25fSXin LICRUNCH_PROGS_usr.bin+= gzip
181884c25d1SGordon TetlowCRUNCH_ALIAS_gzip= gunzip gzcat zcat
182884c25d1SGordon Tetlow
183d60d0f81SGordon TetlowCRUNCH_PROGS_usr.bin+= bzip2
184884c25d1SGordon TetlowCRUNCH_ALIAS_bzip2= bunzip2 bzcat
185884c25d1SGordon TetlowCRUNCH_LIBS+= -lbz2
186884c25d1SGordon Tetlow
187e946bdbeSXin LICRUNCH_PROGS_usr.bin+= less
188e946bdbeSXin LICRUNCH_ALIAS_less= more
189e946bdbeSXin LI
1907fbeb03eSMartin MatuskaCRUNCH_PROGS_usr.bin+= xz
1917fbeb03eSMartin MatuskaCRUNCH_ALIAS_xz= unxz lzma unlzma xzcat lzcat
1927fbeb03eSMartin Matuska
193f831d936SBaptiste DaroussinCRUNCH_PROGS_usr.bin+= zstd
194f831d936SBaptiste DaroussinCRUNCH_ALIAS_zstd= unzstd zstdcat zstdmt
195f831d936SBaptiste DaroussinCRUNCH_LIBS+=	-lprivatezstd
196f831d936SBaptiste Daroussin
197cc7f9762SDavid E. O'BrienCRUNCH_PROGS_usr.bin+= tar
19802b6306fSDimitry AndricCRUNCH_LIBS+= -larchive
1993b495423STim Kientzle.if ${MK_OPENSSL} != "no"
2003b495423STim KientzleCRUNCH_LIBS+= -lcrypto
2013b495423STim Kientzle.endif
20202b6306fSDimitry AndricCRUNCH_LIBS+= -lmd
203cc7f9762SDavid E. O'Brien
2044ab40004SEnji Cooper.if ${MK_NETCAT} != "no"
205f3e05661SEnji CooperCRUNCH_PROGS_usr.bin+=	nc
2064ab40004SEnji Cooper.endif
2074ab40004SEnji Cooper
208c50bf0f3SEnji Cooper.if ${MK_VI} != "no"
209d60d0f81SGordon TetlowCRUNCH_PROGS_usr.bin+= vi
210884c25d1SGordon TetlowCRUNCH_ALIAS_vi= ex
211c50bf0f3SEnji Cooper.endif
212884c25d1SGordon Tetlow
2137ad67863SDag-Erling SmørgravCRUNCH_PROGS_usr.bin+= id
2147ad67863SDag-Erling SmørgravCRUNCH_ALIAS_id= groups whoami
2157ad67863SDag-Erling Smørgrav
216884c25d1SGordon Tetlow##################################################################
217ad02aba6SDag-Erling Smørgrav# Programs from stock /usr/sbin
218ad02aba6SDag-Erling Smørgrav#
219ad02aba6SDag-Erling SmørgravCRUNCH_SRCDIRS+= usr.sbin
220ad02aba6SDag-Erling Smørgrav
22146839d12SEnji CooperCRUNCH_PROGS_usr.sbin+= chroot
222eb4e4048SYaroslav Tykhiy
223eb4e4048SYaroslav TykhiyCRUNCH_PROGS_usr.sbin+= chown
224eb4e4048SYaroslav TykhiyCRUNCH_ALIAS_chown= chgrp
22587820315SKip Macy##################################################################
22687820315SKip MacyCRUNCH_LIBS+= -lm
227ad02aba6SDag-Erling Smørgrav
22846839d12SEnji Cooper.if ${MK_ISCSI} != "no"
22946839d12SEnji CooperCRUNCH_PROGS_usr.bin+=	iscsictl
23046839d12SEnji CooperCRUNCH_PROGS_usr.sbin+=	iscsid
23146839d12SEnji Cooper.endif
23246839d12SEnji Cooper
233169733f4SAdrian Chadd.include <bsd.crunchgen.mk>
234884c25d1SGordon Tetlow.include <bsd.prog.mk>
235