Makefile.sys.inc 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #
  2. # This is included very early from share/mk/src.sys.env.mk, after
  3. # /etc/src-env.conf but before /etc/make.conf, /etc/src.conf, or OBJDIR
  4. # handling.
  5. # - It is not safe to use .OBJDIR/OBJTOP/OBJROOT here.
  6. # - __ENV_ONLY_OPTIONS have been parsed by now except for opporutunistic
  7. # MK_AUTO_OBJ.
  8. #
  9. .if ${MK_DIRDEPS_BUILD} == "no"
  10. # For AUTO_OBJ many targets do not need object directories created at top-level
  11. # for each visited directory. Only when things are being built are they
  12. # needed. Having AUTO_OBJ disabled in a build target is fine as it should
  13. # fallback to running 'make obj' as needed. If a target is not in this list
  14. # then it is ran with MK_AUTO_OBJ=no in environment.
  15. # 'showconfig' is in the list to avoid forcing MK_AUTO_OBJ=no for it.
  16. AUTO_OBJ_TGT_WHITELIST+= \
  17. _* all all-man build* depend everything *toolchain* includes \
  18. libraries obj objlink showconfig tags xdev xdev-build native-xtools \
  19. stage* create-packages* real-packages sign-packages package-pkg \
  20. tinderbox universe* kernel kernels world worlds bmake
  21. # Only allow AUTO_OBJ for the whitelisted targets. See AUTO_OBJ_TGT_WHITELIST
  22. # above. MK_AUTO_OBJ not checked here for "yes" as it may not yet be enabled
  23. # since it is opportunistic.
  24. .if empty(.MAKEOVERRIDES:MMK_AUTO_OBJ)
  25. .for _tgt in ${AUTO_OBJ_TGT_WHITELIST}
  26. .if make(${_tgt})
  27. _CAN_USE_AUTO_OBJ?= yes
  28. .endif
  29. .endfor
  30. .if !defined(_CAN_USE_AUTO_OBJ)
  31. _MAKEARGS+= MK_AUTO_OBJ=no
  32. MK_AUTO_OBJ= no
  33. # This will prevent src.sys.obj.mk from opportunistically enabling AUTO_OBJ
  34. # in this make execution and for sub-makes. For all of these targets we
  35. # just want to read any existing OBJDIR but we don't care if we can create
  36. # or write to them.
  37. .MAKEOVERRIDES+= MK_AUTO_OBJ
  38. .else
  39. # For top-level we always assume the MAKEOBJDIRPREFIX is writable rather than
  40. # falling back to .CURDIR.
  41. __objdir_writable= yes
  42. .endif
  43. .endif # empty(.MAKEOVERRIDES:MMK_AUTO_OBJ)
  44. .endif # ${MK_DIRDEPS_BUILD} == "no"