# This is included explicitly at the top of each sub-Makefile.  We can't
# use the normal "Makefile.inc" mechanism, because we need some of these
# definitions before the sub-Makefile is processed.

RELTOP:= ../..

# RELTOP is the relative path to this point in the source or object
# tree, from any subdirectory of same.  It gets extra "../" prefixes
# added to it as we descend into subdirectories.

RELSRC=	${RELTOP}/../../../contrib/binutils-2.27
SRCDIR=	${.CURDIR}/${RELSRC}
OBJTOP=	${.OBJDIR}/${RELTOP}
TSR=	/${USRDATA_PREFIX}

.PATH: ${SRCDIR}/gold

CFLAGS+= -DHAVE_CONFIG_H
CFLAGS+= -D_LARGEFILE_SOURCE
CFLAGS+= -D_FILE_OFFSET_BITS=64
CFLAGS+= -DBINDIR="\"${TOOLS_PREFIX}${BINDIR}\""
CFLAGS+= -DTOOLBINDIR="\"${TOOLS_PREFIX}${BINDIR}\""
CFLAGS+= -DTOOLLIBDIR="\"${TOOLS_PREFIX}${LIBDIR}\""
CFLAGS+= -DTARGET_SYSTEM_ROOT="\"${TSR:S|//|/|}\""
CFLAGS+= -I. -I${.CURDIR} -I${SRCDIR}/gold
CFLAGS+= -I${SRCDIR}/include -I${SRCDIR}/elfcpp

# XXX: Do we want -Wl,-z,relro on by default? Differs for ld.bfd and lg.gold.
CFLAGS+=	-DDEFAULT_LD_Z_RELRO=0

LDADD_IBERTY=	${OBJTOP}/block1/libiberty/libiberty.a
LDADD_GOLD=	${OBJTOP}/block2/libgold/libgold.a
STD_LDADD=	${LDADD_GOLD} ${LDADD_IBERTY} -lz ${CROSS_LIBDL}

# source files common to both ld.gold and incremental-dump

GOLD_COMMON=	i386.cc \
		x86_64.cc

# hmmm		sparc.cc \
		powerpc.cc \
		arm.cc \
		arm-reloc-property.cc \
		tilegx.cc \
		mips.cc \
		aarch64.cc \
		aarch64-reloc-property.cc
