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}
62 STARTTIME!= LC_TIME=C date
66 # Attempt to rebuild and reinstall *everything*, with reasonable chance of
67 # success, regardless of how old your existing system is. If building on
68 # an i386/elf system, build the aout legacy cruft too.
71 @echo "--------------------------------------------------------------"
72 @echo ">>> ${OBJFORMAT} make world started on ${STARTTIME}"
73 @echo "--------------------------------------------------------------"
76 @echo "--------------------------------------------------------------"
77 @echo ">>> Making 'pre-world' target"
78 @echo "--------------------------------------------------------------"
79 @cd ${.CURDIR}; ${MK_ENV} ${MAKE} pre-world
81 @cd ${.CURDIR}; ${MK_ENV} ${MAKE} buildworld
82 .if ${MACHINE_ARCH} == "i386" && ${OBJFORMAT} == "elf" && defined(WANT_AOUT)
83 @cd ${.CURDIR}; ${LEGACY_ENV} ${XMAKE} legacy-build
85 @cd ${.CURDIR}; ${MK_ENV} ${MAKE} -B installworld
86 .if ${MACHINE_ARCH} == "i386" && ${OBJFORMAT} == "elf" && defined(WANT_AOUT)
87 @cd ${.CURDIR}; ${LEGACY_ENV} ${XMAKE} legacy-install
89 .if target(post-world)
91 @echo "--------------------------------------------------------------"
92 @echo ">>> Making 'post-world' target"
93 @echo "--------------------------------------------------------------"
94 @cd ${.CURDIR}; ${MK_ENV} ${MAKE} post-world
97 @echo "--------------------------------------------------------------"
98 @echo ">>> ${OBJFORMAT} make world started on ${STARTTIME}"
99 @echo ">>> ${OBJFORMAT} make world completed on `LC_TIME=C date`"
100 @echo "--------------------------------------------------------------"
105 # Build 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} buildworld
110 .if ${MACHINE_ARCH} == "i386" && ${OBJFORMAT} == "elf" && defined(WANT_AOUT)
111 @cd ${.CURDIR}; ${LEGACY_ENV} ${XMAKE} legacy-build
117 # Install the world in the current object format, plus the legacy aout
118 # support if the current object format is elf on i386.
121 @cd ${.CURDIR}; ${MK_ENV} ${MAKE} installworld
122 .if ${MACHINE_ARCH} == "i386" && ${OBJFORMAT} == "elf" && defined(WANT_AOUT)
123 @cd ${.CURDIR}; ${LEGACY_ENV} ${XMAKE} -DNOMAN -DNOINFO legacy-install