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