2 # $Id: Makefile.inc0,v 1.10 1998/09/29 22:03:13 jkh Exp $
4 # This makefile ensures that the object directory is set according to the
5 # object format to avoid mixing aout and elf formatted files during the
8 # >> Beware, this makefile overwrites the local build environment! <<
12 # Build things relative to the user's preferred object directory,
13 # defaulting to /usr/obj if not defined.
15 MAKEOBJDIRPREFIX?=/usr/obj
18 # Variables passed to make work better if they are set as environment
19 # variables instead of command line options.
21 MK_ENV= MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${OBJFORMAT}
24 # We should always use the current set of mk files, not the installed ones.
25 # This makefile is a wrapper for the backend makefile (Makefile.inc1).
27 MAKE= make -m ${.CURDIR}/share/mk -f Makefile.inc1
30 # These are the backend targets.
32 BKTGTS= afterdistribute all checkdpadd clean cleandepend cleandir \
33 depend distribute everything hierarchy includes install installmost \
34 lint maninstall mk most obj objlink regress rerelease \
38 # A generic rule for the backend targets.
41 @cd ${.CURDIR}; ${MK_ENV} ${MAKE} ${.TARGET}
44 # Temporary path and environment for the legacy build.
46 ELFTMP= ${MAKEOBJDIRPREFIX}/elf${.CURDIR}/tmp
47 ELFTMPPATH= ${ELFTMP}/sbin:${ELFTMP}/bin:${ELFTMP}/usr/sbin:${ELFTMP}/usr/bin:${ELFTMP}/usr/games
48 LEGACY_ENV= PATH=${ELFTMPPATH} OBJFORMAT=aout NOTOOLS=1 TOOLROOT=${ELFTMP} \
49 MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/aout
50 XMAKE= ${ELFTMP}/usr/bin/${MAKE}
55 # Attempt to rebuild and reinstall *everything*, with reasonable chance of
56 # success, regardless of how old your existing system is. If building on
57 # an i386/elf system, build the aout legacy cruft too.
60 @echo "--------------------------------------------------------------"
61 @echo ">>> ${OBJFORMAT} make world started on `LC_TIME=C date`"
62 @echo "--------------------------------------------------------------"
65 @echo "--------------------------------------------------------------"
66 @echo ">>> Making 'pre-world' target"
67 @echo "--------------------------------------------------------------"
68 @cd ${.CURDIR}; ${MK_ENV} ${MAKE} pre-world
70 @cd ${.CURDIR}; ${MK_ENV} ${MAKE} buildworld
71 .if ${MACHINE_ARCH} == "i386" && ${OBJFORMAT} == "elf" && !defined(NOAOUT)
72 @cd ${.CURDIR}; ${LEGACY_ENV} ${XMAKE} legacy-build
74 @cd ${.CURDIR}; ${MK_ENV} ${MAKE} -B installworld
75 .if ${MACHINE_ARCH} == "i386" && ${OBJFORMAT} == "elf" && !defined(NOAOUT)
76 @cd ${.CURDIR}; ${LEGACY_ENV} ${XMAKE} legacy-install
78 .if target(post-world)
80 @echo "--------------------------------------------------------------"
81 @echo ">>> Making 'post-world' target"
82 @echo "--------------------------------------------------------------"
83 @cd ${.CURDIR}; ${MK_ENV} ${MAKE} post-world
86 @echo "--------------------------------------------------------------"
87 @echo ">>> ${OBJFORMAT} make world completed on `LC_TIME=C date`"
88 @echo "--------------------------------------------------------------"
93 # Build the world in the current object format, plus the legacy aout
94 # support if the current object format is elf on i386.
97 @cd ${.CURDIR}; ${MK_ENV} ${MAKE} buildworld
98 .if ${MACHINE_ARCH} == "i386" && ${OBJFORMAT} == "elf" && !defined(NOAOUT)
99 @cd ${.CURDIR}; ${LEGACY_ENV} ${XMAKE} legacy-build
105 # Install the world in the current object format, plus the legacy aout
106 # support if the current object format is elf on i386.
109 @cd ${.CURDIR}; ${MK_ENV} ${MAKE} installworld
110 .if ${MACHINE_ARCH} == "i386" && ${OBJFORMAT} == "elf" && !defined(NOAOUT)
111 @cd ${.CURDIR}; ${LEGACY_ENV} ${XMAKE} -DNOMAN -DNOINFO legacy-install