Makefile glue to build libgnuefi; similar to libsa or libkern.

This commit is contained in:
jakllsch 2014-04-28 19:09:29 +00:00
parent 12014f31d7
commit 849344e6ee
2 changed files with 134 additions and 0 deletions

View File

@ -0,0 +1,47 @@
# $NetBSD: Makefile,v 1.1 2014/04/28 19:09:29 jakllsch Exp $
LIB= gnuefi
LIBISPRIVATE?= yes
GNUEFI_USE_CREAD?= no # Read compressed kernels
GNUEFI_INCLUDE_NET?= yes # Netboot via TFTP, NFS
GNUEFI_USE_LOADFILE?= no # Generic executable loading support
GNUEFI_ENABLE_LS_OP?= no # Filesystems ls operation
CPPFLAGS= -I${GNUEFIDIR} ${GNUEFICPPFLAGS} ${GNUEFIMISCCPPFLAGS}
.if ${MACHINE_ARCH} == "i386"
GNUEFIARCH=ia32
.else
GNUEFIARCH=${MACHINE_ARCH}
.endif
.if defined(GNUEFI_EXTRADIR)
.-include "${GNUEFI_EXTRADIR}/Makefile.inc"
.endif
.include <bsd.own.mk>
.PATH.c: ${GNUEFIDIR} ${GNUEFIDIR}/../../external/bsd/gnu-efi/dist/lib/${GNUEFIARCH} ${GNUEFIDIR}/../../external/bsd/gnu-efi/dist/lib ${GNUEFIDIR}/../../external/bsd/gnu-efi/dist/lib/runtime
SRCS+= boxdraw.c smbios.c console.c crc.c data.c debug.c dpath.c \
error.c event.c guid.c hand.c hw.c init.c lock.c \
misc.c print.c sread.c str.c \
rtlock.c efirtlib.c rtstr.c vm.c rtdata.c \
initplat.c math.c
COPTS.boxdraw.c= -Wno-missing-field-initializers
COPTS.guid.c= -Wno-missing-field-initializers
COPTS.smbios.c= -Wno-int-to-pointer-cast
COPTS.dpath.c= -Wno-missing-prototypes
COPTS.print.c= -Wno-missing-prototypes
COPTS.hw.c= -Wno-shadow
.include <bsd.lib.mk>
lib${LIB}.o:: ${OBJS}
@echo building standard ${LIB} library
@rm -f lib${LIB}.o
@${LD} -r -o lib${LIB}.o `lorder ${OBJS} | tsort`
CPPFLAGS+= -Wno-pointer-sign

View File

@ -0,0 +1,87 @@
# $NetBSD: Makefile.inc,v 1.1 2014/04/28 19:09:29 jakllsch Exp $
#
# Configuration variables (default values are below):
#
# S must be set to the top of the 'sys' tree.
# GNUEFIDST may be set to the location of the directory where library
# objects are to be built. Defaults to ${.OBJDIR}/lib/gnuefi.
# GNUEFI_AS may be set to 'obj' to build a object from the library's
# object files. (Otherwise, a library will be built.)
# Defaults to 'library'.
# GNUEFIMISCCPPFLAGS
# Miscellaneous cpp flags to be passed to the library's Makefile
# when building.
# GNUEFIMISCMAKEFLAGS
# Miscellaneous flags to be passed to the library's Makefile when
# building. See library's Makefile for more details about
# supported flags and their default values.
# Default values:
GNUEFIDST?= ${.OBJDIR}/lib/gnuefi
GNUEFI_AS?= library
GNUEFIDOTDIR?= ../../.
CWARNFLAGS.clang+= -Wno-format-extra-args
GNUEFIDIR= ${S:S@^.@${GNUEFIDOTDIR}@:Q}/lib/libgnuefi
.if (${GNUEFI_AS} == "obj")
GNUEFILIB= ${GNUEFIDST}/libgnuefi.o
GNUEFILIB_PROF= ${GNUEFIDST}/libgnuefi.po
.else
GNUEFILIB= ${GNUEFIDST}/libgnuefi.a
GNUEFILIB_PROF= ${GNUEFIDST}/libgnuefi_p.a
.endif
ZLIBSRCDIR:= ${.PARSEDIR}/../../../common/dist/zlib
GNUEFIMISCCPPFLAGS+=-I${ZLIBSRCDIR}
GNUEFIMAKE= \
cd ${GNUEFIDST} && ${MAKE} -f ${GNUEFIDIR:Q}/Makefile \
GNUEFIDIR=${GNUEFIDIR:Q} \
CC=${CC:Q} CFLAGS=${CFLAGS:Q} CPUFLAGS= \
AS=${AS:Q} AFLAGS=${AFLAGS:Q} \
LORDER=${LORDER:Q} \
TSORT=${TSORT:Q} \
LD=${LD:Q} STRIP=${STRIP:Q} \
AR=${AR:Q} NM=${NM:Q} \
RANLIB=${RANLIB:Q} SIZE=${SIZE:Q} \
MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE_ARCH:Q} \
GNUEFICPPFLAGS=${CPPFLAGS:S@^-I.@-I${GNUEFIDOTDIR}@g:Q} \
GNUEFIMISCCPPFLAGS=${GNUEFIMISCCPPFLAGS:Q} \
${GNUEFIMISCMAKEFLAGS}
${GNUEFILIB}: .NOTMAIN .MAKE __always_make_gnuefilib
@echo making sure the gnuefi library is up to date...
.if (${GNUEFI_AS} == "library")
@${GNUEFIMAKE} libgnuefi.a
.else
@${GNUEFIMAKE} libgnuefi.o
.endif
${GNUEFILIB_PROF}: .NOTMAIN .MAKE __always_make_gnuefilib
@echo making sure the profiled gnuefi library is up to date...
.if (${GNUEFI_AS} == "library")
@${GNUEFIMAKE} libgnuefi_p.a
.else
@${GNUEFIMAKE} libgnuefi.po
.endif
clean: .NOTMAIN cleangnuefilib
cleangnuefilib: .NOTMAIN
@echo cleaning the gnuefi library objects
@if [ -d "${GNUEFIDST}" ]; then ${GNUEFIMAKE} clean; fi
cleandir distclean: .NOTMAIN cleandirgnuefilib
cleandirgnuefilib: .NOTMAIN
@echo cleandiring the gnuefi library objects
@if [ -d "${GNUEFIDST}" ]; then ${GNUEFIMAKE} cleandir; fi
dependall depend: .NOTMAIN dependgnuefilib
dependgnuefilib: .NOTMAIN .MAKE __always_make_gnuefilib
@echo depending the gnuefi library objects
@${GNUEFIMAKE} depend
__always_make_gnuefilib: .NOTMAIN
@mkdir -p ${GNUEFIDST}
.PHONY: __always_make_gnuefilib
.PHONY: cleangnuefilib cleandirgnuefilib dependgnuefilib