Makefile revision 36722
12061Sjkh# 236722Ssos# $Id: Makefile,v 1.199 1998/06/06 04:39:41 jkoshy 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 "--------------------------------------------------------------" 26036722Ssos @echo " Making mtools" 26136722Ssos @echo "--------------------------------------------------------------" 26236722Ssos ( \ 26336722Ssos cd ${.CURDIR}/usr.sbin/mtree; \ 26436722Ssos MAKEOBJDIRPREFIX=""; unset MAKEOBJDIRPREFIX; \ 26536722Ssos ${MAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} all; \ 26636722Ssos ${MAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} install; \ 26736722Ssos ${MAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} clean \ 26836722Ssos ) 26933133Sadam.endif 27017308Speter @echo 27117308Speter @echo "--------------------------------------------------------------" 27227910Sasami @echo " Making hierarchy" 27317308Speter @echo "--------------------------------------------------------------" 27436074Sbde cd ${.CURDIR}; ${BMAKE} hierarchy 27527910Sasami.if !defined(NOCLEAN) 27617308Speter @echo 27717308Speter @echo "--------------------------------------------------------------" 27827910Sasami @echo " Cleaning up the obj tree" 27917308Speter @echo "--------------------------------------------------------------" 28036074Sbde cd ${.CURDIR}; ${BMAKE} ${CLEANDIR:S/^/par-/} 28127910Sasami.endif 28227910Sasami.if !defined(NOOBJDIR) 28317308Speter @echo 28417308Speter @echo "--------------------------------------------------------------" 28527910Sasami @echo " Rebuilding the obj tree" 28617308Speter @echo "--------------------------------------------------------------" 28736074Sbde cd ${.CURDIR}; ${BMAKE} par-${OBJDIR} 28827910Sasami.endif 28933133Sadam.if !defined(NOTOOLS) 29017308Speter @echo 29117308Speter @echo "--------------------------------------------------------------" 29227910Sasami @echo " Rebuilding bootstrap tools" 29317308Speter @echo "--------------------------------------------------------------" 29436074Sbde cd ${.CURDIR}; ${BMAKE} bootstrap 29517308Speter @echo 29617308Speter @echo "--------------------------------------------------------------" 29727910Sasami @echo " Rebuilding tools necessary to build the include files" 29817308Speter @echo "--------------------------------------------------------------" 29936074Sbde cd ${.CURDIR}; ${BMAKE} include-tools 30033133Sadam.endif 30117308Speter @echo 30217308Speter @echo "--------------------------------------------------------------" 30334509Sbde @echo " Rebuilding ${DESTDIR}/usr/include" 30417308Speter @echo "--------------------------------------------------------------" 30536429Speter cd ${.CURDIR}; SHARED=copies ${BMAKE} includes 30635851Sjb @echo 30735851Sjb @echo "--------------------------------------------------------------" 30835851Sjb @echo " Rebuilding bootstrap libraries" 30935851Sjb @echo "--------------------------------------------------------------" 31036074Sbde cd ${.CURDIR}; ${BMAKE} bootstrap-libraries 31133133Sadam.if !defined(NOTOOLS) 31217962Speter @echo 31317962Speter @echo "--------------------------------------------------------------" 31435851Sjb @echo " Rebuilding tools needed to build libraries" 31517962Speter @echo "--------------------------------------------------------------" 31636074Sbde cd ${.CURDIR}; ${BMAKE} lib-tools 31733133Sadam.endif 31833133Sadam.if !defined(NOTOOLS) 31917962Speter @echo 32017962Speter @echo "--------------------------------------------------------------" 32127910Sasami @echo " Rebuilding all other tools needed to build the world" 32217962Speter @echo "--------------------------------------------------------------" 32336074Sbde cd ${.CURDIR}; ${BMAKE} build-tools 32433133Sadam.endif 32535479Sbde.if !defined(_NODEPEND) 32617308Speter @echo 32717308Speter @echo "--------------------------------------------------------------" 32827910Sasami @echo " Rebuilding dependencies" 32917308Speter @echo "--------------------------------------------------------------" 33036074Sbde cd ${.CURDIR}; ${XMAKE} par-depend 33135479Sbde.endif 33217308Speter @echo 33317308Speter @echo "--------------------------------------------------------------" 33435427Sbde @echo " Building libraries" 33535427Sbde @echo "--------------------------------------------------------------" 33636074Sbde cd ${.CURDIR}; ${XMAKE} -DNOINFO -DNOMAN libraries 33735427Sbde @echo 33835427Sbde @echo "--------------------------------------------------------------" 33927910Sasami @echo " Building everything.." 34017962Speter @echo "--------------------------------------------------------------" 34136074Sbde cd ${.CURDIR}; ${XMAKE} all 3422061Sjkh 34317308Speter# 34427910Sasami# installworld 34527910Sasami# 34627910Sasami# Installs everything compiled by a 'buildworld'. 34727910Sasami# 34827910Sasamiinstallworld: 34936074Sbde cd ${.CURDIR}; ${IXMAKE} reinstall 35027910Sasami 35127910Sasami# 35217308Speter# reinstall 35317308Speter# 35417308Speter# If you have a build server, you can NFS mount the source and obj directories 35517308Speter# and do a 'make reinstall' on the *client* to install new binaries from the 35617308Speter# most recent server build. 35717308Speter# 35817308Speterreinstall: 35912483Speter @echo "--------------------------------------------------------------" 36017308Speter @echo " Making hierarchy" 36112483Speter @echo "--------------------------------------------------------------" 36236074Sbde cd ${.CURDIR}; ${MAKE} hierarchy 36312483Speter @echo 3642061Sjkh @echo "--------------------------------------------------------------" 36517962Speter @echo " Installing everything.." 36617962Speter @echo "--------------------------------------------------------------" 36736074Sbde cd ${.CURDIR}; ${MAKE} install 36836638Sjb.if ${MACHINE_ARCH} == "i386" 36917962Speter @echo 37017962Speter @echo "--------------------------------------------------------------" 37133595Snate @echo " Re-scanning the shared libraries.." 37233595Snate @echo "--------------------------------------------------------------" 37336683Sbde cd ${.CURDIR}; /sbin/ldconfig -R 37436638Sjb.endif 37533595Snate @echo 37633595Snate @echo "--------------------------------------------------------------" 37717962Speter @echo " Rebuilding man page indexes" 37817962Speter @echo "--------------------------------------------------------------" 37936074Sbde cd ${.CURDIR}/share/man; ${MAKE} makedb 3802061Sjkh 38117308Speter# 38217308Speter# update 38317308Speter# 38417308Speter# Update the source tree, by running sup and/or running cvs to update to the 38517308Speter# latest copy. 38617308Speter# 3872302Spaulupdate: 3882302Spaul.if defined(SUP_UPDATE) 3892302Spaul @echo "--------------------------------------------------------------" 39035462Sjkh @echo "Running ${SUP}" 3912302Spaul @echo "--------------------------------------------------------------" 39218714Sache @${SUP} ${SUPFLAGS} ${SUPFILE} 39310760Sache.if defined(SUPFILE1) 39418714Sache @${SUP} ${SUPFLAGS} ${SUPFILE1} 3952302Spaul.endif 39610760Sache.if defined(SUPFILE2) 39718714Sache @${SUP} ${SUPFLAGS} ${SUPFILE2} 39810760Sache.endif 39910760Sache.endif 4002302Spaul.if defined(CVS_UPDATE) 4012302Spaul @echo "--------------------------------------------------------------" 4022302Spaul @echo "Updating /usr/src from cvs repository" ${CVSROOT} 4032302Spaul @echo "--------------------------------------------------------------" 40436074Sbde cd ${.CURDIR}; cvs -q update -P -d 4052302Spaul.endif 4062302Spaul 40717308Speter# 40817308Speter# most 40917308Speter# 41017308Speter# Build most of the user binaries on the existing system libs and includes. 41117308Speter# 41217308Spetermost: 4132061Sjkh @echo "--------------------------------------------------------------" 41417308Speter @echo " Building programs only" 4152061Sjkh @echo "--------------------------------------------------------------" 41636074Sbde cd ${.CURDIR}/bin; ${MAKE} all 41736074Sbde cd ${.CURDIR}/sbin; ${MAKE} all 41836074Sbde cd ${.CURDIR}/libexec; ${MAKE} all 41936074Sbde cd ${.CURDIR}/usr.bin; ${MAKE} all 42036074Sbde cd ${.CURDIR}/usr.sbin; ${MAKE} all 42136074Sbde cd ${.CURDIR}/gnu/libexec; ${MAKE} all 42236074Sbde cd ${.CURDIR}/gnu/usr.bin; ${MAKE} all 42336074Sbde cd ${.CURDIR}/gnu/usr.sbin; ${MAKE} all 42430169Sjkh#.if defined(MAKE_KERBEROS4) && !defined(NOCRYPT) 42536074Sbde# cd ${.CURDIR}/kerberosIV; ${MAKE} most 42617308Speter#.endif 42717308Speter#.if !defined(NOSECURE) && !defined(NOCRYPT) 42836074Sbde# cd ${.CURDIR}/secure; ${MAKE} most 42917308Speter#.endif 4302061Sjkh 43117308Speter# 43217308Speter# installmost 43317308Speter# 43417308Speter# Install the binaries built by the 'most' target. This does not include 43517308Speter# libraries or include files. 43617308Speter# 4373626Swollmaninstallmost: 4383626Swollman @echo "--------------------------------------------------------------" 4393626Swollman @echo " Installing programs only" 4403626Swollman @echo "--------------------------------------------------------------" 44136074Sbde cd ${.CURDIR}/bin; ${MAKE} install 44236074Sbde cd ${.CURDIR}/sbin; ${MAKE} install 44336074Sbde cd ${.CURDIR}/libexec; ${MAKE} install 44436074Sbde cd ${.CURDIR}/usr.bin; ${MAKE} install 44536074Sbde cd ${.CURDIR}/usr.sbin; ${MAKE} install 44636074Sbde cd ${.CURDIR}/gnu/libexec; ${MAKE} install 44736074Sbde cd ${.CURDIR}/gnu/usr.bin; ${MAKE} install 44836074Sbde cd ${.CURDIR}/gnu/usr.sbin; ${MAKE} install 44930169Sjkh#.if defined(MAKE_KERBEROS4) && !defined(NOCRYPT) 45036074Sbde# cd ${.CURDIR}/kerberosIV; ${MAKE} installmost 4513626Swollman#.endif 4523626Swollman#.if !defined(NOSECURE) && !defined(NOCRYPT) 45336074Sbde# cd ${.CURDIR}/secure; ${MAKE} installmost 4543626Swollman#.endif 4553626Swollman 45617308Speter# 45717308Speter# ------------------------------------------------------------------------ 45817308Speter# 45917308Speter# From here onwards are utility targets used by the 'make world' and 46017308Speter# related targets. If your 'world' breaks, you may like to try to fix 46117308Speter# the problem and manually run the following targets to attempt to 46217308Speter# complete the build. Beware, this is *not* guaranteed to work, you 46317308Speter# need to have a pretty good grip on the current state of the system 46417308Speter# to attempt to manually finish it. If in doubt, 'make world' again. 46517308Speter# 4663626Swollman 46717308Speter# 46817308Speter# heirarchy - ensure that all the needed directories are present 46917308Speter# 47017308Speterhierarchy: 47136074Sbde cd ${.CURDIR}/etc; ${MAKE} distrib-dirs 47217308Speter 47317308Speter# 47417308Speter# bootstrap - [re]build tools needed to run the actual build, this includes 47517308Speter# tools needed by 'make depend', as some tools are needed to generate source 47617308Speter# for the dependency information to be gathered from. 47717308Speter# 47817308Speterbootstrap: 47927910Sasami.if defined(DESTDIR) 48027910Sasami rm -f ${DESTDIR}/usr/src/sys 48127910Sasami ln -s ${.CURDIR}/sys ${DESTDIR}/usr/src 48236074Sbde cd ${.CURDIR}/include; find -dx . | cpio -dump ${DESTDIR}/usr/include 48336442Speter.for d in net netinet posix4 sys vm machine 48436442Speter if [ -h ${DESTDIR}/usr/include/$d ]; then \ 48536442Speter rm -f ${DESTDIR}/usr/include/$d ; \ 48636442Speter fi 48736442Speter.endfor 48836429Speter cd ${.CURDIR}/sys; \ 48936429Speter find -dx net netinet posix4 sys vm -name '*.h' -o -type d | \ 49036429Speter cpio -dump ${DESTDIR}/usr/include 49136429Speter mkdir -p ${DESTDIR}/usr/include/machine 49236638Sjb cd ${.CURDIR}/sys/${MACHINE_ARCH}/include; find -dx . -name '*.h' -o -type d | \ 49336429Speter cpio -dump ${DESTDIR}/usr/include/machine 49427910Sasami.endif 49536074Sbde cd ${.CURDIR}/usr.bin/make; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 49636074Sbde ${MAKE} ${MK_FLAGS} all; \ 49730113Sjkh ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR} 49836074Sbde cd ${.CURDIR}/usr.bin/xinstall; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 49936074Sbde ${MAKE} ${MK_FLAGS} all; \ 50030113Sjkh ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR} 50136074Sbde cd ${.CURDIR}/usr.bin/lex; ${MAKE} bootstrap; \ 50236074Sbde ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 50336074Sbde ${MAKE} ${MK_FLAGS} -DNOLIB all; \ 50436682Sbde ${MAKE} ${MK_FLAGS} -DNOLIB -B install ${CLEANDIR} 50536682Sbde.if !defined(NOOBJDIR) 50636682Sbde cd ${.CURDIR}/usr.bin/lex; ${MAKE} ${OBJDIR} 50736682Sbde.endif 50836672Sjkh cd ${.CURDIR}/usr.sbin/mtree; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 50936672Sjkh ${MAKE} ${MK_FLAGS} all; \ 51036672Sjkh ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR} 51136429Speter.if defined(DESTDIR) 51236429Speter cd ${.CURDIR}/include && ${MAKE} copies 51336429Speter.endif 51417308Speter 51517308Speter# 51617308Speter# include-tools - generally the same as 'bootstrap', except that it's for 51717308Speter# things that are specifically needed to generate include files. 51817308Speter# 51927910Sasami# XXX should be merged with bootstrap, it's not worth keeeping them separate. 52027910Sasami# Well, maybe it is now. We force 'cleandepend' here to avoid dependencies 52127910Sasami# on cleaned away headers in ${WORLDTMP}. 52217308Speter# 52317308Speterinclude-tools: 52434520Sbde.for d in usr.bin/compile_et usr.bin/rpcgen 52536074Sbde cd ${.CURDIR}/$d; ${MAKE} cleandepend; \ 52636074Sbde ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 52736074Sbde ${MAKE} ${MK_FLAGS} all; \ 52830113Sjkh ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR} 52934520Sbde.endfor 53017308Speter 53117308Speter# 53217308Speter# includes - possibly generate and install the include files. 53317308Speter# 53414119Speterincludes: 5352061Sjkh.if defined(CLOBBER) 5367130Srgrimes rm -rf ${DESTDIR}/usr/include/* 5377130Srgrimes mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 5387130Srgrimes -p ${DESTDIR}/usr/include 5392061Sjkh.endif 54036074Sbde cd ${.CURDIR}/include; ${MAKE} -B all install 54136074Sbde cd ${.CURDIR}/gnu/include; ${MAKE} install 54236074Sbde cd ${.CURDIR}/gnu/lib/libmp; ${MAKE} beforeinstall 54336074Sbde cd ${.CURDIR}/gnu/lib/libobjc; ${MAKE} beforeinstall 54436074Sbde cd ${.CURDIR}/gnu/lib/libreadline; ${MAKE} beforeinstall 54536074Sbde cd ${.CURDIR}/gnu/lib/libregex; ${MAKE} beforeinstall 54636074Sbde cd ${.CURDIR}/gnu/lib/libstdc++; ${MAKE} beforeinstall 54736074Sbde cd ${.CURDIR}/gnu/lib/libg++; ${MAKE} beforeinstall 54836074Sbde cd ${.CURDIR}/gnu/lib/libdialog; ${MAKE} beforeinstall 54936074Sbde cd ${.CURDIR}/gnu/lib/libgmp; ${MAKE} beforeinstall 55030169Sjkh.if exists(secure) && !defined(NOCRYPT) 55136074Sbde cd ${.CURDIR}/secure/lib/libdes; ${MAKE} beforeinstall 5523197Scsgr.endif 55330169Sjkh.if exists(kerberosIV) && !defined(NOCRYPT) && defined(MAKE_KERBEROS4) 55436074Sbde cd ${.CURDIR}/kerberosIV/lib/libacl; ${MAKE} beforeinstall 55536074Sbde cd ${.CURDIR}/kerberosIV/lib/libkadm; ${MAKE} beforeinstall 55636074Sbde cd ${.CURDIR}/kerberosIV/lib/libkafs; ${MAKE} beforeinstall 55736074Sbde cd ${.CURDIR}/kerberosIV/lib/libkdb; ${MAKE} beforeinstall 55836074Sbde cd ${.CURDIR}/kerberosIV/lib/libkrb; ${MAKE} beforeinstall 55936074Sbde cd ${.CURDIR}/kerberosIV/lib/libtelnet; ${MAKE} beforeinstall 56030169Sjkh.else 56136074Sbde cd ${.CURDIR}/lib/libtelnet; ${MAKE} beforeinstall 56230169Sjkh.endif 56332427Sjb.if exists(${.CURDIR}/lib/csu/${MACHINE}) 56436074Sbde cd ${.CURDIR}/lib/csu/${MACHINE}; ${MAKE} beforeinstall 56532427Sjb.endif 56636074Sbde cd ${.CURDIR}/lib/libalias; ${MAKE} beforeinstall 56736074Sbde cd ${.CURDIR}/lib/libc; ${MAKE} beforeinstall 56836074Sbde cd ${.CURDIR}/lib/libcalendar; ${MAKE} beforeinstall 56936074Sbde cd ${.CURDIR}/lib/libcurses; ${MAKE} beforeinstall 57036074Sbde cd ${.CURDIR}/lib/libdisk; ${MAKE} beforeinstall 57136074Sbde cd ${.CURDIR}/lib/libedit; ${MAKE} beforeinstall 57236074Sbde cd ${.CURDIR}/lib/libftpio; ${MAKE} beforeinstall 57336074Sbde cd ${.CURDIR}/lib/libmd; ${MAKE} beforeinstall 57436074Sbde cd ${.CURDIR}/lib/libmytinfo; ${MAKE} beforeinstall 57536074Sbde cd ${.CURDIR}/lib/libncurses; ${MAKE} beforeinstall 5767281Srgrimes.if !defined(WANT_CSRG_LIBM) 57736074Sbde cd ${.CURDIR}/lib/msun; ${MAKE} beforeinstall 5783242Spaul.endif 57936074Sbde cd ${.CURDIR}/lib/libopie; ${MAKE} beforeinstall 58036074Sbde cd ${.CURDIR}/lib/libpcap; ${MAKE} beforeinstall 58136074Sbde cd ${.CURDIR}/lib/librpcsvc; ${MAKE} beforeinstall 58236074Sbde cd ${.CURDIR}/lib/libskey; ${MAKE} beforeinstall 58330169Sjkh.if !defined(NOTCL) && exists (${.CURDIR}/contrib/tcl) && \ 58430169Sjkh exists(${.CURDIR}/usr.bin/tclsh) && exists (${.CURDIR}/lib/libtcl) 58536074Sbde cd ${.CURDIR}/lib/libtcl; ${MAKE} installhdrs 58630169Sjkh.endif 58736074Sbde cd ${.CURDIR}/lib/libtermcap; ${MAKE} beforeinstall 58836074Sbde cd ${.CURDIR}/lib/libcom_err; ${MAKE} beforeinstall 58936074Sbde cd ${.CURDIR}/lib/libss; ${MAKE} -B hdrs beforeinstall 59036074Sbde cd ${.CURDIR}/lib/libscsi; ${MAKE} beforeinstall 59136074Sbde cd ${.CURDIR}/lib/libutil; ${MAKE} beforeinstall 59236074Sbde cd ${.CURDIR}/lib/libvgl; ${MAKE} beforeinstall 59336074Sbde cd ${.CURDIR}/lib/libz; ${MAKE} beforeinstall 59436074Sbde cd ${.CURDIR}/usr.bin/f2c; ${MAKE} beforeinstall 59536074Sbde cd ${.CURDIR}/usr.bin/lex; ${MAKE} beforeinstall 5962061Sjkh 59717308Speter# 59836638Sjb# Declare tools if they are not required on all architectures. 59936638Sjb# 60036638Sjb.if ${MACHINE_ARCH} == "i386" 60136638Sjb# aout tools: 60236638Sjb_aout_ar = usr.bin/ar 60336638Sjb_aout_as = gnu/usr.bin/as 60436638Sjb_aout_ld = gnu/usr.bin/ld 60536638Sjb_aout_nm = usr.bin/nm 60636638Sjb_aout_ranlib = usr.bin/ranlib 60736638Sjb_aout_size = usr.bin/size 60836638Sjb_aout_strip = usr.bin/strip 60936638Sjb_objformat = usr.bin/objformat 61036638Sjb.endif 61136638Sjb 61236638Sjb# 61317308Speter# lib-tools - build tools to compile and install the libraries. 61417308Speter# 61527910Sasami# XXX gperf is required for cc 61627910Sasami# XXX a new ld and tsort is required for cc 6175366Snatelib-tools: 61827910Sasami.for d in \ 61927910Sasami gnu/usr.bin/gperf \ 62036638Sjb ${_aout_ld} \ 62127910Sasami usr.bin/tsort \ 62236638Sjb ${_aout_as} \ 62327910Sasami gnu/usr.bin/bison \ 62427910Sasami gnu/usr.bin/cc \ 62536638Sjb ${_aout_ar} \ 62636683Sbde usr.bin/env \ 62727910Sasami usr.bin/lex/lib \ 62827910Sasami usr.bin/mk_cmds \ 62936638Sjb ${_aout_nm} \ 63036638Sjb ${_aout_ranlib} \ 63136638Sjb ${_aout_strip} \ 63236374Ssos gnu/usr.bin/binutils \ 63336419Speter usr.bin/uudecode \ 63436638Sjb ${_objformat} 63536074Sbde cd ${.CURDIR}/$d; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 63636074Sbde ${MAKE} ${MK_FLAGS} all; \ 63736074Sbde ${MAKE} ${MK_FLAGS} -B install; \ 63834575Sbde ${MAKE} ${MK_FLAGS:S/-DNOPIC//} -B ${CLEANDIR} ${OBJDIR} 63927910Sasami.endfor 6405366Snate 64117308Speter# 64235427Sbde# We have to know too much about ordering and subdirs in the lib trees: 64317308Speter# 64435427Sbde# To satisfy shared library linkage when only the libraries being built 64535427Sbde# are visible: 64635427Sbde# 64735427Sbde# libcom_err must be built before libss. 64835427Sbde# libcrypt and libmd must be built before libskey. 64935427Sbde# libm must be built before libtcl. 65035427Sbde# libmytinfo must be built before libdialog and libncurses. 65135427Sbde# libncurses must be built before libdialog. 65235427Sbde# libtermcap must be built before libcurses, libedit and libreadline. 65335427Sbde# 65435427Sbde# Some libraries are built conditionally and/or are in inconsistently 65535427Sbde# named directories: 65635427Sbde# 65735427Sbde.if exists(lib/csu/${MACHINE}.pcc) 65835427Sbde_csu=lib/csu/${MACHINE}.pcc 65934541Sbde.else 66035427Sbde_csu=lib/csu/${MACHINE} 66124754Sjdp.endif 66234541Sbde 66336683Sbde.if !defined(NOSECURE) && !defined(NOCRYPT) 66436683Sbde_libcrypt= secure/lib/libcrypt lib/libcrypt 66536444Speter.else 66635427Sbde_libcrypt= lib/libcrypt 66735427Sbde.endif 66835427Sbde 66934541Sbde.if defined(WANT_CSRG_LIBM) 67035427Sbde_libm= lib/libm 67134541Sbde.else 67235427Sbde_libm= lib/msun 6738295Srgrimes.endif 67434541Sbde 67534541Sbde# 67635427Sbde# bootstrap-libraries - build just enough libraries for the bootstrap 67735427Sbde# tools, and install them under ${WORLDTMP}. 67834541Sbde# 67935427Sbde# Build csu and libgcc early so that some tools get linked to the new 68035427Sbde# versions (too late for the main tools, however). Then build the 68135427Sbde# necessary prerequisite libraries (libtermcap just needs to be before 68235427Sbde# libcurses, and this only matters for the NOCLEAN case when NOPIC is 68335427Sbde# not set). 68434541Sbde# 68535427Sbde# This is mostly wrong. The build tools must run on the host system, 68635427Sbde# so they should use host libraries. We depend on the target being 68735427Sbde# similar enough to the host for new target libraries to work on the 68835427Sbde# host. 68934541Sbde# 69035427Sbdebootstrap-libraries: 69135427Sbde.for _lib in ${_csu} gnu/usr.bin/cc/libgcc lib/libtermcap \ 69236397Ssos gnu/lib/libregex gnu/lib/libreadline lib/libc \ 69336444Speter ${_libcrypt} lib/libcurses lib/libedit ${_libm} \ 69435427Sbde lib/libmd lib/libutil lib/libz usr.bin/lex/lib 69534541Sbde.if exists(${.CURDIR}/${_lib}) 69636074Sbde cd ${.CURDIR}/${_lib}; \ 69736074Sbde ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 69836074Sbde ${MAKE} ${MK_FLAGS} all; \ 69930113Sjkh ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR} 7008489Srgrimes.endif 70134541Sbde.endfor 70235427Sbde 70335427Sbde# 70435427Sbde# libraries - build all libraries, and install them under ${DESTDIR}. 70535427Sbde# 70635427Sbde# The ordering is not as special as for bootstrap-libraries. Build 70735427Sbde# the prerequisites first, then build almost everything else in 70835427Sbde# alphabetical order. 70935427Sbde# 71035427Sbdelibraries: 71135427Sbde.for _lib in lib/libcom_err ${_libcrypt} ${_libm} lib/libmytinfo \ 71235427Sbde lib/libncurses lib/libtermcap \ 71335427Sbde gnu/lib gnu/usr.bin/cc/libgcc lib usr.bin/lex/lib usr.sbin/pcvt/keycap 71435427Sbde.if exists(${.CURDIR}/${_lib}) 71536074Sbde cd ${.CURDIR}/${_lib}; ${MAKE} all; ${MAKE} -B install 71635427Sbde.endif 71735427Sbde.endfor 71834541Sbde.if exists(${.CURDIR}/secure/lib) && !defined(NOCRYPT) && !defined(NOSECURE) 71936074Sbde cd ${.CURDIR}/secure/lib; ${MAKE} all; ${MAKE} -B install 7202160Scsgr.endif 72134541Sbde.if exists(${.CURDIR}/kerberosIV/lib) && !defined(NOCRYPT) && \ 72234541Sbde defined(MAKE_KERBEROS4) 72336074Sbde cd ${.CURDIR}/kerberosIV/lib; ${MAKE} all; ${MAKE} -B install 7242626Scsgr.endif 7252061Sjkh 72636589Sjhay# Exclude perl from the build-tools if NOPERL is defined. 72736589Sjhay.if defined(NOPERL) 72836589Sjhay_perl= 72936589Sjhay.else 73036589Sjhay_perl= gnu/usr.bin/perl/perl 73136589Sjhay.endif 73236589Sjhay 73317308Speter# 73417308Speter# build-tools - build and install any other tools needed to complete the 73517308Speter# compile and install. 73627910Sasami# ifdef stale 73727910Sasami# bc and cpp are required to build groff. Otherwise, the order here is 73827910Sasami# mostly historical, i.e., bogus. 73927910Sasami# chmod is used to build gcc's tmpmultilib[2] at obscure times. 74027910Sasami# endif stale 74127910Sasami# XXX uname is a bug - the target should not depend on the host. 74217308Speter# 74311806Sphkbuild-tools: 74419175Sbde.for d in \ 74527910Sasami bin/cat \ 74627910Sasami bin/chmod \ 74727910Sasami bin/cp \ 74827910Sasami bin/date \ 74927910Sasami bin/dd \ 75027910Sasami bin/echo \ 75127910Sasami bin/expr \ 75227910Sasami bin/hostname \ 75327910Sasami bin/ln \ 75427910Sasami bin/ls \ 75527910Sasami bin/mkdir \ 75627910Sasami bin/mv \ 75727910Sasami bin/rm \ 75827910Sasami bin/test \ 75927910Sasami gnu/usr.bin/awk \ 76027910Sasami gnu/usr.bin/bc \ 76127910Sasami gnu/usr.bin/grep \ 76227910Sasami gnu/usr.bin/groff \ 76327910Sasami gnu/usr.bin/gzip \ 76427910Sasami gnu/usr.bin/man/makewhatis \ 76535621Sbde gnu/usr.bin/patch \ 76636589Sjhay ${_perl} \ 76727910Sasami gnu/usr.bin/sort \ 76834509Sbde gnu/usr.bin/texinfo \ 76927910Sasami usr.bin/basename \ 77027910Sasami usr.bin/cap_mkdb \ 77127910Sasami usr.bin/chflags \ 77227910Sasami usr.bin/cmp \ 77327910Sasami usr.bin/col \ 77427910Sasami usr.bin/cpp \ 77527910Sasami usr.bin/expand \ 77627910Sasami usr.bin/file2c \ 77727910Sasami usr.bin/find \ 77827910Sasami usr.bin/gencat \ 77936454Sjkh usr.bin/id \ 78027910Sasami usr.bin/lorder \ 78127910Sasami usr.bin/m4 \ 78227910Sasami usr.bin/mkdep \ 78327910Sasami usr.bin/paste \ 78427910Sasami usr.bin/sed \ 78536638Sjb ${_aout_size} \ 78627910Sasami usr.bin/soelim \ 78719175Sbde usr.bin/symorder \ 78827910Sasami usr.bin/touch \ 78927910Sasami usr.bin/tr \ 79027910Sasami usr.bin/true \ 79127910Sasami usr.bin/uname \ 79227910Sasami usr.bin/uuencode \ 79327910Sasami usr.bin/vgrind \ 79427910Sasami usr.bin/vi \ 79527910Sasami usr.bin/wc \ 79634688Sbde usr.bin/xargs \ 79727910Sasami usr.bin/yacc \ 79827910Sasami usr.sbin/chown \ 79927910Sasami usr.sbin/mtree \ 80036455Sjkh usr.sbin/zic \ 80136455Sjkh bin/sh 80236074Sbde cd ${.CURDIR}/$d; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 80336074Sbde ${MAKE} ${MK_FLAGS} all; \ 80430113Sjkh ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR} 80519175Sbde.endfor 8062061Sjkh 80735479Sbde.for __target in clean cleandepend cleandir depend obj 80830113Sjkh.for entry in ${SUBDIR} 80930113Sjkh${entry}.${__target}__D: .PHONY 81035294Sdt @if test -d ${.CURDIR}/${entry}.${MACHINE}; then \ 81130113Sjkh ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE}"; \ 81230113Sjkh edir=${entry}.${MACHINE}; \ 81330113Sjkh cd ${.CURDIR}/$${edir}; \ 81430113Sjkh else \ 81530113Sjkh ${ECHODIR} "===> ${DIRPRFX}${entry}"; \ 81630113Sjkh edir=${entry}; \ 81730113Sjkh cd ${.CURDIR}/$${edir}; \ 81830113Sjkh fi; \ 81930113Sjkh ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/ 82030113Sjkh.endfor 82130113Sjkhpar-${__target}: ${SUBDIR:S/$/.${__target}__D/} 82230113Sjkh.endfor 82330113Sjkh 82432427Sjb.endif 82532427Sjb 8261594Srgrimes.include <bsd.subdir.mk> 827