Makefile revision 117086
1#$FreeBSD: head/rescue/rescue/Makefile 117086 2003-06-30 21:13:56Z 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 \ 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 -lreadline -lsbuf -lufs -lz 123 124.if ${MACHINE_ARCH} == "i386" 125CRUNCH_PROGS+= cxconfig fdisk 126CRUNCH_ALIAS_bsdlabel= disklabel 127#CRUNCH_PROGS+= mount_nwfs mount_smbfs 128#CRUNCH_LIBS+= -lncp -lsmb 129.endif 130 131.if ${MACHINE} == "pc98" 132CRUNCH_SRCDIR_fdisk=$(.CURDIR)/../../sbin/fdisk_pc98 133.endif 134 135.if ${MACHINE_ARCH} == "ia64" 136CRUNCH_PROGS+= mca gpt fdisk 137.endif 138 139.if ${MACHINE_ARCH} == "sparc64" 140CRUNCH_PROGS+= sunlabel 141.endif 142 143.if ${MACHINE_ARCH} == "alpha" 144CRUNCH_ALIAS_bsdlabel= disklabel 145.endif 146 147.if ${MACHINE_ARCH} == "amd64" 148CRUNCH_PROGS+= fdisk 149CRUNCH_ALIAS_bsdlabel= disklabel 150.endif 151 152CRUNCH_SRCDIR_atm=$(.CURDIR)/../../sbin/atm/atm 153CRUNCH_SRCDIR_fore_dnld=$(.CURDIR)/../../sbin/atm/fore_dnld 154CRUNCH_SRCDIR_ilmid=$(.CURDIR)/../../sbin/atm/ilmid 155CRUNCH_SRCDIR_rtquery=$(.CURDIR)/../../sbin/routed/rtquery 156CRUNCH_ALIAS_reboot= fastboot halt fasthalt 157CRUNCH_ALIAS_restore=rrestore 158CRUNCH_ALIAS_dump= rdump 159CRUNCH_ALIAS_fsck_ffs=fsck_4.2bsd fsck_ufs 160CRUNCH_ALIAS_mount_std= mount_devfs mount_fdescfs mount_linprocfs mount_procfs 161 162# dhclient has historically been troublesome... 163CRUNCH_PROGS+=dhclient 164CRUNCH_BUILDOPTS_dhclient=-DRELEASE_CRUNCH -Dlint 165 166################################################################## 167# Programs from stock /usr/bin 168# 169CRUNCH_SRCDIRS+=$(.CURDIR)/../../usr.bin 170CRUNCH_SRCDIRS+=$(.CURDIR)/../../gnu/usr.bin 171 172CRUNCH_PROGS+=wall 173 174CRUNCH_PROGS+=gzip 175CRUNCH_ALIAS_gzip=gunzip gzcat zcat 176 177CRUNCH_PROGS+=bzip2 178CRUNCH_ALIAS_bzip2=bunzip2 bzcat 179CRUNCH_LIBS+=-lbz2 180 181CRUNCH_PROGS+=tar 182CRUNCH_PROGS+=vi 183CRUNCH_ALIAS_vi=ex 184 185################################################################## 186# The following is pretty nearly a generic crunchgen-handling makefile 187# 188 189CONF= $(PROG).conf 190OUTMK= $(PROG).mk 191OUTC= $(PROG).c 192OUTPUTS= $(OUTMK) $(OUTC) $(PROG).cache 193CRUNCHOBJS= ${.OBJDIR} 194.if defined(MAKEOBJDIRPREFIX) 195CANONICALOBJDIR:=${MAKEOBJDIRPREFIX}${.CURDIR} 196.else 197CANONICALOBJDIR:=/usr/obj${.CURDIR} 198.endif 199 200NOMAN= true 201CLEANFILES+= $(CONF) *.o *.lo *.c *.mk *.cache *.a *.h 202 203# Program names and their aliases contribute hardlinks to 'rescue' executable, 204# except for those that get suppressed. 205.for P in $(CRUNCH_PROGS) 206.ifndef CRUNCH_SUPPRESS_LINK_${P} 207LINKS += $(BINDIR)/$(PROG) $(BINDIR)/$(P) 208.endif 209.for A in $(CRUNCH_ALIAS_$(P)) 210.ifndef CRUNCH_SUPPRESS_LINK_${A} 211LINKS += $(BINDIR)/$(PROG) $(BINDIR)/$(A) 212.endif 213.endfor 214.endfor 215 216all: $(PROG) 217exe: $(PROG) 218 219$(CONF): Makefile 220 echo \# Auto-generated, do not edit >$(.TARGET) 221.for D in $(CRUNCH_SRCDIRS) 222 echo srcdirs $(D) >>$(.TARGET) 223.endfor 224.ifdef CRUNCH_BUILDOPTS 225 echo buildopts $(CRUNCH_BUILDOPTS) >>$(.TARGET) 226.endif 227.ifdef CRUNCH_LIBS 228 echo libs $(CRUNCH_LIBS) >>$(.TARGET) 229.endif 230.for P in $(CRUNCH_PROGS) 231 echo progs $(P) >>$(.TARGET) 232.ifdef CRUNCH_SRCDIR_${P} 233 echo special $(P) srcdir $(CRUNCH_SRCDIR_${P}) >>$(.TARGET) 234.endif 235.ifdef CRUNCH_BUILDOPTS_${P} 236 echo special $(P) buildopts $(CRUNCH_BUILDOPTS_${P}) >>$(.TARGET) 237.endif 238.for A in $(CRUNCH_ALIAS_$(P)) 239 echo ln $(P) $(A) >>$(.TARGET) 240.endfor 241.endfor 242 243 244$(OUTPUTS): $(CONF) 245 MAKEOBJDIRPREFIX=${CRUNCHOBJS} crunchgen -q -m $(OUTMK) -c $(OUTC) $(CONF) 246 247# -m here forces make to treat the bsd.prog.mk and bsd.lib.mk in 248# this directory as overrides for the standard shared ones. 249$(PROG): $(OUTPUTS) 250 MAKEOBJDIRPREFIX=${CRUNCHOBJS} make -f $(OUTMK) 251 252objs: 253 MAKEOBJDIRPREFIX=${CRUNCHOBJS} make -f $(OUTMK) objs 254 255# Use a separate build tree to hold files compiled for this crunchgen binary 256# Yes, this does seem to partly duplicate bsd.subdir.mk, but I can't 257# get that to cooperate with bsd.prog.mk. Besides, many of the standard 258# targets should NOT be propagated into the components. 259cleandepend cleandir obj objlink: 260.for D in $(CRUNCH_SRCDIRS) 261 cd ${D} && MAKEOBJDIRPREFIX=${CANONICALOBJDIR} make ${.TARGET} 262.endfor 263 264clean: 265 rm -f ${CLEANFILES} 266 if [ -e ${.OBJDIR}/$(OUTMK) ]; then \ 267 MAKEOBJDIRPREFIX=${CRUNCHOBJS} make -f $(OUTMK) clean; \ 268 fi 269.for D in $(CRUNCH_SRCDIRS) $(EXTRA_SRCDIRS) 270 cd ${D} && MAKEOBJDIRPREFIX=${CRUNCHOBJS} make clean 271.endfor 272 273.include <bsd.prog.mk> 274