1117035Sgordon#$FreeBSD: releng/10.2/rescue/rescue/Makefile 280438 2015-03-24 14:36:10Z ken $
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					\
92183007Simp	camcontrol ccdconfig 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				\
100183007Simp	restore rcorder route routed rtquery rtsol savecore	\
101191227Skientzle	spppcontrol swapon sysctl tunefs umount
102117035Sgordon
103156813Sru.if ${MK_ATM} != "no"
104171453SrwatsonCRUNCH_PROGS_sbin+= atmconfig
105119664Sphk.endif
106119664Sphk
107156813Sru.if ${MK_INET6_SUPPORT} != "no"
108119664SphkCRUNCH_PROGS_sbin+= ping6
109119664Sphk.endif
110119664Sphk
111156813Sru.if ${MK_IPFILTER} != "no"
112145630SdarrenrCRUNCH_PROGS_sbin+= ipf
113117693Sobrien.endif
114192617Skmacy.if ${MK_ZFS} != "no"
115192617SkmacyCRUNCH_PROGS_sbin+= zfs
116192617SkmacyCRUNCH_PROGS_sbin+= zpool
117270997SdelphijCRUNCH_PROGS_usr.sbin+= zdb
118192617Skmacy.endif
119117693Sobrien
120117035Sgordon# crunchgen does not like C++ programs; this should be fixed someday
121117035Sgordon# CRUNCH_PROGS+= devd
122117035Sgordon
123157177ScognetCRUNCH_LIBS+= -lalias -lcam -lcurses -ldevstat -lipsec
124156905Sru.if ${MK_IPX} != "no"
125156905SruCRUNCH_LIBS+= -lipx
126156905Sru.endif
127192617Skmacy.if ${MK_ZFS} != "no"
128270997SdelphijCRUNCH_LIBS+= -lavl -lzpool -lzfs_core -lzfs -lnvpair -lpthread -luutil -lumem
129192617Skmacy.endif
130269519SdimCRUNCH_LIBS+= -lgeom -lbsdxml -lkiconv
131269519Sdim.if ${MK_OPENSSL} == "no"
132269519SdimCRUNCH_LIBS+= -lmd
133269519Sdim.endif
134280438SkenCRUNCH_LIBS+= -lmt -lsbuf -lufs -lz
135117035Sgordon
136211725Simp.if ${MACHINE_CPUARCH} == "i386"
137173314SmarcelCRUNCH_PROGS_sbin+= bsdlabel sconfig fdisk
138117057SgordonCRUNCH_ALIAS_bsdlabel= disklabel
139252356Sdavide#CRUNCH_PROGS+= mount_smbfs
140252356Sdavide#CRUNCH_LIBS+= -lsmb
141117035Sgordon.endif
142117035Sgordon
143117035Sgordon.if ${MACHINE} == "pc98"
144117692SobrienCRUNCH_SRCDIR_fdisk= $(.CURDIR)/../../sbin/fdisk_pc98
145117035Sgordon.endif
146117035Sgordon
147211725Simp.if ${MACHINE_CPUARCH} == "ia64"
148173314SmarcelCRUNCH_PROGS_sbin+= mca
149117035Sgordon.endif
150117035Sgordon
151211725Simp.if ${MACHINE_CPUARCH} == "sparc64"
152173314SmarcelCRUNCH_PROGS_sbin+= bsdlabel sunlabel
153117035Sgordon.endif
154117035Sgordon
155211725Simp.if ${MACHINE_CPUARCH} == "amd64"
156173314SmarcelCRUNCH_PROGS_sbin+= bsdlabel fdisk
157117057SgordonCRUNCH_ALIAS_bsdlabel= disklabel
158117057Sgordon.endif
159117057Sgordon
160117692SobrienCRUNCH_SRCDIR_atm= $(.CURDIR)/../../sbin/atm/atm
161118826ShartiCRUNCH_SRCDIR_atmconfig= $(.CURDIR)/../../sbin/atm/atmconfig
162117692SobrienCRUNCH_SRCDIR_fore_dnld= $(.CURDIR)/../../sbin/atm/fore_dnld
163117692SobrienCRUNCH_SRCDIR_ilmid= $(.CURDIR)/../../sbin/atm/ilmid
164117692SobrienCRUNCH_SRCDIR_rtquery= $(.CURDIR)/../../sbin/routed/rtquery
165145630SdarrenrCRUNCH_SRCDIR_ipf= $(.CURDIR)/../../sbin/ipf/ipf
166192617Skmacy.if ${MK_ZFS} != "no"
167192617SkmacyCRUNCH_SRCDIR_zfs= ${.CURDIR}/../../cddl/sbin/zfs
168192617SkmacyCRUNCH_SRCDIR_zpool= ${.CURDIR}/../../cddl/sbin/zpool
169270997SdelphijCRUNCH_SRCDIR_zdb= ${.CURDIR}/../../cddl/usr.sbin/zdb
170192617Skmacy.endif
171117035SgordonCRUNCH_ALIAS_reboot= fastboot halt fasthalt
172117692SobrienCRUNCH_ALIAS_restore= rrestore
173117035SgordonCRUNCH_ALIAS_dump= rdump
174117692SobrienCRUNCH_ALIAS_fsck_ffs= fsck_4.2bsd fsck_ufs
175177707SruCRUNCH_ALIAS_geom= glabel gpart
176117035Sgordon
177117035Sgordon# dhclient has historically been troublesome...
178147090SbrooksCRUNCH_PROGS_sbin+= dhclient
179147090SbrooksCRUNCH_BUILDOPTS_dhclient= -DRELEASE_CRUNCH -Dlint
180117035Sgordon
181117035Sgordon##################################################################
182117035Sgordon# Programs from stock /usr/bin
183191227Skientzle#
184117692SobrienCRUNCH_SRCDIRS+= usr.bin
185117035Sgordon
186227531SdesCRUNCH_PROGS_usr.bin= head mt nc sed tail tee
187173073Syar
188166255SdelphijCRUNCH_PROGS_usr.bin+= gzip
189117692SobrienCRUNCH_ALIAS_gzip= gunzip gzcat zcat
190117035Sgordon
191117692SobrienCRUNCH_PROGS_usr.bin+= bzip2
192117692SobrienCRUNCH_ALIAS_bzip2= bunzip2 bzcat
193117692SobrienCRUNCH_LIBS+= -lbz2
194117035Sgordon
195250626SdelphijCRUNCH_PROGS_usr.bin+= less
196250626SdelphijCRUNCH_ALIAS_less= more
197250626Sdelphij
198207849SmmCRUNCH_PROGS_usr.bin+= xz
199207849SmmCRUNCH_ALIAS_xz= unxz lzma unlzma xzcat lzcat
200207849SmmCRUNCH_LIBS+= -llzma
201207849Smm
202138366SobrienCRUNCH_PROGS_usr.bin+= tar
203269519SdimCRUNCH_LIBS+= -larchive
204191239Skientzle.if ${MK_OPENSSL} != "no"
205191239SkientzleCRUNCH_LIBS+= -lcrypto
206191239Skientzle.endif
207269519SdimCRUNCH_LIBS+= -lmd
208138366Sobrien
209117692SobrienCRUNCH_PROGS_usr.bin+= vi
210117692SobrienCRUNCH_ALIAS_vi= ex
211117035Sgordon
212126874SdesCRUNCH_PROGS_usr.bin+= id
213126874SdesCRUNCH_ALIAS_id= groups whoami
214126874Sdes
215117035Sgordon##################################################################
216141478Sdes# Programs from stock /usr/sbin
217191227Skientzle#
218141478SdesCRUNCH_SRCDIRS+= usr.sbin
219141478Sdes
220270997SdelphijCRUNCH_PROGS_usr.sbin+= chroot
221141478Sdes
222173073SyarCRUNCH_PROGS_usr.sbin+= chown
223173073SyarCRUNCH_ALIAS_chown= chgrp
224192617Skmacy##################################################################
225192617SkmacyCRUNCH_LIBS+= -lm
226173073Syar
227215226Sadrian.include <bsd.crunchgen.mk>
228117035Sgordon.include <bsd.prog.mk>
229