Home | History | Annotate | Line # | Download | only in libbfd
      1 #	$NetBSD: Makefile,v 1.13 2026/02/10 19:59:42 christos Exp $
      2 
      3 NOLINKLIB=	# defined
      4 NOLINT=		# defined
      5 NOMAN=		# defined
      6 NOPROFILE=	# defined
      7 NOCLANGERROR=	# defined
      8 
      9 .include <bsd.init.mk>
     10 
     11 # If the platform does not support shared libraries, we need to supply
     12 # *something* for BFD-using programs to link against.  Also provide an
     13 # empty libinstall target so that libbfd.a does not get installed.
     14 .if ${MKPIC} == "no"
     15 MKLINKLIB=	yes
     16 libinstall:	# do nothing
     17 .endif
     18 
     19 LIB=		bfd
     20 
     21 BFD_MACHINE_ARCH?=	${MACHINE_ARCH:C/armv[4-7]/arm/}
     22 
     23 DEFS_MK=${.CURDIR}/arch/${BFD_MACHINE_ARCH}/defs.mk
     24 # XXX: Fix me
     25 BINDIR=/usr/bin
     26 BINDIR=/usr/lib
     27 
     28 .if exists(${DEFS_MK})
     29 .include "${DEFS_MK}"
     30 
     31 SHLIB_MAJOR=	20
     32 SHLIB_MINOR=	0
     33 
     34 LIBDPLIBS+=	z	${.CURDIR}/../../../../../lib/libz
     35 
     36 GCPPFLAGS=	${G_archdefs} ${G_DEFS} ${G_INCLUDES} ${G_TDEFAULTS}
     37 GCPPFLAGS+=	${G_HAVEVECS}
     38 
     39 CPPFLAGS+=	-I${.CURDIR}/arch/${BFD_MACHINE_ARCH} -I${DIST}/include -I. \
     40 		-I${DIST}/bfd ${GCPPFLAGS:M-D*} ${GCPPFLAGS:M-I*:N-I.*} \
     41 		-DDEBUGDIR=\"${DEBUGDIR}\" -DLIBDIR=\"${LIBDIR}\" \
     42 		-DBINDIR=\"${BINDIR}\"
     43 
     44 COPTS.pei-x86_64.c+=	-Wno-stack-protector
     45 COPTS.elfxx-mips.c+=	-Wno-stack-protector
     46 COPTS.elf.c+=		${${ACTIVE_CC} == "gcc" && ${HAVE_GCC:U0} >= 10:? -Wno-overflow :}
     47 
     48 GSRCS=		${G_libbfd_la_OBJECTS:libbfd.lo=lib_bfd.lo} \
     49 		${G_libbfd_la_DEPENDENCIES:M*.lo}
     50 SRCS=		${GSRCS:.lo=.c}
     51 
     52 DPSRCS+=	elf32-target.h elf64-target.h targmatch.h \
     53 		elf32-aarch64.c elf64-aarch64.c \
     54 		elf32-ia64.c elf64-ia64.c \
     55 		elf32-riscv.c elf64-riscv.c \
     56 		peigen.c pepigen.c \
     57 		pex64igen.c
     58 CLEANFILES+=	elf32-target.h elf64-target.h targmatch.h \
     59 		elf32-aarch64.c elf64-aarch64.c \
     60 		elf32-ia64.c elf64-ia64.c \
     61 		elf32-riscv.c elf64-riscv.c \
     62 		peigen.c pepigen.c \
     63 		pex64igen.c
     64 
     65 TEXINFO=	bfd.texinfo
     66 INFOFLAGS=	-I${DIST}/bfd/doc
     67 
     68 .PATH: ${DIST}/bfd ${DIST}/bfd/doc
     69 
     70 .include <bsd.lib.mk>
     71 .include <bsd.info.mk>
     72 
     73 ${OBJS} ${SOBJS}: elf32-target.h elf64-target.h
     74 targets.o targets.pico: targmatch.h Makefile
     75 .else
     76 .include <bsd.prog.mk> # do nothing
     77 .endif
     78 
     79 targmatch.h: config.bfd targmatch.sed
     80 	${_MKTARGET_CREATE}
     81 	${TOOL_SED} -f ${.ALLSRC:M*.sed} ${.ALLSRC:M*.bfd} >$@
     82 
     83 elf32-target.h: elfxx-target.h
     84 	${_MKTARGET_CREATE}
     85 	${TOOL_SED} -e s/NN/32/g < $> > $@
     86 
     87 elf64-target.h: elfxx-target.h
     88 	${_MKTARGET_CREATE}
     89 	${TOOL_SED} -e s/NN/64/g < $> > $@
     90 
     91 elf32-aarch64.c: elfnn-aarch64.c
     92 	${_MKTARGET_CREATE}
     93 	${TOOL_SED} -e s/NN/32/g < $> > $@
     94 
     95 elf64-aarch64.c: elfnn-aarch64.c
     96 	${_MKTARGET_CREATE}
     97 	${TOOL_SED} -e s/NN/64/g < $> > $@
     98 
     99 elf32-ia64.c: elfnn-ia64.c
    100 	${_MKTARGET_CREATE}
    101 	${TOOL_SED} -e s/NN/32/g < $> > $@
    102 
    103 elf64-ia64.c: elfnn-ia64.c
    104 	${_MKTARGET_CREATE}
    105 	${TOOL_SED} -e s/NN/64/g < $> > $@
    106 
    107 elf32-riscv.c: elfnn-riscv.c
    108 	${_MKTARGET_CREATE}
    109 	${TOOL_SED} -e s/NN/32/g < $> > $@
    110 
    111 elf64-riscv.c: elfnn-riscv.c
    112 	${_MKTARGET_CREATE}
    113 	${TOOL_SED} -e s/NN/64/g < $> > $@
    114 
    115 peigen.c: peXXigen.c
    116 	${_MKTARGET_CREATE}
    117 	${TOOL_SED} -e s/XX/pe/g < $> > $@
    118 
    119 pepigen.c: peXXigen.c
    120 	${_MKTARGET_CREATE}
    121 	${TOOL_SED} -e s/XX/pep/g < $> > $@
    122 
    123 pex64igen.c: peXXigen.c
    124 	${_MKTARGET_CREATE}
    125 	${TOOL_SED} -e s/XX/pex64/g < $> > $@
    126 
    127 pe-aarch64igen.c: peXXigen.c
    128 	${_MKTARGET_CREATE}
    129 	${TOOL_SED} -e s/XX/peAArch64/g < $> > $@
    130 
    131 pe-riscv64igen.c: peXXigen.c
    132 	${_MKTARGET_CREATE}
    133 	${TOOL_SED} -e s/XX/peRiscV64/g < $> > $@
    134 
    135