HardenedBSD src tree
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

128 lines
3.8 KiB

  1. # $FreeBSD$
  2. .if !targets(__<${_this:T}>__)
  3. __<${_this:T}>__:
  4. # Makefile for the compatibility libraries.
  5. # - 32-bit compat libraries on MIPS, PowerPC, and AMD64.
  6. .include <bsd.compat.mk>
  7. # Yes, the flags are redundant.
  8. LIBCOMPATWMAKEENV+= \
  9. INSTALL="sh ${.CURDIR}/tools/install.sh" \
  10. PATH=${TMPPATH} \
  11. SYSROOT=${LIBCOMPATTMP} \
  12. LIBDIR=/usr/lib${libcompat} \
  13. SHLIBDIR=/usr/lib${libcompat} \
  14. DTRACE="${LIB$COMPATDTRACE:U${DTRACE}}"
  15. .if ${MK_META_MODE} != "no"
  16. # Don't rebuild build-tools targets during normal build.
  17. LIBCOMPATWMAKEENV+= BUILD_TOOLS_META=.NOMETA
  18. .endif
  19. LIBCOMPATWMAKEFLAGS+= CC="${XCC} ${LIBCOMPATCFLAGS}" \
  20. CXX="${XCXX} ${LIBCOMPATCXXFLAGS} ${LIBCOMPATCFLAGS}" \
  21. CPP="${XCPP} ${LIBCOMPATCFLAGS}" \
  22. DESTDIR=${LIBCOMPATTMP} \
  23. -DNO_CPU_CFLAGS \
  24. MK_CTF=no \
  25. -DNO_LINT \
  26. MK_CFI=no \
  27. MK_SAFESTACK=no \
  28. MK_SPECTREV1_FIX=no \
  29. MK_RETPOLINE=no \
  30. MK_TESTS=no
  31. LIBCOMPATWMAKE+= ${LIBCOMPATWMAKEENV} ${MAKE} ${LIBCOMPATWMAKEFLAGS} \
  32. OBJTOP=${LIBCOMPAT_OBJTOP} \
  33. OBJROOT='$${OBJTOP}/' \
  34. MAKEOBJDIRPREFIX= \
  35. MK_MAN=no MK_HTML=no \
  36. MK_RETPOLINE=no
  37. LIBCOMPATIMAKE+= ${LIBCOMPATWMAKE:NINSTALL=*:NDESTDIR=*} \
  38. MK_TOOLCHAIN=no \
  39. MK_RETPOLINE=no \
  40. ${IMAKE_INSTALL} \
  41. -DLIBRARIES_ONLY
  42. _LC_LIBDIRS.yes= lib
  43. _LC_LIBDIRS.yes+= gnu/lib
  44. _LC_LIBDIRS.yes+= usr.bin/lex/lib
  45. _LC_LIBDIRS.${MK_CDDL:tl}+= cddl/lib
  46. _LC_LIBDIRS.${MK_CRYPT:tl}+= secure/lib
  47. _LC_LIBDIRS.${MK_KERBEROS:tl}+= kerberos5/lib
  48. _LC_INCDIRS= \
  49. include \
  50. lib/ncurses/ncursesw \
  51. ${_LC_LIBDIRS.yes}
  52. .if ${MK_FILE} != "no"
  53. _libmagic= lib/libmagic
  54. .endif
  55. .if ${MK_PMC} != "no" && ${TARGET_ARCH} == "amd64"
  56. _jevents= lib/libpmc/pmu-events
  57. .endif
  58. # Shared logic
  59. build${libcompat}: .PHONY
  60. @echo
  61. @echo "--------------------------------------------------------------"
  62. @echo ">>> stage 4.3: building lib${libcompat} shim libraries"
  63. @echo "--------------------------------------------------------------"
  64. .if !defined(NO_CLEAN)
  65. rm -rf ${LIBCOMPATTMP}
  66. .else
  67. ${_+_}@if [ -e "${LIBCOMPATTMP}" ]; then \
  68. echo ">>> Deleting stale files in build${libcompat} tree..."; \
  69. cd ${.CURDIR}; ${WMAKE} -DBATCH_DELETE_OLD_FILES \
  70. DESTDIR=${LIBCOMPATTMP} \
  71. delete-old delete-old-libs >/dev/null; \
  72. fi
  73. .endif # !defined(NO_CLEAN)
  74. mkdir -p ${LIBCOMPATTMP}/usr/include
  75. ${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.usr.dist \
  76. -p ${LIBCOMPATTMP}/usr >/dev/null
  77. ${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.include.dist \
  78. -p ${LIBCOMPATTMP}/usr/include >/dev/null
  79. ${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \
  80. -p ${LIBCOMPATTMP}/usr >/dev/null
  81. .if ${MK_DEBUG_FILES} != "no"
  82. ${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.debug.dist \
  83. -p ${LIBCOMPATTMP}/usr/lib >/dev/null
  84. ${WORLDTMP_MTREE} -f ${.CURDIR}/etc/mtree/BSD.lib${libcompat}.dist \
  85. -p ${LIBCOMPATTMP}/usr/lib/debug/usr >/dev/null
  86. .endif
  87. mkdir -p ${WORLDTMP}
  88. ln -sf ${.CURDIR}/sys ${WORLDTMP}
  89. .for _t in ${_obj} includes
  90. .for _dir in ${_LC_INCDIRS}
  91. ${_+_}cd ${.CURDIR}/${_dir}; ${LIBCOMPATWMAKE} MK_INCLUDES=yes \
  92. DIRPRFX=${_dir}/ ${_t}
  93. .endfor
  94. .endfor
  95. .for _dir in lib/ncurses/ncurses lib/ncurses/ncursesw ${_libmagic} ${_jevents}
  96. .for _t in ${_obj} build-tools
  97. ${_+_}cd ${.CURDIR}/${_dir}; \
  98. WORLDTMP=${WORLDTMP} \
  99. MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \
  100. ${MAKE} SSP_CFLAGS= DESTDIR= \
  101. OBJTOP=${LIBCOMPAT_OBJTOP} \
  102. OBJROOT='$${OBJTOP}/' \
  103. MAKEOBJDIRPREFIX= \
  104. DIRPRFX=${_dir}/ -DNO_LINT -DNO_CPU_CFLAGS \
  105. MK_CTF=no MK_RETPOLINE=no MK_WARNS=no \
  106. ${_t}
  107. .endfor
  108. .endfor
  109. ${_+_}cd ${.CURDIR}; \
  110. ${LIBCOMPATWMAKE} -f Makefile.inc1 -DNO_FSCHG libraries
  111. distribute${libcompat} install${libcompat}: .PHONY
  112. .for _dir in ${_LC_LIBDIRS.yes}
  113. ${_+_}cd ${.CURDIR}/${_dir}; ${LIBCOMPATIMAKE} ${.TARGET:S/${libcompat}$//}
  114. .endfor
  115. .endif # !targets(__<${_this:T}>__)