1 # $NetBSD: Makefile.inc,v 1.1.12.2 2016/04/22 15:44:16 skrll Exp $ 2 # 3 # Configuration variables (default values are below): 4 # 5 # S must be set to the top of the 'sys' tree. 6 # GNUEFIDST may be set to the location of the directory where library 7 # objects are to be built. Defaults to ${.OBJDIR}/lib/gnuefi. 8 # GNUEFI_AS may be set to 'obj' to build a object from the library's 9 # object files. (Otherwise, a library will be built.) 10 # Defaults to 'library'. 11 # GNUEFIMISCCPPFLAGS 12 # Miscellaneous cpp flags to be passed to the library's Makefile 13 # when building. 14 # GNUEFIMISCMAKEFLAGS 15 # Miscellaneous flags to be passed to the library's Makefile when 16 # building. See library's Makefile for more details about 17 # supported flags and their default values. 18 19 # Default values: 20 GNUEFIDST?= ${.OBJDIR}/lib/gnuefi 21 GNUEFI_AS?= library 22 GNUEFIDOTDIR?= ../../. 23 24 CWARNFLAGS.clang+= -Wno-format-extra-args 25 26 GNUEFIDIR= ${S:S@^.@${GNUEFIDOTDIR}@:Q}/lib/libgnuefi 27 .if (${GNUEFI_AS} == "obj") 28 GNUEFILIB= ${GNUEFIDST}/libgnuefi.o 29 GNUEFILIB_PROF= ${GNUEFIDST}/libgnuefi.po 30 .else 31 GNUEFILIB= ${GNUEFIDST}/libgnuefi.a 32 GNUEFILIB_PROF= ${GNUEFIDST}/libgnuefi_p.a 33 .endif 34 ZLIBSRCDIR:= ${.PARSEDIR}/../../../common/dist/zlib 35 GNUEFIMISCCPPFLAGS+=-I${ZLIBSRCDIR} 36 37 GNUEFIMAKE= \ 38 cd ${GNUEFIDST} && ${MAKE} -f ${GNUEFIDIR:Q}/Makefile \ 39 GNUEFIDIR=${GNUEFIDIR:Q} \ 40 CC=${CC:Q} CFLAGS=${CFLAGS:Q} CPUFLAGS= \ 41 AS=${AS:Q} AFLAGS=${AFLAGS:Q} \ 42 LORDER=${LORDER:Q} \ 43 TSORT=${TSORT:Q} \ 44 LD=${LD:Q} STRIP=${STRIP:Q} \ 45 AR=${AR:Q} NM=${NM:Q} \ 46 RANLIB=${RANLIB:Q} SIZE=${SIZE:Q} \ 47 MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE_ARCH:Q} \ 48 GNUEFICPPFLAGS=${CPPFLAGS:S@^-I.@-I${GNUEFIDOTDIR}@g:Q} \ 49 GNUEFIMISCCPPFLAGS=${GNUEFIMISCCPPFLAGS:Q} \ 50 ${GNUEFIMISCMAKEFLAGS} 51 52 ${GNUEFILIB}: .NOTMAIN .MAKE __always_make_gnuefilib 53 @echo making sure the gnuefi library is up to date... 54 .if (${GNUEFI_AS} == "library") 55 @${GNUEFIMAKE} libgnuefi.a 56 .else 57 @${GNUEFIMAKE} libgnuefi.o 58 .endif 59 60 ${GNUEFILIB_PROF}: .NOTMAIN .MAKE __always_make_gnuefilib 61 @echo making sure the profiled gnuefi library is up to date... 62 .if (${GNUEFI_AS} == "library") 63 @${GNUEFIMAKE} libgnuefi_p.a 64 .else 65 @${GNUEFIMAKE} libgnuefi.po 66 .endif 67 68 clean: .NOTMAIN cleangnuefilib 69 cleangnuefilib: .NOTMAIN 70 @echo cleaning the gnuefi library objects 71 @if [ -d "${GNUEFIDST}" ]; then ${GNUEFIMAKE} clean; fi 72 73 cleandir distclean: .NOTMAIN cleandirgnuefilib 74 cleandirgnuefilib: .NOTMAIN 75 @echo cleandiring the gnuefi library objects 76 @if [ -d "${GNUEFIDST}" ]; then ${GNUEFIMAKE} cleandir; fi 77 78 dependall depend: .NOTMAIN dependgnuefilib 79 dependgnuefilib: .NOTMAIN .MAKE __always_make_gnuefilib 80 @echo depending the gnuefi library objects 81 @${GNUEFIMAKE} depend 82 83 __always_make_gnuefilib: .NOTMAIN 84 @mkdir -p ${GNUEFIDST} 85 86 .PHONY: __always_make_gnuefilib 87 .PHONY: cleangnuefilib cleandirgnuefilib dependgnuefilib 88