When building modules, define make variable OPT_FDT if the kernel config

includes the FDT option.  Use OPT_FDT to conditionally compile modules
that require FDT support.

In the past we've gotten away with using the arch name as a proxy for FDT
support in makefile conditional logic, but now mips has some platforms with
fdt support and some without and we need a more direct test.
This commit is contained in:
Ian Lepore 2016-05-27 17:40:29 +00:00
parent 6351b3857b
commit 99819ca00c
2 changed files with 13 additions and 1 deletions

View File

@ -150,3 +150,11 @@ MK_${var}_SUPPORT:= yes
.endif
.endif
.endfor
# Some modules only compile successfully if option FDT is set, due to #ifdef FDT
# wrapped around declarations. Module makefiles can optionally compile such
# things using .if !empty(OPT_FDT)
.if !defined(OPT_FDT) && defined(KERNBUILDDIR)
OPT_FDT!= sed -n '/FDT/p' ${KERNBUILDDIR}/opt_platform.h
.export OPT_FDT
.endif

View File

@ -25,6 +25,10 @@
# SUCH DAMAGE.
#
SUBDIR = gpiobus gpioiic gpioled gpiopps gpiospi
SUBDIR = gpiobus gpioiic gpioled gpiospi
.if !empty(OPT_FDT)
SUBDIR += gpiopps
.endif
.include <bsd.subdir.mk>