1117035Sgordon#$FreeBSD: stable/10/rescue/rescue/Makefile 315781 2017-03-23 04:47:43Z ngie $
2117035Sgordon#	@(#)Makefile	8.1 (Berkeley) 6/2/93
3117035Sgordon
4276486SngieMAN=
5156813Sru
6156813Sru.include <bsd.own.mk>
7188895SruMK_SSP=	no
8156813Sru
9117035SgordonPROG=	rescue
10117692SobrienBINDIR?=/rescue
11117035Sgordon
12117035Sgordon# Shell scripts need #! line to be edited from /bin/sh to /rescue/sh
13117035SgordonSCRIPTS= nextboot_FIXED
14153455SjhbSCRIPTSNAME_nextboot_FIXED= nextboot
15117035Sgordonnextboot_FIXED: ../../sbin/reboot/nextboot.sh
16117035Sgordon	sed '1s/\/bin\//\/rescue\//' ${.ALLSRC} > ${.TARGET}
17117035SgordonCLEANFILES+= nextboot_FIXED
18117035Sgordon
19147090SbrooksSCRIPTS+= dhclient_FIXED
20147090SbrooksSCRIPTSNAME_dhclient_FIXED= dhclient-script
21147090Sbrooksdhclient_FIXED: ../../sbin/dhclient/dhclient-script
22147090Sbrooks	sed '1s/\/bin\//\/rescue\//' ${.ALLSRC} > ${.TARGET}
23147090SbrooksCLEANFILES+= dhclient_FIXED
24117035Sgordon
25215226Sadrian# The help which used to be here is now in mk/bsd.crunchgen.mk
26117035Sgordon
27117035Sgordon# Define Makefile variable RESCUE
28117035SgordonCRUNCH_BUILDOPTS+= -DRESCUE
29117035Sgordon# Define compile-time RESCUE symbol when compiling components
30117035SgordonCRUNCH_BUILDOPTS+= CRUNCH_CFLAGS=-DRESCUE
31117035Sgordon
32117449Sgordon# An experiment that failed: try overriding bsd.lib.mk and bsd.prog.mk
33117449Sgordon# rather than incorporating rescue-specific logic into standard files.
34117035Sgordon#MAKEFLAGS= -m ${.CURDIR} ${.MAKEFLAGS}
35117035Sgordon
36117035Sgordon# Hackery:  'librescue' exists merely as a tool for appropriately
37117035Sgordon# recompiling specific library entries.  We _know_ they're needed, and
38117035Sgordon# regular archive searching creates ugly library ordering problems.
39117035Sgordon# Easiest fix: tell the linker to include them into the executable
40117035Sgordon# first, so they are guaranteed to override the regular lib entries.
41117035Sgordon# Note that if 'librescue' hasn't been compiled, we'll just get the
42117035Sgordon# regular lib entries from libc and friends.
43117035SgordonCRUNCH_LIBS+= ${.OBJDIR}/../librescue/*.o
44117035Sgordon
45117035Sgordon###################################################################
46117035Sgordon# Programs from stock /bin
47117035Sgordon#
48117035Sgordon# WARNING: Changing this list may require adjusting
49117035Sgordon# /usr/include/paths.h as well!  You were warned!
50117035Sgordon#
51117692SobrienCRUNCH_SRCDIRS+= bin
52117791SobrienCRUNCH_PROGS_bin= cat chflags chio chmod cp date dd df echo 	\
53182543Syar	 ed expr getfacl hostname kenv kill ln ls mkdir mv	\
54276557Sdelphij	 pkill ps pwd realpath rm rmdir setfacl sh sleep stty	\
55276557Sdelphij	 sync test
56266279SbdreweryCRUNCH_LIBS+= -lcrypt -ledit -ljail -lkvm -ll -ltermcap -lutil
57215226SadrianCRUNCH_BUILDTOOLS+= bin/sh
58117035Sgordon
59117035Sgordon# Additional options for specific programs
60117035SgordonCRUNCH_ALIAS_test= [
61117035SgordonCRUNCH_ALIAS_sh= -sh
62117035Sgordon# The -sh alias shouldn't appear in /rescue as a hard link
63117692SobrienCRUNCH_SUPPRESS_LINK_-sh= 1
64117035SgordonCRUNCH_ALIAS_ln= link
65117035SgordonCRUNCH_ALIAS_rm= unlink
66117035SgordonCRUNCH_ALIAS_ed= red
67173073SyarCRUNCH_ALIAS_pkill= pgrep
68173073Syar
69156813Sru.if ${MK_RCMDS} != "no"
70117601SgordonCRUNCH_PROGS_bin+= rcp
71117035Sgordon.endif
72117035Sgordon
73156813Sru.if ${MK_TCSH} != "no"
74117601SgordonCRUNCH_PROGS_bin+= csh
75117035SgordonCRUNCH_ALIAS_csh= -csh tcsh -tcsh
76215226SadrianCRUNCH_BUILDTOOLS+= bin/csh
77117692SobrienCRUNCH_SUPPRESS_LINK_-csh= 1
78117692SobrienCRUNCH_SUPPRESS_LINK_-tcsh= 1
79117035Sgordon.endif
80117035Sgordon
81117035Sgordon###################################################################
82117035Sgordon# Programs from standard /sbin
83117035Sgordon#
84117035Sgordon# WARNING: Changing this list may require adjusting
85117035Sgordon# /usr/include/paths.h as well!  You were warned!
86117035Sgordon#
87117791Sobrien# Note that mdmfs have their own private 'pathnames.h'
88117035Sgordon# headers in addition to the standard 'paths.h' header.
89117035Sgordon#
90117692SobrienCRUNCH_SRCDIRS+= sbin
91249083SmavCRUNCH_PROGS_sbin= badsect					\
92315110Sngie	camcontrol clri devfs dmesg dump			\
93133799Smarius	dumpfs dumpon fsck fsck_ffs fsck_msdosfs fsdb		\
94173314Smarcel	fsirand gbde geom ifconfig init 			\
95183007Simp	kldconfig kldload kldstat kldunload ldconfig 		\
96183007Simp	md5 mdconfig mdmfs mknod mount mount_cd9660		\
97241636Sattilio	mount_msdosfs mount_nfs mount_nullfs			\
98183007Simp	mount_udf mount_unionfs newfs				\
99183007Simp	newfs_msdos nos-tun ping reboot				\
100315356Sngie	restore rcorder route savecore		 		\
101315116Sngie	shutdown spppcontrol swapon sysctl tunefs umount
102117035Sgordon
103156813Sru.if ${MK_ATM} != "no"
104171453SrwatsonCRUNCH_PROGS_sbin+= atmconfig
105119664Sphk.endif
106119664Sphk
107315110Sngie.if ${MK_CCD} != "no"
108315110SngieCRUNCH_PROGS_sbin+= ccdconfig
109315110Sngie.endif
110315110Sngie
111156813Sru.if ${MK_INET6_SUPPORT} != "no"
112119664SphkCRUNCH_PROGS_sbin+= ping6
113315356SngieCRUNCH_PROGS_sbin+= rtsol
114119664Sphk.endif
115119664Sphk
116156813Sru.if ${MK_IPFILTER} != "no"
117145630SdarrenrCRUNCH_PROGS_sbin+= ipf
118117693Sobrien.endif
119315110Sngie
120315110Sngie.if ${MK_ROUTED} != "no"
121315110SngieCRUNCH_PROGS_sbin+= routed rtquery
122315110Sngie.endif
123315110Sngie
124192617Skmacy.if ${MK_ZFS} != "no"
125192617SkmacyCRUNCH_PROGS_sbin+= zfs
126192617SkmacyCRUNCH_PROGS_sbin+= zpool
127270997SdelphijCRUNCH_PROGS_usr.sbin+= zdb
128192617Skmacy.endif
129117693Sobrien
130117035Sgordon# crunchgen does not like C++ programs; this should be fixed someday
131117035Sgordon# CRUNCH_PROGS+= devd
132117035Sgordon
133292588SdelphijCRUNCH_LIBS+= -lalias -lcam -lcurses -ldevstat -lipsec -llzma
134156905Sru.if ${MK_IPX} != "no"
135156905SruCRUNCH_LIBS+= -lipx
136156905Sru.endif
137192617Skmacy.if ${MK_ZFS} != "no"
138270997SdelphijCRUNCH_LIBS+= -lavl -lzpool -lzfs_core -lzfs -lnvpair -lpthread -luutil -lumem
139292588Sdelphij.else
140292588Sdelphij# liblzma needs pthread
141292588SdelphijCRUNCH_LIBS+= -lpthread
142192617Skmacy.endif
143269519SdimCRUNCH_LIBS+= -lgeom -lbsdxml -lkiconv
144269519Sdim.if ${MK_OPENSSL} == "no"
145269519SdimCRUNCH_LIBS+= -lmd
146269519Sdim.endif
147280438SkenCRUNCH_LIBS+= -lmt -lsbuf -lufs -lz
148117035Sgordon
149211725Simp.if ${MACHINE_CPUARCH} == "i386"
150173314SmarcelCRUNCH_PROGS_sbin+= bsdlabel sconfig fdisk
151117057SgordonCRUNCH_ALIAS_bsdlabel= disklabel
152252356Sdavide#CRUNCH_PROGS+= mount_smbfs
153252356Sdavide#CRUNCH_LIBS+= -lsmb
154117035Sgordon.endif
155117035Sgordon
156117035Sgordon.if ${MACHINE} == "pc98"
157117692SobrienCRUNCH_SRCDIR_fdisk= $(.CURDIR)/../../sbin/fdisk_pc98
158117035Sgordon.endif
159117035Sgordon
160211725Simp.if ${MACHINE_CPUARCH} == "ia64"
161173314SmarcelCRUNCH_PROGS_sbin+= mca
162117035Sgordon.endif
163117035Sgordon
164211725Simp.if ${MACHINE_CPUARCH} == "sparc64"
165173314SmarcelCRUNCH_PROGS_sbin+= bsdlabel sunlabel
166117035Sgordon.endif
167117035Sgordon
168211725Simp.if ${MACHINE_CPUARCH} == "amd64"
169173314SmarcelCRUNCH_PROGS_sbin+= bsdlabel fdisk
170117057SgordonCRUNCH_ALIAS_bsdlabel= disklabel
171117057Sgordon.endif
172117057Sgordon
173117692SobrienCRUNCH_SRCDIR_atm= $(.CURDIR)/../../sbin/atm/atm
174118826ShartiCRUNCH_SRCDIR_atmconfig= $(.CURDIR)/../../sbin/atm/atmconfig
175117692SobrienCRUNCH_SRCDIR_fore_dnld= $(.CURDIR)/../../sbin/atm/fore_dnld
176117692SobrienCRUNCH_SRCDIR_ilmid= $(.CURDIR)/../../sbin/atm/ilmid
177117692SobrienCRUNCH_SRCDIR_rtquery= $(.CURDIR)/../../sbin/routed/rtquery
178145630SdarrenrCRUNCH_SRCDIR_ipf= $(.CURDIR)/../../sbin/ipf/ipf
179192617Skmacy.if ${MK_ZFS} != "no"
180192617SkmacyCRUNCH_SRCDIR_zfs= ${.CURDIR}/../../cddl/sbin/zfs
181192617SkmacyCRUNCH_SRCDIR_zpool= ${.CURDIR}/../../cddl/sbin/zpool
182270997SdelphijCRUNCH_SRCDIR_zdb= ${.CURDIR}/../../cddl/usr.sbin/zdb
183192617Skmacy.endif
184117035SgordonCRUNCH_ALIAS_reboot= fastboot halt fasthalt
185117692SobrienCRUNCH_ALIAS_restore= rrestore
186117035SgordonCRUNCH_ALIAS_dump= rdump
187117692SobrienCRUNCH_ALIAS_fsck_ffs= fsck_4.2bsd fsck_ufs
188177707SruCRUNCH_ALIAS_geom= glabel gpart
189315116SngieCRUNCH_ALIAS_shutdown= poweroff
190117035Sgordon
191117035Sgordon# dhclient has historically been troublesome...
192147090SbrooksCRUNCH_PROGS_sbin+= dhclient
193147090SbrooksCRUNCH_BUILDOPTS_dhclient= -DRELEASE_CRUNCH -Dlint
194117035Sgordon
195117035Sgordon##################################################################
196117035Sgordon# Programs from stock /usr/bin
197191227Skientzle#
198117692SobrienCRUNCH_SRCDIRS+= usr.bin
199117035Sgordon
200315356SngieCRUNCH_PROGS_usr.bin= head mt sed tail tee
201173073Syar
202166255SdelphijCRUNCH_PROGS_usr.bin+= gzip
203117692SobrienCRUNCH_ALIAS_gzip= gunzip gzcat zcat
204117035Sgordon
205117692SobrienCRUNCH_PROGS_usr.bin+= bzip2
206117692SobrienCRUNCH_ALIAS_bzip2= bunzip2 bzcat
207117692SobrienCRUNCH_LIBS+= -lbz2
208117035Sgordon
209250626SdelphijCRUNCH_PROGS_usr.bin+= less
210250626SdelphijCRUNCH_ALIAS_less= more
211250626Sdelphij
212207849SmmCRUNCH_PROGS_usr.bin+= xz
213207849SmmCRUNCH_ALIAS_xz= unxz lzma unlzma xzcat lzcat
214207849Smm
215138366SobrienCRUNCH_PROGS_usr.bin+= tar
216269519SdimCRUNCH_LIBS+= -larchive
217191239Skientzle.if ${MK_OPENSSL} != "no"
218191239SkientzleCRUNCH_LIBS+= -lcrypto
219191239Skientzle.endif
220269519SdimCRUNCH_LIBS+= -lmd
221138366Sobrien
222315356Sngie.if ${MK_NETCAT} != "no"
223315781SngieCRUNCH_PROGS_usr.bin+=	nc
224315356Sngie.endif
225315356Sngie
226117692SobrienCRUNCH_PROGS_usr.bin+= vi
227117692SobrienCRUNCH_ALIAS_vi= ex
228117035Sgordon
229126874SdesCRUNCH_PROGS_usr.bin+= id
230126874SdesCRUNCH_ALIAS_id= groups whoami
231126874Sdes
232117035Sgordon##################################################################
233141478Sdes# Programs from stock /usr/sbin
234191227Skientzle#
235141478SdesCRUNCH_SRCDIRS+= usr.sbin
236141478Sdes
237270997SdelphijCRUNCH_PROGS_usr.sbin+= chroot
238141478Sdes
239173073SyarCRUNCH_PROGS_usr.sbin+= chown
240173073SyarCRUNCH_ALIAS_chown= chgrp
241192617Skmacy##################################################################
242192617SkmacyCRUNCH_LIBS+= -lm
243173073Syar
244291874Sngie.if ${MK_ISCSI} != "no"
245291874SngieCRUNCH_PROGS_usr.bin+=	iscsictl
246291874SngieCRUNCH_PROGS_usr.sbin+=	iscsid
247291874Sngie.endif
248291874Sngie
249215226Sadrian.include <bsd.crunchgen.mk>
250117035Sgordon.include <bsd.prog.mk>
251