2 # $Id: Makefile.inc0,v 1.12 1998/12/16 11:45:51 ache 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= all checkdpadd clean cleandepend cleandir \
33 depend 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}; ${MAKE} ${.TARGET}
43 # These targets are used during a make release, which is done after a
44 # make world, so they should use the same OBJDIRPREFIX that was used
45 # during the make world.
46 RELTGTS= afterdistribute distribute
49 @cd ${.CURDIR}; ${MK_ENV} ${MAKE} ${.TARGET}
52 # Temporary path and environment for the legacy build.
54 ELFTMP= ${MAKEOBJDIRPREFIX}/elf${.CURDIR}/tmp
55 ELFTMPPATH= ${ELFTMP}/sbin:${ELFTMP}/bin:${ELFTMP}/usr/sbin:${ELFTMP}/usr/bin:${ELFTMP}/usr/games
56 LEGACY_ENV= PATH=${ELFTMPPATH} OBJFORMAT=aout NOTOOLS=1 TOOLROOT=${ELFTMP} \
57 MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/aout
58 XMAKE= ${ELFTMP}/usr/bin/${MAKE}
63 # Attempt to rebuild and reinstall *everything*, with reasonable chance of
64 # success, regardless of how old your existing system is. If building on
65 # an i386/elf system, build the aout legacy cruft too.
68 @echo "--------------------------------------------------------------"
69 @echo ">>> ${OBJFORMAT} make world started on `LC_TIME=C date`"
70 @echo "--------------------------------------------------------------"
73 @echo "--------------------------------------------------------------"
74 @echo ">>> Making 'pre-world' target"
75 @echo "--------------------------------------------------------------"
76 @cd ${.CURDIR}; ${MK_ENV} ${MAKE} pre-world
78 @cd ${.CURDIR}; ${MK_ENV} ${MAKE} buildworld
79 .if ${MACHINE_ARCH} == "i386" && ${OBJFORMAT} == "elf" && !defined(NOAOUT)
80 @cd ${.CURDIR}; ${LEGACY_ENV} ${XMAKE} legacy-build
82 @cd ${.CURDIR}; ${MK_ENV} ${MAKE} -B installworld
83 .if ${MACHINE_ARCH} == "i386" && ${OBJFORMAT} == "elf" && !defined(NOAOUT)
84 @cd ${.CURDIR}; ${LEGACY_ENV} ${XMAKE} legacy-install
86 .if target(post-world)
88 @echo "--------------------------------------------------------------"
89 @echo ">>> Making 'post-world' target"
90 @echo "--------------------------------------------------------------"
91 @cd ${.CURDIR}; ${MK_ENV} ${MAKE} post-world
94 @echo "--------------------------------------------------------------"
95 @echo ">>> ${OBJFORMAT} make world completed on `LC_TIME=C date`"
96 @echo "--------------------------------------------------------------"
101 # Build the world in the current object format, plus the legacy aout
102 # support if the current object format is elf on i386.
105 @cd ${.CURDIR}; ${MK_ENV} ${MAKE} buildworld
106 .if ${MACHINE_ARCH} == "i386" && ${OBJFORMAT} == "elf" && !defined(NOAOUT)
107 @cd ${.CURDIR}; ${LEGACY_ENV} ${XMAKE} legacy-build
113 # Install the world in the current object format, plus the legacy aout
114 # support if the current object format is elf on i386.
117 @cd ${.CURDIR}; ${MK_ENV} ${MAKE} installworld
118 .if ${MACHINE_ARCH} == "i386" && ${OBJFORMAT} == "elf" && !defined(NOAOUT)
119 @cd ${.CURDIR}; ${LEGACY_ENV} ${XMAKE} -DNOMAN -DNOINFO legacy-install