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