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