Makefile revision 36800
12061Sjkh# 236800Sbde# $Id: Makefile,v 1.200 1998/06/07 10:50:28 sos Exp $ 32061Sjkh# 433611Sjb# While porting to the another architecture include the bootstrap instead 532427Sjb# of the normal build. 632427Sjb# 736111Sjb.if exists(${.CURDIR}/Makefile.${MACHINE}) && defined(BOOTSTRAP_WORLD) 833611Sjb.include "${.CURDIR}/Makefile.${MACHINE}" 932427Sjb.else 1032427Sjb# 112061Sjkh# Make command line options: 1215603Smarkm# -DCLOBBER will remove /usr/include 1330169Sjkh# -DMAKE_KERBEROS4 to build KerberosIV 142061Sjkh# -DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir 1512483Speter# -DNOCLEAN do not clean at all 1634509Sbde# -DNOTOOLS do not rebuild any tools first 172160Scsgr# -DNOCRYPT will prevent building of crypt versions 182834Swollman# -DNOLKM do not build loadable kernel modules 192061Sjkh# -DNOOBJDIR do not run ``${MAKE} obj'' 202061Sjkh# -DNOPROFILE do not build profiled libraries 212160Scsgr# -DNOSECURE do not go into secure subdir 2217308Speter# -DNOGAMES do not go into games subdir 2319320Sadam# -DNOSHARE do not go into share subdir 2427788Sasami# -DNOINFO do not make or install info files 2530169Sjkh# -DNOLIBC_R do not build libc_r. 2625980Sasami# LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list 271594Srgrimes 2817308Speter# 2917308Speter# The intended user-driven targets are: 3027910Sasami# buildworld - rebuild *everything*, including glue to help do upgrades 3127910Sasami# installworld- install everything built by "buildworld" 3227910Sasami# world - buildworld + installworld 3317308Speter# update - convenient way to update your source tree (eg: sup/cvs) 3417308Speter# most - build user commands, no libraries or include files 3517308Speter# installmost - install user commands, no libraries or include files 3619175Sbde# 3719175Sbde# Standard targets (not defined here) are documented in the makefiles in 3819175Sbde# /usr/share/mk. These include: 3919175Sbde# obj depend all install clean cleandepend cleanobj 4017308Speter 4127910Sasami.if (!make(world)) && (!make(buildworld)) && (!make(installworld)) 4234509Sbde.MAKEFLAGS:= -m ${.CURDIR}/share/mk ${.MAKEFLAGS} 4327910Sasami.endif 4417308Speter 452061Sjkh# Put initial settings here. 462061SjkhSUBDIR= 471594Srgrimes 4830169Sjkh# We must do share/info early so that installation of info `dir' 4930169Sjkh# entries works correctly. Do it first since it is less likely to 5030169Sjkh# grow dependencies on include and lib than vice versa. 5130169Sjkh.if exists(share/info) 5230169SjkhSUBDIR+= share/info 5330169Sjkh.endif 5430169Sjkh 5530169Sjkh# We must do include and lib early so that the perl *.ph generation 567407Srgrimes# works correctly as it uses the header files installed by this. 577108Sphk.if exists(include) 587108SphkSUBDIR+= include 597108Sphk.endif 607407Srgrimes.if exists(lib) 617407SrgrimesSUBDIR+= lib 627407Srgrimes.endif 637108Sphk 642061Sjkh.if exists(bin) 652061SjkhSUBDIR+= bin 662061Sjkh.endif 6717308Speter.if exists(games) && !defined(NOGAMES) 682061SjkhSUBDIR+= games 692061Sjkh.endif 702061Sjkh.if exists(gnu) 712061SjkhSUBDIR+= gnu 722061Sjkh.endif 7335427Sbde.if exists(kerberosIV) && exists(crypto) && !defined(NOCRYPT) && \ 7435427Sbde defined(MAKE_KERBEROS4) 7530169SjkhSUBDIR+= kerberosIV 762626Scsgr.endif 772061Sjkh.if exists(libexec) 782061SjkhSUBDIR+= libexec 792061Sjkh.endif 802061Sjkh.if exists(sbin) 812061SjkhSUBDIR+= sbin 822061Sjkh.endif 8319320Sadam.if exists(share) && !defined(NOSHARE) 842061SjkhSUBDIR+= share 852061Sjkh.endif 862061Sjkh.if exists(sys) 872061SjkhSUBDIR+= sys 882061Sjkh.endif 892061Sjkh.if exists(usr.bin) 902061SjkhSUBDIR+= usr.bin 912061Sjkh.endif 922061Sjkh.if exists(usr.sbin) 932061SjkhSUBDIR+= usr.sbin 942061Sjkh.endif 952834Swollman.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE) 962834SwollmanSUBDIR+= secure 972834Swollman.endif 982834Swollman.if exists(lkm) && !defined(NOLKM) 992834SwollmanSUBDIR+= lkm 1002834Swollman.endif 1011594Srgrimes 1024486Sphk# etc must be last for "distribute" to work 1034486Sphk.if exists(etc) && make(distribute) 1044486SphkSUBDIR+= etc 1054486Sphk.endif 1064486Sphk 1072061Sjkh# These are last, since it is nice to at least get the base system 1082061Sjkh# rebuilt before you do them. 10925979Sjkh.if defined(LOCAL_DIRS) 11025979Sjkh.for _DIR in ${LOCAL_DIRS} 11125979Sjkh.if exists(${_DIR}) & exists(${_DIR}/Makefile) 11225979SjkhSUBDIR+= ${_DIR} 1132061Sjkh.endif 11425979Sjkh.endfor 1152061Sjkh.endif 1162061Sjkh 11717308Speter# Handle -DNOOBJDIR, -DNOCLEAN and -DNOCLEANDIR 1182061Sjkh.if defined(NOOBJDIR) 1192061SjkhOBJDIR= 1202061Sjkh.else 1212061SjkhOBJDIR= obj 1222061Sjkh.endif 12312483Speter 12412483Speter.if defined(NOCLEAN) 12512483SpeterCLEANDIR= 12612483Speter.else 1272061Sjkh.if defined(NOCLEANDIR) 12835479SbdeCLEANDIR= clean cleandepend 1298854Srgrimes.else 1302061SjkhCLEANDIR= cleandir 1312061Sjkh.endif 13212483Speter.endif 1332061Sjkh 13435479Sbde.if !defined(NOCLEAN) && ${.MAKEFLAGS:M-j} == "" 13535479Sbde_NODEPEND= true 13635479Sbde.endif 13735479Sbde.if defined(_NODEPEND) 13835479Sbde_DEPEND= cleandepend 13935479Sbde.else 14035479Sbde_DEPEND= depend 14135479Sbde.endif 14235479Sbde 14335462SjkhSUP?= cvsup 14435462SjkhSUPFLAGS?= -g -L 2 -P - 14518714Sache 14617308Speter# 14734541Sbde# While building tools for bootstrapping, we don't need to waste time on 14834575Sbde# shared or profiled libraries, shared linkage, or documentation, except 14934575Sbde# when the tools won't get cleaned we must use the defaults for shared 15034575Sbde# libraries and shared linkage (and this doesn't waste time). 15134592Sbde# XXX actually, we do need to waste time building shared libraries. 15217308Speter# 15334575Sbde.if defined(NOCLEAN) 15435427SbdeMK_FLAGS= -DNOINFO -DNOMAN -DNOPROFILE 15534575Sbde.else 15635427SbdeMK_FLAGS= -DNOINFO -DNOMAN -DNOPIC -DNOPROFILE -DNOSHARED 15734575Sbde.endif 15815603Smarkm 15917308Speter# 16017308Speter# world 16117308Speter# 16217308Speter# Attempt to rebuild and reinstall *everything*, with reasonable chance of 16317308Speter# success, regardless of how old your existing system is. 16417308Speter# 16517308Speter# >> Beware, it overwrites the local build environment! << 16617308Speter# 16717308Speterworld: 16818362Sjkh @echo "--------------------------------------------------------------" 16919966Sache @echo "make world started on `LC_TIME=C date`" 17018362Sjkh @echo "--------------------------------------------------------------" 17117308Speter.if target(pre-world) 17227910Sasami @echo 17317308Speter @echo "--------------------------------------------------------------" 17417308Speter @echo " Making 'pre-world' target" 17517308Speter @echo "--------------------------------------------------------------" 17636074Sbde cd ${.CURDIR}; ${MAKE} pre-world 17727910Sasami.endif 17836074Sbde cd ${.CURDIR}; ${MAKE} buildworld 17936074Sbde cd ${.CURDIR}; ${MAKE} -B installworld 18027910Sasami.if target(post-world) 18117308Speter @echo 1822061Sjkh @echo "--------------------------------------------------------------" 18327910Sasami @echo " Making 'post-world' target" 1842061Sjkh @echo "--------------------------------------------------------------" 18536074Sbde cd ${.CURDIR}; ${MAKE} post-world 18627910Sasami.endif 1872061Sjkh @echo 18817308Speter @echo "--------------------------------------------------------------" 18927910Sasami @echo "make world completed on `LC_TIME=C date`" 19017308Speter @echo "--------------------------------------------------------------" 19127910Sasami 19227910Sasami.if defined(MAKEOBJDIRPREFIX) 19327910SasamiWORLDTMP= ${MAKEOBJDIRPREFIX}${.CURDIR}/tmp 19417308Speter.else 19527910SasamiWORLDTMP= /usr/obj${.CURDIR}/tmp 19617308Speter.endif 19727910SasamiSTRICTTMPPATH= ${WORLDTMP}/sbin:${WORLDTMP}/usr/sbin:${WORLDTMP}/bin:${WORLDTMP}/usr/bin 19827910SasamiTMPPATH= ${STRICTTMPPATH}:${PATH} 19927910Sasami 20027910Sasami# XXX COMPILER_PATH is needed for finding cc1, ld and as 20136622Scharnier# XXX GCC_EXEC_PREFIX is for *crt.o. It is probably unnecessary now 20236622Scharnier# that LIBRARY_PATH is set. We still can't use -nostdlib, since gcc 20327910Sasami# wouldn't link *crt.o or libgcc if it were used. 20427910Sasami# XXX LD_LIBRARY_PATH is for ld.so. It is also used by ld, although we don't 20527910Sasami# want that - all compile-time library paths should be resolved by gcc. 20627910Sasami# It fails for set[ug]id executables (are any used?). 20727910SasamiCOMPILER_ENV= BISON_SIMPLE=${WORLDTMP}/usr/share/misc/bison.simple \ 20827910Sasami COMPILER_PATH=${WORLDTMP}/usr/libexec:${WORLDTMP}/usr/bin \ 20934509Sbde GCC_EXEC_PREFIX=${WORLDTMP}${SHLIBDIR}:${WORLDTMP}/usr/lib/ \ 21027910Sasami LD_LIBRARY_PATH=${WORLDTMP}${SHLIBDIR} \ 21127910Sasami LIBRARY_PATH=${WORLDTMP}${SHLIBDIR}:${WORLDTMP}/usr/lib 21227910Sasami 21336423SpeterBMAKEENV= PATH=${TMPPATH} ${COMPILER_ENV} NOEXTRADEPEND=t \ 21436423Speter OBJFORMAT_PATH=${WORLDTMP}/usr/libexec:/usr/libexec 21527910SasamiXMAKEENV= PATH=${STRICTTMPPATH} ${COMPILER_ENV} \ 21636423Speter OBJFORMAT_PATH=${WORLDTMP}/usr/libexec \ 21735479Sbde CFLAGS="-nostdinc ${CFLAGS}" # XXX -nostdlib 21827910Sasami 21927910Sasami# used to compile and install 'make' in temporary build tree 22034688SbdeMAKETMP= ${WORLDTMP}/make 22134688SbdeIBMAKE= ${BMAKEENV} MAKEOBJDIR=${MAKETMP} ${MAKE} DESTDIR=${WORLDTMP} 22227910Sasami# bootstrap make 22335427SbdeBMAKE= ${BMAKEENV} ${WORLDTMP}/usr/bin/make DESTDIR=${WORLDTMP} 22427910Sasami# cross make used for compilation 22535427SbdeXMAKE= ${XMAKEENV} ${WORLDTMP}/usr/bin/make DESTDIR=${WORLDTMP} 22627910Sasami# cross make used for final installation 22735427SbdeIXMAKE= ${XMAKEENV} ${WORLDTMP}/usr/bin/make 22827910Sasami 22927910Sasami# 23027910Sasami# buildworld 23127910Sasami# 23227910Sasami# Attempt to rebuild the entire system, with reasonable chance of 23327910Sasami# success, regardless of how old your existing system is. 23427910Sasami# 23527910Sasamibuildworld: 23627910Sasami.if !defined(NOCLEAN) 23717308Speter @echo 23817308Speter @echo "--------------------------------------------------------------" 23927910Sasami @echo " Cleaning up the temporary build tree" 24017308Speter @echo "--------------------------------------------------------------" 24127910Sasami mkdir -p ${WORLDTMP} 24227910Sasami chflags -R noschg ${WORLDTMP}/ 24327910Sasami rm -rf ${WORLDTMP} 24427910Sasami.endif 24533133Sadam.if !defined(NOTOOLS) 24617466Speter @echo 24717308Speter @echo "--------------------------------------------------------------" 24827910Sasami @echo " Making make" 24917308Speter @echo "--------------------------------------------------------------" 25034688Sbde mkdir -p ${WORLDTMP}/usr/bin ${MAKETMP} 25134688Sbde ( \ 25236074Sbde cd ${.CURDIR}/usr.bin/make; \ 25336074Sbde MAKEOBJDIRPREFIX=""; unset MAKEOBJDIRPREFIX; \ 25436074Sbde ${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} all; \ 25536074Sbde ${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} install; \ 25634688Sbde ${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} clean \ 25734688Sbde ) 25836722Ssos @echo 25936722Ssos @echo "--------------------------------------------------------------" 26036800Sbde @echo " Making mtree" 26136722Ssos @echo "--------------------------------------------------------------" 26236800Sbde mkdir -p ${WORLDTMP}/usr/sbin ${WORLDTMP}/mtree 26336722Ssos ( \ 26436722Ssos cd ${.CURDIR}/usr.sbin/mtree; \ 26536722Ssos MAKEOBJDIRPREFIX=""; unset MAKEOBJDIRPREFIX; \ 26636800Sbde export MAKEOBJDIR=${WORLDTMP}/mtree; \ 26736800Sbde ${BMAKE} ${MK_FLAGS} all; \ 26836800Sbde ${BMAKE} ${MK_FLAGS} -B install clean \ 26936722Ssos ) 27033133Sadam.endif 27117308Speter @echo 27217308Speter @echo "--------------------------------------------------------------" 27327910Sasami @echo " Making hierarchy" 27417308Speter @echo "--------------------------------------------------------------" 27536074Sbde cd ${.CURDIR}; ${BMAKE} hierarchy 27627910Sasami.if !defined(NOCLEAN) 27717308Speter @echo 27817308Speter @echo "--------------------------------------------------------------" 27927910Sasami @echo " Cleaning up the obj tree" 28017308Speter @echo "--------------------------------------------------------------" 28136074Sbde cd ${.CURDIR}; ${BMAKE} ${CLEANDIR:S/^/par-/} 28227910Sasami.endif 28327910Sasami.if !defined(NOOBJDIR) 28417308Speter @echo 28517308Speter @echo "--------------------------------------------------------------" 28627910Sasami @echo " Rebuilding the obj tree" 28717308Speter @echo "--------------------------------------------------------------" 28836074Sbde cd ${.CURDIR}; ${BMAKE} par-${OBJDIR} 28927910Sasami.endif 29033133Sadam.if !defined(NOTOOLS) 29117308Speter @echo 29217308Speter @echo "--------------------------------------------------------------" 29327910Sasami @echo " Rebuilding bootstrap tools" 29417308Speter @echo "--------------------------------------------------------------" 29536074Sbde cd ${.CURDIR}; ${BMAKE} bootstrap 29617308Speter @echo 29717308Speter @echo "--------------------------------------------------------------" 29827910Sasami @echo " Rebuilding tools necessary to build the include files" 29917308Speter @echo "--------------------------------------------------------------" 30036074Sbde cd ${.CURDIR}; ${BMAKE} include-tools 30133133Sadam.endif 30217308Speter @echo 30317308Speter @echo "--------------------------------------------------------------" 30434509Sbde @echo " Rebuilding ${DESTDIR}/usr/include" 30517308Speter @echo "--------------------------------------------------------------" 30636429Speter cd ${.CURDIR}; SHARED=copies ${BMAKE} includes 30735851Sjb @echo 30835851Sjb @echo "--------------------------------------------------------------" 30935851Sjb @echo " Rebuilding bootstrap libraries" 31035851Sjb @echo "--------------------------------------------------------------" 31136074Sbde cd ${.CURDIR}; ${BMAKE} bootstrap-libraries 31233133Sadam.if !defined(NOTOOLS) 31317962Speter @echo 31417962Speter @echo "--------------------------------------------------------------" 31535851Sjb @echo " Rebuilding tools needed to build libraries" 31617962Speter @echo "--------------------------------------------------------------" 31736074Sbde cd ${.CURDIR}; ${BMAKE} lib-tools 31833133Sadam.endif 31933133Sadam.if !defined(NOTOOLS) 32017962Speter @echo 32117962Speter @echo "--------------------------------------------------------------" 32227910Sasami @echo " Rebuilding all other tools needed to build the world" 32317962Speter @echo "--------------------------------------------------------------" 32436074Sbde cd ${.CURDIR}; ${BMAKE} build-tools 32533133Sadam.endif 32635479Sbde.if !defined(_NODEPEND) 32717308Speter @echo 32817308Speter @echo "--------------------------------------------------------------" 32927910Sasami @echo " Rebuilding dependencies" 33017308Speter @echo "--------------------------------------------------------------" 33136074Sbde cd ${.CURDIR}; ${XMAKE} par-depend 33235479Sbde.endif 33317308Speter @echo 33417308Speter @echo "--------------------------------------------------------------" 33535427Sbde @echo " Building libraries" 33635427Sbde @echo "--------------------------------------------------------------" 33736074Sbde cd ${.CURDIR}; ${XMAKE} -DNOINFO -DNOMAN libraries 33835427Sbde @echo 33935427Sbde @echo "--------------------------------------------------------------" 34027910Sasami @echo " Building everything.." 34117962Speter @echo "--------------------------------------------------------------" 34236074Sbde cd ${.CURDIR}; ${XMAKE} all 3432061Sjkh 34417308Speter# 34527910Sasami# installworld 34627910Sasami# 34727910Sasami# Installs everything compiled by a 'buildworld'. 34827910Sasami# 34927910Sasamiinstallworld: 35036074Sbde cd ${.CURDIR}; ${IXMAKE} reinstall 35127910Sasami 35227910Sasami# 35317308Speter# reinstall 35417308Speter# 35517308Speter# If you have a build server, you can NFS mount the source and obj directories 35617308Speter# and do a 'make reinstall' on the *client* to install new binaries from the 35717308Speter# most recent server build. 35817308Speter# 35917308Speterreinstall: 36012483Speter @echo "--------------------------------------------------------------" 36117308Speter @echo " Making hierarchy" 36212483Speter @echo "--------------------------------------------------------------" 36336074Sbde cd ${.CURDIR}; ${MAKE} hierarchy 36412483Speter @echo 3652061Sjkh @echo "--------------------------------------------------------------" 36617962Speter @echo " Installing everything.." 36717962Speter @echo "--------------------------------------------------------------" 36836074Sbde cd ${.CURDIR}; ${MAKE} install 36936638Sjb.if ${MACHINE_ARCH} == "i386" 37017962Speter @echo 37117962Speter @echo "--------------------------------------------------------------" 37233595Snate @echo " Re-scanning the shared libraries.." 37333595Snate @echo "--------------------------------------------------------------" 37436683Sbde cd ${.CURDIR}; /sbin/ldconfig -R 37536638Sjb.endif 37633595Snate @echo 37733595Snate @echo "--------------------------------------------------------------" 37817962Speter @echo " Rebuilding man page indexes" 37917962Speter @echo "--------------------------------------------------------------" 38036074Sbde cd ${.CURDIR}/share/man; ${MAKE} makedb 3812061Sjkh 38217308Speter# 38317308Speter# update 38417308Speter# 38517308Speter# Update the source tree, by running sup and/or running cvs to update to the 38617308Speter# latest copy. 38717308Speter# 3882302Spaulupdate: 3892302Spaul.if defined(SUP_UPDATE) 3902302Spaul @echo "--------------------------------------------------------------" 39135462Sjkh @echo "Running ${SUP}" 3922302Spaul @echo "--------------------------------------------------------------" 39318714Sache @${SUP} ${SUPFLAGS} ${SUPFILE} 39410760Sache.if defined(SUPFILE1) 39518714Sache @${SUP} ${SUPFLAGS} ${SUPFILE1} 3962302Spaul.endif 39710760Sache.if defined(SUPFILE2) 39818714Sache @${SUP} ${SUPFLAGS} ${SUPFILE2} 39910760Sache.endif 40010760Sache.endif 4012302Spaul.if defined(CVS_UPDATE) 4022302Spaul @echo "--------------------------------------------------------------" 4032302Spaul @echo "Updating /usr/src from cvs repository" ${CVSROOT} 4042302Spaul @echo "--------------------------------------------------------------" 40536074Sbde cd ${.CURDIR}; cvs -q update -P -d 4062302Spaul.endif 4072302Spaul 40817308Speter# 40917308Speter# most 41017308Speter# 41117308Speter# Build most of the user binaries on the existing system libs and includes. 41217308Speter# 41317308Spetermost: 4142061Sjkh @echo "--------------------------------------------------------------" 41517308Speter @echo " Building programs only" 4162061Sjkh @echo "--------------------------------------------------------------" 41736074Sbde cd ${.CURDIR}/bin; ${MAKE} all 41836074Sbde cd ${.CURDIR}/sbin; ${MAKE} all 41936074Sbde cd ${.CURDIR}/libexec; ${MAKE} all 42036074Sbde cd ${.CURDIR}/usr.bin; ${MAKE} all 42136074Sbde cd ${.CURDIR}/usr.sbin; ${MAKE} all 42236074Sbde cd ${.CURDIR}/gnu/libexec; ${MAKE} all 42336074Sbde cd ${.CURDIR}/gnu/usr.bin; ${MAKE} all 42436074Sbde cd ${.CURDIR}/gnu/usr.sbin; ${MAKE} all 42530169Sjkh#.if defined(MAKE_KERBEROS4) && !defined(NOCRYPT) 42636074Sbde# cd ${.CURDIR}/kerberosIV; ${MAKE} most 42717308Speter#.endif 42817308Speter#.if !defined(NOSECURE) && !defined(NOCRYPT) 42936074Sbde# cd ${.CURDIR}/secure; ${MAKE} most 43017308Speter#.endif 4312061Sjkh 43217308Speter# 43317308Speter# installmost 43417308Speter# 43517308Speter# Install the binaries built by the 'most' target. This does not include 43617308Speter# libraries or include files. 43717308Speter# 4383626Swollmaninstallmost: 4393626Swollman @echo "--------------------------------------------------------------" 4403626Swollman @echo " Installing programs only" 4413626Swollman @echo "--------------------------------------------------------------" 44236074Sbde cd ${.CURDIR}/bin; ${MAKE} install 44336074Sbde cd ${.CURDIR}/sbin; ${MAKE} install 44436074Sbde cd ${.CURDIR}/libexec; ${MAKE} install 44536074Sbde cd ${.CURDIR}/usr.bin; ${MAKE} install 44636074Sbde cd ${.CURDIR}/usr.sbin; ${MAKE} install 44736074Sbde cd ${.CURDIR}/gnu/libexec; ${MAKE} install 44836074Sbde cd ${.CURDIR}/gnu/usr.bin; ${MAKE} install 44936074Sbde cd ${.CURDIR}/gnu/usr.sbin; ${MAKE} install 45030169Sjkh#.if defined(MAKE_KERBEROS4) && !defined(NOCRYPT) 45136074Sbde# cd ${.CURDIR}/kerberosIV; ${MAKE} installmost 4523626Swollman#.endif 4533626Swollman#.if !defined(NOSECURE) && !defined(NOCRYPT) 45436074Sbde# cd ${.CURDIR}/secure; ${MAKE} installmost 4553626Swollman#.endif 4563626Swollman 45717308Speter# 45817308Speter# ------------------------------------------------------------------------ 45917308Speter# 46017308Speter# From here onwards are utility targets used by the 'make world' and 46117308Speter# related targets. If your 'world' breaks, you may like to try to fix 46217308Speter# the problem and manually run the following targets to attempt to 46317308Speter# complete the build. Beware, this is *not* guaranteed to work, you 46417308Speter# need to have a pretty good grip on the current state of the system 46517308Speter# to attempt to manually finish it. If in doubt, 'make world' again. 46617308Speter# 4673626Swollman 46817308Speter# 46917308Speter# heirarchy - ensure that all the needed directories are present 47017308Speter# 47117308Speterhierarchy: 47236074Sbde cd ${.CURDIR}/etc; ${MAKE} distrib-dirs 47317308Speter 47417308Speter# 47517308Speter# bootstrap - [re]build tools needed to run the actual build, this includes 47617308Speter# tools needed by 'make depend', as some tools are needed to generate source 47717308Speter# for the dependency information to be gathered from. 47817308Speter# 47917308Speterbootstrap: 48027910Sasami.if defined(DESTDIR) 48127910Sasami rm -f ${DESTDIR}/usr/src/sys 48227910Sasami ln -s ${.CURDIR}/sys ${DESTDIR}/usr/src 48336074Sbde cd ${.CURDIR}/include; find -dx . | cpio -dump ${DESTDIR}/usr/include 48436442Speter.for d in net netinet posix4 sys vm machine 48536442Speter if [ -h ${DESTDIR}/usr/include/$d ]; then \ 48636442Speter rm -f ${DESTDIR}/usr/include/$d ; \ 48736442Speter fi 48836442Speter.endfor 48936429Speter cd ${.CURDIR}/sys; \ 49036429Speter find -dx net netinet posix4 sys vm -name '*.h' -o -type d | \ 49136429Speter cpio -dump ${DESTDIR}/usr/include 49236429Speter mkdir -p ${DESTDIR}/usr/include/machine 49336638Sjb cd ${.CURDIR}/sys/${MACHINE_ARCH}/include; find -dx . -name '*.h' -o -type d | \ 49436429Speter cpio -dump ${DESTDIR}/usr/include/machine 49527910Sasami.endif 49636074Sbde cd ${.CURDIR}/usr.bin/make; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 49736074Sbde ${MAKE} ${MK_FLAGS} all; \ 49830113Sjkh ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR} 49936074Sbde cd ${.CURDIR}/usr.bin/xinstall; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 50036074Sbde ${MAKE} ${MK_FLAGS} all; \ 50130113Sjkh ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR} 50236074Sbde cd ${.CURDIR}/usr.bin/lex; ${MAKE} bootstrap; \ 50336074Sbde ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 50436074Sbde ${MAKE} ${MK_FLAGS} -DNOLIB all; \ 50536682Sbde ${MAKE} ${MK_FLAGS} -DNOLIB -B install ${CLEANDIR} 50636682Sbde.if !defined(NOOBJDIR) 50736682Sbde cd ${.CURDIR}/usr.bin/lex; ${MAKE} ${OBJDIR} 50836682Sbde.endif 50936672Sjkh cd ${.CURDIR}/usr.sbin/mtree; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 51036672Sjkh ${MAKE} ${MK_FLAGS} all; \ 51136672Sjkh ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR} 51236429Speter.if defined(DESTDIR) 51336429Speter cd ${.CURDIR}/include && ${MAKE} copies 51436429Speter.endif 51517308Speter 51617308Speter# 51717308Speter# include-tools - generally the same as 'bootstrap', except that it's for 51817308Speter# things that are specifically needed to generate include files. 51917308Speter# 52027910Sasami# XXX should be merged with bootstrap, it's not worth keeeping them separate. 52127910Sasami# Well, maybe it is now. We force 'cleandepend' here to avoid dependencies 52227910Sasami# on cleaned away headers in ${WORLDTMP}. 52317308Speter# 52417308Speterinclude-tools: 52534520Sbde.for d in usr.bin/compile_et usr.bin/rpcgen 52636074Sbde cd ${.CURDIR}/$d; ${MAKE} cleandepend; \ 52736074Sbde ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 52836074Sbde ${MAKE} ${MK_FLAGS} all; \ 52930113Sjkh ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR} 53034520Sbde.endfor 53117308Speter 53217308Speter# 53317308Speter# includes - possibly generate and install the include files. 53417308Speter# 53514119Speterincludes: 5362061Sjkh.if defined(CLOBBER) 5377130Srgrimes rm -rf ${DESTDIR}/usr/include/* 5387130Srgrimes mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 5397130Srgrimes -p ${DESTDIR}/usr/include 5402061Sjkh.endif 54136074Sbde cd ${.CURDIR}/include; ${MAKE} -B all install 54236074Sbde cd ${.CURDIR}/gnu/include; ${MAKE} install 54336074Sbde cd ${.CURDIR}/gnu/lib/libmp; ${MAKE} beforeinstall 54436074Sbde cd ${.CURDIR}/gnu/lib/libobjc; ${MAKE} beforeinstall 54536074Sbde cd ${.CURDIR}/gnu/lib/libreadline; ${MAKE} beforeinstall 54636074Sbde cd ${.CURDIR}/gnu/lib/libregex; ${MAKE} beforeinstall 54736074Sbde cd ${.CURDIR}/gnu/lib/libstdc++; ${MAKE} beforeinstall 54836074Sbde cd ${.CURDIR}/gnu/lib/libg++; ${MAKE} beforeinstall 54936074Sbde cd ${.CURDIR}/gnu/lib/libdialog; ${MAKE} beforeinstall 55036074Sbde cd ${.CURDIR}/gnu/lib/libgmp; ${MAKE} beforeinstall 55130169Sjkh.if exists(secure) && !defined(NOCRYPT) 55236074Sbde cd ${.CURDIR}/secure/lib/libdes; ${MAKE} beforeinstall 5533197Scsgr.endif 55430169Sjkh.if exists(kerberosIV) && !defined(NOCRYPT) && defined(MAKE_KERBEROS4) 55536074Sbde cd ${.CURDIR}/kerberosIV/lib/libacl; ${MAKE} beforeinstall 55636074Sbde cd ${.CURDIR}/kerberosIV/lib/libkadm; ${MAKE} beforeinstall 55736074Sbde cd ${.CURDIR}/kerberosIV/lib/libkafs; ${MAKE} beforeinstall 55836074Sbde cd ${.CURDIR}/kerberosIV/lib/libkdb; ${MAKE} beforeinstall 55936074Sbde cd ${.CURDIR}/kerberosIV/lib/libkrb; ${MAKE} beforeinstall 56036074Sbde cd ${.CURDIR}/kerberosIV/lib/libtelnet; ${MAKE} beforeinstall 56130169Sjkh.else 56236074Sbde cd ${.CURDIR}/lib/libtelnet; ${MAKE} beforeinstall 56330169Sjkh.endif 56432427Sjb.if exists(${.CURDIR}/lib/csu/${MACHINE}) 56536074Sbde cd ${.CURDIR}/lib/csu/${MACHINE}; ${MAKE} beforeinstall 56632427Sjb.endif 56736074Sbde cd ${.CURDIR}/lib/libalias; ${MAKE} beforeinstall 56836074Sbde cd ${.CURDIR}/lib/libc; ${MAKE} beforeinstall 56936074Sbde cd ${.CURDIR}/lib/libcalendar; ${MAKE} beforeinstall 57036074Sbde cd ${.CURDIR}/lib/libcurses; ${MAKE} beforeinstall 57136074Sbde cd ${.CURDIR}/lib/libdisk; ${MAKE} beforeinstall 57236074Sbde cd ${.CURDIR}/lib/libedit; ${MAKE} beforeinstall 57336074Sbde cd ${.CURDIR}/lib/libftpio; ${MAKE} beforeinstall 57436074Sbde cd ${.CURDIR}/lib/libmd; ${MAKE} beforeinstall 57536074Sbde cd ${.CURDIR}/lib/libmytinfo; ${MAKE} beforeinstall 57636074Sbde cd ${.CURDIR}/lib/libncurses; ${MAKE} beforeinstall 5777281Srgrimes.if !defined(WANT_CSRG_LIBM) 57836074Sbde cd ${.CURDIR}/lib/msun; ${MAKE} beforeinstall 5793242Spaul.endif 58036074Sbde cd ${.CURDIR}/lib/libopie; ${MAKE} beforeinstall 58136074Sbde cd ${.CURDIR}/lib/libpcap; ${MAKE} beforeinstall 58236074Sbde cd ${.CURDIR}/lib/librpcsvc; ${MAKE} beforeinstall 58336074Sbde cd ${.CURDIR}/lib/libskey; ${MAKE} beforeinstall 58430169Sjkh.if !defined(NOTCL) && exists (${.CURDIR}/contrib/tcl) && \ 58530169Sjkh exists(${.CURDIR}/usr.bin/tclsh) && exists (${.CURDIR}/lib/libtcl) 58636074Sbde cd ${.CURDIR}/lib/libtcl; ${MAKE} installhdrs 58730169Sjkh.endif 58836074Sbde cd ${.CURDIR}/lib/libtermcap; ${MAKE} beforeinstall 58936074Sbde cd ${.CURDIR}/lib/libcom_err; ${MAKE} beforeinstall 59036074Sbde cd ${.CURDIR}/lib/libss; ${MAKE} -B hdrs beforeinstall 59136074Sbde cd ${.CURDIR}/lib/libscsi; ${MAKE} beforeinstall 59236074Sbde cd ${.CURDIR}/lib/libutil; ${MAKE} beforeinstall 59336074Sbde cd ${.CURDIR}/lib/libvgl; ${MAKE} beforeinstall 59436074Sbde cd ${.CURDIR}/lib/libz; ${MAKE} beforeinstall 59536074Sbde cd ${.CURDIR}/usr.bin/f2c; ${MAKE} beforeinstall 59636074Sbde cd ${.CURDIR}/usr.bin/lex; ${MAKE} beforeinstall 5972061Sjkh 59817308Speter# 59936638Sjb# Declare tools if they are not required on all architectures. 60036638Sjb# 60136638Sjb.if ${MACHINE_ARCH} == "i386" 60236638Sjb# aout tools: 60336638Sjb_aout_ar = usr.bin/ar 60436638Sjb_aout_as = gnu/usr.bin/as 60536638Sjb_aout_ld = gnu/usr.bin/ld 60636638Sjb_aout_nm = usr.bin/nm 60736638Sjb_aout_ranlib = usr.bin/ranlib 60836638Sjb_aout_size = usr.bin/size 60936638Sjb_aout_strip = usr.bin/strip 61036638Sjb_objformat = usr.bin/objformat 61136638Sjb.endif 61236638Sjb 61336638Sjb# 61417308Speter# lib-tools - build tools to compile and install the libraries. 61517308Speter# 61627910Sasami# XXX gperf is required for cc 61727910Sasami# XXX a new ld and tsort is required for cc 6185366Snatelib-tools: 61927910Sasami.for d in \ 62027910Sasami gnu/usr.bin/gperf \ 62136638Sjb ${_aout_ld} \ 62227910Sasami usr.bin/tsort \ 62336638Sjb ${_aout_as} \ 62427910Sasami gnu/usr.bin/bison \ 62527910Sasami gnu/usr.bin/cc \ 62636638Sjb ${_aout_ar} \ 62736683Sbde usr.bin/env \ 62827910Sasami usr.bin/lex/lib \ 62927910Sasami usr.bin/mk_cmds \ 63036638Sjb ${_aout_nm} \ 63136638Sjb ${_aout_ranlib} \ 63236638Sjb ${_aout_strip} \ 63336374Ssos gnu/usr.bin/binutils \ 63436419Speter usr.bin/uudecode \ 63536638Sjb ${_objformat} 63636074Sbde cd ${.CURDIR}/$d; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 63736074Sbde ${MAKE} ${MK_FLAGS} all; \ 63836074Sbde ${MAKE} ${MK_FLAGS} -B install; \ 63934575Sbde ${MAKE} ${MK_FLAGS:S/-DNOPIC//} -B ${CLEANDIR} ${OBJDIR} 64027910Sasami.endfor 6415366Snate 64217308Speter# 64335427Sbde# We have to know too much about ordering and subdirs in the lib trees: 64417308Speter# 64535427Sbde# To satisfy shared library linkage when only the libraries being built 64635427Sbde# are visible: 64735427Sbde# 64835427Sbde# libcom_err must be built before libss. 64935427Sbde# libcrypt and libmd must be built before libskey. 65035427Sbde# libm must be built before libtcl. 65135427Sbde# libmytinfo must be built before libdialog and libncurses. 65235427Sbde# libncurses must be built before libdialog. 65335427Sbde# libtermcap must be built before libcurses, libedit and libreadline. 65435427Sbde# 65535427Sbde# Some libraries are built conditionally and/or are in inconsistently 65635427Sbde# named directories: 65735427Sbde# 65835427Sbde.if exists(lib/csu/${MACHINE}.pcc) 65935427Sbde_csu=lib/csu/${MACHINE}.pcc 66034541Sbde.else 66135427Sbde_csu=lib/csu/${MACHINE} 66224754Sjdp.endif 66334541Sbde 66436683Sbde.if !defined(NOSECURE) && !defined(NOCRYPT) 66536683Sbde_libcrypt= secure/lib/libcrypt lib/libcrypt 66636444Speter.else 66735427Sbde_libcrypt= lib/libcrypt 66835427Sbde.endif 66935427Sbde 67034541Sbde.if defined(WANT_CSRG_LIBM) 67135427Sbde_libm= lib/libm 67234541Sbde.else 67335427Sbde_libm= lib/msun 6748295Srgrimes.endif 67534541Sbde 67634541Sbde# 67735427Sbde# bootstrap-libraries - build just enough libraries for the bootstrap 67835427Sbde# tools, and install them under ${WORLDTMP}. 67934541Sbde# 68035427Sbde# Build csu and libgcc early so that some tools get linked to the new 68135427Sbde# versions (too late for the main tools, however). Then build the 68235427Sbde# necessary prerequisite libraries (libtermcap just needs to be before 68335427Sbde# libcurses, and this only matters for the NOCLEAN case when NOPIC is 68435427Sbde# not set). 68534541Sbde# 68635427Sbde# This is mostly wrong. The build tools must run on the host system, 68735427Sbde# so they should use host libraries. We depend on the target being 68835427Sbde# similar enough to the host for new target libraries to work on the 68935427Sbde# host. 69034541Sbde# 69135427Sbdebootstrap-libraries: 69235427Sbde.for _lib in ${_csu} gnu/usr.bin/cc/libgcc lib/libtermcap \ 69336397Ssos gnu/lib/libregex gnu/lib/libreadline lib/libc \ 69436444Speter ${_libcrypt} lib/libcurses lib/libedit ${_libm} \ 69535427Sbde lib/libmd lib/libutil lib/libz usr.bin/lex/lib 69634541Sbde.if exists(${.CURDIR}/${_lib}) 69736074Sbde cd ${.CURDIR}/${_lib}; \ 69836074Sbde ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 69936074Sbde ${MAKE} ${MK_FLAGS} all; \ 70030113Sjkh ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR} 7018489Srgrimes.endif 70234541Sbde.endfor 70335427Sbde 70435427Sbde# 70535427Sbde# libraries - build all libraries, and install them under ${DESTDIR}. 70635427Sbde# 70735427Sbde# The ordering is not as special as for bootstrap-libraries. Build 70835427Sbde# the prerequisites first, then build almost everything else in 70935427Sbde# alphabetical order. 71035427Sbde# 71135427Sbdelibraries: 71235427Sbde.for _lib in lib/libcom_err ${_libcrypt} ${_libm} lib/libmytinfo \ 71335427Sbde lib/libncurses lib/libtermcap \ 71435427Sbde gnu/lib gnu/usr.bin/cc/libgcc lib usr.bin/lex/lib usr.sbin/pcvt/keycap 71535427Sbde.if exists(${.CURDIR}/${_lib}) 71636074Sbde cd ${.CURDIR}/${_lib}; ${MAKE} all; ${MAKE} -B install 71735427Sbde.endif 71835427Sbde.endfor 71934541Sbde.if exists(${.CURDIR}/secure/lib) && !defined(NOCRYPT) && !defined(NOSECURE) 72036074Sbde cd ${.CURDIR}/secure/lib; ${MAKE} all; ${MAKE} -B install 7212160Scsgr.endif 72234541Sbde.if exists(${.CURDIR}/kerberosIV/lib) && !defined(NOCRYPT) && \ 72334541Sbde defined(MAKE_KERBEROS4) 72436074Sbde cd ${.CURDIR}/kerberosIV/lib; ${MAKE} all; ${MAKE} -B install 7252626Scsgr.endif 7262061Sjkh 72736589Sjhay# Exclude perl from the build-tools if NOPERL is defined. 72836589Sjhay.if defined(NOPERL) 72936589Sjhay_perl= 73036589Sjhay.else 73136589Sjhay_perl= gnu/usr.bin/perl/perl 73236589Sjhay.endif 73336589Sjhay 73417308Speter# 73517308Speter# build-tools - build and install any other tools needed to complete the 73617308Speter# compile and install. 73727910Sasami# ifdef stale 73827910Sasami# bc and cpp are required to build groff. Otherwise, the order here is 73927910Sasami# mostly historical, i.e., bogus. 74027910Sasami# chmod is used to build gcc's tmpmultilib[2] at obscure times. 74127910Sasami# endif stale 74227910Sasami# XXX uname is a bug - the target should not depend on the host. 74317308Speter# 74411806Sphkbuild-tools: 74519175Sbde.for d in \ 74627910Sasami bin/cat \ 74727910Sasami bin/chmod \ 74827910Sasami bin/cp \ 74927910Sasami bin/date \ 75027910Sasami bin/dd \ 75127910Sasami bin/echo \ 75227910Sasami bin/expr \ 75327910Sasami bin/hostname \ 75427910Sasami bin/ln \ 75527910Sasami bin/ls \ 75627910Sasami bin/mkdir \ 75727910Sasami bin/mv \ 75827910Sasami bin/rm \ 75927910Sasami bin/test \ 76027910Sasami gnu/usr.bin/awk \ 76127910Sasami gnu/usr.bin/bc \ 76227910Sasami gnu/usr.bin/grep \ 76327910Sasami gnu/usr.bin/groff \ 76427910Sasami gnu/usr.bin/gzip \ 76527910Sasami gnu/usr.bin/man/makewhatis \ 76635621Sbde gnu/usr.bin/patch \ 76736589Sjhay ${_perl} \ 76827910Sasami gnu/usr.bin/sort \ 76934509Sbde gnu/usr.bin/texinfo \ 77027910Sasami usr.bin/basename \ 77127910Sasami usr.bin/cap_mkdb \ 77227910Sasami usr.bin/chflags \ 77327910Sasami usr.bin/cmp \ 77427910Sasami usr.bin/col \ 77527910Sasami usr.bin/cpp \ 77627910Sasami usr.bin/expand \ 77727910Sasami usr.bin/file2c \ 77827910Sasami usr.bin/find \ 77927910Sasami usr.bin/gencat \ 78036454Sjkh usr.bin/id \ 78127910Sasami usr.bin/lorder \ 78227910Sasami usr.bin/m4 \ 78327910Sasami usr.bin/mkdep \ 78427910Sasami usr.bin/paste \ 78527910Sasami usr.bin/sed \ 78636638Sjb ${_aout_size} \ 78727910Sasami usr.bin/soelim \ 78819175Sbde usr.bin/symorder \ 78927910Sasami usr.bin/touch \ 79027910Sasami usr.bin/tr \ 79127910Sasami usr.bin/true \ 79227910Sasami usr.bin/uname \ 79327910Sasami usr.bin/uuencode \ 79427910Sasami usr.bin/vgrind \ 79527910Sasami usr.bin/vi \ 79627910Sasami usr.bin/wc \ 79734688Sbde usr.bin/xargs \ 79827910Sasami usr.bin/yacc \ 79927910Sasami usr.sbin/chown \ 80027910Sasami usr.sbin/mtree \ 80136455Sjkh usr.sbin/zic \ 80236455Sjkh bin/sh 80336074Sbde cd ${.CURDIR}/$d; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 80436074Sbde ${MAKE} ${MK_FLAGS} all; \ 80530113Sjkh ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR} 80619175Sbde.endfor 8072061Sjkh 80835479Sbde.for __target in clean cleandepend cleandir depend obj 80930113Sjkh.for entry in ${SUBDIR} 81030113Sjkh${entry}.${__target}__D: .PHONY 81135294Sdt @if test -d ${.CURDIR}/${entry}.${MACHINE}; then \ 81230113Sjkh ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE}"; \ 81330113Sjkh edir=${entry}.${MACHINE}; \ 81430113Sjkh cd ${.CURDIR}/$${edir}; \ 81530113Sjkh else \ 81630113Sjkh ${ECHODIR} "===> ${DIRPRFX}${entry}"; \ 81730113Sjkh edir=${entry}; \ 81830113Sjkh cd ${.CURDIR}/$${edir}; \ 81930113Sjkh fi; \ 82030113Sjkh ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/ 82130113Sjkh.endfor 82230113Sjkhpar-${__target}: ${SUBDIR:S/$/.${__target}__D/} 82330113Sjkh.endfor 82430113Sjkh 82532427Sjb.endif 82632427Sjb 8271594Srgrimes.include <bsd.subdir.mk> 828