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