buildworld: Really support static toolchain.
[dragonfly.git] / gnu / usr.bin / binutils227 / block2 / ld / Makefile
blob074b3dd2683643ab7ed27dcd06504a782fd8ed38
1 .include "../../Makefile.inc1"
2 .include "../Makefile.block2"
4 .PATH: ${SRCDIR}/ld
6 PROG= ld.bfd
7 MFILE= ld${MANPAGEVER}.1
8 MAN= ${MFILE}
9 SRCS+= ldgram.y \
10 ldlex.l \
11 lexsup.c \
12 ldlang.c \
13 mri.c \
14 ldctor.c \
15 ldmain.c \
16 ldwrite.c \
17 ldexp.c \
18 ldemul.c \
19 ldver.c \
20 ldmisc.c \
21 ldfile.c \
22 ldcref.c \
23 plugin.c \
24 ldbuildid.c
25 LDADD= ${LDADD_BFD} ${LDADD_IBERTY} -lz
27 LIBEXEC_BINUTILS= ${BINDIR}/..
28 SCRIPTDIR= ${LIBEXEC_BINUTILS}/ldscripts
29 ELF_SCR_EXT= x xbn xc xd xdc xdw xn xr xs xsc xsw xu xw
31 .include "Makefile.x86_64"
33 # We need to change CFLAGS, so that not to pick up bulibs's config.h first.
34 BULIBS_INC:= # empty
36 CFLAGS+= -I${SRCDIR}/include -I${SRCDIR}/bfd
37 CFLAGS+= -I${SRCDIR}/ld -I${.OBJDIR} -I${.CURDIR}
38 CFLAGS+= ${_BULIBS_INC} # for bfd.h
40 CFLAGS+= -DSCRIPTDIR=\"${TOOLS_PREFIX}${LIBEXEC_BINUTILS}\"
41 CFLAGS+= -DBINDIR=\"${TOOLS_PREFIX}${LIBEXEC_BINUTILS}\"
42 CFLAGS+= -DTOOLBINDIR=\"${TOOLS_PREFIX}${LIBEXEC_BINUTILS}\"
43 CFLAGS+= -DENABLE_PLUGINS -DHAVE_CONFIG_H
44 CFLAGS+= -DTARGET_SYSTEM_ROOT=\"${USRDATA_PREFIX}\"
46 CFLAGS+= -DELF_LIST_OPTIONS=TRUE
47 CFLAGS+= -DELF_SHLIB_LIST_OPTIONS=TRUE
48 CFLAGS+= -DELF_PLT_UNWIND_LIST_OPTIONS=TRUE
50 # XXX: Do we want -Wl,-z,relro on by default? Differs for ld.bfd and lg.gold.
51 CFLAGS+= -DDEFAULT_LD_Z_RELRO=0
53 # link-time optimization requires dlopen() which means ld cannot be built
54 # statically and also support -plugin, not even for cross-tools.
55 .if !defined(REALLY_NOSHARED)
56 .undef NOSHARED
57 .endif
59 ldemul.c: ldemul-list.h
61 CLEANDIRS+= ldscripts tmpdir
62 CLEANFILES+= ldemul-list.h stringify.sed
64 EMXFR=
65 EMLST=
66 .for _e in ${EMS}
67 EMXFR+= extern ld_emulation_xfer_type ld_${_e}_emulation;
68 EMLST+= &ld_${_e}_emulation,
69 .endfor
71 ldemul-list.h:
72 echo "${EMXFR}" > ${.TARGET}
73 echo "#define EMULATION_LIST ${EMLST} 0" >> ${.TARGET}
75 stringify.sed:
76 ${LN} -sf ${SRCDIR}/ld/emultempl/astring.sed ${.TARGET}
78 ${MFILE}: ${SRCDIR}/ld/ld.1
79 cp ${.ALLSRC} ${.TARGET}
81 install-ldscripts: ${LDSCRIPTS:S|^|ldscripts/|}
82 ${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
83 ${.ALLSRC} ${DESTDIR}${SCRIPTDIR}
85 .if defined(IS_PRIMARY)
86 MLINKS+= ${MFILE} ld.1
87 .endif
89 afterinstall: install-ldscripts
91 CLEANDIRS+= ldscripts tmpdir
92 CLEANFILES+= ${MFILE} ldemul-list.h stringify.sed
94 .include <bsd.prog.mk>