Home | History | Annotate | Line # | Download | only in efiboot
Makefile.efiboot revision 1.7.2.2
      1  1.7.2.2  christos # $NetBSD: Makefile.efiboot,v 1.7.2.2 2019/06/10 22:09:56 christos Exp $
      2  1.7.2.2  christos 
      3  1.7.2.2  christos S=		${.CURDIR}/../../..
      4  1.7.2.2  christos 
      5  1.7.2.2  christos NOMAN=		# defined
      6  1.7.2.2  christos NOPIE=		# defined
      7  1.7.2.2  christos NOLIBCSANITIZER=# defined
      8  1.7.2.2  christos NOSANITIZER=	# defined
      9  1.7.2.2  christos NORELRO=	# defined
     10  1.7.2.2  christos PROG?=		boot.efi
     11  1.7.2.2  christos NEWVERSWHAT?=	"EFI Boot"
     12  1.7.2.2  christos 
     13  1.7.2.2  christos EFIDIR= ${S}/external/bsd/gnu-efi/dist
     14  1.7.2.2  christos GNUEFIARCH?= ${MACHINE_CPU}
     15  1.7.2.2  christos CPPFLAGS+= -I${EFIDIR}/inc -I${EFIDIR}/inc/${GNUEFIARCH}
     16  1.7.2.2  christos CPPFLAGS+= -I${EFIDIR}/inc/protocol
     17  1.7.2.2  christos 
     18  1.7.2.2  christos LDSCRIPT?= ${EFIDIR}/gnuefi/elf_${GNUEFIARCH}_efi.lds
     19  1.7.2.2  christos 
     20  1.7.2.2  christos AFLAGS.start.S= ${${ACTIVE_CC} == "clang":?-no-integrated-as:}
     21  1.7.2.2  christos 
     22  1.7.2.2  christos .PATH: ${EFIDIR}/gnuefi
     23  1.7.2.2  christos SOURCES=	crt0-efi-${GNUEFIARCH}.S reloc_${GNUEFIARCH}.c
     24  1.7.2.2  christos SOURCES+=	boot.c conf.c console.c dev_net.c devopen.c exec.c panic.c prompt.c
     25  1.7.2.2  christos SOURCES+=	efiboot.c efichar.c efidev.c efienv.c efigetsecs.c efifdt.c efifile.c efiblock.c efinet.c efipxe.c efiacpi.c
     26  1.7.2.2  christos 
     27  1.7.2.2  christos .PATH: ${S}/external/bsd/libfdt/dist
     28  1.7.2.2  christos CPPFLAGS+=	-I${S}/external/bsd/libfdt/dist
     29  1.7.2.2  christos SOURCES+=	fdt.c fdt_addresses.c fdt_empty_tree.c fdt_overlay.c
     30  1.7.2.2  christos SOURCES+=	fdt_ro.c fdt_rw.c fdt_strerror.c fdt_sw.c fdt_wip.c
     31  1.7.2.2  christos 
     32  1.7.2.2  christos SRCS= ${SOURCES} ${EXTRA_SOURCES}
     33  1.7.2.2  christos 
     34  1.7.2.2  christos .include <bsd.init.mk>
     35  1.7.2.2  christos 
     36  1.7.2.2  christos STRIPFLAG=	# nothing
     37  1.7.2.2  christos 
     38  1.7.2.2  christos LIBCRT0=	# nothing
     39  1.7.2.2  christos LIBCRTI=	# nothing
     40  1.7.2.2  christos LIBCRTBEGIN=	# nothing
     41  1.7.2.2  christos LIBCRTEND=	# nothing
     42  1.7.2.2  christos LIBC=		# nothing
     43  1.7.2.2  christos 
     44  1.7.2.2  christos BINDIR=/usr/mdec
     45  1.7.2.2  christos BINMODE=444
     46  1.7.2.2  christos 
     47  1.7.2.2  christos .PATH:	${.CURDIR} ${.CURDIR}/..
     48  1.7.2.2  christos .PATH:	${.CURDIR}/../../lib
     49  1.7.2.2  christos 
     50  1.7.2.2  christos LDFLAGS+= -nostdlib -T${LDSCRIPT} -Bsymbolic -shared
     51  1.7.2.2  christos CPPFLAGS+= -I$S -I${.CURDIR} -I${.CURDIR}/../common -I$S/lib/libsa
     52  1.7.2.2  christos CPPFLAGS+= -I${.OBJDIR}
     53  1.7.2.2  christos CPPFLAGS+= -I${.CURDIR}/../../lib
     54  1.7.2.2  christos CPPFLAGS+= -I${S}/../common/include
     55  1.7.2.2  christos 
     56  1.7.2.2  christos COPTS+=	-fpic -g -O2
     57  1.7.2.2  christos COPTS+=	-fshort-wchar -fno-strict-aliasing
     58  1.7.2.2  christos COPTS+=	-ffreestanding -fno-stack-protector
     59  1.7.2.2  christos LDFLAGS+= --defsym=EFI_SUBSYSTEM=0xa
     60  1.7.2.2  christos 
     61  1.7.2.2  christos 
     62  1.7.2.2  christos COPTS+= ${${ACTIVE_CC} == "gcc":? -Wno-error=unused-but-set-variable :}
     63  1.7.2.2  christos CPPFLAGS+= -nostdinc -D_STANDALONE
     64  1.7.2.2  christos CPPFLAGS+= -DEFIBOOT
     65  1.7.2.2  christos CPPFLAGS+= -DPROGRESS_FN=efi_progress
     66  1.7.2.2  christos 
     67  1.7.2.2  christos CPPFLAGS+= -Wall -Wmissing-prototypes
     68  1.7.2.2  christos CPPFLAGS+= -Wno-pointer-sign
     69  1.7.2.2  christos 
     70  1.7.2.2  christos CPPFLAGS+= -DHEAP_VARIABLE
     71  1.7.2.2  christos #CPPFLAGS+= -DSUPPORT_CD9660
     72  1.7.2.2  christos CPPFLAGS+= -D"devb2cdb(bno)=(bno)"
     73  1.7.2.2  christos CPPFLAGS+= -DSUPPORT_DOSFS
     74  1.7.2.2  christos #CPPFLAGS+= -DSUPPORT_EXT2FS
     75  1.7.2.2  christos CPPFLAGS+= -DSUPPORT_BOOTP
     76  1.7.2.2  christos CPPFLAGS+= -DSUPPORT_DHCP
     77  1.7.2.2  christos #CPPFLAGS+= -DSUPPORT_NFS
     78  1.7.2.2  christos CPPFLAGS+= -DSUPPORT_TFTP
     79  1.7.2.2  christos CPPFLAGS+= -DLIBSA_ENABLE_LS_OP
     80  1.7.2.2  christos 
     81  1.7.2.2  christos #CPPFLAGS+= -DEFIBOOT_DEBUG
     82  1.7.2.2  christos #CPPFLAGS+= -DARP_DEBUG
     83  1.7.2.2  christos #CPPFLAGS+= -DBOOTP_DEBUG
     84  1.7.2.2  christos #CPPFLAGS+= -DNET_DEBUG
     85  1.7.2.2  christos #CPPFLAGS+= -DNETIF_DEBUG
     86  1.7.2.2  christos #CPPFLAGS+= -DNFS_DEBUG
     87  1.7.2.2  christos #CPPFLAGS+= -DRARP_DEBUG
     88  1.7.2.2  christos #CPPFLAGS+= -DRPC_DEBUG
     89  1.7.2.2  christos 
     90  1.7.2.2  christos SAMISCCPPFLAGS+= -DLIBSA_PRINTF_LONGLONG_SUPPORT
     91  1.7.2.2  christos SAMISCCPPFLAGS+= -DLIBSA_PRINTF_WIDTH_SUPPORT
     92  1.7.2.2  christos SAMISCCPPFLAGS+= -D"cdb2devb(bno)=(bno)"
     93  1.7.2.2  christos 
     94  1.7.2.2  christos ### find out what to use for libsa
     95  1.7.2.2  christos SA_AS= library
     96  1.7.2.2  christos SAMISCMAKEFLAGS+="SA_USE_LOADFILE=yes"
     97  1.7.2.2  christos SAMISCMAKEFLAGS+="SA_USE_CREAD=yes"
     98  1.7.2.2  christos SAMISCMAKEFLAGS+="SA_INCLUDE_NET=yes"
     99  1.7.2.2  christos SAMISCMAKEFLAGS+="SA_ENABLE_LS_OP=yes"
    100  1.7.2.2  christos .include "${S}/lib/libsa/Makefile.inc"
    101  1.7.2.2  christos LIBSA= ${SALIB}
    102  1.7.2.2  christos 
    103  1.7.2.2  christos ### find out what to use for libkern
    104  1.7.2.2  christos KERN_AS= library
    105  1.7.2.2  christos LIBKERN_ARCH?= ${MACHINE_ARCH}
    106  1.7.2.2  christos KERNMISCMAKEFLAGS+="LIBKERN_ARCH=${LIBKERN_ARCH}"
    107  1.7.2.2  christos .include "${S}/lib/libkern/Makefile.inc"
    108  1.7.2.2  christos LIBKERN= ${KERNLIB}
    109  1.7.2.2  christos 
    110  1.7.2.2  christos ### find out what to use for libz
    111  1.7.2.2  christos Z_AS= library
    112  1.7.2.2  christos .include "${S}/lib/libz/Makefile.inc"
    113  1.7.2.2  christos LIBZ= ${ZLIB}
    114  1.7.2.2  christos 
    115  1.7.2.2  christos ### find out what to use for libgnuefi
    116  1.7.2.2  christos GNUEFI_AS= library
    117  1.7.2.2  christos LIBGNUEFI_ARCH?= ${MACHINE_ARCH}
    118  1.7.2.2  christos GNUEFIMISCMAKEFLAGS+="LIBGNUEFI_ARCH=${LIBGNUEFI_ARCH}"
    119  1.7.2.2  christos GNUEFIMISCCPPFLAGS+= -I${EFIDIR}/lib
    120  1.7.2.2  christos .include "${S}/lib/libgnuefi/Makefile.inc"
    121  1.7.2.2  christos LIBGNUEFI= ${GNUEFILIB}
    122  1.7.2.2  christos 
    123  1.7.2.2  christos cleandir distclean: .WAIT cleanlibdir
    124  1.7.2.2  christos 
    125  1.7.2.2  christos cleanlibdir:
    126  1.7.2.2  christos 	-rm -rf lib
    127  1.7.2.2  christos 
    128  1.7.2.2  christos LIBLIST= ${LIBGNUEFI} ${LIBSA} ${LIBZ} ${LIBKERN} ${LIBSA}
    129  1.7.2.2  christos 
    130  1.7.2.2  christos VERSIONMACHINE=evbarm
    131  1.7.2.2  christos .include "${S}/conf/newvers_stand.mk"
    132  1.7.2.2  christos 
    133  1.7.2.2  christos CLEANFILES+=	${PROG}.so ${PROG}.tmp
    134  1.7.2.2  christos 
    135  1.7.2.2  christos ${PROG}: ${PROG}.so
    136  1.7.2.2  christos 	${OBJCOPY} -j .text -j .sdata -j .data -j .dynamic -j .dynsym -j .rel \
    137  1.7.2.2  christos 	    -j .rela -j .rel.* -j .rela.* -j .rel* -j .rela* \
    138  1.7.2.2  christos 	    -j .reloc -O binary ${PROG}.so ${.TARGET}
    139  1.7.2.2  christos 
    140  1.7.2.2  christos .include <bsd.prog.mk>
    141  1.7.2.2  christos 
    142  1.7.2.2  christos ${PROG}.so: ${OBJS} ${LIBLIST} ${LDSCRIPT} ${.CURDIR}/../Makefile.efiboot
    143  1.7.2.2  christos 	${LD} ${LDFLAGS} -o ${.TARGET}.tmp ${OBJS} ${LIBLIST}
    144  1.7.2.2  christos 	@if ${OBJDUMP} -t ${.TARGET}.tmp | grep 'UND'; then		\
    145  1.7.2.2  christos 	    (echo Undefined symbols; false);				\
    146  1.7.2.2  christos 	fi
    147  1.7.2.2  christos 	rm -f ${.TARGET}
    148  1.7.2.2  christos 	mv ${.TARGET}.tmp ${.TARGET}
    149  1.7.2.2  christos 
    150  1.7.2.2  christos KLINK_MACHINE?=	${MACHINE}
    151  1.7.2.2  christos .include <bsd.klinks.mk>
    152