xref: /freebsd/rescue/rescue/Makefile (revision 6419bb52)
1#$FreeBSD$
2#	@(#)Makefile	8.1 (Berkeley) 6/2/93
3
4.include <src.opts.mk>
5
6PACKAGE=rescue
7MAN=
8MK_SSP=	no
9NO_SHARED=	yes
10
11PROG=	rescue
12BINDIR?=/rescue
13
14# Shell scripts need #! line to be edited from /bin/sh to /rescue/sh
15SCRIPTS= nextboot_FIXED
16SCRIPTSNAME_nextboot_FIXED= nextboot
17nextboot_FIXED: ../../sbin/reboot/nextboot.sh
18	sed '1s/\/bin\//\/rescue\//' ${.ALLSRC} > ${.TARGET}
19CLEANFILES+= nextboot_FIXED
20
21SCRIPTS+= dhclient_FIXED
22SCRIPTSNAME_dhclient_FIXED= dhclient-script
23dhclient_FIXED: ../../sbin/dhclient/dhclient-script
24	sed '1s/\/bin\//\/rescue\//' ${.ALLSRC} > ${.TARGET}
25CLEANFILES+= dhclient_FIXED
26
27# The help which used to be here is now in mk/bsd.crunchgen.mk
28
29# Define Makefile variable RESCUE
30CRUNCH_BUILDOPTS+= -DRESCUE
31# Define compile-time RESCUE symbol when compiling components
32CRUNCH_BUILDOPTS+= CRUNCH_CFLAGS=-DRESCUE
33
34# An experiment that failed: try overriding bsd.lib.mk and bsd.prog.mk
35# rather than incorporating rescue-specific logic into standard files.
36#MAKEFLAGS= -m ${.CURDIR} ${.MAKEFLAGS}
37
38# Hackery:  'librescue' exists merely as a tool for appropriately
39# recompiling specific library entries.  We _know_ they're needed, and
40# regular archive searching creates ugly library ordering problems.
41# Easiest fix: tell the linker to include them into the executable
42# first, so they are guaranteed to override the regular lib entries.
43# Note that if 'librescue' hasn't been compiled, we'll just get the
44# regular lib entries from libc and friends.
45CRUNCH_LIBS+= ${.OBJDIR}/../librescue/*.o
46
47###################################################################
48# Programs from stock /bin
49#
50# WARNING: Changing this list may require adjusting
51# /usr/include/paths.h as well!  You were warned!
52#
53CRUNCH_SRCDIRS+= bin
54CRUNCH_PROGS_bin= cat chflags chio chmod cp date dd df echo 	\
55	 ed expr getfacl hostname kenv kill ln ls mkdir mv	\
56	 pkill ps pwd realpath rm rmdir setfacl sh sleep stty	\
57	 sync test
58CRUNCH_LIBS+= -lcrypt -ledit -ljail -lkvm -lelf -ltermcapw -lutil -lxo
59CRUNCH_BUILDTOOLS+= bin/sh
60
61# Additional options for specific programs
62CRUNCH_ALIAS_test= [
63CRUNCH_ALIAS_sh= -sh
64# The -sh alias shouldn't appear in /rescue as a hard link
65CRUNCH_SUPPRESS_LINK_-sh= 1
66CRUNCH_ALIAS_ln= link
67CRUNCH_ALIAS_rm= unlink
68CRUNCH_ALIAS_ed= red
69CRUNCH_ALIAS_pkill= pgrep
70
71.if ${MK_TCSH} != "no"
72CRUNCH_PROGS_bin+= csh
73CRUNCH_ALIAS_csh= -csh tcsh -tcsh
74CRUNCH_BUILDTOOLS+= bin/csh
75CRUNCH_SUPPRESS_LINK_-csh= 1
76CRUNCH_SUPPRESS_LINK_-tcsh= 1
77.endif
78
79###################################################################
80# Programs from standard /sbin
81#
82# WARNING: Changing this list may require adjusting
83# /usr/include/paths.h as well!  You were warned!
84#
85# Note that mdmfs have their own private 'pathnames.h'
86# headers in addition to the standard 'paths.h' header.
87#
88CRUNCH_SRCDIRS+= sbin
89CRUNCH_PROGS_sbin= 						\
90	camcontrol clri devfs dmesg dump			\
91	dumpfs dumpon fsck fsck_ffs fsck_msdosfs fsdb		\
92	fsirand gbde geom ifconfig init 			\
93	kldconfig kldload kldstat kldunload ldconfig 		\
94	md5 mdconfig mdmfs mknod mount mount_cd9660		\
95	mount_msdosfs mount_nfs mount_nullfs			\
96	mount_udf mount_unionfs newfs				\
97	newfs_msdos nos-tun ping reboot				\
98	restore rcorder route savecore		 		\
99	shutdown spppcontrol swapon sysctl tunefs umount
100
101.if ${MK_CCD} != "no"
102CRUNCH_PROGS_sbin+= ccdconfig
103.endif
104
105.if ${MK_INET6_SUPPORT} != "no"
106CRUNCH_PROGS_sbin+= ping6
107CRUNCH_PROGS_sbin+= rtsol
108.endif
109
110.if ${MK_IPFILTER} != "no"
111CRUNCH_PROGS_sbin+= ipf
112CRUNCH_LIBS_ipf+=	${LIBIPF}
113.endif
114
115.if ${MK_ROUTED} != "no"
116CRUNCH_PROGS_sbin+= routed rtquery
117.endif
118
119.if ${MK_ZFS} != "no"
120CRUNCH_PROGS_sbin+= bectl
121CRUNCH_PROGS_sbin+= zfs
122CRUNCH_PROGS_sbin+= zpool
123CRUNCH_PROGS_usr.sbin+= zdb
124.endif
125
126# crunchgen does not like C++ programs; this should be fixed someday
127# CRUNCH_PROGS+= devd
128
129CRUNCH_LIBS+= -l80211 -lalias -lcam -lncursesw -ldevstat -lipsec -llzma
130.if ${MK_ZFS} != "no"
131CRUNCH_LIBS+= -lavl -lzpool -lzfs_core -lzfs -lnvpair -lpthread -luutil -lumem
132CRUNCH_LIBS+= -lbe
133.else
134# liblzma needs pthread
135CRUNCH_LIBS+= -lpthread
136.endif
137CRUNCH_LIBS+= -lgeom -lbsdxml -lkiconv
138.if ${MK_OPENSSL} == "no"
139CRUNCH_LIBS+= -lmd
140.endif
141CRUNCH_LIBS+= -lmt -lsbuf -lufs -lz
142
143.if ${MACHINE_CPUARCH} == "i386"
144CRUNCH_PROGS_sbin+= bsdlabel sconfig fdisk
145CRUNCH_ALIAS_bsdlabel= disklabel
146#CRUNCH_PROGS+= mount_smbfs
147#CRUNCH_LIBS+= -lsmb
148.endif
149
150.if ${MACHINE_CPUARCH} == "sparc64"
151CRUNCH_PROGS_sbin+= bsdlabel sunlabel
152.endif
153
154.if ${MACHINE_CPUARCH} == "amd64"
155CRUNCH_PROGS_sbin+= bsdlabel fdisk
156CRUNCH_ALIAS_bsdlabel= disklabel
157.endif
158
159CRUNCH_SRCDIR_rtquery= ${SRCTOP}/sbin/routed/rtquery
160CRUNCH_SRCDIR_ipf= ${SRCTOP}/sbin/ipf/ipf
161.if ${MK_ZFS} != "no"
162CRUNCH_SRCDIR_zfs= ${SRCTOP}/cddl/sbin/zfs
163CRUNCH_SRCDIR_zpool= ${SRCTOP}/cddl/sbin/zpool
164CRUNCH_SRCDIR_zdb= ${SRCTOP}/cddl/usr.sbin/zdb
165.endif
166CRUNCH_ALIAS_reboot= fastboot halt fasthalt
167CRUNCH_ALIAS_restore= rrestore
168CRUNCH_ALIAS_dump= rdump
169CRUNCH_ALIAS_fsck_ffs= fsck_4.2bsd fsck_ufs
170CRUNCH_ALIAS_geom= glabel gpart
171CRUNCH_ALIAS_shutdown= poweroff
172
173# dhclient has historically been troublesome...
174CRUNCH_PROGS_sbin+= dhclient
175
176##################################################################
177# Programs from stock /usr/bin
178#
179CRUNCH_SRCDIRS+= usr.bin
180
181CRUNCH_PROGS_usr.bin= head mt sed tail tee
182
183CRUNCH_PROGS_usr.bin+= gzip
184CRUNCH_ALIAS_gzip= gunzip gzcat zcat
185
186CRUNCH_PROGS_usr.bin+= bzip2
187CRUNCH_ALIAS_bzip2= bunzip2 bzcat
188CRUNCH_LIBS+= -lbz2
189
190CRUNCH_PROGS_usr.bin+= less
191CRUNCH_ALIAS_less= more
192
193CRUNCH_PROGS_usr.bin+= xz
194CRUNCH_ALIAS_xz= unxz lzma unlzma xzcat lzcat
195
196CRUNCH_PROGS_usr.bin+= zstd
197CRUNCH_ALIAS_zstd= unzstd zstdcat zstdmt
198CRUNCH_LIBS+=	${LDADD_zstd}
199
200CRUNCH_PROGS_usr.bin+= tar
201CRUNCH_LIBS+= -larchive
202.if ${MK_OPENSSL} != "no"
203CRUNCH_LIBS+= -lcrypto
204.endif
205CRUNCH_LIBS+= -lmd
206
207.if ${MK_NETCAT} != "no"
208CRUNCH_PROGS_usr.bin+=	nc
209.endif
210
211.if ${MK_VI} != "no"
212CRUNCH_PROGS_usr.bin+= vi
213CRUNCH_ALIAS_vi= ex
214.endif
215
216CRUNCH_PROGS_usr.bin+= id
217CRUNCH_ALIAS_id= groups whoami
218
219##################################################################
220# Programs from stock /usr/sbin
221#
222CRUNCH_SRCDIRS+= usr.sbin
223
224CRUNCH_PROGS_usr.sbin+= chroot
225
226CRUNCH_PROGS_usr.sbin+= chown
227CRUNCH_ALIAS_chown= chgrp
228##################################################################
229CRUNCH_LIBS+= -lm
230
231.if ${MK_ISCSI} != "no"
232CRUNCH_PROGS_usr.bin+=	iscsictl
233CRUNCH_PROGS_usr.sbin+=	iscsid
234.endif
235
236.include <bsd.crunchgen.mk>
237.include <bsd.prog.mk>
238