xref: /freebsd/rescue/rescue/Makefile (revision 53200025)
1884c25d1SGordon Tetlow#$FreeBSD$
2884c25d1SGordon Tetlow#	@(#)Makefile	8.1 (Berkeley) 6/2/93
3884c25d1SGordon Tetlow
4c6063d0dSWarner Losh.include <src.opts.mk>
54af3fa14SWarner Losh
64af3fa14SWarner LoshMAN=
7d9ca85fcSRuslan ErmilovMK_SSP=	no
8e1fe3dbaSRuslan Ermilov
9884c25d1SGordon TetlowPROG=	rescue
10884c25d1SGordon TetlowBINDIR?=/rescue
11884c25d1SGordon Tetlow
12884c25d1SGordon Tetlow# Shell scripts need #! line to be edited from /bin/sh to /rescue/sh
13884c25d1SGordon TetlowSCRIPTS= nextboot_FIXED
1404ddb211SJohn BaldwinSCRIPTSNAME_nextboot_FIXED= nextboot
15884c25d1SGordon Tetlownextboot_FIXED: ../../sbin/reboot/nextboot.sh
16884c25d1SGordon Tetlow	sed '1s/\/bin\//\/rescue\//' ${.ALLSRC} > ${.TARGET}
17884c25d1SGordon TetlowCLEANFILES+= nextboot_FIXED
18884c25d1SGordon Tetlow
19d4208689SBrooks DavisSCRIPTS+= dhclient_FIXED
20d4208689SBrooks DavisSCRIPTSNAME_dhclient_FIXED= dhclient-script
21d4208689SBrooks Davisdhclient_FIXED: ../../sbin/dhclient/dhclient-script
22d4208689SBrooks Davis	sed '1s/\/bin\//\/rescue\//' ${.ALLSRC} > ${.TARGET}
23d4208689SBrooks DavisCLEANFILES+= dhclient_FIXED
24884c25d1SGordon Tetlow
25169733f4SAdrian Chadd# The help which used to be here is now in mk/bsd.crunchgen.mk
26884c25d1SGordon Tetlow
27884c25d1SGordon Tetlow# Define Makefile variable RESCUE
28884c25d1SGordon TetlowCRUNCH_BUILDOPTS+= -DRESCUE
29884c25d1SGordon Tetlow# Define compile-time RESCUE symbol when compiling components
30884c25d1SGordon TetlowCRUNCH_BUILDOPTS+= CRUNCH_CFLAGS=-DRESCUE
31884c25d1SGordon Tetlow
324d938af0SGordon Tetlow# An experiment that failed: try overriding bsd.lib.mk and bsd.prog.mk
334d938af0SGordon Tetlow# rather than incorporating rescue-specific logic into standard files.
34884c25d1SGordon Tetlow#MAKEFLAGS= -m ${.CURDIR} ${.MAKEFLAGS}
35884c25d1SGordon Tetlow
36884c25d1SGordon Tetlow# Hackery:  'librescue' exists merely as a tool for appropriately
37884c25d1SGordon Tetlow# recompiling specific library entries.  We _know_ they're needed, and
38884c25d1SGordon Tetlow# regular archive searching creates ugly library ordering problems.
39884c25d1SGordon Tetlow# Easiest fix: tell the linker to include them into the executable
40884c25d1SGordon Tetlow# first, so they are guaranteed to override the regular lib entries.
41884c25d1SGordon Tetlow# Note that if 'librescue' hasn't been compiled, we'll just get the
42884c25d1SGordon Tetlow# regular lib entries from libc and friends.
43884c25d1SGordon TetlowCRUNCH_LIBS+= ${.OBJDIR}/../librescue/*.o
44884c25d1SGordon Tetlow
45884c25d1SGordon Tetlow###################################################################
46884c25d1SGordon Tetlow# Programs from stock /bin
47884c25d1SGordon Tetlow#
48884c25d1SGordon Tetlow# WARNING: Changing this list may require adjusting
49884c25d1SGordon Tetlow# /usr/include/paths.h as well!  You were warned!
50884c25d1SGordon Tetlow#
51d60d0f81SGordon TetlowCRUNCH_SRCDIRS+= bin
5239ae372dSDavid E. O'BrienCRUNCH_PROGS_bin= cat chflags chio chmod cp date dd df echo 	\
5321be3b31SYaroslav Tykhiy	 ed expr getfacl hostname kenv kill ln ls mkdir mv	\
54e8b00d3dSXin LI	 pkill ps pwd realpath rm rmdir setfacl sh sleep stty	\
55e8b00d3dSXin LI	 sync test
565c96e246SMarcel MoolenaarCRUNCH_LIBS+= -lcrypt -ledit -ljail -lkvm -ll -ltermcapw -lutil -lxo
57169733f4SAdrian ChaddCRUNCH_BUILDTOOLS+= bin/sh
58884c25d1SGordon Tetlow
59884c25d1SGordon Tetlow# Additional options for specific programs
60884c25d1SGordon TetlowCRUNCH_ALIAS_test= [
61884c25d1SGordon TetlowCRUNCH_ALIAS_sh= -sh
62884c25d1SGordon Tetlow# The -sh alias shouldn't appear in /rescue as a hard link
63884c25d1SGordon TetlowCRUNCH_SUPPRESS_LINK_-sh= 1
64884c25d1SGordon TetlowCRUNCH_ALIAS_ln= link
65884c25d1SGordon TetlowCRUNCH_ALIAS_rm= unlink
66884c25d1SGordon TetlowCRUNCH_ALIAS_ed= red
67eb4e4048SYaroslav TykhiyCRUNCH_ALIAS_pkill= pgrep
68eb4e4048SYaroslav Tykhiy
69e1fe3dbaSRuslan Ermilov.if ${MK_RCMDS} != "no"
70d60d0f81SGordon TetlowCRUNCH_PROGS_bin+= rcp
71884c25d1SGordon Tetlow.endif
72884c25d1SGordon Tetlow
73e1fe3dbaSRuslan Ermilov.if ${MK_TCSH} != "no"
74d60d0f81SGordon TetlowCRUNCH_PROGS_bin+= csh
75884c25d1SGordon TetlowCRUNCH_ALIAS_csh= -csh tcsh -tcsh
76169733f4SAdrian ChaddCRUNCH_BUILDTOOLS+= bin/csh
77884c25d1SGordon TetlowCRUNCH_SUPPRESS_LINK_-csh= 1
78884c25d1SGordon TetlowCRUNCH_SUPPRESS_LINK_-tcsh= 1
79884c25d1SGordon Tetlow.endif
80884c25d1SGordon Tetlow
81884c25d1SGordon Tetlow###################################################################
82884c25d1SGordon Tetlow# Programs from standard /sbin
83884c25d1SGordon Tetlow#
84884c25d1SGordon Tetlow# WARNING: Changing this list may require adjusting
85884c25d1SGordon Tetlow# /usr/include/paths.h as well!  You were warned!
86884c25d1SGordon Tetlow#
8739ae372dSDavid E. O'Brien# Note that mdmfs have their own private 'pathnames.h'
88884c25d1SGordon Tetlow# headers in addition to the standard 'paths.h' header.
89884c25d1SGordon Tetlow#
90d60d0f81SGordon TetlowCRUNCH_SRCDIRS+= sbin
9145f6d665SAlexander MotinCRUNCH_PROGS_sbin= badsect					\
92513b02ffSHartmut Brandt	camcontrol ccdconfig clri devfs dmesg dump		\
93cc795cb4SMarius Strobl	dumpfs dumpon fsck fsck_ffs fsck_msdosfs fsdb		\
942f161397SMarcel Moolenaar	fsirand gbde geom ifconfig init 			\
9539ae372dSDavid E. O'Brien	kldconfig kldload kldstat kldunload ldconfig 		\
96c89454cbSCraig Rodrigues	md5 mdconfig mdmfs mknod mount mount_cd9660		\
97a42ac676SAttilio Rao	mount_msdosfs mount_nfs mount_nullfs			\
98534046e3SRong-En Fan	mount_udf mount_unionfs newfs				\
99043fc269SPoul-Henning Kamp	newfs_msdos nos-tun ping reboot				\
10039ae372dSDavid E. O'Brien	restore rcorder route routed rtquery rtsol savecore	\
101d2a0bb08SEd Schouten	spppcontrol swapon sysctl tunefs umount
10240353969SPoul-Henning Kamp
103e1fe3dbaSRuslan Ermilov.if ${MK_ATM} != "no"
1042b851aebSRobert WatsonCRUNCH_PROGS_sbin+= atmconfig
10540353969SPoul-Henning Kamp.endif
10640353969SPoul-Henning Kamp
107e1fe3dbaSRuslan Ermilov.if ${MK_INET6_SUPPORT} != "no"
10840353969SPoul-Henning KampCRUNCH_PROGS_sbin+= ping6
10940353969SPoul-Henning Kamp.endif
11040353969SPoul-Henning Kamp
111e1fe3dbaSRuslan Ermilov.if ${MK_IPFILTER} != "no"
112cf4ee2c9SDarren ReedCRUNCH_PROGS_sbin+= ipf
1135433713cSDavid E. O'Brien.endif
11487820315SKip Macy.if ${MK_ZFS} != "no"
11587820315SKip MacyCRUNCH_PROGS_sbin+= zfs
11687820315SKip MacyCRUNCH_PROGS_sbin+= zpool
1174c75e226SXin LICRUNCH_PROGS_usr.sbin+= zdb
11887820315SKip Macy.endif
1195433713cSDavid E. O'Brien
120884c25d1SGordon Tetlow# crunchgen does not like C++ programs; this should be fixed someday
121884c25d1SGordon Tetlow# CRUNCH_PROGS+= devd
122884c25d1SGordon Tetlow
12353200025SRui PauloCRUNCH_LIBS+= -lalias -lcam -lncursesw -ldevstat -lipsec -llzma
12487820315SKip Macy.if ${MK_ZFS} != "no"
1254c75e226SXin LICRUNCH_LIBS+= -lavl -lzpool -lzfs_core -lzfs -lnvpair -lpthread -luutil -lumem
12653200025SRui Paulo.else
12753200025SRui Paulo# liblzma needs pthread
12853200025SRui PauloCRUNCH_LIBS+= -lpthread
12987820315SKip Macy.endif
13002b6306fSDimitry AndricCRUNCH_LIBS+= -lgeom -lbsdxml -lkiconv
13102b6306fSDimitry Andric.if ${MK_OPENSSL} == "no"
13202b6306fSDimitry AndricCRUNCH_LIBS+= -lmd
13302b6306fSDimitry Andric.endif
13402b6306fSDimitry AndricCRUNCH_LIBS+= -lsbuf -lufs -lz
135884c25d1SGordon Tetlow
13625faff34SWarner Losh.if ${MACHINE_CPUARCH} == "i386"
1372f161397SMarcel MoolenaarCRUNCH_PROGS_sbin+= bsdlabel sconfig fdisk
1389b6e332fSGordon TetlowCRUNCH_ALIAS_bsdlabel= disklabel
139237abf0cSDavide Italiano#CRUNCH_PROGS+= mount_smbfs
140237abf0cSDavide Italiano#CRUNCH_LIBS+= -lsmb
141884c25d1SGordon Tetlow.endif
142884c25d1SGordon Tetlow
143884c25d1SGordon Tetlow.if ${MACHINE} == "pc98"
144107e6cdaSGordon TetlowCRUNCH_SRCDIR_fdisk= $(.CURDIR)/../../sbin/fdisk_pc98
145884c25d1SGordon Tetlow.endif
146884c25d1SGordon Tetlow
14725faff34SWarner Losh.if ${MACHINE_CPUARCH} == "sparc64"
1482f161397SMarcel MoolenaarCRUNCH_PROGS_sbin+= bsdlabel sunlabel
149884c25d1SGordon Tetlow.endif
150884c25d1SGordon Tetlow
15125faff34SWarner Losh.if ${MACHINE_CPUARCH} == "amd64"
1522f161397SMarcel MoolenaarCRUNCH_PROGS_sbin+= bsdlabel fdisk
1539b6e332fSGordon TetlowCRUNCH_ALIAS_bsdlabel= disklabel
154884c25d1SGordon Tetlow.endif
155884c25d1SGordon Tetlow
156884c25d1SGordon TetlowCRUNCH_SRCDIR_atm= $(.CURDIR)/../../sbin/atm/atm
157513b02ffSHartmut BrandtCRUNCH_SRCDIR_atmconfig= $(.CURDIR)/../../sbin/atm/atmconfig
158884c25d1SGordon TetlowCRUNCH_SRCDIR_fore_dnld= $(.CURDIR)/../../sbin/atm/fore_dnld
159884c25d1SGordon TetlowCRUNCH_SRCDIR_ilmid= $(.CURDIR)/../../sbin/atm/ilmid
160884c25d1SGordon TetlowCRUNCH_SRCDIR_rtquery= $(.CURDIR)/../../sbin/routed/rtquery
161cf4ee2c9SDarren ReedCRUNCH_SRCDIR_ipf= $(.CURDIR)/../../sbin/ipf/ipf
16287820315SKip Macy.if ${MK_ZFS} != "no"
16387820315SKip MacyCRUNCH_SRCDIR_zfs= ${.CURDIR}/../../cddl/sbin/zfs
16487820315SKip MacyCRUNCH_SRCDIR_zpool= ${.CURDIR}/../../cddl/sbin/zpool
1654c75e226SXin LICRUNCH_SRCDIR_zdb= ${.CURDIR}/../../cddl/usr.sbin/zdb
16687820315SKip Macy.endif
167884c25d1SGordon TetlowCRUNCH_ALIAS_reboot= fastboot halt fasthalt
168884c25d1SGordon TetlowCRUNCH_ALIAS_restore= rrestore
169884c25d1SGordon TetlowCRUNCH_ALIAS_dump= rdump
170884c25d1SGordon TetlowCRUNCH_ALIAS_fsck_ffs= fsck_4.2bsd fsck_ufs
17108910321SRuslan ErmilovCRUNCH_ALIAS_geom= glabel gpart
172884c25d1SGordon Tetlow
173884c25d1SGordon Tetlow# dhclient has historically been troublesome...
174d4208689SBrooks DavisCRUNCH_PROGS_sbin+= dhclient
175d4208689SBrooks DavisCRUNCH_BUILDOPTS_dhclient= -DRELEASE_CRUNCH -Dlint
176884c25d1SGordon Tetlow
177884c25d1SGordon Tetlow##################################################################
178884c25d1SGordon Tetlow# Programs from stock /usr/bin
179884c25d1SGordon Tetlow#
180d60d0f81SGordon TetlowCRUNCH_SRCDIRS+= usr.bin
181884c25d1SGordon Tetlow
18220f8f679SDag-Erling SmørgravCRUNCH_PROGS_usr.bin= head mt nc sed tail tee
183eb4e4048SYaroslav Tykhiy
1849a9ea25fSXin LICRUNCH_PROGS_usr.bin+= gzip
185884c25d1SGordon TetlowCRUNCH_ALIAS_gzip= gunzip gzcat zcat
186884c25d1SGordon Tetlow
187d60d0f81SGordon TetlowCRUNCH_PROGS_usr.bin+= bzip2
188884c25d1SGordon TetlowCRUNCH_ALIAS_bzip2= bunzip2 bzcat
189884c25d1SGordon TetlowCRUNCH_LIBS+= -lbz2
190884c25d1SGordon Tetlow
191e946bdbeSXin LICRUNCH_PROGS_usr.bin+= less
192e946bdbeSXin LICRUNCH_ALIAS_less= more
193e946bdbeSXin LI
1947fbeb03eSMartin MatuskaCRUNCH_PROGS_usr.bin+= xz
1957fbeb03eSMartin MatuskaCRUNCH_ALIAS_xz= unxz lzma unlzma xzcat lzcat
1967fbeb03eSMartin Matuska
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
204c50bf0f3SEnji Cooper.if ${MK_VI} != "no"
205d60d0f81SGordon TetlowCRUNCH_PROGS_usr.bin+= vi
206884c25d1SGordon TetlowCRUNCH_ALIAS_vi= ex
207c50bf0f3SEnji Cooper.endif
208884c25d1SGordon Tetlow
2097ad67863SDag-Erling SmørgravCRUNCH_PROGS_usr.bin+= id
2107ad67863SDag-Erling SmørgravCRUNCH_ALIAS_id= groups whoami
2117ad67863SDag-Erling Smørgrav
212884c25d1SGordon Tetlow##################################################################
213ad02aba6SDag-Erling Smørgrav# Programs from stock /usr/sbin
214ad02aba6SDag-Erling Smørgrav#
215ad02aba6SDag-Erling SmørgravCRUNCH_SRCDIRS+= usr.sbin
216ad02aba6SDag-Erling Smørgrav
2174c75e226SXin LICRUNCH_PROGS_usr.sbin+= chroot
218eb4e4048SYaroslav Tykhiy
219eb4e4048SYaroslav TykhiyCRUNCH_PROGS_usr.sbin+= chown
220eb4e4048SYaroslav TykhiyCRUNCH_ALIAS_chown= chgrp
22187820315SKip Macy##################################################################
22287820315SKip MacyCRUNCH_LIBS+= -lm
223ad02aba6SDag-Erling Smørgrav
224169733f4SAdrian Chadd.include <bsd.crunchgen.mk>
225884c25d1SGordon Tetlow.include <bsd.prog.mk>
226