diff --git a/stand/common/commands.c b/stand/common/commands.c --- a/stand/common/commands.c +++ b/stand/common/commands.c @@ -123,7 +123,6 @@ return (pager_output("\n")); } - static int command_help(int argc, char *argv[]) { @@ -132,7 +131,8 @@ char *topic, *subtopic, *t, *s, *d; /* page the help text from our load path */ - snprintf(buf, sizeof(buf), "%s/boot/loader.help", getenv("loaddev")); + snprintf(buf, sizeof(buf), "%s/boot/%s", getenv("loaddev"), + HELP_FILENAME); if ((hfd = open(buf, O_RDONLY)) < 0) { printf("Verbose help not available, " "use '?' to list commands\n"); diff --git a/stand/efi/loader/Makefile b/stand/efi/loader/Makefile --- a/stand/efi/loader/Makefile +++ b/stand/efi/loader/Makefile @@ -84,6 +84,7 @@ NEWVERSWHAT= "EFI loader" ${MACHINE} VERSION_FILE= ${.CURDIR}/../loader/version +HELP_FILENAME= "loader.help.efi" # Always add MI sources .include "${BOOTSRC}/loader.mk" diff --git a/stand/i386/loader/Makefile b/stand/i386/loader/Makefile --- a/stand/i386/loader/Makefile +++ b/stand/i386/loader/Makefile @@ -62,6 +62,7 @@ .if exists(${.CURDIR}/help.i386) HELP_FILES= ${.CURDIR}/help.i386 .endif +HELP_FILENAME= "loader.help.bios" # Always add MI sources .include "${BOOTSRC}/loader.mk" diff --git a/stand/kboot/Makefile b/stand/kboot/Makefile --- a/stand/kboot/Makefile +++ b/stand/kboot/Makefile @@ -42,6 +42,8 @@ HAVE_ZFS=yes .endif +HELP_FILENAME= "loader.help.kboot" + .include "${BOOTSRC}/fdt.mk" # Note: Since we're producing a userland binary, we key off of MACHINE_ARCH diff --git a/stand/loader.mk b/stand/loader.mk --- a/stand/loader.mk +++ b/stand/loader.mk @@ -162,12 +162,17 @@ CFLAGS+= -DELF_VERBOSE .endif -.if !empty(HELP_FILES) +# Each loader variant defines their own help filename. Optional or +# build-specific commands are included by augmenting HELP_FILES. +.if !defined(HELP_FILENAME) +.error Define HELP_FILENAME before including loader.mk +.endif + HELP_FILES+= ${LDRSRC}/help.common -CLEANFILES+= loader.help -FILES+= loader.help +CFLAGS+= -DHELP_FILENAME=\"${HELP_FILENAME}\" +CLEANFILES+= ${HELP_FILENAME} +FILES+= ${HELP_FILENAME} -loader.help: ${HELP_FILES} +${HELP_FILENAME}: ${HELP_FILES} cat ${HELP_FILES} | awk -f ${LDRSRC}/merge_help.awk > ${.TARGET} -.endif diff --git a/stand/powerpc/ofw/Makefile b/stand/powerpc/ofw/Makefile --- a/stand/powerpc/ofw/Makefile +++ b/stand/powerpc/ofw/Makefile @@ -37,6 +37,7 @@ .endif HELP_FILES= ${FDTSRC}/help.fdt +HELP_FILENAME= "loader.help.ofw" # Always add MI sources .include "${BOOTSRC}/loader.mk" diff --git a/stand/uboot/Makefile b/stand/uboot/Makefile --- a/stand/uboot/Makefile +++ b/stand/uboot/Makefile @@ -35,7 +35,8 @@ CWARNFLAGS.self_reloc.c+= -Wno-error=maybe-uninitialized .endif -HELP_FILES= ${.CURDIR}/help.uboot ${BOOTSRC}/fdt/help.fdt +HELP_FILES= ${.CURDIR}/help.uboot ${BOOTSRC}/fdt/help.fdt +HELP_FILENAME= "loader.help.uboot" # Always add MI sources .include "${BOOTSRC}/loader.mk" diff --git a/stand/userboot/userboot/Makefile b/stand/userboot/userboot/Makefile --- a/stand/userboot/userboot/Makefile +++ b/stand/userboot/userboot/Makefile @@ -54,6 +54,8 @@ HAVE_ZFS=yes .endif +HELP_FILENAME= "loader.help.userboot" + # Always add MI sources .include "${BOOTSRC}/loader.mk" CFLAGS+= -I.