From 6b9f688352c672850ed67ad2a31788d3ff024f5d Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Mon, 16 Oct 2017 03:59:44 +0000 Subject: [PATCH] Move all the ficl common code into ficl.mk There's a number of copies of basically identical code to enable building forth in /boot/loader. Move it all into ficl.mk. --- sys/boot/arm/uboot/Makefile | 8 -------- sys/boot/defs.mk | 9 +++++++-- sys/boot/efi/boot1/Makefile | 1 + sys/boot/efi/libefi/Makefile | 1 - sys/boot/efi/loader/Makefile | 8 -------- sys/boot/ficl.mk | 2 ++ sys/boot/i386/loader/Makefile | 22 +++++++++------------- sys/boot/loader.mk | 2 +- sys/boot/mips/beri/loader/Makefile | 8 -------- sys/boot/mips/uboot/Makefile | 12 ------------ sys/boot/powerpc/kboot/Makefile | 9 --------- sys/boot/powerpc/ofw/Makefile | 9 +-------- sys/boot/powerpc/ps3/Makefile | 8 -------- sys/boot/powerpc/uboot/Makefile | 8 -------- sys/boot/sparc64/loader/Makefile | 8 -------- sys/boot/userboot/userboot/Makefile | 8 -------- 16 files changed, 21 insertions(+), 102 deletions(-) diff --git a/sys/boot/arm/uboot/Makefile b/sys/boot/arm/uboot/Makefile index ba56279b0f8b..ab9306d30834 100644 --- a/sys/boot/arm/uboot/Makefile +++ b/sys/boot/arm/uboot/Makefile @@ -81,14 +81,6 @@ LIBUBOOT_FDT= ${.OBJDIR}/../../uboot/fdt/libuboot_fdt.a LIBFDT= ${.OBJDIR}/../../fdt/libfdt.a .endif -.if ${MK_FORTH} != "no" -# Enable BootForth -BOOT_FORTH= yes -CFLAGS+= -DBOOT_FORTH -I${.CURDIR}/../../ficl -CFLAGS+= -I${.CURDIR}/../../ficl/arm -LIBFICL= ${.OBJDIR}/../../ficl/libficl.a -.endif - # Always add MI sources .include "../../loader.mk" CFLAGS+= -I. diff --git a/sys/boot/defs.mk b/sys/boot/defs.mk index a84598003567..65a4dc22e384 100644 --- a/sys/boot/defs.mk +++ b/sys/boot/defs.mk @@ -1,5 +1,7 @@ # $FreeBSD$ +.include + .if !defined(__BOOT_DEFS_MK__) __BOOT_DEFS_MK__=${MFILE} @@ -9,9 +11,12 @@ LDR_MI= ${BOOTDIR}/common SASRC= ${SRCTOP}/sys/boot/libsa SYSDIR= ${SRCTOP}/sys -# Normal Standalone library +# NB: The makefiles depend on these being empty when we don't build forth. +.if ${MK_FORTH} != "no" +LIBFICL= ${OBJTOP}/sys/boot/ficl/libficl.a +LIBFICL32= ${OBJTOP}/sys/boot/ficl32/libficl.a +.endif LIBSA= ${OBJTOP}/sys/boot/libsa/libsa.a -# Standalone library compiled for 32-bit version of the processor LIBSA32= ${OBJTOP}/sys/boot/libsa32/libsa32.a .endif # __BOOT_DEFS_MK__ diff --git a/sys/boot/efi/boot1/Makefile b/sys/boot/efi/boot1/Makefile index 6375a796886f..2018e776a02e 100644 --- a/sys/boot/efi/boot1/Makefile +++ b/sys/boot/efi/boot1/Makefile @@ -5,6 +5,7 @@ MAN= .include "../Makefile.inc" MK_SSP= no +MK_FORTH= no PROG= boot1.sym INTERNALPROG= diff --git a/sys/boot/efi/libefi/Makefile b/sys/boot/efi/libefi/Makefile index e94098616359..6f3c17236a9b 100644 --- a/sys/boot/efi/libefi/Makefile +++ b/sys/boot/efi/libefi/Makefile @@ -3,7 +3,6 @@ .include .if ${MK_FORTH} != "no" -CFLAGS+= -DBOOT_FORTH .include "../../ficl.mk" .endif diff --git a/sys/boot/efi/loader/Makefile b/sys/boot/efi/loader/Makefile index 006e544f19e3..2b3aa2b31d84 100644 --- a/sys/boot/efi/loader/Makefile +++ b/sys/boot/efi/loader/Makefile @@ -78,14 +78,6 @@ CFLAGS+= -DSMBIOS_NETWORK_ENDIAN_UUID .endif .endif -.if ${MK_FORTH} != "no" -BOOT_FORTH= yes -CFLAGS+= -DBOOT_FORTH -CFLAGS+= -I${.CURDIR}/../../ficl -CFLAGS+= -I${.CURDIR}/../../ficl/${MACHINE_CPUARCH} -LIBFICL= ${.OBJDIR}/../../ficl/libficl.a -.endif - LOADER_FDT_SUPPORT?= no .if ${MK_FDT} != "no" && ${LOADER_FDT_SUPPORT} != "no" CFLAGS+= -I${.CURDIR}/../../fdt diff --git a/sys/boot/ficl.mk b/sys/boot/ficl.mk index 8700362332f0..bde0cc423e70 100644 --- a/sys/boot/ficl.mk +++ b/sys/boot/ficl.mk @@ -27,6 +27,8 @@ CFLAGS+= -m32 -mcpu=powerpc -I. .endif CFLAGS+= -I${FICLDIR} -I${FICLDIR}/${FICL_CPUARCH} -I${LDR_MI} +CFLAGS+= -DBOOT_FORTH +CFLAGS+= -DBF_DICTSIZE=15000 .if ${MACHINE_CPUARCH} == "amd64" && defined(FICL32) .if !exists(machine) diff --git a/sys/boot/i386/loader/Makefile b/sys/boot/i386/loader/Makefile index b5b169e2717c..68413c96a110 100644 --- a/sys/boot/i386/loader/Makefile +++ b/sys/boot/i386/loader/Makefile @@ -42,17 +42,6 @@ HAVE_BCACHE= yes HAVE_PNP= yes HAVE_ISABUS= yes -.if ${MK_FORTH} != "no" -# Enable BootForth -BOOT_FORTH= yes -CFLAGS+= -DBOOT_FORTH -I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/i386 -.if ${MACHINE_CPUARCH} == "amd64" -LIBFICL= ${.OBJDIR}/../../ficl32/libficl.a -.else -LIBFICL= ${.OBJDIR}/../../ficl/libficl.a -.endif -.endif - .if defined(LOADER_BZIP2_SUPPORT) CFLAGS+= -DLOADER_BZIP2_SUPPORT .endif @@ -119,8 +108,15 @@ FILES+= loader.rc menu.rc # XXX crt0.o needs to be first for pxeboot(8) to work OBJS= ${BTXCRT} -DPADD= ${LIBFICL} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBGELIBOOT} ${LIBSA32} -LDADD= ${LIBFICL} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBGELIBOOT} ${LIBSA32} +# XXX not happy with this construct, revisit +.if ${MACHINE_CPUARCH} == "amd64" +FICL= ${LIBFICL32} +.else +FICL= ${LIBFICL} +.endif + +DPADD= ${FICL} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBGELIBOOT} ${LIBSA32} +LDADD= ${FICL} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBGELIBOOT} ${LIBSA32} .include diff --git a/sys/boot/loader.mk b/sys/boot/loader.mk index 65ca86728a95..6e71cda7b2af 100644 --- a/sys/boot/loader.mk +++ b/sys/boot/loader.mk @@ -64,7 +64,7 @@ SRCS+= pnp.c .endif # Forth interpreter -.if defined(BOOT_FORTH) +.if ${MK_FORTH} != "no" SRCS+= interp_forth.c .include "${BOOTDIR}/ficl.mk" .endif diff --git a/sys/boot/mips/beri/loader/Makefile b/sys/boot/mips/beri/loader/Makefile index aec550cc038c..db11b1fa2051 100644 --- a/sys/boot/mips/beri/loader/Makefile +++ b/sys/boot/mips/beri/loader/Makefile @@ -68,14 +68,6 @@ CFLAGS+= -DLOADER_BZIP2_SUPPORT #CFLAGS+= -DLOADER_NFS_SUPPORT #CFLAGS+= -DLOADER_TFTP_SUPPORT -.if ${MK_FORTH} != "no" -# Enable BootForth -BOOT_FORTH= yes -CFLAGS+= -DBOOT_FORTH -I${.CURDIR}/../../../ficl -CFLAGS+= -I${.CURDIR}/../../../ficl/mips64 -LIBFICL= ${.OBJDIR}/../../../ficl/libficl.a -.endif - # Always add MI sources .include "../../../loader.mk" diff --git a/sys/boot/mips/uboot/Makefile b/sys/boot/mips/uboot/Makefile index 3efafafe23af..2b36c2eb328e 100644 --- a/sys/boot/mips/uboot/Makefile +++ b/sys/boot/mips/uboot/Makefile @@ -81,18 +81,6 @@ LIBUBOOT_FDT= ${.OBJDIR}/../../uboot/fdt/libuboot_fdt.a LIBFDT= ${.OBJDIR}/../../fdt/libfdt.a .endif -.if ${MK_FORTH} != "no" -# Enable BootForth -BOOT_FORTH= yes -CFLAGS+= -DBOOT_FORTH -I${.CURDIR}/../../ficl -.if ${MACHINE_ARCH:Mmips64*} != "" -CFLAGS+= -I${.CURDIR}/../../ficl/mips64 -.else -CFLAGS+= -I${.CURDIR}/../../ficl/mips -.endif -LIBFICL= ${.OBJDIR}/../../ficl/libficl.a -.endif - # Always add MI sources .include "../../loader.mk" CFLAGS+= -I. diff --git a/sys/boot/powerpc/kboot/Makefile b/sys/boot/powerpc/kboot/Makefile index f5767f972ac9..252eb80c0a2e 100644 --- a/sys/boot/powerpc/kboot/Makefile +++ b/sys/boot/powerpc/kboot/Makefile @@ -60,15 +60,6 @@ CFLAGS+= -DLOADER_FDT_SUPPORT LIBFDT= ${.OBJDIR}/../../fdt/libfdt.a .endif - -.if ${MK_FORTH} != "no" -# Enable BootForth -BOOT_FORTH= yes -CFLAGS+= -DBOOT_FORTH -I${.CURDIR}/../../ficl -CFLAGS+= -I${.CURDIR}/../../ficl/powerpc -LIBFICL= ${.OBJDIR}/../../ficl/libficl.a -.endif - CFLAGS+= -mcpu=powerpc64 # Always add MI sources diff --git a/sys/boot/powerpc/ofw/Makefile b/sys/boot/powerpc/ofw/Makefile index b170812559f6..5a04c7df6825 100644 --- a/sys/boot/powerpc/ofw/Makefile +++ b/sys/boot/powerpc/ofw/Makefile @@ -60,16 +60,9 @@ CFLAGS+= -DLOADER_FDT_SUPPORT LIBFDT= ${.OBJDIR}/../../fdt/libfdt.a .endif -.if ${MK_FORTH} != "no" -# Enable BootForth -BOOT_FORTH= yes -CFLAGS+= -DBOOT_FORTH -I${.CURDIR}/../../ficl -CFLAGS+= -I${.CURDIR}/../../ficl/powerpc -LIBFICL= ${.OBJDIR}/../../ficl/libficl.a -.endif - # Always add MI sources .include "../../loader.mk" + .PATH: ${.CURDIR}/../../../libkern CFLAGS+= -I${.CURDIR}/../../.. CFLAGS+= -I. diff --git a/sys/boot/powerpc/ps3/Makefile b/sys/boot/powerpc/ps3/Makefile index f6b3d41c2b98..bce98ff84343 100644 --- a/sys/boot/powerpc/ps3/Makefile +++ b/sys/boot/powerpc/ps3/Makefile @@ -61,14 +61,6 @@ LIBFDT= ${.OBJDIR}/../../fdt/libfdt.a .endif -.if ${MK_FORTH} != "no" -# Enable BootForth -BOOT_FORTH= yes -CFLAGS+= -DBOOT_FORTH -I${.CURDIR}/../../ficl -CFLAGS+= -I${.CURDIR}/../../ficl/powerpc -LIBFICL= ${.OBJDIR}/../../ficl/libficl.a -.endif - CFLAGS+= -mcpu=powerpc64 # Always add MI sources diff --git a/sys/boot/powerpc/uboot/Makefile b/sys/boot/powerpc/uboot/Makefile index 5a88546d5ce3..eaa551e64ded 100644 --- a/sys/boot/powerpc/uboot/Makefile +++ b/sys/boot/powerpc/uboot/Makefile @@ -66,14 +66,6 @@ LIBUBOOT_FDT= ${.OBJDIR}/../../uboot/fdt/libuboot_fdt.a LIBFDT= ${.OBJDIR}/../../fdt/libfdt.a .endif -.if ${MK_FORTH} != "no" -# Enable BootForth -BOOT_FORTH= yes -CFLAGS+= -DBOOT_FORTH -I${.CURDIR}/../../ficl -CFLAGS+= -I${.CURDIR}/../../ficl/powerpc -LIBFICL= ${.OBJDIR}/../../ficl/libficl.a -.endif - # Always add MI sources .include "../../loader.mk" .PATH: ${.CURDIR}/../../../libkern diff --git a/sys/boot/sparc64/loader/Makefile b/sys/boot/sparc64/loader/Makefile index 4825a76ddd6b..1dfb1535da01 100644 --- a/sys/boot/sparc64/loader/Makefile +++ b/sys/boot/sparc64/loader/Makefile @@ -57,14 +57,6 @@ CFLAGS+= -DLOADER_NFS_SUPPORT CFLAGS+= -DLOADER_TFTP_SUPPORT .endif -.if ${MK_FORTH} != "no" -# Enable BootForth -BOOT_FORTH= yes -CFLAGS+= -DBOOT_FORTH -I${.CURDIR}/../../ficl -CFLAGS+= -I${.CURDIR}/../../ficl/sparc64 -LIBFICL= ${.OBJDIR}/../../ficl/libficl.a -.endif - # Always add MI sources .include "../../loader.mk" CFLAGS+= -I. diff --git a/sys/boot/userboot/userboot/Makefile b/sys/boot/userboot/userboot/Makefile index 9a8963c9ed65..851454859c94 100644 --- a/sys/boot/userboot/userboot/Makefile +++ b/sys/boot/userboot/userboot/Makefile @@ -39,14 +39,6 @@ LDFLAGS+= -nostdlib -Wl,-Bsymbolic NEWVERSWHAT= "User boot" ${MACHINE_CPUARCH} -.if ${MK_FORTH} != "no" -BOOT_FORTH= yes -CFLAGS+= -DBOOT_FORTH -I${.CURDIR}/../../ficl -CFLAGS+= -I${.CURDIR}/../../ficl/i386 -CFLAGS+= -DBF_DICTSIZE=15000 -LIBFICL= ${.OBJDIR}/../ficl/libficl.a -.endif - .if ${MK_ZFS} != "no" CFLAGS+= -DUSERBOOT_ZFS_SUPPORT LIBZFSBOOT= ${.OBJDIR}/../zfs/libzfsboot.a