As with the libraries, recursively add dependencies of the enabled drivers to the build list to enable building with, for example, just --enable_drivers=net/mlx5 or --enable_drivers=net/cpfl.
Signed-off-by: Bruce Richardson <[email protected]> --- drivers/meson.build | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/drivers/meson.build b/drivers/meson.build index cb71bc8231..fe514a0b15 100644 --- a/drivers/meson.build +++ b/drivers/meson.build @@ -71,23 +71,26 @@ foreach driver_option : ['disable_drivers', 'enable_drivers'] endforeach disable_drivers = run_command(list_dir_globs, disable_drivers, check: true).stdout().split() -enable_drivers = run_command(list_dir_globs, enable_drivers, check: true).stdout().split() -foreach d:enable_drivers +requested_drivers = run_command(list_dir_globs, enable_drivers, check: true).stdout().split() +foreach d:requested_drivers if disable_drivers.contains(d) error('Driver "@0@" is in both "enable_drivers" and "disable_drivers".'.format(d)) endif endforeach -require_drivers = true -if enable_drivers.length() == 0 - require_drivers = false - enable_drivers = run_command(list_dir_globs, '**', check: true).stdout().split() -endif +require_drivers = requested_drivers.length() != 0 # these drivers must always be enabled, otherwise the build breaks always_enable = ['bus/pci', 'bus/vdev'] # we always need a mempool driver, and ring is default, so make it mandatory always_enable += ['mempool/ring'] -enable_drivers += always_enable + +# expand the requested drivers to also include the drivers they depend on; with +# no drivers requested every driver is wanted, so no list is needed +enable_drivers = [] +if require_drivers + enable_drivers = run_command(resolve_deps_cmd, dpdk_deps_graph, '--drivers', + requested_drivers + always_enable, check: true).stdout().strip().split(',') +endif default_cflags = machine_args default_cflags += ['-DALLOW_EXPERIMENTAL_API'] @@ -200,7 +203,7 @@ foreach subpath:subdirs name = name.split('/')[1] endif - if not enable_drivers.contains(drv_path) + if require_drivers and not enable_drivers.contains(drv_path) build = false reason = 'not in enabled drivers build config' elif disable_drivers.contains(drv_path) -- 2.53.0

