Deduplicate loader vers.c Makefile rules

The Makefile rule to create vers.c for loader version info was
previously duplicated in each of the various loader Makefiles.
Instead, share a common rule in Makefile.inc.

Reviewed by:	bapt
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D8841
This commit is contained in:
Ed Maste 2016-12-19 14:40:59 +00:00
parent 7f900be181
commit bc814587a9
13 changed files with 19 additions and 52 deletions

View File

@ -90,7 +90,7 @@ LIBFICL= ${.OBJDIR}/../../ficl/libficl.a
CFLAGS+= -I${.CURDIR}/../../common CFLAGS+= -I${.CURDIR}/../../common
CFLAGS+= -I. CFLAGS+= -I.
CLEANFILES+= vers.c loader.help CLEANFILES+= loader.help
CFLAGS+= -ffreestanding -msoft-float CFLAGS+= -ffreestanding -msoft-float
@ -119,9 +119,6 @@ LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} -lstand
OBJS+= ${SRCS:N*.h:R:S/$/.o/g} OBJS+= ${SRCS:N*.h:R:S/$/.o/g}
vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version
sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
loader.help: help.common help.uboot ${.CURDIR}/../../fdt/help.fdt loader.help: help.common help.uboot ${.CURDIR}/../../fdt/help.fdt
cat ${.ALLSRC} | \ cat ${.ALLSRC} | \
awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET} awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}

View File

@ -71,3 +71,8 @@ CFLAGS+= -DBOOT_PROMPT_123
SRCS+= install.c SRCS+= install.c
CFLAGS+=-I${.CURDIR}/../../../../lib/libstand CFLAGS+=-I${.CURDIR}/../../../../lib/libstand
.endif .endif
CLEANFILES+= vers.c
VERSION_FILE?= ${.CURDIR}/version
vers.c: ${SRCTOP}/sys/boot/common/newvers.sh ${VERSION_FILE}
sh ${SRCTOP}/sys/boot/common/newvers.sh ${VERSION_FILE} ${NEWVERSWHAT}

View File

@ -115,13 +115,10 @@ FILESMODE_loader.efi= ${BINMODE}
LDSCRIPT= ${.CURDIR}/arch/${MACHINE}/ldscript.${MACHINE} LDSCRIPT= ${.CURDIR}/arch/${MACHINE}/ldscript.${MACHINE}
LDFLAGS+= -Wl,-T${LDSCRIPT} -Wl,-Bsymbolic -shared LDFLAGS+= -Wl,-T${LDSCRIPT} -Wl,-Bsymbolic -shared
CLEANFILES+= vers.c loader.efi CLEANFILES+= loader.efi
NEWVERSWHAT= "EFI loader" ${MACHINE} NEWVERSWHAT= "EFI loader" ${MACHINE}
vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/../../efi/loader/version
sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
NM?= nm NM?= nm
OBJCOPY?= objcopy OBJCOPY?= objcopy

View File

@ -8,6 +8,7 @@ PROG= ${LOADER}.sym
MAN= MAN=
INTERNALPROG= INTERNALPROG=
NEWVERSWHAT?= "bootstrap loader" x86 NEWVERSWHAT?= "bootstrap loader" x86
VERSION_FILE= ${.CURDIR}/../loader/version
# architecture-specific loader code # architecture-specific loader code
SRCS= main.c conf.c vers.c SRCS= main.c conf.c vers.c
@ -72,7 +73,7 @@ CFLAGS+= -I${.CURDIR}/../../.. -D_STAND
CFLAGS+= -I${.CURDIR}/../../common CFLAGS+= -I${.CURDIR}/../../common
CFLAGS+= -I. CFLAGS+= -I.
CLEANFILES= vers.c ${LOADER} ${LOADER}.bin loader.help CLEANFILES= ${LOADER} ${LOADER}.bin loader.help
CFLAGS+= -Wall CFLAGS+= -Wall
LDFLAGS= -static -Ttext 0x0 LDFLAGS= -static -Ttext 0x0
@ -93,10 +94,6 @@ CFLAGS+= -I${.CURDIR}/../btx/lib
# Pick up ../Makefile.inc early. # Pick up ../Makefile.inc early.
.include <bsd.init.mk> .include <bsd.init.mk>
vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/../loader/version
sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/../loader/version \
${NEWVERSWHAT}
${LOADER}: ${LOADER}.bin ${BTXLDR} ${BTXKERN} ${LOADER}: ${LOADER}.bin ${BTXLDR} ${BTXKERN}
btxld -v -f aout -e ${LOADER_ADDRESS} -o ${.TARGET} -l ${BTXLDR} \ btxld -v -f aout -e ${LOADER_ADDRESS} -o ${.TARGET} -l ${BTXLDR} \
-b ${BTXKERN} ${LOADER}.bin -b ${BTXKERN} ${LOADER}.bin

View File

@ -92,7 +92,7 @@ CFLAGS+= -I${.CURDIR}/../common
# Loader-specific MD headers # Loader-specific MD headers
CFLAGS+= -I${.CURDIR} CFLAGS+= -I${.CURDIR}
CLEANFILES+= vers.c loader.help CLEANFILES+= loader.help
# Generate code appropriate for the loader environment # Generate code appropriate for the loader environment
CFLAGS+= -G0 \ CFLAGS+= -G0 \
@ -114,10 +114,6 @@ LIBSTAND= ${.OBJDIR}/../../../../../lib/libstand/libstand.a
DPADD= ${LIBFICL} ${LIBSTAND} DPADD= ${LIBFICL} ${LIBSTAND}
LDADD= ${LIBFICL} ${LIBSTAND} LDADD= ${LIBFICL} ${LIBSTAND}
vers.c: ${.CURDIR}/../../../common/newvers.sh ${.CURDIR}/version
sh ${.CURDIR}/../../../common/newvers.sh ${.CURDIR}/version \
${NEWVERSWHAT}
loader.help: help.common help.mips loader.help: help.common help.mips
cat ${.ALLSRC} | \ cat ${.ALLSRC} | \
awk -f ${.CURDIR}/../../../common/merge_help.awk > ${.TARGET} awk -f ${.CURDIR}/../../../common/merge_help.awk > ${.TARGET}

View File

@ -99,7 +99,7 @@ LIBFICL= ${.OBJDIR}/../../ficl/libficl.a
CFLAGS+= -I${.CURDIR}/../../common CFLAGS+= -I${.CURDIR}/../../common
CFLAGS+= -I. CFLAGS+= -I.
CLEANFILES+= vers.c loader.help CLEANFILES+= loader.help
CFLAGS+= -ffreestanding -msoft-float -g CFLAGS+= -ffreestanding -msoft-float -g
@ -128,9 +128,6 @@ LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSTAND}
OBJS+= ${SRCS:N*.h:R:S/$/.o/g} OBJS+= ${SRCS:N*.h:R:S/$/.o/g}
vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version
sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
loader.help: help.common help.uboot ${.CURDIR}/../../fdt/help.fdt loader.help: help.common help.uboot ${.CURDIR}/../../fdt/help.fdt
cat ${.ALLSRC} | \ cat ${.ALLSRC} | \
awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET} awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}

View File

@ -8,6 +8,7 @@ LOADER?= loader
PROG= ${LOADER}.sym PROG= ${LOADER}.sym
INTERNALPROG= INTERNALPROG=
NEWVERSWHAT= "bootstrap loader" pc98 NEWVERSWHAT= "bootstrap loader" pc98
VERSION_FILE= ${.CURDIR}/../../i386/loader/version
# architecture-specific loader code # architecture-specific loader code
SRCS= main.c conf.c vers.c SRCS= main.c conf.c vers.c
@ -48,7 +49,7 @@ CFLAGS+= -I${.CURDIR}/../../common
CFLAGS+= -I${.CURDIR}/../../i386 CFLAGS+= -I${.CURDIR}/../../i386
CFLAGS+= -I. CFLAGS+= -I.
CLEANFILES= vers.c ${LOADER} ${LOADER}.bin loader.help CLEANFILES= ${LOADER} ${LOADER}.bin loader.help
CFLAGS+= -Wall CFLAGS+= -Wall
LDFLAGS= -static -Ttext 0x0 LDFLAGS= -static -Ttext 0x0
@ -69,9 +70,6 @@ CFLAGS+= -I${.CURDIR}/../btx/lib
# Pick up ../Makefile.inc early. # Pick up ../Makefile.inc early.
.include <bsd.init.mk> .include <bsd.init.mk>
vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/../../i386/loader/version
sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/../../i386/loader/version ${NEWVERSWHAT}
${LOADER}: ${LOADER}.bin ${BTXLDR} ${BTXKERN} ${LOADER}: ${LOADER}.bin ${BTXLDR} ${BTXKERN}
btxld -v -f aout -e ${LOADER_ADDRESS} -o ${.TARGET} -l ${BTXLDR} \ btxld -v -f aout -e ${LOADER_ADDRESS} -o ${.TARGET} -l ${BTXLDR} \
-b ${BTXKERN} ${LOADER}.bin -b ${BTXKERN} ${LOADER}.bin

View File

@ -76,7 +76,7 @@ CFLAGS+= -mcpu=powerpc64
CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}/../../.. CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}/../../..
CFLAGS+= -I. CFLAGS+= -I.
CLEANFILES+= vers.c loader.help CLEANFILES+= loader.help
CFLAGS+= -Wall -ffreestanding -msoft-float -DAIM CFLAGS+= -Wall -ffreestanding -msoft-float -DAIM
# load address. set in linker script # load address. set in linker script
@ -99,9 +99,6 @@ CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/
DPADD= ${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSTAND} DPADD= ${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSTAND}
LDADD= ${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSTAND} LDADD= ${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSTAND}
vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version
sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
loader.help: help.common help.kboot ${.CURDIR}/../../fdt/help.fdt loader.help: help.common help.kboot ${.CURDIR}/../../fdt/help.fdt
cat ${.ALLSRC} | \ cat ${.ALLSRC} | \
awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET} awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}

View File

@ -73,7 +73,7 @@ LIBFICL= ${.OBJDIR}/../../ficl/libficl.a
CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}/../../.. CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}/../../..
CFLAGS+= -I. CFLAGS+= -I.
CLEANFILES+= vers.c loader.help CLEANFILES+= loader.help
CFLAGS+= -ffreestanding -msoft-float CFLAGS+= -ffreestanding -msoft-float
# load address. set in linker script # load address. set in linker script
@ -97,9 +97,6 @@ CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/
DPADD= ${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSTAND} DPADD= ${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSTAND}
LDADD= ${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSTAND} LDADD= ${LIBFICL} ${LIBOFW} ${LIBFDT} ${LIBSTAND}
vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version
sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
loader.help: help.common help.ofw ${.CURDIR}/../../fdt/help.fdt loader.help: help.common help.ofw ${.CURDIR}/../../fdt/help.fdt
cat ${.ALLSRC} | \ cat ${.ALLSRC} | \
awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET} awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}

View File

@ -76,7 +76,7 @@ CFLAGS+= -mcpu=powerpc64
CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}/../../.. CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}/../../..
CFLAGS+= -I. CFLAGS+= -I.
CLEANFILES+= vers.c loader.help CLEANFILES+= loader.help
CFLAGS+= -Wall -ffreestanding -msoft-float -DAIM CFLAGS+= -Wall -ffreestanding -msoft-float -DAIM
# load address. set in linker script # load address. set in linker script
@ -101,9 +101,6 @@ SC_DFLT_FONT=cp437
font.h: font.h:
uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x16.fnt && file2c 'u_char dflt_font_16[16*256] = {' '};' < ${SC_DFLT_FONT}-8x16 > font.h && uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x14.fnt && file2c 'u_char dflt_font_14[14*256] = {' '};' < ${SC_DFLT_FONT}-8x14 >> font.h && uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x8.fnt && file2c 'u_char dflt_font_8[8*256] = {' '};' < ${SC_DFLT_FONT}-8x8 >> font.h uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x16.fnt && file2c 'u_char dflt_font_16[16*256] = {' '};' < ${SC_DFLT_FONT}-8x16 > font.h && uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x14.fnt && file2c 'u_char dflt_font_14[14*256] = {' '};' < ${SC_DFLT_FONT}-8x14 >> font.h && uudecode < /usr/share/syscons/fonts/${SC_DFLT_FONT}-8x8.fnt && file2c 'u_char dflt_font_8[8*256] = {' '};' < ${SC_DFLT_FONT}-8x8 >> font.h
vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version
sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
loader.help: help.common help.ps3 ${.CURDIR}/../../fdt/help.fdt loader.help: help.common help.ps3 ${.CURDIR}/../../fdt/help.fdt
cat ${.ALLSRC} | \ cat ${.ALLSRC} | \
awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET} awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}

View File

@ -79,7 +79,7 @@ LIBFICL= ${.OBJDIR}/../../ficl/libficl.a
CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}/../../.. CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}/../../..
CFLAGS+= -I. CFLAGS+= -I.
CLEANFILES+= vers.c ${PROG}.help CLEANFILES+= ${PROG}.help
CFLAGS+= -ffreestanding CFLAGS+= -ffreestanding
@ -102,9 +102,6 @@ CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/
DPADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSTAND} DPADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSTAND}
LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSTAND} LDADD= ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSTAND}
vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version
sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
loader.help: help.common help.uboot ${.CURDIR}/../../fdt/help.fdt loader.help: help.common help.uboot ${.CURDIR}/../../fdt/help.fdt
cat ${.ALLSRC} | \ cat ${.ALLSRC} | \
awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET} awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}

View File

@ -6,6 +6,7 @@ MAN=
PROG?= loader PROG?= loader
NEWVERSWHAT?= "bootstrap loader" sparc64 NEWVERSWHAT?= "bootstrap loader" sparc64
VERSION_FILE= ${.CURDIR}/../loader/version
INSTALLFLAGS= -b INSTALLFLAGS= -b
# Architecture-specific loader code # Architecture-specific loader code
@ -70,7 +71,7 @@ LIBFICL= ${.OBJDIR}/../../ficl/libficl.a
CFLAGS+= -I${.CURDIR}/../../common CFLAGS+= -I${.CURDIR}/../../common
CFLAGS+= -I. CFLAGS+= -I.
CLEANFILES+= vers.c loader.help CLEANFILES+= loader.help
LDFLAGS= -static LDFLAGS= -static
@ -84,10 +85,6 @@ CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/
DPADD= ${LIBFICL} ${LIBZFSBOOT} ${LIBOFW} ${LIBSTAND} DPADD= ${LIBFICL} ${LIBZFSBOOT} ${LIBOFW} ${LIBSTAND}
LDADD= ${LIBFICL} ${LIBZFSBOOT} ${LIBOFW} -lstand LDADD= ${LIBFICL} ${LIBZFSBOOT} ${LIBOFW} -lstand
vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/../loader/version
sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/../loader/version \
${NEWVERSWHAT}
loader.help: help.common help.sparc64 loader.help: help.common help.sparc64
cat ${.ALLSRC} | \ cat ${.ALLSRC} | \
awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET} awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}

View File

@ -41,11 +41,6 @@ LDFLAGS+= -nostdlib -Wl,-Bsymbolic
NEWVERSWHAT= "User boot" ${MACHINE_CPUARCH} NEWVERSWHAT= "User boot" ${MACHINE_CPUARCH}
vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version
sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
CLEANFILES= vers.c
.if ${MK_FORTH} != "no" .if ${MK_FORTH} != "no"
BOOT_FORTH= yes BOOT_FORTH= yes
CFLAGS+= -DBOOT_FORTH -I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/i386 CFLAGS+= -DBOOT_FORTH -I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/i386