94 lines
2.3 KiB
Makefile
94 lines
2.3 KiB
Makefile
# $FreeBSD$
|
|
|
|
BASE= loader
|
|
PROG= ${BASE}.efi
|
|
NOMAN=
|
|
NEWVERSWHAT= "EFI boot" ${MACHINE_ARCH}
|
|
|
|
.PATH: ${.CURDIR}/../common
|
|
|
|
SRCS+= main.c conf.c
|
|
|
|
# Enable BootForth
|
|
#BOOT_FORTH= yes
|
|
CFLAGS+= -I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/alpha
|
|
.if BOOT_FORTH
|
|
CFLAGS+= -DBOOT_FORTH
|
|
.if exists(${.OBJDIR}/../../ficl/libficl.a)
|
|
LIBFICL= ${.OBJDIR}/../../ficl/libficl.a
|
|
.else
|
|
LIBFICL= ${.CURDIR}/../../ficl/libficl.a
|
|
.endif
|
|
.else
|
|
LIBFICL=
|
|
.endif
|
|
|
|
# Always add MI sources
|
|
.PATH: ${.CURDIR}/../../common
|
|
.include <${.CURDIR}/../../common/Makefile.inc>
|
|
CFLAGS+= -I-
|
|
CFLAGS+= -I${.CURDIR}/../include
|
|
CFLAGS+= -I${.CURDIR}/../include/${MACHINE_ARCH}
|
|
CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}
|
|
CFLAGS+= -I${.CURDIR}/../../.. -I.
|
|
CFLAGS+= -I${.CURDIR}/../libefi
|
|
CFLAGS+= -DLOADER
|
|
CFLAGS+= -Wall
|
|
|
|
LDSCRIPT= ${.CURDIR}/../libefi/arch/${MACHINE_ARCH}/ldscript.${MACHINE_ARCH}
|
|
LDFLAGS= -nostdlib -T ${LDSCRIPT} -shared -Bsymbolic
|
|
|
|
CLEANFILES+= setdef0.c setdef0.o setdef1.c setdef1.o setdefs.h start.o \
|
|
vers.c vers.o ${BASE}.efi ${BASE}.sym ${BASE}.list
|
|
CLEANFILES+= loader.help
|
|
CLEANFILES+= machine
|
|
|
|
CRT= start.o
|
|
|
|
all: ${PROG}
|
|
|
|
vers.o: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version
|
|
sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/version ${NEWVERSWHAT}
|
|
${CC} -c vers.c
|
|
|
|
${BASE}.efi: ${BASE}.sym
|
|
${OBJCOPY} -j .text \
|
|
-j .hash \
|
|
-j .data \
|
|
-j .sdata \
|
|
-j .dynamic \
|
|
-j .rela \
|
|
-j .reloc \
|
|
-j .dynsym \
|
|
--target=efi-app-${MACHINE_ARCH} \
|
|
${BASE}.sym ${BASE}.efi
|
|
|
|
${BASE}.sym: ${OBJS} ${LIBSTAND} ${LIBARC} ${CRT} vers.o
|
|
${LD} ${LDFLAGS} -o ${BASE}.sym -M \
|
|
${CRT} {OBJS} vers.o \
|
|
${LIBFICL} ${LIBSTAND} ${LIBEFI} ${LIBSTAND} \
|
|
> ${.OBJDIR}/${BASE}.list
|
|
|
|
${BASE}.help: help.common help.efi
|
|
cat ${.ALLSRC} | awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}
|
|
|
|
beforeinstall:
|
|
.if exists(${.OBJDIR}/loader.help)
|
|
${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
|
|
${.OBJDIR}/${BASE}.help ${DESTDIR}/boot
|
|
.else
|
|
${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 \
|
|
${.CURDIR}/${BASE}.help ${DESTDIR}/boot
|
|
.endif
|
|
|
|
# Other fragments still to be brought in from ../Makfile.booters?
|
|
start.o: ${.CURDIR}/../libefi/arch/${MACHINE_ARCH}/start.S
|
|
${CC} -c ${CFLAGS} $<
|
|
|
|
machine:
|
|
ln -sf ${.CURDIR}/../../../${MACHINE_ARCH}/include machine
|
|
|
|
.include <bsd.prog.mk>
|
|
|
|
beforedepend ${OBJS}: machine
|