1117035Sgordon#$FreeBSD$
2117035Sgordon#	@(#)Makefile	8.1 (Berkeley) 6/2/93
3117035Sgordon
4156813SruNO_MAN=
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	\
54183007Simp	 pkill ps pwd realpath rm rmdir setfacl sh stty sync test
55266279SbdreweryCRUNCH_LIBS+= -lcrypt -ledit -ljail -lkvm -ll -ltermcap -lutil
56215226SadrianCRUNCH_BUILDTOOLS+= bin/sh
57117035Sgordon
58117035Sgordon# Additional options for specific programs
59117035SgordonCRUNCH_ALIAS_test= [
60117035SgordonCRUNCH_ALIAS_sh= -sh
61117035Sgordon# The -sh alias shouldn't appear in /rescue as a hard link
62117692SobrienCRUNCH_SUPPRESS_LINK_-sh= 1
63117035SgordonCRUNCH_ALIAS_ln= link
64117035SgordonCRUNCH_ALIAS_rm= unlink
65117035SgordonCRUNCH_ALIAS_ed= red
66173073SyarCRUNCH_ALIAS_pkill= pgrep
67173073Syar
68156813Sru.if ${MK_RCMDS} != "no"
69117601SgordonCRUNCH_PROGS_bin+= rcp
70117035Sgordon.endif
71117035Sgordon
72156813Sru.if ${MK_TCSH} != "no"
73117601SgordonCRUNCH_PROGS_bin+= csh
74117035SgordonCRUNCH_ALIAS_csh= -csh tcsh -tcsh
75215226SadrianCRUNCH_BUILDTOOLS+= bin/csh
76117692SobrienCRUNCH_SUPPRESS_LINK_-csh= 1
77117692SobrienCRUNCH_SUPPRESS_LINK_-tcsh= 1
78117035Sgordon.endif
79117035Sgordon
80117035Sgordon###################################################################
81117035Sgordon# Programs from standard /sbin
82117035Sgordon#
83117035Sgordon# WARNING: Changing this list may require adjusting
84117035Sgordon# /usr/include/paths.h as well!  You were warned!
85117035Sgordon#
86117791Sobrien# Note that mdmfs have their own private 'pathnames.h'
87117035Sgordon# headers in addition to the standard 'paths.h' header.
88117035Sgordon#
89117692SobrienCRUNCH_SRCDIRS+= sbin
90249083SmavCRUNCH_PROGS_sbin= badsect					\
91183007Simp	camcontrol ccdconfig clri devfs dmesg dump		\
92133799Smarius	dumpfs dumpon fsck fsck_ffs fsck_msdosfs fsdb		\
93173314Smarcel	fsirand gbde geom ifconfig init 			\
94183007Simp	kldconfig kldload kldstat kldunload ldconfig 		\
95183007Simp	md5 mdconfig mdmfs mknod mount mount_cd9660		\
96241636Sattilio	mount_msdosfs mount_nfs mount_nullfs			\
97183007Simp	mount_udf mount_unionfs newfs				\
98183007Simp	newfs_msdos nos-tun ping reboot				\
99183007Simp	restore rcorder route routed rtquery rtsol savecore	\
100191227Skientzle	spppcontrol swapon sysctl tunefs umount
101117035Sgordon
102156813Sru.if ${MK_ATM} != "no"
103171453SrwatsonCRUNCH_PROGS_sbin+= atmconfig
104119664Sphk.endif
105119664Sphk
106156813Sru.if ${MK_INET6_SUPPORT} != "no"
107119664SphkCRUNCH_PROGS_sbin+= ping6
108119664Sphk.endif
109119664Sphk
110156813Sru.if ${MK_IPFILTER} != "no"
111145630SdarrenrCRUNCH_PROGS_sbin+= ipf
112117693Sobrien.endif
113192617Skmacy.if ${MK_ZFS} != "no"
114192617SkmacyCRUNCH_PROGS_sbin+= zfs
115192617SkmacyCRUNCH_PROGS_sbin+= zpool
116270997SdelphijCRUNCH_PROGS_usr.sbin+= zdb
117192617Skmacy.endif
118117693Sobrien
119117035Sgordon# crunchgen does not like C++ programs; this should be fixed someday
120117035Sgordon# CRUNCH_PROGS+= devd
121117035Sgordon
122157177ScognetCRUNCH_LIBS+= -lalias -lcam -lcurses -ldevstat -lipsec
123156905Sru.if ${MK_IPX} != "no"
124156905SruCRUNCH_LIBS+= -lipx
125156905Sru.endif
126192617Skmacy.if ${MK_ZFS} != "no"
127270997SdelphijCRUNCH_LIBS+= -lavl -lzpool -lzfs_core -lzfs -lnvpair -lpthread -luutil -lumem
128192617Skmacy.endif
129269519SdimCRUNCH_LIBS+= -lgeom -lbsdxml -lkiconv
130269519Sdim.if ${MK_OPENSSL} == "no"
131269519SdimCRUNCH_LIBS+= -lmd
132269519Sdim.endif
133269519SdimCRUNCH_LIBS+= -lsbuf -lufs -lz
134117035Sgordon
135211725Simp.if ${MACHINE_CPUARCH} == "i386"
136173314SmarcelCRUNCH_PROGS_sbin+= bsdlabel sconfig fdisk
137117057SgordonCRUNCH_ALIAS_bsdlabel= disklabel
138252356Sdavide#CRUNCH_PROGS+= mount_smbfs
139252356Sdavide#CRUNCH_LIBS+= -lsmb
140117035Sgordon.endif
141117035Sgordon
142117035Sgordon.if ${MACHINE} == "pc98"
143173314SmarcelCRUNCH_PROGS_sbin+= bsdlabel
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