Makefile revision 36419
12061Sjkh# 236419Speter# $Id: Makefile,v 1.182 1998/05/27 07:59:31 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 1420710Sasami# -DALLLANG to build documentation for all languages 1520710Sasami# (where available -- see share/doc/Makefile) 163197Scsgr# 172061Sjkh# -DNOCLEANDIR run ${MAKE} clean, instead of ${MAKE} cleandir 1812483Speter# -DNOCLEAN do not clean at all 1934509Sbde# -DNOTOOLS do not rebuild any tools first 202160Scsgr# -DNOCRYPT will prevent building of crypt versions 212834Swollman# -DNOLKM do not build loadable kernel modules 222061Sjkh# -DNOOBJDIR do not run ``${MAKE} obj'' 232061Sjkh# -DNOPROFILE do not build profiled libraries 242160Scsgr# -DNOSECURE do not go into secure subdir 2517308Speter# -DNOGAMES do not go into games subdir 2619320Sadam# -DNOSHARE do not go into share subdir 2727788Sasami# -DNOINFO do not make or install info files 2830169Sjkh# -DNOLIBC_R do not build libc_r. 2925980Sasami# LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list 301594Srgrimes 3117308Speter# 3217308Speter# The intended user-driven targets are: 3327910Sasami# buildworld - rebuild *everything*, including glue to help do upgrades 3427910Sasami# installworld- install everything built by "buildworld" 3527910Sasami# world - buildworld + installworld 3617308Speter# update - convenient way to update your source tree (eg: sup/cvs) 3717308Speter# most - build user commands, no libraries or include files 3817308Speter# installmost - install user commands, no libraries or include files 3919175Sbde# 4019175Sbde# Standard targets (not defined here) are documented in the makefiles in 4119175Sbde# /usr/share/mk. These include: 4219175Sbde# obj depend all install clean cleandepend cleanobj 4317308Speter 4427910Sasami.if (!make(world)) && (!make(buildworld)) && (!make(installworld)) 4534509Sbde.MAKEFLAGS:= -m ${.CURDIR}/share/mk ${.MAKEFLAGS} 4627910Sasami.endif 4717308Speter 482061Sjkh# Put initial settings here. 492061SjkhSUBDIR= 501594Srgrimes 5130169Sjkh# We must do share/info early so that installation of info `dir' 5230169Sjkh# entries works correctly. Do it first since it is less likely to 5330169Sjkh# grow dependencies on include and lib than vice versa. 5430169Sjkh.if exists(share/info) 5530169SjkhSUBDIR+= share/info 5630169Sjkh.endif 5730169Sjkh 5830169Sjkh# We must do include and lib early so that the perl *.ph generation 597407Srgrimes# works correctly as it uses the header files installed by this. 607108Sphk.if exists(include) 617108SphkSUBDIR+= include 627108Sphk.endif 637407Srgrimes.if exists(lib) 647407SrgrimesSUBDIR+= lib 657407Srgrimes.endif 667108Sphk 672061Sjkh.if exists(bin) 682061SjkhSUBDIR+= bin 692061Sjkh.endif 7017308Speter.if exists(games) && !defined(NOGAMES) 712061SjkhSUBDIR+= games 722061Sjkh.endif 732061Sjkh.if exists(gnu) 742061SjkhSUBDIR+= gnu 752061Sjkh.endif 7635427Sbde.if exists(kerberosIV) && exists(crypto) && !defined(NOCRYPT) && \ 7735427Sbde defined(MAKE_KERBEROS4) 7830169SjkhSUBDIR+= kerberosIV 792626Scsgr.endif 802061Sjkh.if exists(libexec) 812061SjkhSUBDIR+= libexec 822061Sjkh.endif 832061Sjkh.if exists(sbin) 842061SjkhSUBDIR+= sbin 852061Sjkh.endif 8619320Sadam.if exists(share) && !defined(NOSHARE) 872061SjkhSUBDIR+= share 882061Sjkh.endif 892061Sjkh.if exists(sys) 902061SjkhSUBDIR+= sys 912061Sjkh.endif 922061Sjkh.if exists(usr.bin) 932061SjkhSUBDIR+= usr.bin 942061Sjkh.endif 952061Sjkh.if exists(usr.sbin) 962061SjkhSUBDIR+= usr.sbin 972061Sjkh.endif 982834Swollman.if exists(secure) && !defined(NOCRYPT) && !defined(NOSECURE) 992834SwollmanSUBDIR+= secure 1002834Swollman.endif 1012834Swollman.if exists(lkm) && !defined(NOLKM) 1022834SwollmanSUBDIR+= lkm 1032834Swollman.endif 1041594Srgrimes 1054486Sphk# etc must be last for "distribute" to work 1064486Sphk.if exists(etc) && make(distribute) 1074486SphkSUBDIR+= etc 1084486Sphk.endif 1094486Sphk 1102061Sjkh# These are last, since it is nice to at least get the base system 1112061Sjkh# rebuilt before you do them. 11225979Sjkh.if defined(LOCAL_DIRS) 11325979Sjkh.for _DIR in ${LOCAL_DIRS} 11425979Sjkh.if exists(${_DIR}) & exists(${_DIR}/Makefile) 11525979SjkhSUBDIR+= ${_DIR} 1162061Sjkh.endif 11725979Sjkh.endfor 1182061Sjkh.endif 1192061Sjkh 12017308Speter# Handle -DNOOBJDIR, -DNOCLEAN and -DNOCLEANDIR 1212061Sjkh.if defined(NOOBJDIR) 1222061SjkhOBJDIR= 1232061Sjkh.else 1242061SjkhOBJDIR= obj 1252061Sjkh.endif 12612483Speter 12712483Speter.if defined(NOCLEAN) 12812483SpeterCLEANDIR= 12912483Speter.else 1302061Sjkh.if defined(NOCLEANDIR) 13135479SbdeCLEANDIR= clean cleandepend 1328854Srgrimes.else 1332061SjkhCLEANDIR= cleandir 1342061Sjkh.endif 13512483Speter.endif 1362061Sjkh 13735479Sbde.if !defined(NOCLEAN) && ${.MAKEFLAGS:M-j} == "" 13835479Sbde_NODEPEND= true 13935479Sbde.endif 14035479Sbde.if defined(_NODEPEND) 14135479Sbde_DEPEND= cleandepend 14235479Sbde.else 14335479Sbde_DEPEND= depend 14435479Sbde.endif 14535479Sbde 14635462SjkhSUP?= cvsup 14735462SjkhSUPFLAGS?= -g -L 2 -P - 14818714Sache 14917308Speter# 15034541Sbde# While building tools for bootstrapping, we don't need to waste time on 15134575Sbde# shared or profiled libraries, shared linkage, or documentation, except 15234575Sbde# when the tools won't get cleaned we must use the defaults for shared 15334575Sbde# libraries and shared linkage (and this doesn't waste time). 15434592Sbde# XXX actually, we do need to waste time building shared libraries. 15517308Speter# 15634575Sbde.if defined(NOCLEAN) 15735427SbdeMK_FLAGS= -DNOINFO -DNOMAN -DNOPROFILE 15834575Sbde.else 15935427SbdeMK_FLAGS= -DNOINFO -DNOMAN -DNOPIC -DNOPROFILE -DNOSHARED 16034575Sbde.endif 16115603Smarkm 16217308Speter# 16317308Speter# world 16417308Speter# 16517308Speter# Attempt to rebuild and reinstall *everything*, with reasonable chance of 16617308Speter# success, regardless of how old your existing system is. 16717308Speter# 16817308Speter# >> Beware, it overwrites the local build environment! << 16917308Speter# 17017308Speterworld: 17118362Sjkh @echo "--------------------------------------------------------------" 17219966Sache @echo "make world started on `LC_TIME=C date`" 17318362Sjkh @echo "--------------------------------------------------------------" 17417308Speter.if target(pre-world) 17527910Sasami @echo 17617308Speter @echo "--------------------------------------------------------------" 17717308Speter @echo " Making 'pre-world' target" 17817308Speter @echo "--------------------------------------------------------------" 17936074Sbde cd ${.CURDIR}; ${MAKE} pre-world 18027910Sasami.endif 18136074Sbde cd ${.CURDIR}; ${MAKE} buildworld 18236074Sbde cd ${.CURDIR}; ${MAKE} -B installworld 18327910Sasami.if target(post-world) 18417308Speter @echo 1852061Sjkh @echo "--------------------------------------------------------------" 18627910Sasami @echo " Making 'post-world' target" 1872061Sjkh @echo "--------------------------------------------------------------" 18836074Sbde cd ${.CURDIR}; ${MAKE} post-world 18927910Sasami.endif 1902061Sjkh @echo 19117308Speter @echo "--------------------------------------------------------------" 19227910Sasami @echo "make world completed on `LC_TIME=C date`" 19317308Speter @echo "--------------------------------------------------------------" 19427910Sasami 19527910Sasami.if defined(MAKEOBJDIRPREFIX) 19627910SasamiWORLDTMP= ${MAKEOBJDIRPREFIX}${.CURDIR}/tmp 19717308Speter.else 19827910SasamiWORLDTMP= /usr/obj${.CURDIR}/tmp 19917308Speter.endif 20027910SasamiSTRICTTMPPATH= ${WORLDTMP}/sbin:${WORLDTMP}/usr/sbin:${WORLDTMP}/bin:${WORLDTMP}/usr/bin 20127910SasamiTMPPATH= ${STRICTTMPPATH}:${PATH} 20227910Sasami 20327910Sasami# XXX COMPILER_PATH is needed for finding cc1, ld and as 20427910Sasami# XXX GCC_EXEC_PREFIX is for *crt.o. It is probably unnecssary now 20527910Sasami# tbat LIBRARY_PATH is set. We still can't use -nostdlib, since gcc 20627910Sasami# wouldn't link *crt.o or libgcc if it were used. 20727910Sasami# XXX LD_LIBRARY_PATH is for ld.so. It is also used by ld, although we don't 20827910Sasami# want that - all compile-time library paths should be resolved by gcc. 20927910Sasami# It fails for set[ug]id executables (are any used?). 21027910SasamiCOMPILER_ENV= BISON_SIMPLE=${WORLDTMP}/usr/share/misc/bison.simple \ 21136408Ssos OBJFORMAT_PATH=${WORLDTMP}/usr/libexec \ 21227910Sasami COMPILER_PATH=${WORLDTMP}/usr/libexec:${WORLDTMP}/usr/bin \ 21334509Sbde GCC_EXEC_PREFIX=${WORLDTMP}${SHLIBDIR}:${WORLDTMP}/usr/lib/ \ 21427910Sasami LD_LIBRARY_PATH=${WORLDTMP}${SHLIBDIR} \ 21527910Sasami LIBRARY_PATH=${WORLDTMP}${SHLIBDIR}:${WORLDTMP}/usr/lib 21627910Sasami 21727910SasamiBMAKEENV= PATH=${TMPPATH} ${COMPILER_ENV} NOEXTRADEPEND=t 21827910SasamiXMAKEENV= PATH=${STRICTTMPPATH} ${COMPILER_ENV} \ 21935479Sbde CFLAGS="-nostdinc ${CFLAGS}" # XXX -nostdlib 22027910Sasami 22127910Sasami# used to compile and install 'make' in temporary build tree 22234688SbdeMAKETMP= ${WORLDTMP}/make 22334688SbdeIBMAKE= ${BMAKEENV} MAKEOBJDIR=${MAKETMP} ${MAKE} DESTDIR=${WORLDTMP} 22427910Sasami# bootstrap make 22535427SbdeBMAKE= ${BMAKEENV} ${WORLDTMP}/usr/bin/make DESTDIR=${WORLDTMP} 22627910Sasami# cross make used for compilation 22735427SbdeXMAKE= ${XMAKEENV} ${WORLDTMP}/usr/bin/make DESTDIR=${WORLDTMP} 22827910Sasami# cross make used for final installation 22935427SbdeIXMAKE= ${XMAKEENV} ${WORLDTMP}/usr/bin/make 23027910Sasami 23127910Sasami# 23227910Sasami# buildworld 23327910Sasami# 23427910Sasami# Attempt to rebuild the entire system, with reasonable chance of 23527910Sasami# success, regardless of how old your existing system is. 23627910Sasami# 23727910Sasamibuildworld: 23827910Sasami.if !defined(NOCLEAN) 23917308Speter @echo 24017308Speter @echo "--------------------------------------------------------------" 24127910Sasami @echo " Cleaning up the temporary build tree" 24217308Speter @echo "--------------------------------------------------------------" 24327910Sasami mkdir -p ${WORLDTMP} 24427910Sasami chflags -R noschg ${WORLDTMP}/ 24527910Sasami rm -rf ${WORLDTMP} 24627910Sasami.endif 24733133Sadam.if !defined(NOTOOLS) 24817466Speter @echo 24917308Speter @echo "--------------------------------------------------------------" 25027910Sasami @echo " Making make" 25117308Speter @echo "--------------------------------------------------------------" 25234688Sbde mkdir -p ${WORLDTMP}/usr/bin ${MAKETMP} 25334688Sbde ( \ 25436074Sbde cd ${.CURDIR}/usr.bin/make; \ 25536074Sbde MAKEOBJDIRPREFIX=""; unset MAKEOBJDIRPREFIX; \ 25636074Sbde ${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} all; \ 25736074Sbde ${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} install; \ 25834688Sbde ${IBMAKE} -I${.CURDIR}/share/mk ${MK_FLAGS} clean \ 25934688Sbde ) 26033133Sadam.endif 26117308Speter @echo 26217308Speter @echo "--------------------------------------------------------------" 26327910Sasami @echo " Making hierarchy" 26417308Speter @echo "--------------------------------------------------------------" 26536074Sbde cd ${.CURDIR}; ${BMAKE} hierarchy 26627910Sasami.if !defined(NOCLEAN) 26717308Speter @echo 26817308Speter @echo "--------------------------------------------------------------" 26927910Sasami @echo " Cleaning up the obj tree" 27017308Speter @echo "--------------------------------------------------------------" 27136074Sbde cd ${.CURDIR}; ${BMAKE} ${CLEANDIR:S/^/par-/} 27227910Sasami.endif 27327910Sasami.if !defined(NOOBJDIR) 27417308Speter @echo 27517308Speter @echo "--------------------------------------------------------------" 27627910Sasami @echo " Rebuilding the obj tree" 27717308Speter @echo "--------------------------------------------------------------" 27836074Sbde cd ${.CURDIR}; ${BMAKE} par-${OBJDIR} 27927910Sasami.endif 28033133Sadam.if !defined(NOTOOLS) 28117308Speter @echo 28217308Speter @echo "--------------------------------------------------------------" 28327910Sasami @echo " Rebuilding bootstrap tools" 28417308Speter @echo "--------------------------------------------------------------" 28536074Sbde cd ${.CURDIR}; ${BMAKE} bootstrap 28617308Speter @echo 28717308Speter @echo "--------------------------------------------------------------" 28827910Sasami @echo " Rebuilding tools necessary to build the include files" 28917308Speter @echo "--------------------------------------------------------------" 29036074Sbde cd ${.CURDIR}; ${BMAKE} include-tools 29133133Sadam.endif 29217308Speter @echo 29317308Speter @echo "--------------------------------------------------------------" 29434509Sbde @echo " Rebuilding ${DESTDIR}/usr/include" 29517308Speter @echo "--------------------------------------------------------------" 29636074Sbde cd ${.CURDIR}; SHARED=symlinks ${BMAKE} includes 29735851Sjb @echo 29835851Sjb @echo "--------------------------------------------------------------" 29935851Sjb @echo " Rebuilding bootstrap libraries" 30035851Sjb @echo "--------------------------------------------------------------" 30136074Sbde cd ${.CURDIR}; ${BMAKE} bootstrap-libraries 30233133Sadam.if !defined(NOTOOLS) 30317962Speter @echo 30417962Speter @echo "--------------------------------------------------------------" 30535851Sjb @echo " Rebuilding tools needed to build libraries" 30617962Speter @echo "--------------------------------------------------------------" 30736074Sbde cd ${.CURDIR}; ${BMAKE} lib-tools 30833133Sadam.endif 30933133Sadam.if !defined(NOTOOLS) 31017962Speter @echo 31117962Speter @echo "--------------------------------------------------------------" 31227910Sasami @echo " Rebuilding all other tools needed to build the world" 31317962Speter @echo "--------------------------------------------------------------" 31436074Sbde cd ${.CURDIR}; ${BMAKE} build-tools 31533133Sadam.endif 31635479Sbde.if !defined(_NODEPEND) 31717308Speter @echo 31817308Speter @echo "--------------------------------------------------------------" 31927910Sasami @echo " Rebuilding dependencies" 32017308Speter @echo "--------------------------------------------------------------" 32136074Sbde cd ${.CURDIR}; ${XMAKE} par-depend 32235479Sbde.endif 32317308Speter @echo 32417308Speter @echo "--------------------------------------------------------------" 32535427Sbde @echo " Building libraries" 32635427Sbde @echo "--------------------------------------------------------------" 32736074Sbde cd ${.CURDIR}; ${XMAKE} -DNOINFO -DNOMAN libraries 32835427Sbde @echo 32935427Sbde @echo "--------------------------------------------------------------" 33027910Sasami @echo " Building everything.." 33117962Speter @echo "--------------------------------------------------------------" 33236074Sbde cd ${.CURDIR}; ${XMAKE} all 3332061Sjkh 33417308Speter# 33527910Sasami# installworld 33627910Sasami# 33727910Sasami# Installs everything compiled by a 'buildworld'. 33827910Sasami# 33927910Sasamiinstallworld: 34036074Sbde cd ${.CURDIR}; ${IXMAKE} reinstall 34127910Sasami 34227910Sasami# 34317308Speter# reinstall 34417308Speter# 34517308Speter# If you have a build server, you can NFS mount the source and obj directories 34617308Speter# and do a 'make reinstall' on the *client* to install new binaries from the 34717308Speter# most recent server build. 34817308Speter# 34917308Speterreinstall: 35012483Speter @echo "--------------------------------------------------------------" 35117308Speter @echo " Making hierarchy" 35212483Speter @echo "--------------------------------------------------------------" 35336074Sbde cd ${.CURDIR}; ${MAKE} hierarchy 35412483Speter @echo 3552061Sjkh @echo "--------------------------------------------------------------" 35617962Speter @echo " Installing everything.." 35717962Speter @echo "--------------------------------------------------------------" 35836074Sbde cd ${.CURDIR}; ${MAKE} install 35917962Speter @echo 36017962Speter @echo "--------------------------------------------------------------" 36133595Snate @echo " Re-scanning the shared libraries.." 36233595Snate @echo "--------------------------------------------------------------" 36336074Sbde cd ${.CURDIR}; ldconfig -R 36433595Snate @echo 36533595Snate @echo "--------------------------------------------------------------" 36617962Speter @echo " Rebuilding man page indexes" 36717962Speter @echo "--------------------------------------------------------------" 36836074Sbde cd ${.CURDIR}/share/man; ${MAKE} makedb 3692061Sjkh 37017308Speter# 37117308Speter# update 37217308Speter# 37317308Speter# Update the source tree, by running sup and/or running cvs to update to the 37417308Speter# latest copy. 37517308Speter# 3762302Spaulupdate: 3772302Spaul.if defined(SUP_UPDATE) 3782302Spaul @echo "--------------------------------------------------------------" 37935462Sjkh @echo "Running ${SUP}" 3802302Spaul @echo "--------------------------------------------------------------" 38118714Sache @${SUP} ${SUPFLAGS} ${SUPFILE} 38210760Sache.if defined(SUPFILE1) 38318714Sache @${SUP} ${SUPFLAGS} ${SUPFILE1} 3842302Spaul.endif 38510760Sache.if defined(SUPFILE2) 38618714Sache @${SUP} ${SUPFLAGS} ${SUPFILE2} 38710760Sache.endif 38810760Sache.endif 3892302Spaul.if defined(CVS_UPDATE) 3902302Spaul @echo "--------------------------------------------------------------" 3912302Spaul @echo "Updating /usr/src from cvs repository" ${CVSROOT} 3922302Spaul @echo "--------------------------------------------------------------" 39336074Sbde cd ${.CURDIR}; cvs -q update -P -d 3942302Spaul.endif 3952302Spaul 39617308Speter# 39717308Speter# most 39817308Speter# 39917308Speter# Build most of the user binaries on the existing system libs and includes. 40017308Speter# 40117308Spetermost: 4022061Sjkh @echo "--------------------------------------------------------------" 40317308Speter @echo " Building programs only" 4042061Sjkh @echo "--------------------------------------------------------------" 40536074Sbde cd ${.CURDIR}/bin; ${MAKE} all 40636074Sbde cd ${.CURDIR}/sbin; ${MAKE} all 40736074Sbde cd ${.CURDIR}/libexec; ${MAKE} all 40836074Sbde cd ${.CURDIR}/usr.bin; ${MAKE} all 40936074Sbde cd ${.CURDIR}/usr.sbin; ${MAKE} all 41036074Sbde cd ${.CURDIR}/gnu/libexec; ${MAKE} all 41136074Sbde cd ${.CURDIR}/gnu/usr.bin; ${MAKE} all 41236074Sbde cd ${.CURDIR}/gnu/usr.sbin; ${MAKE} all 41330169Sjkh#.if defined(MAKE_KERBEROS4) && !defined(NOCRYPT) 41436074Sbde# cd ${.CURDIR}/kerberosIV; ${MAKE} most 41517308Speter#.endif 41617308Speter#.if !defined(NOSECURE) && !defined(NOCRYPT) 41736074Sbde# cd ${.CURDIR}/secure; ${MAKE} most 41817308Speter#.endif 4192061Sjkh 42017308Speter# 42117308Speter# installmost 42217308Speter# 42317308Speter# Install the binaries built by the 'most' target. This does not include 42417308Speter# libraries or include files. 42517308Speter# 4263626Swollmaninstallmost: 4273626Swollman @echo "--------------------------------------------------------------" 4283626Swollman @echo " Installing programs only" 4293626Swollman @echo "--------------------------------------------------------------" 43036074Sbde cd ${.CURDIR}/bin; ${MAKE} install 43136074Sbde cd ${.CURDIR}/sbin; ${MAKE} install 43236074Sbde cd ${.CURDIR}/libexec; ${MAKE} install 43336074Sbde cd ${.CURDIR}/usr.bin; ${MAKE} install 43436074Sbde cd ${.CURDIR}/usr.sbin; ${MAKE} install 43536074Sbde cd ${.CURDIR}/gnu/libexec; ${MAKE} install 43636074Sbde cd ${.CURDIR}/gnu/usr.bin; ${MAKE} install 43736074Sbde cd ${.CURDIR}/gnu/usr.sbin; ${MAKE} install 43830169Sjkh#.if defined(MAKE_KERBEROS4) && !defined(NOCRYPT) 43936074Sbde# cd ${.CURDIR}/kerberosIV; ${MAKE} installmost 4403626Swollman#.endif 4413626Swollman#.if !defined(NOSECURE) && !defined(NOCRYPT) 44236074Sbde# cd ${.CURDIR}/secure; ${MAKE} installmost 4433626Swollman#.endif 4443626Swollman 44517308Speter# 44617308Speter# ------------------------------------------------------------------------ 44717308Speter# 44817308Speter# From here onwards are utility targets used by the 'make world' and 44917308Speter# related targets. If your 'world' breaks, you may like to try to fix 45017308Speter# the problem and manually run the following targets to attempt to 45117308Speter# complete the build. Beware, this is *not* guaranteed to work, you 45217308Speter# need to have a pretty good grip on the current state of the system 45317308Speter# to attempt to manually finish it. If in doubt, 'make world' again. 45417308Speter# 4553626Swollman 45617308Speter# 45717308Speter# heirarchy - ensure that all the needed directories are present 45817308Speter# 45917308Speterhierarchy: 46036074Sbde cd ${.CURDIR}/etc; ${MAKE} distrib-dirs 46117308Speter 46217308Speter# 46317308Speter# bootstrap - [re]build tools needed to run the actual build, this includes 46417308Speter# tools needed by 'make depend', as some tools are needed to generate source 46517308Speter# for the dependency information to be gathered from. 46617308Speter# 46717308Speterbootstrap: 46827910Sasami.if defined(DESTDIR) 46927910Sasami rm -f ${DESTDIR}/usr/src/sys 47027910Sasami ln -s ${.CURDIR}/sys ${DESTDIR}/usr/src 47136074Sbde cd ${.CURDIR}/include; find -dx . | cpio -dump ${DESTDIR}/usr/include 47236074Sbde cd ${.CURDIR}/include; ${MAKE} symlinks 47327910Sasami.endif 47436074Sbde cd ${.CURDIR}/usr.bin/make; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 47536074Sbde ${MAKE} ${MK_FLAGS} all; \ 47630113Sjkh ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR} 47736074Sbde cd ${.CURDIR}/usr.bin/xinstall; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 47836074Sbde ${MAKE} ${MK_FLAGS} all; \ 47930113Sjkh ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR} 48036074Sbde cd ${.CURDIR}/usr.bin/lex; ${MAKE} bootstrap; \ 48136074Sbde ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 48236074Sbde ${MAKE} ${MK_FLAGS} -DNOLIB all; \ 48330113Sjkh ${MAKE} ${MK_FLAGS} -DNOLIB -B install ${CLEANDIR} 48429938Smckay.if !defined(NOOBJDIR) 48536074Sbde cd ${.CURDIR}/usr.bin/lex; ${MAKE} ${OBJDIR} 48629938Smckay.endif 48717308Speter 48817308Speter# 48917308Speter# include-tools - generally the same as 'bootstrap', except that it's for 49017308Speter# things that are specifically needed to generate include files. 49117308Speter# 49227910Sasami# XXX should be merged with bootstrap, it's not worth keeeping them separate. 49327910Sasami# Well, maybe it is now. We force 'cleandepend' here to avoid dependencies 49427910Sasami# on cleaned away headers in ${WORLDTMP}. 49517308Speter# 49617308Speterinclude-tools: 49734520Sbde.for d in usr.bin/compile_et usr.bin/rpcgen 49836074Sbde cd ${.CURDIR}/$d; ${MAKE} cleandepend; \ 49936074Sbde ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 50036074Sbde ${MAKE} ${MK_FLAGS} all; \ 50130113Sjkh ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR} 50234520Sbde.endfor 50317308Speter 50417308Speter# 50517308Speter# includes - possibly generate and install the include files. 50617308Speter# 50714119Speterincludes: 5082061Sjkh.if defined(CLOBBER) 5097130Srgrimes rm -rf ${DESTDIR}/usr/include/* 5107130Srgrimes mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ 5117130Srgrimes -p ${DESTDIR}/usr/include 5122061Sjkh.endif 51336074Sbde cd ${.CURDIR}/include; ${MAKE} -B all install 51436074Sbde cd ${.CURDIR}/gnu/include; ${MAKE} install 51536074Sbde cd ${.CURDIR}/gnu/lib/libmp; ${MAKE} beforeinstall 51636074Sbde cd ${.CURDIR}/gnu/lib/libobjc; ${MAKE} beforeinstall 51736074Sbde cd ${.CURDIR}/gnu/lib/libreadline; ${MAKE} beforeinstall 51836074Sbde cd ${.CURDIR}/gnu/lib/libregex; ${MAKE} beforeinstall 51936074Sbde cd ${.CURDIR}/gnu/lib/libstdc++; ${MAKE} beforeinstall 52036074Sbde cd ${.CURDIR}/gnu/lib/libg++; ${MAKE} beforeinstall 52136074Sbde cd ${.CURDIR}/gnu/lib/libdialog; ${MAKE} beforeinstall 52236074Sbde cd ${.CURDIR}/gnu/lib/libgmp; ${MAKE} beforeinstall 52330169Sjkh.if exists(secure) && !defined(NOCRYPT) 52436074Sbde cd ${.CURDIR}/secure/lib/libdes; ${MAKE} beforeinstall 5253197Scsgr.endif 52630169Sjkh.if exists(kerberosIV) && !defined(NOCRYPT) && defined(MAKE_KERBEROS4) 52736074Sbde cd ${.CURDIR}/kerberosIV/lib/libacl; ${MAKE} beforeinstall 52836074Sbde cd ${.CURDIR}/kerberosIV/lib/libkadm; ${MAKE} beforeinstall 52936074Sbde cd ${.CURDIR}/kerberosIV/lib/libkafs; ${MAKE} beforeinstall 53036074Sbde cd ${.CURDIR}/kerberosIV/lib/libkdb; ${MAKE} beforeinstall 53136074Sbde cd ${.CURDIR}/kerberosIV/lib/libkrb; ${MAKE} beforeinstall 53236074Sbde cd ${.CURDIR}/kerberosIV/lib/libtelnet; ${MAKE} beforeinstall 53330169Sjkh.else 53436074Sbde cd ${.CURDIR}/lib/libtelnet; ${MAKE} beforeinstall 53530169Sjkh.endif 53632427Sjb.if exists(${.CURDIR}/lib/csu/${MACHINE}) 53736074Sbde cd ${.CURDIR}/lib/csu/${MACHINE}; ${MAKE} beforeinstall 53832427Sjb.endif 53936074Sbde cd ${.CURDIR}/lib/libalias; ${MAKE} beforeinstall 54036074Sbde cd ${.CURDIR}/lib/libc; ${MAKE} beforeinstall 54136074Sbde cd ${.CURDIR}/lib/libcalendar; ${MAKE} beforeinstall 54236074Sbde cd ${.CURDIR}/lib/libcurses; ${MAKE} beforeinstall 54336074Sbde cd ${.CURDIR}/lib/libdisk; ${MAKE} beforeinstall 54436074Sbde cd ${.CURDIR}/lib/libedit; ${MAKE} beforeinstall 54536074Sbde cd ${.CURDIR}/lib/libftpio; ${MAKE} beforeinstall 54636074Sbde cd ${.CURDIR}/lib/libmd; ${MAKE} beforeinstall 54736074Sbde cd ${.CURDIR}/lib/libmytinfo; ${MAKE} beforeinstall 54836074Sbde cd ${.CURDIR}/lib/libncurses; ${MAKE} beforeinstall 5497281Srgrimes.if !defined(WANT_CSRG_LIBM) 55036074Sbde cd ${.CURDIR}/lib/msun; ${MAKE} beforeinstall 5513242Spaul.endif 55236074Sbde cd ${.CURDIR}/lib/libopie; ${MAKE} beforeinstall 55336074Sbde cd ${.CURDIR}/lib/libpcap; ${MAKE} beforeinstall 55436074Sbde cd ${.CURDIR}/lib/librpcsvc; ${MAKE} beforeinstall 55536074Sbde cd ${.CURDIR}/lib/libskey; ${MAKE} beforeinstall 55630169Sjkh.if !defined(NOTCL) && exists (${.CURDIR}/contrib/tcl) && \ 55730169Sjkh exists(${.CURDIR}/usr.bin/tclsh) && exists (${.CURDIR}/lib/libtcl) 55836074Sbde cd ${.CURDIR}/lib/libtcl; ${MAKE} installhdrs 55930169Sjkh.endif 56036074Sbde cd ${.CURDIR}/lib/libtermcap; ${MAKE} beforeinstall 56136074Sbde cd ${.CURDIR}/lib/libcom_err; ${MAKE} beforeinstall 56236074Sbde cd ${.CURDIR}/lib/libss; ${MAKE} -B hdrs beforeinstall 56336074Sbde cd ${.CURDIR}/lib/libscsi; ${MAKE} beforeinstall 56436074Sbde cd ${.CURDIR}/lib/libutil; ${MAKE} beforeinstall 56536074Sbde cd ${.CURDIR}/lib/libvgl; ${MAKE} beforeinstall 56636074Sbde cd ${.CURDIR}/lib/libz; ${MAKE} beforeinstall 56736074Sbde cd ${.CURDIR}/usr.bin/f2c; ${MAKE} beforeinstall 56836074Sbde cd ${.CURDIR}/usr.bin/lex; ${MAKE} beforeinstall 5692061Sjkh 57017308Speter# 57117308Speter# lib-tools - build tools to compile and install the libraries. 57217308Speter# 57327910Sasami# XXX gperf is required for cc 57427910Sasami# XXX a new ld and tsort is required for cc 5755366Snatelib-tools: 57627910Sasami.for d in \ 57727910Sasami gnu/usr.bin/gperf \ 57827910Sasami gnu/usr.bin/ld \ 57927910Sasami usr.bin/tsort \ 58027910Sasami gnu/usr.bin/as \ 58127910Sasami gnu/usr.bin/bison \ 58227910Sasami gnu/usr.bin/cc \ 58327910Sasami usr.bin/ar \ 58427910Sasami usr.bin/lex/lib \ 58527910Sasami usr.bin/mk_cmds \ 58627910Sasami usr.bin/nm \ 58727910Sasami usr.bin/ranlib \ 58836374Ssos usr.bin/strip \ 58936374Ssos usr.bin/env \ 59036374Ssos gnu/usr.bin/binutils \ 59136419Speter usr.bin/uudecode \ 59236419Speter usr.bin/objformat 59336074Sbde cd ${.CURDIR}/$d; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 59436074Sbde ${MAKE} ${MK_FLAGS} all; \ 59536074Sbde ${MAKE} ${MK_FLAGS} -B install; \ 59634575Sbde ${MAKE} ${MK_FLAGS:S/-DNOPIC//} -B ${CLEANDIR} ${OBJDIR} 59727910Sasami.endfor 5985366Snate 59917308Speter# 60035427Sbde# We have to know too much about ordering and subdirs in the lib trees: 60117308Speter# 60235427Sbde# To satisfy shared library linkage when only the libraries being built 60335427Sbde# are visible: 60435427Sbde# 60535427Sbde# libcom_err must be built before libss. 60635427Sbde# libcrypt and libmd must be built before libskey. 60735427Sbde# libm must be built before libtcl. 60835427Sbde# libmytinfo must be built before libdialog and libncurses. 60935427Sbde# libncurses must be built before libdialog. 61035427Sbde# libtermcap must be built before libcurses, libedit and libreadline. 61135427Sbde# 61235427Sbde# Some libraries are built conditionally and/or are in inconsistently 61335427Sbde# named directories: 61435427Sbde# 61535427Sbde.if exists(lib/csu/${MACHINE}.pcc) 61635427Sbde_csu=lib/csu/${MACHINE}.pcc 61734541Sbde.else 61835427Sbde_csu=lib/csu/${MACHINE} 61924754Sjdp.endif 62034541Sbde 62135427Sbde_libcrypt= lib/libcrypt 62235427Sbde.if !defined(NOSECURE) && !defined(NOCRYPT) 62335427Sbde_libcrypt+= secure/lib/libcrypt 62435427Sbde.endif 62535427Sbde 62634541Sbde.if defined(WANT_CSRG_LIBM) 62735427Sbde_libm= lib/libm 62834541Sbde.else 62935427Sbde_libm= lib/msun 6308295Srgrimes.endif 63134541Sbde 63234541Sbde# 63335427Sbde# bootstrap-libraries - build just enough libraries for the bootstrap 63435427Sbde# tools, and install them under ${WORLDTMP}. 63534541Sbde# 63635427Sbde# Build csu and libgcc early so that some tools get linked to the new 63735427Sbde# versions (too late for the main tools, however). Then build the 63835427Sbde# necessary prerequisite libraries (libtermcap just needs to be before 63935427Sbde# libcurses, and this only matters for the NOCLEAN case when NOPIC is 64035427Sbde# not set). 64134541Sbde# 64235427Sbde# This is mostly wrong. The build tools must run on the host system, 64335427Sbde# so they should use host libraries. We depend on the target being 64435427Sbde# similar enough to the host for new target libraries to work on the 64535427Sbde# host. 64634541Sbde# 64735427Sbdebootstrap-libraries: 64835427Sbde.for _lib in ${_csu} gnu/usr.bin/cc/libgcc lib/libtermcap \ 64936397Ssos gnu/lib/libregex gnu/lib/libreadline lib/libc \ 65036397Ssos lib/libcrypt lib/libcurses lib/libedit ${_libm} \ 65135427Sbde lib/libmd lib/libutil lib/libz usr.bin/lex/lib 65234541Sbde.if exists(${.CURDIR}/${_lib}) 65336074Sbde cd ${.CURDIR}/${_lib}; \ 65436074Sbde ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 65536074Sbde ${MAKE} ${MK_FLAGS} all; \ 65630113Sjkh ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR} 6578489Srgrimes.endif 65834541Sbde.endfor 65935427Sbde 66035427Sbde# 66135427Sbde# libraries - build all libraries, and install them under ${DESTDIR}. 66235427Sbde# 66335427Sbde# The ordering is not as special as for bootstrap-libraries. Build 66435427Sbde# the prerequisites first, then build almost everything else in 66535427Sbde# alphabetical order. 66635427Sbde# 66735427Sbdelibraries: 66835427Sbde.for _lib in lib/libcom_err ${_libcrypt} ${_libm} lib/libmytinfo \ 66935427Sbde lib/libncurses lib/libtermcap \ 67035427Sbde gnu/lib gnu/usr.bin/cc/libgcc lib usr.bin/lex/lib usr.sbin/pcvt/keycap 67135427Sbde.if exists(${.CURDIR}/${_lib}) 67236074Sbde cd ${.CURDIR}/${_lib}; ${MAKE} all; ${MAKE} -B install 67335427Sbde.endif 67435427Sbde.endfor 67534541Sbde.if exists(${.CURDIR}/secure/lib) && !defined(NOCRYPT) && !defined(NOSECURE) 67636074Sbde cd ${.CURDIR}/secure/lib; ${MAKE} all; ${MAKE} -B install 6772160Scsgr.endif 67834541Sbde.if exists(${.CURDIR}/kerberosIV/lib) && !defined(NOCRYPT) && \ 67934541Sbde defined(MAKE_KERBEROS4) 68036074Sbde cd ${.CURDIR}/kerberosIV/lib; ${MAKE} all; ${MAKE} -B install 6812626Scsgr.endif 6822061Sjkh 68317308Speter# 68417308Speter# build-tools - build and install any other tools needed to complete the 68517308Speter# compile and install. 68627910Sasami# ifdef stale 68727910Sasami# bc and cpp are required to build groff. Otherwise, the order here is 68827910Sasami# mostly historical, i.e., bogus. 68927910Sasami# chmod is used to build gcc's tmpmultilib[2] at obscure times. 69027910Sasami# endif stale 69127910Sasami# XXX uname is a bug - the target should not depend on the host. 69217308Speter# 69311806Sphkbuild-tools: 69419175Sbde.for d in \ 69527910Sasami bin/cat \ 69627910Sasami bin/chmod \ 69727910Sasami bin/cp \ 69827910Sasami bin/date \ 69927910Sasami bin/dd \ 70027910Sasami bin/echo \ 70127910Sasami bin/expr \ 70227910Sasami bin/hostname \ 70327910Sasami bin/ln \ 70427910Sasami bin/ls \ 70527910Sasami bin/mkdir \ 70627910Sasami bin/mv \ 70727910Sasami bin/rm \ 70827910Sasami bin/sh \ 70927910Sasami bin/test \ 71027910Sasami gnu/usr.bin/awk \ 71127910Sasami gnu/usr.bin/bc \ 71227910Sasami gnu/usr.bin/grep \ 71327910Sasami gnu/usr.bin/groff \ 71427910Sasami gnu/usr.bin/gzip \ 71527910Sasami gnu/usr.bin/man/makewhatis \ 71635621Sbde gnu/usr.bin/patch \ 71736142Sjb gnu/usr.bin/perl/perl \ 71827910Sasami gnu/usr.bin/sort \ 71934509Sbde gnu/usr.bin/texinfo \ 72027910Sasami usr.bin/basename \ 72127910Sasami usr.bin/cap_mkdb \ 72227910Sasami usr.bin/chflags \ 72327910Sasami usr.bin/cmp \ 72427910Sasami usr.bin/col \ 72527910Sasami usr.bin/cpp \ 72627910Sasami usr.bin/expand \ 72727910Sasami usr.bin/file2c \ 72827910Sasami usr.bin/find \ 72927910Sasami usr.bin/gencat \ 73027910Sasami usr.bin/lorder \ 73127910Sasami usr.bin/m4 \ 73227910Sasami usr.bin/mkdep \ 73327910Sasami usr.bin/paste \ 73427910Sasami usr.bin/sed \ 73527910Sasami usr.bin/size \ 73627910Sasami usr.bin/soelim \ 73727910Sasami usr.bin/strip \ 73819175Sbde usr.bin/symorder \ 73927910Sasami usr.bin/touch \ 74027910Sasami usr.bin/tr \ 74127910Sasami usr.bin/true \ 74227910Sasami usr.bin/uname \ 74327910Sasami usr.bin/uuencode \ 74427910Sasami usr.bin/vgrind \ 74527910Sasami usr.bin/vi \ 74627910Sasami usr.bin/wc \ 74734688Sbde usr.bin/xargs \ 74827910Sasami usr.bin/yacc \ 74927910Sasami usr.sbin/chown \ 75027910Sasami usr.sbin/mtree \ 75127910Sasami usr.sbin/zic 75236074Sbde cd ${.CURDIR}/$d; ${MAKE} ${MK_FLAGS} ${_DEPEND}; \ 75336074Sbde ${MAKE} ${MK_FLAGS} all; \ 75430113Sjkh ${MAKE} ${MK_FLAGS} -B install ${CLEANDIR} ${OBJDIR} 75519175Sbde.endfor 7562061Sjkh 75735479Sbde.for __target in clean cleandepend cleandir depend obj 75830113Sjkh.for entry in ${SUBDIR} 75930113Sjkh${entry}.${__target}__D: .PHONY 76035294Sdt @if test -d ${.CURDIR}/${entry}.${MACHINE}; then \ 76130113Sjkh ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE}"; \ 76230113Sjkh edir=${entry}.${MACHINE}; \ 76330113Sjkh cd ${.CURDIR}/$${edir}; \ 76430113Sjkh else \ 76530113Sjkh ${ECHODIR} "===> ${DIRPRFX}${entry}"; \ 76630113Sjkh edir=${entry}; \ 76730113Sjkh cd ${.CURDIR}/$${edir}; \ 76830113Sjkh fi; \ 76930113Sjkh ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/ 77030113Sjkh.endfor 77130113Sjkhpar-${__target}: ${SUBDIR:S/$/.${__target}__D/} 77230113Sjkh.endfor 77330113Sjkh 77432427Sjb.endif 77532427Sjb 7761594Srgrimes.include <bsd.subdir.mk> 777