| Commit | Line | Data |
|---|---|---|
| 984263bc MD |
1 | # |
| 2 | # $FreeBSD: src/Makefile.inc1,v 1.141.2.62 2003/04/06 19:54:00 dwmalone Exp $ | |
| cecff5c1 MD |
3 | # |
| 4 | # Build-time options are documented in make.conf(5). | |
| 984263bc MD |
5 | # |
| 6 | # The intended user-driven targets are: | |
| 1397f94a | 7 | # |
| 984263bc | 8 | # buildworld - rebuild *everything*, including glue to help do upgrades |
| 1397f94a MD |
9 | # quickworld - skip the glue and do a depend+build on the meat |
| 10 | # realquickworld - skip the glue and depend stages and just build the meat | |
| 11 | # crossworld - only build the glue (particularly the cross-build environment) | |
| 984263bc | 12 | # installworld- install everything built by "buildworld" |
| 984263bc MD |
13 | # most - build user commands, no libraries or include files |
| 14 | # installmost - install user commands, no libraries or include files | |
| 15 | # | |
| 16 | # Standard targets (not defined here) are documented in the makefiles in | |
| 17 | # /usr/share/mk. These include: | |
| 18 | # obj depend all install clean cleandepend cleanobj | |
| 19 | ||
| 20 | # Put initial settings here. | |
| 21 | SUBDIR= | |
| 22 | ||
| 23 | # We must do share/info early so that installation of info `dir' | |
| 24 | # entries works correctly. Do it first since it is less likely to | |
| 25 | # grow dependencies on include and lib than vice versa. | |
| 26 | .if exists(${.CURDIR}/share/info) | |
| 27 | SUBDIR+= share/info | |
| 28 | .endif | |
| 29 | ||
| 30 | # We must do include and lib early so that the perl *.ph generation | |
| 31 | # works correctly as it uses the header files installed by this. | |
| 32 | .if exists(${.CURDIR}/include) | |
| 33 | SUBDIR+= include | |
| 34 | .endif | |
| 35 | .if exists(${.CURDIR}/lib) | |
| 36 | SUBDIR+= lib | |
| 37 | .endif | |
| 17d0fefe MD |
38 | # This exists simply to ensure that the obj dir hierarchy is |
| 39 | # intact for nrelease, allowing the nrelease Makefile's to | |
| 40 | # reference ${.OBJDIR}. | |
| 41 | # | |
| 42 | .if exists(${.CURDIR}/nrelease) | |
| 43 | SUBDIR+= nrelease | |
| 44 | .endif | |
| 984263bc MD |
45 | |
| 46 | .if exists(${.CURDIR}/bin) | |
| 47 | SUBDIR+= bin | |
| 48 | .endif | |
| cecff5c1 | 49 | .if exists(${.CURDIR}/games) && !defined(NO_GAMES) |
| 984263bc MD |
50 | SUBDIR+= games |
| 51 | .endif | |
| 52 | .if exists(${.CURDIR}/gnu) | |
| 53 | SUBDIR+= gnu | |
| 54 | .endif | |
| 984263bc MD |
55 | .if exists(${.CURDIR}/libexec) |
| 56 | SUBDIR+= libexec | |
| 57 | .endif | |
| 58 | .if exists(${.CURDIR}/sbin) | |
| 59 | SUBDIR+= sbin | |
| 60 | .endif | |
| cecff5c1 | 61 | .if exists(${.CURDIR}/secure) && !defined(NO_CRYPT) |
| 984263bc MD |
62 | SUBDIR+= secure |
| 63 | .endif | |
| cecff5c1 | 64 | .if exists(${.CURDIR}/share) && !defined(NO_SHARE) |
| 984263bc MD |
65 | SUBDIR+= share |
| 66 | .endif | |
| 67 | .if exists(${.CURDIR}/sys) | |
| 68 | SUBDIR+= sys | |
| 69 | .endif | |
| 70 | .if exists(${.CURDIR}/usr.bin) | |
| 71 | SUBDIR+= usr.bin | |
| 72 | .endif | |
| 73 | .if exists(${.CURDIR}/usr.sbin) | |
| 74 | SUBDIR+= usr.sbin | |
| 75 | .endif | |
| 76 | ||
| 984263bc MD |
77 | .if exists(${.CURDIR}/etc) |
| 78 | SUBDIR+= etc | |
| 79 | .endif | |
| 80 | ||
| 81 | # These are last, since it is nice to at least get the base system | |
| 82 | # rebuilt before you do them. | |
| 83 | .if defined(LOCAL_DIRS) | |
| 84 | .for _DIR in ${LOCAL_DIRS} | |
| 85 | .if exists(${.CURDIR}/${_DIR}) & exists(${.CURDIR}/${_DIR}/Makefile) | |
| 86 | SUBDIR+= ${_DIR} | |
| 87 | .endif | |
| 88 | .endfor | |
| 89 | .endif | |
| 90 | ||
| 91 | .if defined(SUBDIR_OVERRIDE) | |
| 92 | SUBDIR= ${SUBDIR_OVERRIDE} | |
| 93 | .endif | |
| 94 | ||
| 95 | .if defined(NOCLEANDIR) | |
| 96 | CLEANDIR= clean cleandepend | |
| 97 | .else | |
| 98 | CLEANDIR= cleandir | |
| 99 | .endif | |
| 100 | ||
| 9974d917 SS |
101 | .if defined(NO_CLEAN) |
| 102 | NOCLEAN= # defined | |
| 103 | .endif | |
| d0a8f509 | 104 | |
| 1397f94a MD |
105 | # Object directory base in primary make. Note that when we rerun make |
| 106 | # from inside this file we change MAKEOBJDIRPREFIX to the appropriate | |
| 107 | # subdirectory because the rest of the build system needs it that way. | |
| 108 | # The original object directory base is saved in OBJTREE. | |
| 109 | # | |
| 984263bc | 110 | MAKEOBJDIRPREFIX?= /usr/obj |
| 1397f94a MD |
111 | OBJTREE?= ${MAKEOBJDIRPREFIX} |
| 112 | ||
| 113 | # Used for stage installs and pathing | |
| 114 | # | |
| 115 | DESTDIRBASE?= ${OBJTREE}${.CURDIR} | |
| 116 | ||
| c89fd520 SS |
117 | # Remove DESTDIR from MAKEFLAGS. It is present in the environment |
| 118 | # anyhow, and we need to be able to override it for stage installs | |
| 119 | .MAKEFLAGS:= ${.MAKEFLAGS:NDESTDIR=*} | |
| 120 | ||
| 79809ae1 | 121 | # This sets the compiler we use to build the world/kernel with |
| 30c91f0c | 122 | WORLD_CCVER?= gcc44 |
| e685772e | 123 | WORLD_BINUTILSVER?= binutils222 |
| ded5c503 | 124 | |
| b2b3ffcd SS |
125 | # temporary until everybody has converted to x86_64 |
| 126 | .if ${MACHINE_ARCH} == "amd64" | |
| 127 | MACHINE_ARCH= x86_64 | |
| 128 | .makeenv MACHINE_ARCH | |
| 129 | .endif | |
| 130 | ||
| 984263bc MD |
131 | TARGET_ARCH?= ${MACHINE_ARCH} |
| 132 | .if ${TARGET_ARCH} == ${MACHINE_ARCH} | |
| 133 | TARGET?= ${MACHINE} | |
| 134 | .else | |
| 135 | TARGET?= ${TARGET_ARCH} | |
| 136 | .endif | |
| 137 | .if make(buildworld) | |
| 138 | BUILD_ARCH!= sysctl -n hw.machine_arch | |
| b2b3ffcd SS |
139 | |
| 140 | # temporary until everybody has converted to x86_64 | |
| 141 | .if ${BUILD_ARCH} == "amd64" | |
| 142 | BUILD_ARCH= x86_64 | |
| 143 | .endif | |
| 144 | ||
| 984263bc MD |
145 | .if ${MACHINE_ARCH} != ${BUILD_ARCH} |
| 146 | .error To cross-build, set TARGET_ARCH. | |
| 147 | .endif | |
| 148 | .endif | |
| 1397f94a | 149 | |
| 0955fd91 MD |
150 | # Backwards compatibility with older make's or older sys.mk's. make |
| 151 | # is expected to define MACHINE_PLATFORM. | |
| 152 | # | |
| 153 | .if !defined(MACHINE_PLATFORM) | |
| 154 | MACHINE_PLATFORM= pc32 | |
| 155 | .endif | |
| 4d005c1d SS |
156 | |
| 157 | # XXX this is ugly and we need to come up with a nicer solution | |
| 158 | .if !defined(TARGET_PLATFORM) | |
| 159 | .if ${TARGET_ARCH} == "i386" | |
| 160 | TARGET_PLATFORM= pc32 | |
| b2b3ffcd | 161 | .elif ${TARGET_ARCH} == "x86_64" |
| 4d005c1d SS |
162 | TARGET_PLATFORM= pc64 |
| 163 | .else | |
| 164 | .error Unknown target architecture. | |
| 165 | .endif | |
| 166 | .endif | |
| 0955fd91 | 167 | |
| 5f87b7d3 SZ |
168 | THREAD_LIB?= thread_xu |
| 169 | .if ${THREAD_LIB} == "c_r" | |
| 170 | .if defined(NO_LIBC_R) | |
| 171 | .error libc_r is chosen as the default thread library, but NO_LIBC_R is defined | |
| 172 | .endif | |
| 173 | .endif | |
| 174 | ||
| 1397f94a MD |
175 | # BTOOLS (Natively built) All non-cross-development tools that the |
| 176 | # main build needs. This includes things like 'mkdir' and 'rm'. | |
| 177 | # We will not use the native system's exec path once we start | |
| 178 | # on WORLD. (bootstrap-tools and build-tools or BTOOLS) | |
| 179 | # | |
| 180 | # CTOOLS (Natively built) Cross development tools which are specific | |
| 181 | # to the target architecture. | |
| 182 | # | |
| 183 | # WORLD (Cross built) Our ultimate buildworld, using only BTOOLS and | |
| 184 | # CTOOLS. | |
| 185 | # | |
| 0955fd91 MD |
186 | # MACHINE_PLATFORM Platform Architecture we are building on |
| 187 | # MACHINE Machine Architecture (usually the same as MACHINE_ARCH) | |
| e2ea6619 MD |
188 | # MACHINE_ARCH Cpu Architecture we are building on |
| 189 | # | |
| 0955fd91 MD |
190 | # TARGET_PLATFORM Platform Architecture we are building for |
| 191 | # TARGET Machine Architecture we are building for | |
| e2ea6619 | 192 | # TARGET_ARCH Cpu Architecture we are building for |
| 1397f94a MD |
193 | # |
| 194 | BTOOLSDEST= ${DESTDIRBASE}/btools_${MACHINE_ARCH} | |
| 195 | CTOOLSDEST= ${DESTDIRBASE}/ctools_${MACHINE_ARCH}_${TARGET_ARCH} | |
| 196 | WORLDDEST= ${DESTDIRBASE}/world_${TARGET_ARCH} | |
| 197 | ||
| 79aa78bc MD |
198 | # The bootstrap-tools path is used by the bootstrap-tools, build-tools, and |
| 199 | # cross-tools stages to augment the existing command path to access newer | |
| 200 | # versions of certain utilities such as 'patch' that the cross-tools stage | |
| 201 | # might expect. | |
| 202 | # | |
| 203 | BTOOLSPATH= ${BTOOLSDEST}/usr/sbin:${BTOOLSDEST}/usr/bin:${BTOOLSDEST}/bin:${BTOOLSDEST}/usr/games | |
| 204 | ||
| 1397f94a MD |
205 | # The strict temporary command path contains all binaries required |
| 206 | # by the buildworld system after the cross-tools stage. | |
| 207 | # | |
| 21e43067 | 208 | STRICTTMPPATH= ${CTOOLSDEST}/usr/sbin:${CTOOLSDEST}/usr/bin:${CTOOLSDEST}/bin:${CTOOLSDEST}/usr/games:${BTOOLSDEST}/usr/sbin:${BTOOLSDEST}/usr/bin:${BTOOLSDEST}/bin:${BTOOLSDEST}/usr/games:/usr/pkg/bin |
| 984263bc MD |
209 | |
| 210 | TMPDIR?= /tmp | |
| 211 | TMPPID!= echo $$$$ | |
| 984263bc MD |
212 | |
| 213 | # | |
| 214 | # Building a world goes through the following stages | |
| 215 | # | |
| 216 | # 1. bootstrap-tool stage [BMAKE] | |
| 217 | # This stage is responsible for creating programs that | |
| 218 | # are needed for backward compatibility reasons. They | |
| 219 | # are not built as cross-tools. | |
| 220 | # 2. build-tool stage [TMAKE] | |
| 221 | # This stage is responsible for creating the object | |
| 222 | # tree and building any tools that are needed during | |
| 223 | # the build process. | |
| 224 | # 3. cross-tool stage [XMAKE] | |
| 225 | # This stage is responsible for creating any tools that | |
| 226 | # are needed for cross-builds. A cross-compiler is one | |
| 227 | # of them. | |
| 228 | # 4. world stage [WMAKE] | |
| 229 | # This stage actually builds the world. | |
| 230 | # 5. install stage (optional) [IMAKE] | |
| 231 | # This stage installs a previously built world. | |
| 232 | # | |
| 233 | ||
| 984263bc | 234 | # bootstrap-tool stage |
| 1397f94a MD |
235 | # |
| 236 | BMAKEENV= MAKEOBJDIRPREFIX=${BTOOLSDEST} \ | |
| 237 | OBJTREE=${OBJTREE} \ | |
| 44831353 | 238 | DESTDIR=${BTOOLSDEST} \ |
| 79aa78bc | 239 | PATH=${BTOOLSPATH}:${PATH} \ |
| 984263bc | 240 | INSTALL="sh ${.CURDIR}/tools/install.sh" |
| 1397f94a | 241 | |
| 984263bc | 242 | BMAKE= ${BMAKEENV} ${MAKE} -f Makefile.inc1 -DBOOTSTRAPPING \ |
| e486d225 SS |
243 | -DNOINFO -DNOMAN -DNOPIC -DNOPROFILE -DNOSHARED \ |
| 244 | -DNO_WERROR -DNO_NLS | |
| 984263bc MD |
245 | |
| 246 | # build-tool stage | |
| 1397f94a MD |
247 | # |
| 248 | TMAKEENV= MAKEOBJDIRPREFIX=${BTOOLSDEST} \ | |
| 249 | OBJTREE=${OBJTREE} \ | |
| 984263bc | 250 | DESTDIR= \ |
| 79aa78bc | 251 | PATH=${BTOOLSPATH}:${PATH} \ |
| 984263bc | 252 | INSTALL="sh ${.CURDIR}/tools/install.sh" |
| 1397f94a MD |
253 | |
| 254 | TMAKE= ${TMAKEENV} ${MAKE} -f Makefile.inc1 -DBOOTSTRAPPING \ | |
| e486d225 | 255 | -DNO_FORTRAN -DNOSHARED |
| 984263bc MD |
256 | |
| 257 | # cross-tool stage | |
| 1397f94a MD |
258 | # |
| 259 | # note: TOOLS_PREFIX points to the obj root holding the cross | |
| 44831353 MD |
260 | # compiler binaries, while USRDATA_PREFIX points to the obj root |
| 261 | # holding the target environment (and also determines where cross-built | |
| 262 | # libraries, crt*.o, and include files are installed). | |
| 1397f94a MD |
263 | # |
| 264 | XMAKEENV= MAKEOBJDIRPREFIX=${CTOOLSDEST} \ | |
| 265 | OBJTREE=${OBJTREE} \ | |
| 266 | DESTDIR=${CTOOLSDEST} \ | |
| 267 | INSTALL="sh ${.CURDIR}/tools/install.sh" \ | |
| 268 | TOOLS_PREFIX=${CTOOLSDEST} \ | |
| 79aa78bc MD |
269 | USRDATA_PREFIX=${WORLDDEST} \ |
| 270 | PATH=${BTOOLSPATH}:${PATH} | |
| 1397f94a | 271 | |
| 44831353 | 272 | XMAKE= ${XMAKEENV} ${MAKE} -f Makefile.inc1 -DNO_FORTRAN -DNO_GDB \ |
| e486d225 | 273 | -DBOOTSTRAPPING -DNOSHARED |
| 1397f94a MD |
274 | |
| 275 | # world stage, note the strict path and note that TOOLS_PREFIX is left | |
| 276 | # unset and USRDATA_PREFIX (which defaults to TOOLS_PREFIX) is set to empty, | |
| 277 | # which is primarily for the compiler so it targets / (e.g. /usr/<blah>) | |
| 278 | # for both binary and library paths, even though it is being compiled to | |
| 279 | # WORLDDEST. None of the programs in the world stage are ever actually | |
| 280 | # executed during the buildworld/installworld. | |
| 281 | # | |
| 282 | CROSSENV= MAKEOBJDIRPREFIX=${WORLDDEST} \ | |
| 283 | OBJTREE=${OBJTREE} \ | |
| 284 | MACHINE_ARCH=${TARGET_ARCH} \ | |
| 285 | MACHINE=${TARGET} \ | |
| 0955fd91 | 286 | MACHINE_PLATFORM=${TARGET_PLATFORM} \ |
| ded5c503 | 287 | OBJFORMAT_PATH=${CTOOLSDEST} \ |
| ce6fa878 | 288 | HOST_CCVER=${HOST_CCVER} \ |
| 123dec51 SS |
289 | CCVER=${WORLD_CCVER} \ |
| 290 | BINUTILSVER=${WORLD_BINUTILSVER} | |
| 984263bc | 291 | |
| 984263bc | 292 | WMAKEENV= ${CROSSENV} \ |
| 1397f94a | 293 | DESTDIR=${WORLDDEST} \ |
| 984263bc | 294 | INSTALL="sh ${.CURDIR}/tools/install.sh" \ |
| 1397f94a MD |
295 | PATH=${STRICTTMPPATH} |
| 296 | ||
| 984263bc MD |
297 | WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1 |
| 298 | ||
| 299 | # install stage | |
| b07b69cc | 300 | # |
| 984263bc | 301 | IMAKEENV= ${CROSSENV} \ |
| 1397f94a | 302 | PATH=${STRICTTMPPATH} |
| 984263bc MD |
303 | IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1 |
| 304 | ||
| 305 | # kernel stage | |
| b07b69cc MD |
306 | # |
| 307 | KMAKEENV= ${WMAKEENV} | |
| 984263bc | 308 | |
| 984263bc MD |
309 | # buildworld |
| 310 | # | |
| 311 | # Attempt to rebuild the entire system, with reasonable chance of | |
| 312 | # success, regardless of how old your existing system is. | |
| 313 | # | |
| 2cde9453 SS |
314 | _worldtmp: _cleantmp _mtreetmp |
| 315 | .ORDER: _cleantmp _mtreetmp | |
| 316 | ||
| 317 | _cleantmp: | |
| 984263bc MD |
318 | @echo |
| 319 | @echo "--------------------------------------------------------------" | |
| 320 | @echo ">>> Rebuilding the temporary build tree" | |
| 321 | @echo "--------------------------------------------------------------" | |
| 322 | .if !defined(NOCLEAN) | |
| 1397f94a | 323 | rm -rf ${BTOOLSDEST} ${CTOOLSDEST} ${WORLDDEST} |
| 984263bc MD |
324 | .else |
| 325 | # XXX - These two can depend on any header file. | |
| 326 | rm -f ${OBJTREE}${.CURDIR}/usr.bin/kdump/ioctl.c | |
| 327 | rm -f ${OBJTREE}${.CURDIR}/usr.bin/truss/ioctl.c | |
| 328 | .endif | |
| 2cde9453 SS |
329 | |
| 330 | _mtreetmp: | |
| 1397f94a MD |
331 | mkdir -p ${DESTDIRBASE} ${BTOOLSDEST} ${CTOOLSDEST} ${WORLDDEST} |
| 332 | .for _dir in ${WORLDDEST} ${BTOOLSDEST} ${CTOOLSDEST} | |
| 333 | mtree -deU -f ${.CURDIR}/etc/mtree/BSD.root.dist \ | |
| 334 | -p ${_dir}/ > /dev/null | |
| 335 | mtree -deU -f ${.CURDIR}/etc/mtree/BSD.usr.dist \ | |
| 336 | -p ${_dir}/usr > /dev/null | |
| 984263bc | 337 | .endfor |
| 1397f94a MD |
338 | mtree -deU -f ${.CURDIR}/etc/mtree/BSD.include.dist \ |
| 339 | -p ${WORLDDEST}/usr/include > /dev/null | |
| 062db326 | 340 | ${LN} -sf ${.CURDIR}/sys ${WORLDDEST} |
| 1397f94a | 341 | |
| 984263bc MD |
342 | _bootstrap-tools: |
| 343 | @echo | |
| 344 | @echo "--------------------------------------------------------------" | |
| 345 | @echo ">>> stage 1: bootstrap tools" | |
| 346 | @echo "--------------------------------------------------------------" | |
| 347 | cd ${.CURDIR}; ${BMAKE} bootstrap-tools | |
| 348 | _cleanobj: | |
| 984263bc MD |
349 | @echo |
| 350 | @echo "--------------------------------------------------------------" | |
| 1397f94a | 351 | @echo ">>> stage 2a: cleaning up the object tree" |
| 984263bc MD |
352 | @echo "--------------------------------------------------------------" |
| 353 | cd ${.CURDIR}; ${WMAKE} ${CLEANDIR:S/^/par-/} | |
| 984263bc MD |
354 | _obj: |
| 355 | @echo | |
| 356 | @echo "--------------------------------------------------------------" | |
| 1397f94a | 357 | @echo ">>> stage 2b: rebuilding the object tree" |
| 984263bc MD |
358 | @echo "--------------------------------------------------------------" |
| 359 | cd ${.CURDIR}; ${WMAKE} par-obj | |
| 360 | _build-tools: | |
| 361 | @echo | |
| 362 | @echo "--------------------------------------------------------------" | |
| 1397f94a | 363 | @echo ">>> stage 2c: build tools" |
| 984263bc MD |
364 | @echo "--------------------------------------------------------------" |
| 365 | cd ${.CURDIR}; ${TMAKE} build-tools | |
| 366 | _cross-tools: | |
| 367 | @echo | |
| 368 | @echo "--------------------------------------------------------------" | |
| 369 | @echo ">>> stage 3: cross tools" | |
| 370 | @echo "--------------------------------------------------------------" | |
| 371 | cd ${.CURDIR}; ${XMAKE} cross-tools | |
| 372 | _includes: | |
| 373 | @echo | |
| 374 | @echo "--------------------------------------------------------------" | |
| 1397f94a | 375 | @echo ">>> stage 4a: populating ${WORLDDEST}/usr/include" |
| 984263bc MD |
376 | @echo "--------------------------------------------------------------" |
| 377 | cd ${.CURDIR}; ${WMAKE} SHARED=symlinks par-includes | |
| 378 | _libraries: | |
| 379 | @echo | |
| 380 | @echo "--------------------------------------------------------------" | |
| 1397f94a | 381 | @echo ">>> stage 4b: building libraries" |
| 984263bc MD |
382 | @echo "--------------------------------------------------------------" |
| 383 | cd ${.CURDIR}; ${WMAKE} -DNOHTML -DNOINFO -DNOMAN -DNOFSCHG libraries | |
| 384 | _depend: | |
| 385 | @echo | |
| 386 | @echo "--------------------------------------------------------------" | |
| 1397f94a | 387 | @echo ">>> stage 4c: make dependencies" |
| 984263bc MD |
388 | @echo "--------------------------------------------------------------" |
| 389 | cd ${.CURDIR}; ${WMAKE} par-depend | |
| 390 | everything: | |
| 391 | @echo | |
| 392 | @echo "--------------------------------------------------------------" | |
| 1397f94a | 393 | @echo ">>> stage 4d: building everything.." |
| 984263bc MD |
394 | @echo "--------------------------------------------------------------" |
| 395 | cd ${.CURDIR}; ${WMAKE} all | |
| 396 | ||
| 1397f94a MD |
397 | # note: buildworld no longer depends on _cleanobj because we rm -rf the |
| 398 | # entire object tree and built the bootstrap tools in a different location. | |
| 399 | # | |
| 400 | # buildworld - build everything from scratch | |
| 401 | # quickworld - skip the bootstrap, build, and cross-build steps | |
| 402 | # realquickworld - skip the bootstrap, build, crossbuild, and depend step. | |
| 403 | # | |
| 404 | # note: we include _obj in realquickworld to prevent accidental creation | |
| 405 | # of files in /usr/src. | |
| 984263bc | 406 | |
| c08b39fe | 407 | WMAKE_TGTS= |
| 984263bc MD |
408 | .if !defined(SUBDIR_OVERRIDE) |
| 409 | WMAKE_TGTS+= _worldtmp _bootstrap-tools | |
| 410 | .endif | |
| 1397f94a | 411 | WMAKE_TGTS+= _obj _build-tools |
| 984263bc MD |
412 | .if !defined(SUBDIR_OVERRIDE) |
| 413 | WMAKE_TGTS+= _cross-tools | |
| 414 | .endif | |
| 415 | WMAKE_TGTS+= _includes _libraries _depend everything | |
| 416 | ||
| 417 | buildworld: ${WMAKE_TGTS} | |
| 1397f94a | 418 | |
| 2cde9453 | 419 | quickworld: _mtreetmp _obj _includes _libraries _depend everything |
| 1397f94a | 420 | |
| 2cde9453 | 421 | realquickworld: _mtreetmp _obj _includes _libraries everything |
| 1397f94a MD |
422 | |
| 423 | crossworld: _worldtmp _bootstrap-tools _obj _build-tools _cross-tools | |
| 424 | ||
| 984263bc | 425 | .ORDER: ${WMAKE_TGTS} |
| 9ce30817 | 426 | .ORDER: _obj _includes |
| 2cde9453 | 427 | .ORDER: _mtreetmp _obj |
| 984263bc MD |
428 | |
| 429 | # | |
| 430 | # installcheck | |
| 431 | # | |
| c08b39fe | 432 | # Checks to be sure system is ready for installworld |
| 984263bc MD |
433 | # |
| 434 | installcheck: | |
| 435 | .if !defined(NO_SENDMAIL) | |
| f35282e3 MD |
436 | @pw usershow smmsp || (echo "You may need to run 'make preupgrade' first"; exit 1) |
| 437 | @pw groupshow smmsp || (echo "You may need to run 'make preupgrade' first"; exit 1) | |
| 984263bc | 438 | .endif |
| f35282e3 | 439 | @pw usershow _pflogd || (echo "You may need to run 'make preupgrade' first"; exit 1) |
| f35282e3 MD |
440 | @pw groupshow authpf || (echo "You may need to run 'make preupgrade' first"; exit 1) |
| 441 | @pw groupshow _pflogd || (echo "You may need to run 'make preupgrade' first"; exit 1) | |
| 9b815a46 | 442 | .if !defined(DESTDIR) || ${DESTDIR} == "" || ${DESTDIR} == "/" |
| f7ed9937 | 443 | @case `uname -r` in 1.2*|1.3-*|1.3.*|1.4.*|1.5.0-*|1.5.1-*|1.5.2-*|1.5.3-*) echo "You must upgrade your kernel to at least 1.5.4 and reboot before you can safely installworld, due to libc/system call ABI changes" ; exit 1;; esac |
| 9b815a46 | 444 | .endif |
| 984263bc MD |
445 | # |
| 446 | # installworld | |
| 447 | # | |
| 448 | # Installs everything compiled by a 'buildworld'. | |
| 449 | # | |
| 5cccfb7b | 450 | installworld: installcheck |
| 984263bc | 451 | cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//} |
| ec6483ce | 452 | ${INSTALL} -o root -g wheel -m 644 ${.CURDIR}/Makefile_upgrade.inc ${DESTDIR}/etc/upgrade/ |
| 984263bc MD |
453 | |
| 454 | # | |
| 455 | # reinstall | |
| 456 | # | |
| 457 | # If you have a build server, you can NFS mount the source and obj directories | |
| 458 | # and do a 'make reinstall' on the *client* to install new binaries from the | |
| 459 | # most recent server build. | |
| 460 | # | |
| 461 | reinstall: | |
| 462 | @echo "--------------------------------------------------------------" | |
| 463 | @echo ">>> Making hierarchy" | |
| 464 | @echo "--------------------------------------------------------------" | |
| 465 | cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 hierarchy | |
| 466 | @echo | |
| 467 | @echo "--------------------------------------------------------------" | |
| 468 | @echo ">>> Installing everything.." | |
| 469 | @echo "--------------------------------------------------------------" | |
| 470 | cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 install | |
| 984263bc | 471 | |
| 984263bc | 472 | # |
| fc7aca3e | 473 | # buildkernel, nativekernel, quickkernel, and installkernel |
| 984263bc MD |
474 | # |
| 475 | # Which kernels to build and/or install is specified by setting | |
| 476 | # KERNCONF. If not defined a GENERIC kernel is built/installed. | |
| 477 | # Only the existing (depending TARGET) config files are used | |
| 478 | # for building kernels and only the first of these is designated | |
| 479 | # as the one being installed. | |
| 480 | # | |
| c2c83759 MD |
481 | # You can specify INSTALLSTRIPPED=1 if you wish the installed |
| 482 | # kernel and modules to be stripped of its debug info (required | |
| 483 | # symbols are left intact). You can specify INSTALLSTRIPPEDMODULES | |
| 484 | # if you only want to strip the modules of their debug info. These | |
| 485 | # only apply if you have DEBUG=-g in your kernel config or make line. | |
| 486 | # | |
| 984263bc MD |
487 | # Note that we have to use TARGET instead of TARGET_ARCH when |
| 488 | # we're in kernel-land. Since only TARGET_ARCH is (expected) to | |
| 489 | # be set to cross-build, we have to make sure TARGET is set | |
| 490 | # properly. | |
| 491 | ||
| 492 | .if !defined(KERNCONF) && defined(KERNEL) | |
| 493 | KERNCONF= ${KERNEL} | |
| 494 | KERNWARN= yes | |
| 495 | .else | |
| 702a95cc SS |
496 | # XXX makeshift fix to build the right kernel for the (target) architecture |
| 497 | # We should configure this in the platform files somehow | |
| 498 | .if ${TARGET_ARCH} == "i386" | |
| 984263bc | 499 | KERNCONF?= GENERIC |
| 702a95cc | 500 | .else |
| b2b3ffcd | 501 | KERNCONF?= X86_64_GENERIC |
| 702a95cc | 502 | .endif |
| 984263bc MD |
503 | .endif |
| 504 | INSTKERNNAME?= kernel | |
| 505 | ||
| 506 | KRNLSRCDIR= ${.CURDIR}/sys | |
| 4e54470f | 507 | KRNLCONFDIR= ${KRNLSRCDIR}/config |
| 984263bc MD |
508 | KRNLOBJDIR= ${OBJTREE}${KRNLSRCDIR} |
| 509 | KERNCONFDIR?= ${KRNLCONFDIR} | |
| 510 | ||
| 511 | BUILDKERNELS= | |
| 512 | INSTALLKERNEL= | |
| 513 | .for _kernel in ${KERNCONF} | |
| 514 | .if exists(${KERNCONFDIR}/${_kernel}) | |
| 515 | BUILDKERNELS+= ${_kernel} | |
| 516 | .if empty(INSTALLKERNEL) | |
| 517 | INSTALLKERNEL= ${_kernel} | |
| 518 | .endif | |
| 519 | .endif | |
| 520 | .endfor | |
| 521 | ||
| 9a359590 MD |
522 | # kernel version numbers survive rm -rf |
| 523 | # | |
| 524 | .for _kernel in ${BUILDKERNELS} | |
| 525 | .if exists(${KRNLOBJDIR}/${_kernel}/version) | |
| 526 | KERNEL_VERSION_${_kernel} != cat ${KRNLOBJDIR}/${_kernel}/version | |
| 527 | .endif | |
| 528 | .endfor | |
| 529 | ||
| 984263bc MD |
530 | # |
| 531 | # buildkernel | |
| 532 | # | |
| 533 | # Builds all kernels defined by BUILDKERNELS. | |
| 534 | # | |
| fc7aca3e | 535 | bk_tools: |
| e05c8c84 MD |
536 | @if [ ! -f ${WORLDDEST}/.libraries_done ]; then \ |
| 537 | echo "You must buildworld before buildkernel. If you wish"; \ | |
| 538 | echo "to build a kernel using native tools, config it manually"; \ | |
| 539 | echo "or use the nativekernel target if you are in a rush"; \ | |
| 540 | exit 1; \ | |
| c2c83759 MD |
541 | fi |
| 542 | ||
| 543 | maybe_bk_tools: | |
| 544 | .for _kernel in ${BUILDKERNELS} | |
| 545 | @if [ ! -f ${KRNLOBJDIR}/${_kernel}/.nativekernel_run ]; then \ | |
| 546 | if [ ! -f ${WORLDDEST}/.libraries_done ]; then \ | |
| 547 | echo "The kernel was build using buildworld tools which no" ; \ | |
| 548 | echo "longer appear to exist, quickkernel failed!" ; \ | |
| 549 | exit 1; \ | |
| 550 | fi; \ | |
| 551 | fi | |
| 552 | .endfor | |
| e05c8c84 | 553 | |
| fc7aca3e | 554 | bk_build_list: |
| 984263bc MD |
555 | .if empty(BUILDKERNELS) |
| 556 | @echo ">>> ERROR: Missing kernel configuration file(s) (${KERNCONF})." | |
| 603cdb58 | 557 | @echo ">>> Did you move your kernel configs from i386/conf to config/?" |
| 984263bc MD |
558 | @false |
| 559 | .endif | |
| fc7aca3e MD |
560 | |
| 561 | bk_kernwarn: | |
| 984263bc MD |
562 | .if defined(KERNWARN) |
| 563 | @echo "--------------------------------------------------------------" | |
| 564 | @echo ">>> WARNING: KERNEL= setting should be changed to KERNCONF=" | |
| 565 | @echo "--------------------------------------------------------------" | |
| 566 | @sleep 3 | |
| 567 | .endif | |
| 568 | @echo | |
| fc7aca3e MD |
569 | |
| 570 | # The buildkernel target rebuilds the specified kernels from scratch | |
| 571 | # using the crossbuild tools generated by the last buildworld. It is | |
| 572 | # the safest (but also the most time consuming) way to build a new kernel. | |
| 573 | # | |
| 574 | buildkernel: bk_tools bk_build_list bk_kernwarn | |
| 984263bc MD |
575 | .for _kernel in ${BUILDKERNELS} |
| 576 | @echo "--------------------------------------------------------------" | |
| 577 | @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`" | |
| 578 | @echo "--------------------------------------------------------------" | |
| 579 | @echo "===> ${_kernel}" | |
| fc7aca3e MD |
580 | .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN) |
| 581 | rm -rf ${KRNLOBJDIR}/${_kernel} | |
| 582 | .else | |
| e05c8c84 | 583 | @if [ -f ${KRNLOBJDIR}/${_kernel}/.nativekernel_run ]; then \ |
| fc7aca3e | 584 | echo "YOU ARE REBUILDING WITH BUILDKERNEL, REMOVING OLD NATIVEKERNEL BUILD"; \ |
| e05c8c84 | 585 | rm -rf ${KRNLOBJDIR}/${_kernel}; fi |
| fc7aca3e | 586 | .endif |
| 984263bc MD |
587 | mkdir -p ${KRNLOBJDIR} |
| 588 | .if !defined(NO_KERNELCONFIG) | |
| 589 | cd ${KRNLCONFDIR}; \ | |
| 1397f94a | 590 | PATH=${STRICTTMPPATH} \ |
| 984263bc MD |
591 | config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \ |
| 592 | ${KERNCONFDIR}/${_kernel} | |
| 593 | .endif | |
| 9a359590 MD |
594 | .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN) && defined(KERNEL_VERSION_${_kernel}) |
| 595 | echo ${KERNEL_VERSION_${_kernel}} > ${KRNLOBJDIR}/${_kernel}/version | |
| 596 | .endif | |
| e05c8c84 | 597 | touch ${KRNLOBJDIR}/${_kernel}/.buildkernel_run |
| 984263bc MD |
598 | .if !defined(NO_KERNELDEPEND) |
| 599 | cd ${KRNLOBJDIR}/${_kernel}; \ | |
| 600 | ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} depend | |
| 601 | .endif | |
| 602 | cd ${KRNLOBJDIR}/${_kernel}; \ | |
| 603 | ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} all | |
| 604 | @echo "--------------------------------------------------------------" | |
| 605 | @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`" | |
| 606 | @echo "--------------------------------------------------------------" | |
| 607 | .endfor | |
| 608 | ||
| fc7aca3e | 609 | # The nativekernel target rebuilds the specified kernels from scratch |
| 114580ac | 610 | # using the system's standard compiler rather than using the crossbuild |
| fc7aca3e MD |
611 | # tools generated by the last buildworld. This is fairly safe if your |
| 612 | # system is reasonable up-to-date. | |
| e05c8c84 | 613 | # |
| fc7aca3e | 614 | nativekernel: bk_build_list bk_kernwarn |
| e05c8c84 MD |
615 | .for _kernel in ${BUILDKERNELS} |
| 616 | @echo "--------------------------------------------------------------" | |
| 617 | @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`" | |
| 618 | @echo "--------------------------------------------------------------" | |
| 619 | @echo "===> ${_kernel}" | |
| fc7aca3e MD |
620 | .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN) |
| 621 | rm -rf ${KRNLOBJDIR}/${_kernel} | |
| 622 | .else | |
| e05c8c84 | 623 | @if [ -f ${KRNLOBJDIR}/${_kernel}/.buildkernel_run ]; then \ |
| fc7aca3e | 624 | echo "YOU ARE REBUILDING WITH NATIVEKERNEL, REMOVING OLD BUILDKERNEL BUILD"; \ |
| e05c8c84 | 625 | rm -rf ${KRNLOBJDIR}/${_kernel}; fi |
| fc7aca3e | 626 | .endif |
| e05c8c84 MD |
627 | mkdir -p ${KRNLOBJDIR} |
| 628 | .if !defined(NO_KERNELCONFIG) | |
| 629 | cd ${KRNLCONFDIR}; \ | |
| 630 | config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \ | |
| 631 | ${KERNCONFDIR}/${_kernel} | |
| 632 | .endif | |
| 9a359590 MD |
633 | .if !defined(NOCLEAN) && !defined(NO_KERNELCLEAN) && defined(KERNEL_VERSION_${_kernel}) |
| 634 | echo ${KERNEL_VERSION_${_kernel}} > ${KRNLOBJDIR}/${_kernel}/version | |
| 635 | .endif | |
| e05c8c84 | 636 | touch ${KRNLOBJDIR}/${_kernel}/.nativekernel_run |
| e05c8c84 MD |
637 | cd ${KRNLOBJDIR}/${_kernel}; \ |
| 638 | MAKESRCPATH=${KRNLSRCDIR}/dev/disk/aic7xxx/aicasm \ | |
| 639 | ${MAKE} -DBOOTSTRAPPING -f ${KRNLSRCDIR}/dev/disk/aic7xxx/aicasm/Makefile | |
| 640 | .if !defined(NO_KERNELDEPEND) | |
| 641 | cd ${KRNLOBJDIR}/${_kernel}; \ | |
| 642 | ${MAKE} KERNEL=${INSTKERNNAME} depend | |
| 643 | .endif | |
| 644 | cd ${KRNLOBJDIR}/${_kernel}; \ | |
| 645 | ${MAKE} KERNEL=${INSTKERNNAME} all | |
| 646 | @echo "--------------------------------------------------------------" | |
| 647 | @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`" | |
| 648 | @echo "--------------------------------------------------------------" | |
| 649 | .endfor | |
| 650 | ||
| fc7aca3e MD |
651 | # The quickkernel target rebuilds the specified kernels as quickly |
| 652 | # as possible. It will use the native tools or the buildworld cross tools | |
| 653 | # based on whether the kernel was originally generated via buildkernel or | |
| 654 | # nativekernel. Config is rerun but the object hierarchy is not rebuilt, | |
| 655 | # nor is the make depend step run. | |
| 984263bc | 656 | # |
| c2c83759 | 657 | quickkernel: maybe_bk_tools bk_build_list bk_kernwarn |
| fc7aca3e MD |
658 | .for _kernel in ${BUILDKERNELS} |
| 659 | @echo "--------------------------------------------------------------" | |
| 660 | @echo ">>> Kernel build for ${_kernel} started on `LC_ALL=C date`" | |
| 661 | @echo "--------------------------------------------------------------" | |
| 662 | @echo "===> ${_kernel}" | |
| 663 | .if exists(${KRNLOBJDIR}/${_kernel}/.buildkernel_run) | |
| 664 | .if !defined(NO_KERNELCONFIG) | |
| 665 | cd ${KRNLCONFDIR}; \ | |
| 666 | PATH=${STRICTTMPPATH} \ | |
| 667 | config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \ | |
| 668 | ${KERNCONFDIR}/${_kernel} | |
| 669 | .endif | |
| 670 | cd ${KRNLOBJDIR}/${_kernel}; \ | |
| 671 | ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} all | |
| 672 | .else | |
| 673 | .if !defined(NO_KERNELCONFIG) | |
| 674 | cd ${KRNLCONFDIR}; \ | |
| 675 | config ${CONFIGARGS} -d ${KRNLOBJDIR}/${_kernel} \ | |
| 676 | ${KERNCONFDIR}/${_kernel} | |
| 677 | .endif | |
| 678 | cd ${KRNLOBJDIR}/${_kernel}; \ | |
| 679 | ${MAKE} KERNEL=${INSTKERNNAME} all | |
| 680 | .endif | |
| 681 | @echo "--------------------------------------------------------------" | |
| 682 | @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`" | |
| 683 | @echo "--------------------------------------------------------------" | |
| 684 | .endfor | |
| 685 | ||
| 686 | ||
| 984263bc MD |
687 | # installkernel |
| 688 | # | |
| 689 | # Install the kernel defined by INSTALLKERNEL | |
| 690 | # | |
| 691 | installkernel reinstallkernel: | |
| 982b0507 MD |
692 | @echo "--------------------------------------------------------------" |
| 693 | @echo ">>> Kernel install for ${INSTALLKERNEL} started on `LC_ALL=C date`" | |
| 694 | @echo "--------------------------------------------------------------" | |
| 695 | .if exists(${KRNLOBJDIR}/${INSTALLKERNEL}/.buildkernel_run) | |
| 984263bc | 696 | cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \ |
| 982b0507 | 697 | ${IMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel$//} |
| c2c83759 MD |
698 | .else |
| 699 | cd ${KRNLOBJDIR}/${INSTALLKERNEL}; \ | |
| 700 | ${MAKE} KERNEL=${INSTKERNNAME} ${.TARGET:S/kernel$//} | |
| 701 | .endif | |
| 984263bc MD |
702 | |
| 703 | # | |
| 984263bc MD |
704 | # most |
| 705 | # | |
| 706 | # Build most of the user binaries on the existing system libs and includes. | |
| 707 | # | |
| 708 | most: | |
| 709 | @echo "--------------------------------------------------------------" | |
| 710 | @echo ">>> Building programs only" | |
| 711 | @echo "--------------------------------------------------------------" | |
| 712 | .for _dir in bin sbin libexec usr.bin usr.sbin gnu/libexec gnu/usr.bin gnu/usr.sbin | |
| 713 | cd ${.CURDIR}/${_dir}; ${MAKE} DIRPRFX=${_dir}/ all | |
| 714 | .endfor | |
| 715 | ||
| 716 | # | |
| 717 | # installmost | |
| 718 | # | |
| 719 | # Install the binaries built by the 'most' target. This does not include | |
| 720 | # libraries or include files. | |
| 721 | # | |
| 722 | installmost: | |
| 723 | @echo "--------------------------------------------------------------" | |
| 724 | @echo ">>> Installing programs only" | |
| 725 | @echo "--------------------------------------------------------------" | |
| 726 | .for _dir in bin sbin libexec usr.bin usr.sbin gnu/libexec gnu/usr.bin gnu/usr.sbin | |
| 727 | cd ${.CURDIR}/${_dir}; ${MAKE} DIRPRFX=${_dir}/ install | |
| 728 | .endfor | |
| 729 | ||
| 730 | # | |
| 731 | # ------------------------------------------------------------------------ | |
| 732 | # | |
| 733 | # From here onwards are utility targets used by the 'make world' and | |
| 734 | # related targets. If your 'world' breaks, you may like to try to fix | |
| 735 | # the problem and manually run the following targets to attempt to | |
| 736 | # complete the build. Beware, this is *not* guaranteed to work, you | |
| 737 | # need to have a pretty good grip on the current state of the system | |
| 738 | # to attempt to manually finish it. If in doubt, 'make world' again. | |
| 739 | # | |
| 740 | ||
| 79aa78bc MD |
741 | # bootstrap-tools: Build all tools required to build all tools. Note that |
| 742 | # order is important in a number of cases and also note that the bootstrap | |
| 743 | # and build tools stages have access to earlier binaries they themselves | |
| 744 | # had generated. | |
| 984263bc | 745 | # |
| 79aa78bc MD |
746 | # patch: older patch's do not have -i. This program must be built |
| 747 | # first so other bootstrap tools that need to apply patches | |
| 748 | # can use it. | |
| 17030342 MD |
749 | # [x]install: dependancies on various new install features |
| 750 | # rpcgen: old rpcgen used a hardwired cpp path, newer OBJFORMAT_PATH | |
| 751 | # envs are not compatible with older objformat binaries. | |
| 752 | # | |
| cecff5c1 | 753 | .if exists(${.CURDIR}/games) && !defined(NO_GAMES) |
| 984263bc MD |
754 | _strfile= games/fortune/strfile |
| 755 | .endif | |
| 756 | ||
| d2e9c9d8 MD |
757 | BSTRAPDIRS= ${_strfile} \ |
| 758 | usr.bin/patch \ | |
| 759 | bin/chmod bin/cp bin/cpdup bin/dd bin/mkdir bin/rm bin/echo \ | |
| 760 | bin/test bin/cat bin/ln bin/mv bin/csh bin/expr bin/sh \ | |
| 761 | bin/hostname bin/kill \ | |
| 762 | usr.bin/yacc usr.bin/colldef usr.bin/uudecode usr.bin/xinstall \ | |
| 763 | usr.bin/m4 usr.bin/rpcgen usr.bin/make usr.bin/awk usr.bin/stat \ | |
| 764 | usr.bin/find usr.bin/lex usr.bin/sed usr.bin/uname usr.bin/touch \ | |
| 765 | usr.bin/mkdep usr.bin/mktemp usr.bin/lorder usr.bin/file2c \ | |
| 766 | usr.bin/tsort usr.bin/tr usr.bin/join usr.bin/wc usr.bin/basename \ | |
| 767 | usr.bin/gencat usr.bin/chflags usr.bin/expand usr.bin/paste \ | |
| 768 | usr.bin/mklocale usr.bin/uuencode usr.bin/compile_et usr.bin/hexdump \ | |
| 769 | usr.bin/cap_mkdb usr.bin/true usr.bin/false \ | |
| 770 | usr.bin/cmp usr.bin/xargs usr.bin/id usr.bin/env usr.bin/dirname \ | |
| 771 | usr.bin/tail usr.bin/unifdef \ | |
| 772 | usr.sbin/chown usr.sbin/mtree usr.sbin/config \ | |
| 773 | usr.sbin/btxld usr.sbin/zic usr.sbin/makewhatis \ | |
| 774 | gnu/usr.bin/texinfo gnu/usr.bin/grep usr.bin/sort \ | |
| 775 | usr.bin/gzip usr.bin/bzip2 usr.bin/mkcsmapper usr.bin/mkesdb | |
| 776 | ||
| 777 | bootstrap-tools: bootstrap-tools-before bootstrap-tools-targets | |
| 778 | touch ${BTOOLSDEST}/.bootstrap_done | |
| 779 | ||
| 780 | bootstrap-tools-before: | |
| 062db326 | 781 | ${LN} -fs /bin/date ${BTOOLSDEST}/bin/date |
| d2e9c9d8 MD |
782 | |
| 783 | bootstrap-tools-targets: ${BSTRAPDIRS:S/^/bstrap-/} | |
| 784 | ||
| 785 | .ORDER: bootstrap-tools-before bootstrap-tools-targets | |
| 786 | ||
| 787 | .for _tool in ${BSTRAPDIRS} | |
| 788 | bstrap-${_tool}! | |
| 1397f94a | 789 | ${ECHODIR} "===> ${_tool} (bootstrap-tools)"; \ |
| 984263bc MD |
790 | cd ${.CURDIR}/${_tool}; \ |
| 791 | ${MAKE} DIRPRFX=${_tool}/ obj; \ | |
| 792 | ${MAKE} DIRPRFX=${_tool}/ depend; \ | |
| 793 | ${MAKE} DIRPRFX=${_tool}/ all; \ | |
| 1397f94a | 794 | ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${BTOOLSDEST} install |
| 984263bc MD |
795 | .endfor |
| 796 | ||
| bceb727e | 797 | # build-tools: Build special purpose build tools. |
| 984263bc | 798 | # |
| 1397f94a MD |
799 | # XXX we may be able to remove or consolidate this into bootstrap-tools |
| 800 | # now that we have the native helper (.nx/.no) infrastructure. | |
| 801 | # | |
| cecff5c1 | 802 | .if exists(${.CURDIR}/share) && !defined(NO_SHARE) |
| 984263bc MD |
803 | _share= share/syscons/scrnmaps |
| 804 | .endif | |
| 805 | ||
| 30c91f0c | 806 | .if !defined(NO_GCC41) |
| ddf7cc86 SS |
807 | _gcc41_cross= gnu/usr.bin/cc41 |
| 808 | _gcc41_tools= gnu/usr.bin/cc41/cc_prep gnu/usr.bin/cc41/cc_tools | |
| 30c91f0c | 809 | .endif |
| 4f5ea479 SS |
810 | _gcc44_cross= gnu/usr.bin/cc44 |
| 811 | _gcc44_tools= gnu/usr.bin/cc44/cc_prep gnu/usr.bin/cc44/cc_tools | |
| c97b9141 | 812 | _custom_cross= libexec/customcc |
| 123dec51 | 813 | _binutils= gnu/usr.bin/${WORLD_BINUTILSVER} |
| 17030342 | 814 | |
| d2e9c9d8 MD |
815 | BTOOLSDIRS= ${_gcc41_tools} ${_gcc44_tools} ${_libkrb5} ${_share} |
| 816 | ||
| 817 | build-tools: build-tools-targets | |
| 818 | touch ${BTOOLSDEST}/.build_done | |
| 819 | ||
| 820 | build-tools-targets: ${BTOOLSDIRS:S/^/btools-/} | |
| 821 | ||
| 822 | .for _tool in ${BTOOLSDIRS} | |
| 823 | btools-${_tool}! | |
| 1397f94a | 824 | ${ECHODIR} "===> ${_tool} (build-tools)"; \ |
| 984263bc MD |
825 | cd ${.CURDIR}/${_tool}; \ |
| 826 | ${MAKE} DIRPRFX=${_tool}/ obj; \ | |
| 1397f94a MD |
827 | ${MAKE} DIRPRFX=${_tool}/ depend; \ |
| 828 | ${MAKE} DIRPRFX=${_tool}/ all; \ | |
| 829 | ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${BTOOLSDEST} install | |
| 984263bc MD |
830 | .endfor |
| 831 | ||
| 832 | # | |
| 833 | # cross-tools: Build cross-building tools | |
| 834 | # | |
| 984263bc MD |
835 | .if ${TARGET_ARCH} == "i386" && ${MACHINE_ARCH} != "i386" |
| 836 | _btxld= usr.sbin/btxld | |
| 837 | .endif | |
| 838 | ||
| d2e9c9d8 MD |
839 | CTOOLSDIRS= ${_btxld} ${_binutils} usr.bin/objformat \ |
| 840 | ${_gcc41_cross} ${_gcc44_cross} ${_custom_cross} | |
| 841 | ||
| 842 | cross-tools: cross-tools-targets | |
| 843 | touch ${CTOOLSDEST}/.cross_done | |
| 844 | ||
| 845 | cross-tools-targets: ${CTOOLSDIRS:S/^/ctools-/} | |
| 846 | ||
| 847 | .for _tool in ${CTOOLSDIRS} | |
| 848 | ctools-${_tool}! | |
| 1397f94a | 849 | ${ECHODIR} "===> ${_tool} (cross-tools)"; \ |
| 984263bc MD |
850 | cd ${.CURDIR}/${_tool}; \ |
| 851 | ${MAKE} DIRPRFX=${_tool}/ obj; \ | |
| 852 | ${MAKE} DIRPRFX=${_tool}/ depend; \ | |
| 853 | ${MAKE} DIRPRFX=${_tool}/ all; \ | |
| 1397f94a | 854 | ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${CTOOLSDEST} install |
| 984263bc MD |
855 | .endfor |
| 856 | ||
| 857 | # | |
| 858 | # hierarchy - ensure that all the needed directories are present | |
| 859 | # | |
| 860 | hierarchy: | |
| 861 | cd ${.CURDIR}/etc; ${MAKE} distrib-dirs | |
| 862 | ||
| 863 | # | |
| 864 | # libraries - build all libraries, and install them under ${DESTDIR}. | |
| 865 | # | |
| 866 | # The list of libraries with dependents (${_prebuild_libs}) and their | |
| 867 | # interdependencies (__L) are built automatically by the | |
| 868 | # ${.CURDIR}/tools/make_libdeps.sh script. | |
| 869 | # | |
| 5228fe46 MD |
870 | # .makeenv does not work when bootstrapping from 4.x, so we must be sure |
| 871 | # to specify the correct CCVER or 'cc' will not exec the correct compiler. | |
| 872 | # | |
| 984263bc | 873 | libraries: |
| 30c91f0c | 874 | .if !defined(NO_GCC41) |
| ddf7cc86 SS |
875 | cd ${.CURDIR}; \ |
| 876 | HOST_CCVER=${HOST_CCVER} CCVER=gcc41 \ | |
| 877 | ${MAKE} -f Makefile.inc1 _startup_libs41; | |
| 30c91f0c | 878 | .endif |
| 29d48e65 | 879 | cd ${.CURDIR}; \ |
| 4f5ea479 SS |
880 | HOST_CCVER=${HOST_CCVER} CCVER=gcc44 \ |
| 881 | ${MAKE} -f Makefile.inc1 _startup_libs44; | |
| 882 | cd ${.CURDIR}; \ | |
| 984263bc MD |
883 | ${MAKE} -f Makefile.inc1 _startup_libs; \ |
| 884 | ${MAKE} -f Makefile.inc1 _prebuild_libs; \ | |
| 885 | ${MAKE} -f Makefile.inc1 _generic_libs; | |
| e05c8c84 | 886 | touch ${WORLDDEST}/.libraries_done |
| 984263bc MD |
887 | |
| 888 | # These dependencies are not automatically generated: | |
| 889 | # | |
| fd8b66cd | 890 | # gnu/lib/${CCVER}/libgcc and gnu/lib/${CCVER}/csu must be built before all |
| 4f5ea479 SS |
891 | # shared libraries for ELF. The target for _startup_libsXX is |
| 892 | # specifically built using gccXX. | |
| 984263bc | 893 | # |
| fd8b66cd | 894 | _startup_libs41= gnu/lib/gcc41/csu gnu/lib/gcc41/libgcc |
| 4f5ea479 | 895 | _startup_libs44= gnu/lib/gcc44/csu gnu/lib/gcc44/libgcc |
| e1da6819 | 896 | _startup_libs= lib/csu lib/libc lib/libc_rtld |
| 984263bc | 897 | |
| 59392a00 | 898 | _prebuild_libs= lib/libbz2 lib/liblzma lib/libz |
| 0b153c05 | 899 | _prebuild_libs+= lib/libutil |
| 984263bc MD |
900 | |
| 901 | _generic_libs= gnu/lib | |
| 902 | ||
| 984263bc | 903 | _prebuild_libs+= lib/libcom_err lib/libcrypt lib/libmd \ |
| 7d1ab061 | 904 | lib/libncurses/libncurses lib/libopie lib/libradius \ |
| 48d67717 | 905 | lib/libsbuf lib/libtacplus lib/libm \ |
| 9f95f3e0 | 906 | lib/libpam lib/libypclnt lib/lib${THREAD_LIB} \ |
| 3d91d947 | 907 | lib/libpthread lib/libprop lib/libdevattr |
| 984263bc MD |
908 | |
| 909 | lib/libopie__L lib/libradius__L lib/libtacplus__L: lib/libmd__L | |
| 984263bc MD |
910 | |
| 911 | _generic_libs+= lib | |
| 912 | ||
| cecff5c1 | 913 | .if !defined(NO_CRYPT) |
| 984263bc MD |
914 | .if !defined(NO_OPENSSL) |
| 915 | _prebuild_libs+= secure/lib/libcrypto secure/lib/libssl | |
| 916 | .if !defined(NO_OPENSSH) | |
| 917 | _prebuild_libs+= secure/lib/libssh | |
| 918 | secure/lib/libssh__L: secure/lib/libcrypto__L lib/libz__L | |
| 919 | .endif | |
| 920 | .endif | |
| 921 | _generic_libs+= secure/lib | |
| 922 | .endif | |
| 923 | ||
| 924 | _generic_libs+= usr.bin/lex/lib | |
| 925 | ||
| 96c51b62 | 926 | .for _lib in ${_startup_libs41} ${_startup_libs44} \ |
| 4db2a28c | 927 | ${_startup_libs} ${_prebuild_libs} ${_generic_libs} |
| 984263bc MD |
928 | ${_lib}__L: .PHONY |
| 929 | .if exists(${.CURDIR}/${_lib}) | |
| 930 | ${ECHODIR} "===> ${_lib}"; \ | |
| 931 | cd ${.CURDIR}/${_lib}; \ | |
| 932 | ${MAKE} DIRPRFX=${_lib}/ depend; \ | |
| 933 | ${MAKE} DIRPRFX=${_lib}/ all; \ | |
| 934 | ${MAKE} DIRPRFX=${_lib}/ install | |
| 935 | .endif | |
| 936 | .endfor | |
| 937 | ||
| 938 | _startup_libs: ${_startup_libs:S/$/__L/} | |
| ddf7cc86 | 939 | _startup_libs41: ${_startup_libs41:S/$/__L/} |
| 4f5ea479 | 940 | _startup_libs44: ${_startup_libs44:S/$/__L/} |
| 984263bc MD |
941 | _prebuild_libs: ${_prebuild_libs:S/$/__L/} |
| 942 | _generic_libs: ${_generic_libs:S/$/__L/} | |
| 943 | ||
| 1397f94a MD |
944 | # library targets must be ordered because there are inter-library |
| 945 | # races (e.g. generation of tconfig.h) | |
| 946 | # | |
| ddf7cc86 | 947 | .ORDER: ${_startup_libs41:S/$/__L/} |
| 4f5ea479 | 948 | .ORDER: ${_startup_libs44:S/$/__L/} |
| 1397f94a MD |
949 | .ORDER: ${_startup_libs:S/$/__L/} |
| 950 | .ORDER: ${_prebuild_libs:S/$/__L/} | |
| 951 | .ORDER: ${_generic_libs:S/$/__L/} | |
| 952 | ||
| 953 | .for __target in clean cleandepend cleandir obj depend includes | |
| 984263bc MD |
954 | .for entry in ${SUBDIR} |
| 955 | ${entry}.${__target}__D: .PHONY | |
| 956 | @if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \ | |
| 957 | ${ECHODIR} "===> ${DIRPRFX}${entry}.${MACHINE_ARCH}"; \ | |
| 958 | edir=${entry}.${MACHINE_ARCH}; \ | |
| 959 | cd ${.CURDIR}/$${edir}; \ | |
| 960 | else \ | |
| 961 | ${ECHODIR} "===> ${DIRPRFX}${entry}"; \ | |
| 962 | edir=${entry}; \ | |
| 963 | cd ${.CURDIR}/$${edir}; \ | |
| 964 | fi; \ | |
| 965 | ${MAKE} ${__target} DIRPRFX=${DIRPRFX}$${edir}/ | |
| 966 | .endfor | |
| 967 | par-${__target}: ${SUBDIR:S/$/.${__target}__D/} | |
| 1397f94a | 968 | .ORDER: ${SUBDIR:S/$/.${__target}__D/} |
| 984263bc | 969 | .endfor |
| 1397f94a | 970 | .ORDER: par-clean par-cleandepend par-cleandir par-obj par-depend par-includes |
| 984263bc | 971 | |
| cb0f1574 MD |
972 | # The wmake target is used by /usr/bin/wmake to run make in a |
| 973 | # world build environment. | |
| 974 | # | |
| 975 | wmake: | |
| 1397f94a | 976 | @echo '${WMAKEENV} ${MAKE} -m ${.CURDIR}/share/mk ${WMAKE_ARGS}' |
| cb0f1574 | 977 | |
| 5c7da0d7 MD |
978 | wmakeenv: |
| 979 | @echo '${WMAKEENV} /bin/sh' | |
| 980 | ||
| 1397f94a MD |
981 | bmake: |
| 982 | @echo '${BMAKEENV} ${MAKE} -m ${.CURDIR}/share/mk ${BMAKE_ARGS}' | |
| 983 | ||
| 17030342 MD |
984 | bmakeenv: |
| 985 | @echo '${BMAKEENV} /bin/sh' | |
| 986 | ||
| 1397f94a MD |
987 | tmake: |
| 988 | @echo '${TMAKEENV} ${MAKE} -m ${.CURDIR}/share/mk ${TMAKE_ARGS}' | |
| 989 | ||
| 17030342 MD |
990 | tmakeenv: |
| 991 | @echo '${TMAKEENV} /bin/sh' | |
| 992 | ||
| 66834c05 SS |
993 | xmake: |
| 994 | @echo '${XMAKEENV} ${MAKE} -m ${.CURDIR}/share/mk ${XMAKE_ARGS}' | |
| 995 | ||
| 996 | xmakeenv: | |
| 997 | @echo '${XMAKEENV} /bin/sh' | |
| 998 | ||
| 984263bc | 999 | .include <bsd.subdir.mk> |
| cb0f1574 | 1000 |