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