freebsd-src/sys/boot/loader.mk
Ed Maste 14481f92c4 loader.mk: clean md.o even if MD_IMAGE_SIZE not defined
We don't normally provide special handling for optionally-included src
files, but md.o depends on both md.c and the value of ${MD_IMAGE_SIZE}.
Previously if one built with MD_IMAGE_SIZE, executed "make clean", and
then built with a different MD_IMAGE_SIZE md.o would not be rebuilt.

Reported by:	Zakary Nafziger
Sponsored by:	The FreeBSD Foundation
2017-10-17 19:11:29 +00:00

80 lines
1.7 KiB
Makefile

# $FreeBSD$
.include "defs.mk"
.PATH: ${LDR_MI} ${BOOTDIR}/libsa
CFLAGS+=-I${LDR_MI}
SRCS+= boot.c commands.c console.c devopen.c interp.c
SRCS+= interp_backslash.c interp_parse.c ls.c misc.c
SRCS+= module.c
.if ${MACHINE} == "i386" || ${MACHINE_CPUARCH} == "amd64"
SRCS+= load_elf32.c load_elf32_obj.c reloc_elf32.c
SRCS+= load_elf64.c load_elf64_obj.c reloc_elf64.c
.elif ${MACHINE_CPUARCH} == "aarch64"
SRCS+= load_elf64.c reloc_elf64.c
.elif ${MACHINE_CPUARCH} == "arm"
SRCS+= load_elf32.c reloc_elf32.c
.elif ${MACHINE_CPUARCH} == "powerpc"
SRCS+= load_elf32.c reloc_elf32.c
SRCS+= load_elf64.c reloc_elf64.c
.elif ${MACHINE_CPUARCH} == "sparc64"
SRCS+= load_elf64.c reloc_elf64.c
.elif ${MACHINE_ARCH:Mmips64*} != ""
SRCS+= load_elf64.c reloc_elf64.c
.elif ${MACHINE} == "mips"
SRCS+= load_elf32.c reloc_elf32.c
.endif
.if ${LOADER_DISK_SUPPORT:Uyes} == "yes"
SRCS+= disk.c part.c
.endif
.if ${LOADER_NET_SUPPORT:Uno} == "yes"
SRCS+= dev_net.c
.endif
.if defined(HAVE_BCACHE)
SRCS+= bcache.c
.endif
.if defined(MD_IMAGE_SIZE)
CFLAGS+= -DMD_IMAGE_SIZE=${MD_IMAGE_SIZE}
SRCS+= md.c
.else
CLEANFILES+= md.o
.endif
# Machine-independant ISA PnP
.if defined(HAVE_ISABUS)
SRCS+= isapnp.c
.endif
.if defined(HAVE_PNP)
SRCS+= pnp.c
.endif
# Forth interpreter
.if ${MK_FORTH} != "no"
SRCS+= interp_forth.c
.include "${BOOTDIR}/ficl.mk"
.endif
.if defined(BOOT_PROMPT_123)
CFLAGS+= -DBOOT_PROMPT_123
.endif
.if defined(LOADER_INSTALL_SUPPORT)
SRCS+= install.c
.endif
CLEANFILES+= vers.c
VERSION_FILE?= ${.CURDIR}/version
.if ${MK_REPRODUCIBLE_BUILD} != no
REPRO_FLAG= -r
.endif
vers.c: ${LDR_MI}/newvers.sh ${VERSION_FILE}
sh ${LDR_MI}/newvers.sh ${REPRO_FLAG} ${VERSION_FILE} \
${NEWVERSWHAT}