2 # $Id: Makefile.inc0,v 1.14 1999/01/14 06:45:53 jhay 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 .if ${MACHINE_ARCH} == "i386" && ${OBJFORMAT} == "aout"
22 MK_ENV= MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/${OBJFORMAT}
26 # We should always use the current set of mk files, not the installed ones.
27 # This makefile is a wrapper for the backend makefile (Makefile.inc1).
29 MAKE= make -m ${.CURDIR}/share/mk -f Makefile.inc1
32 # These are the backend targets.
34 BKTGTS= all checkdpadd clean cleandepend cleandir \
35 depend everything hierarchy includes install installmost \
36 lint maninstall mk most obj objlink regress rerelease \
40 # A generic rule for the backend targets.
43 @cd ${.CURDIR}; ${MAKE} ${.TARGET}
45 # These targets are used during a make release, which is done after a
46 # make world, so they should use the same OBJDIRPREFIX that was used
47 # during the make world.
48 RELTGTS= afterdistribute distribute
51 @cd ${.CURDIR}; ${MK_ENV} ${MAKE} ${.TARGET}
54 # Temporary path and environment for the legacy build.
56 ELFTMP= ${MAKEOBJDIRPREFIX}${.CURDIR}/tmp
57 ELFTMPPATH= ${ELFTMP}/sbin:${ELFTMP}/bin:${ELFTMP}/usr/sbin:${ELFTMP}/usr/bin:${ELFTMP}/usr/games
58 LEGACY_ENV= PATH=${ELFTMPPATH} OBJFORMAT=aout NOTOOLS=1 TOOLROOT=${ELFTMP} \
59 MAKEOBJDIRPREFIX=${MAKEOBJDIRPREFIX}/aout
60 XMAKE= ${ELFTMP}/usr/bin/${MAKE}
65 # Attempt to rebuild and reinstall *everything*, with reasonable chance of
66 # success, regardless of how old your existing system is. If building on
67 # an i386/elf system, build the aout legacy cruft too.
70 @echo "--------------------------------------------------------------"
71 @echo ">>> ${OBJFORMAT} make world started on `LC_TIME=C date`"
72 @echo "--------------------------------------------------------------"
75 @echo "--------------------------------------------------------------"
76 @echo ">>> Making 'pre-world' target"
77 @echo "--------------------------------------------------------------"
78 @cd ${.CURDIR}; ${MK_ENV} ${MAKE} pre-world
80 @cd ${.CURDIR}; ${MK_ENV} ${MAKE} buildworld
81 .if ${MACHINE_ARCH} == "i386" && ${OBJFORMAT} == "elf" && defined(WANT_AOUT)
82 @cd ${.CURDIR}; ${LEGACY_ENV} ${XMAKE} legacy-build
84 @cd ${.CURDIR}; ${MK_ENV} ${MAKE} -B installworld
85 .if ${MACHINE_ARCH} == "i386" && ${OBJFORMAT} == "elf" && defined(WANT_AOUT)
86 @cd ${.CURDIR}; ${LEGACY_ENV} ${XMAKE} legacy-install
88 .if target(post-world)
90 @echo "--------------------------------------------------------------"
91 @echo ">>> Making 'post-world' target"
92 @echo "--------------------------------------------------------------"
93 @cd ${.CURDIR}; ${MK_ENV} ${MAKE} post-world
96 @echo "--------------------------------------------------------------"
97 @echo ">>> ${OBJFORMAT} make world completed on `LC_TIME=C date`"
98 @echo "--------------------------------------------------------------"
103 # Build the world in the current object format, plus the legacy aout
104 # support if the current object format is elf on i386.
107 @cd ${.CURDIR}; ${MK_ENV} ${MAKE} buildworld
108 .if ${MACHINE_ARCH} == "i386" && ${OBJFORMAT} == "elf" && defined(WANT_AOUT)
109 @cd ${.CURDIR}; ${LEGACY_ENV} ${XMAKE} legacy-build
115 # Install the world in the current object format, plus the legacy aout
116 # support if the current object format is elf on i386.
119 @cd ${.CURDIR}; ${MK_ENV} ${MAKE} installworld
120 .if ${MACHINE_ARCH} == "i386" && ${OBJFORMAT} == "elf" && defined(WANT_AOUT)
121 @cd ${.CURDIR}; ${LEGACY_ENV} ${XMAKE} -DNOMAN -DNOINFO legacy-install