Makefile revision 117057
1#$FreeBSD: head/rescue/rescue/Makefile 117057 2003-06-30 05:06:43Z gordon $ 2# @(#)Makefile 8.1 (Berkeley) 6/2/93 3 4PROG= rescue 5BINDIR?= /rescue 6 7# Uncomment to exclude tcsh 8#NO_TCSH=1 9 10# Shell scripts need #! line to be edited from /bin/sh to /rescue/sh 11SCRIPTS= nextboot_FIXED 12SCRIPTSNAME_nextboot_FIXED= nextboot.sh 13nextboot_FIXED: ../../sbin/reboot/nextboot.sh 14 sed '1s/\/bin\//\/rescue\//' ${.ALLSRC} > ${.TARGET} 15CLEANFILES+= nextboot_FIXED 16 17SCRIPTS+= dhclient_FIXED 18SCRIPTSNAME_dhclient_FIXED= dhclient-script 19dhclient_FIXED: ../../contrib/isc-dhcp/client/scripts/freebsd 20 sed '1s/\/bin\//\/rescue\//' ${.ALLSRC} > ${.TARGET} 21CLEANFILES+= dhclient_FIXED 22 23################################################################# 24# 25# General notes: 26# 27# A number of Make variables are used to generate the crunchgen config file. 28# 29# CRUNCH_SRCDIRS: lists directories to search for included programs 30# CRUNCH_PROGS: lists programs to be included 31# CRUNCH_LIBS: libraries to link with 32# CRUNCH_BUILDOPTS: generic build options to be added to every program 33# 34# Special options can be specified for individual programs 35# CRUNCH_SRCDIR_$(P): base source directory for program $(P) 36# CRUNCH_BUILDOPTS_$(P): additional build options for $(P) 37# CRUNCH_ALIAS_$(P): additional names to be used for $(P) 38# 39# By default, any name appearing in CRUNCH_PROGS or CRUNCH_ALIAS_${P} 40# will be used to generate a hard link to the resulting binary. 41# Specific links can be suppressed by setting 42# CRUNCH_SUPPRESS_LINK_$(NAME) to 1. 43# 44 45# Define Makefile variable RESCUE 46CRUNCH_BUILDOPTS+= -DRESCUE 47# Define compile-time RESCUE symbol when compiling components 48CRUNCH_BUILDOPTS+= CRUNCH_CFLAGS=-DRESCUE 49 50#MAKEFLAGS= -m ${.CURDIR} ${.MAKEFLAGS} 51 52# Hackery: 'librescue' exists merely as a tool for appropriately 53# recompiling specific library entries. We _know_ they're needed, and 54# regular archive searching creates ugly library ordering problems. 55# Easiest fix: tell the linker to include them into the executable 56# first, so they are guaranteed to override the regular lib entries. 57# Note that if 'librescue' hasn't been compiled, we'll just get the 58# regular lib entries from libc and friends. 59CRUNCH_LIBS+= ${.OBJDIR}/../librescue/*.o 60 61################################################################### 62# Programs from stock /bin 63# 64# WARNING: Changing this list may require adjusting 65# /usr/include/paths.h as well! You were warned! 66# 67CRUNCH_SRCDIRS+=$(.CURDIR)/../../bin $(.CURDIR)/../../usr.bin 68CRUNCH_PROGS=cat chflags chio chmod cp date dd df domainname echo ed \ 69 expr getfacl hostname kenv kill ln ls mkdir mv pax ps pwd \ 70 realpath rm rmdir setfacl sh sleep stty sync test 71CRUNCH_LIBS+=-lcrypt -lcrypto -ledit -lkvm -ll -lm -ltermcap -lutil 72 73# Additional options for specific programs 74CRUNCH_ALIAS_test= [ 75CRUNCH_ALIAS_sh= -sh 76# The -sh alias shouldn't appear in /rescue as a hard link 77CRUNCH_SUPPRESS_LINK_-sh=1 78CRUNCH_ALIAS_ln= link 79CRUNCH_ALIAS_rm= unlink 80CRUNCH_ALIAS_ed= red 81 82.if !defined(NO_RCMNDS) 83CRUNCH_PROGS+= rcp 84.endif 85 86.if !defined(NO_TCSH) 87CRUNCH_PROGS+= csh 88CRUNCH_ALIAS_csh= -csh tcsh -tcsh 89CRUNCH_SUPPRESS_LINK_-csh=1 90CRUNCH_SUPPRESS_LINK_-tcsh=1 91.endif 92 93#Is rmail of any use at all here? I think not. 94#CRUNCH_PROGS+= rmail 95 96################################################################### 97# Programs from standard /sbin 98# 99# WARNING: Changing this list may require adjusting 100# /usr/include/paths.h as well! You were warned! 101# 102# Note that mdmfs and shutdown have their own private 'pathnames.h' 103# headers in addition to the standard 'paths.h' header. 104# 105CRUNCH_SRCDIRS+=$(.CURDIR)/../../sbin 106CRUNCH_PROGS+=atm adjkerntz atacontrol badsect bsdlabel camcontrol \ 107 ccdconfig clri comcontrol conscontrol devfs dmesg dump \ 108 dumpfs dumpon fore_dnld fsck fsck_ffs fsck_msdosfs fsdb \ 109 fsirand gbde growfs ifconfig ilmid init ip6fw ipf ipfs ipfstat \ 110 ipfw ipmon ipnat kldconfig kldload kldstat kldunload ldconfig \ 111 md5 mdconfig mdmfs mknod mount mount_cd9660 mount_ext2fs \ 112 mount_msdosfs mount_nfs mount_ntfs mount_nullfs mount_portalfs \ 113 mount_std mount_udf mount_umapfs mount_unionfs natd newfs \ 114 newfs_msdos nfsiod nos-tun ping ping6 quotacheck raidctl reboot \ 115 restore rcorder route routed rtquery rtsol savecore shutdown \ 116 slattach spppcontrol startslip swapon sysctl tunefs umount vinum 117 118# crunchgen does not like C++ programs; this should be fixed someday 119# CRUNCH_PROGS+= devd 120 121CRUNCH_LIBS+=-lalias -latm -lbsdxml -lcam -lcurses -ldevstat -lipsec -lipx \ 122 -lgeom -lmd -lncp -lreadline -lsbuf -lsmb -lufs -lz 123 124.if ${MACHINE_ARCH} == "i386" 125CRUNCH_PROGS+= cxconfig fdisk mount_nwfs mount_smbfs 126CRUNCH_ALIAS_bsdlabel= disklabel 127.endif 128 129.if ${MACHINE} == "pc98" 130CRUNCH_PROGS+= fdisk_pc98 131CRUNCH_ALIAS_bsdlabel= disklabel 132CRUNCH_ALIAS_fdisk_pc98= fdisk 133.endif 134 135.if ${MACHINE_ARCH} == "ia64" 136CRUNCH_PROGS+= mca gpt fdisk 137CRUNCH_ALIAS_bsdlabel= disklabel 138.endif 139 140.if ${MACHINE_ARCH} == "sparc64" 141CRUNCH_PROGS+= fdisk sunlabel 142.endif 143 144.if ${MACHINE_ARCH} == "alpha" 145CRUNCH_PROGS+= fdisk 146CRUNCH_ALIAS_bsdlabel= disklabel 147.endif 148 149.if ${MACHINE_ARCH} == "amd64" 150CRUNCH_PROGS+= fdisk 151CRUNCH_ALIAS_bsdlabel= disklabel 152.endif 153 154CRUNCH_SRCDIR_atm=$(.CURDIR)/../../sbin/atm/atm 155CRUNCH_SRCDIR_fore_dnld=$(.CURDIR)/../../sbin/atm/fore_dnld 156CRUNCH_SRCDIR_ilmid=$(.CURDIR)/../../sbin/atm/ilmid 157CRUNCH_SRCDIR_rtquery=$(.CURDIR)/../../sbin/routed/rtquery 158CRUNCH_ALIAS_reboot= fastboot halt fasthalt 159CRUNCH_ALIAS_restore=rrestore 160CRUNCH_ALIAS_dump= rdump 161CRUNCH_ALIAS_fsck_ffs=fsck_4.2bsd fsck_ufs 162CRUNCH_ALIAS_mount_std= mount_devfs mount_fdescfs mount_linprocfs mount_procfs 163 164# dhclient has historically been troublesome... 165CRUNCH_PROGS+=dhclient 166CRUNCH_BUILDOPTS_dhclient=-DRELEASE_CRUNCH -Dlint 167 168################################################################## 169# Programs from stock /usr/bin 170# 171CRUNCH_SRCDIRS+=$(.CURDIR)/../../usr.bin 172CRUNCH_SRCDIRS+=$(.CURDIR)/../../gnu/usr.bin 173 174CRUNCH_PROGS+=wall 175 176CRUNCH_PROGS+=gzip 177CRUNCH_ALIAS_gzip=gunzip gzcat zcat 178 179CRUNCH_PROGS+=bzip2 180CRUNCH_ALIAS_bzip2=bunzip2 bzcat 181CRUNCH_LIBS+=-lbz2 182 183CRUNCH_PROGS+=tar 184CRUNCH_PROGS+=vi 185CRUNCH_ALIAS_vi=ex 186 187################################################################## 188# The following is pretty nearly a generic crunchgen-handling makefile 189# 190 191CONF= $(PROG).conf 192OUTMK= $(PROG).mk 193OUTC= $(PROG).c 194OUTPUTS= $(OUTMK) $(OUTC) $(PROG).cache 195CRUNCHOBJS= ${.OBJDIR} 196.if defined(MAKEOBJDIRPREFIX) 197CANONICALOBJDIR:=${MAKEOBJDIRPREFIX}${.CURDIR} 198.else 199CANONICALOBJDIR:=/usr/obj${.CURDIR} 200.endif 201 202NOMAN= true 203CLEANFILES+= $(CONF) *.o *.lo *.c *.mk *.cache *.a *.h 204 205# Program names and their aliases contribute hardlinks to 'rescue' executable, 206# except for those that get suppressed. 207.for P in $(CRUNCH_PROGS) 208.ifndef CRUNCH_SUPPRESS_LINK_${P} 209LINKS += $(BINDIR)/$(PROG) $(BINDIR)/$(P) 210.endif 211.for A in $(CRUNCH_ALIAS_$(P)) 212.ifndef CRUNCH_SUPPRESS_LINK_${A} 213LINKS += $(BINDIR)/$(PROG) $(BINDIR)/$(A) 214.endif 215.endfor 216.endfor 217 218all: $(PROG) 219exe: $(PROG) 220 221$(CONF): Makefile 222 echo \# Auto-generated, do not edit >$(.TARGET) 223.for D in $(CRUNCH_SRCDIRS) 224 echo srcdirs $(D) >>$(.TARGET) 225.endfor 226.ifdef CRUNCH_BUILDOPTS 227 echo buildopts $(CRUNCH_BUILDOPTS) >>$(.TARGET) 228.endif 229.ifdef CRUNCH_LIBS 230 echo libs $(CRUNCH_LIBS) >>$(.TARGET) 231.endif 232.for P in $(CRUNCH_PROGS) 233 echo progs $(P) >>$(.TARGET) 234.ifdef CRUNCH_SRCDIR_${P} 235 echo special $(P) srcdir $(CRUNCH_SRCDIR_${P}) >>$(.TARGET) 236.endif 237.ifdef CRUNCH_BUILDOPTS_${P} 238 echo special $(P) buildopts $(CRUNCH_BUILDOPTS_${P}) >>$(.TARGET) 239.endif 240.for A in $(CRUNCH_ALIAS_$(P)) 241 echo ln $(P) $(A) >>$(.TARGET) 242.endfor 243.endfor 244 245 246$(OUTPUTS): $(CONF) 247 MAKEOBJDIRPREFIX=${CRUNCHOBJS} crunchgen -q -m $(OUTMK) -c $(OUTC) $(CONF) 248 249# -m here forces make to treat the bsd.prog.mk and bsd.lib.mk in 250# this directory as overrides for the standard shared ones. 251$(PROG): $(OUTPUTS) 252 MAKEOBJDIRPREFIX=${CRUNCHOBJS} make -f $(OUTMK) 253 254objs: 255 MAKEOBJDIRPREFIX=${CRUNCHOBJS} make -f $(OUTMK) objs 256 257# Use a separate build tree to hold files compiled for this crunchgen binary 258# Yes, this does seem to partly duplicate bsd.subdir.mk, but I can't 259# get that to cooperate with bsd.prog.mk. Besides, many of the standard 260# targets should NOT be propagated into the components. 261cleandepend cleandir obj objlink: 262.for D in $(CRUNCH_SRCDIRS) 263 cd ${D} && MAKEOBJDIRPREFIX=${CANONICALOBJDIR} make ${.TARGET} 264.endfor 265 266clean: 267 rm -f ${CLEANFILES} 268 if [ -e ${.OBJDIR}/$(OUTMK) ]; then \ 269 MAKEOBJDIRPREFIX=${CRUNCHOBJS} make -f $(OUTMK) clean; \ 270 fi 271.for D in $(CRUNCH_SRCDIRS) $(EXTRA_SRCDIRS) 272 cd ${D} && MAKEOBJDIRPREFIX=${CRUNCHOBJS} make clean 273.endfor 274 275.include <bsd.prog.mk> 276