SHELL=/bin/bash

BOX_INDEX_VERSIONS=	bin/box-index-versions
BOX_INDEX_PROVIDERS=	bin/box-index-providers

BOX_DIR_GLOB=		AlmaLinux-* CentOS-*
BOX_VER_DIR_GLOB=	AlmaLinux-*/[0-9]*.*.* CentOS-*/[0-9]*.*.*

index: index-versions

index-versions: index-providers
	@ for box_dir in $(BOX_DIR_GLOB); do \
	    [[ -d $$box_dir ]] || continue; \
	    set -- $(BOX_INDEX_VERSIONS) "$$box_dir"; \
	    echo "$$*"; \
	    "$$@"; \
	  done

index-providers:
	@ for box_ver_dir in $(BOX_VER_DIR_GLOB); do \
	    [[ -d $$box_ver_dir ]] || continue; \
	    set -- $(BOX_INDEX_PROVIDERS) "$$box_ver_dir"; \
	    echo "$$*"; \
	    "$$@"; \
	  done
