blob: 5fe0028f593fc5c0d586bb9064183abffacebbc3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
|
# $NetBSD: Makefile,v 1.25 2001/11/19 05:06:50 perry Exp $
# for OBJECT_FMT, UNPRIVED
.include <bsd.own.mk>
.if !defined(USE_NEW_TOOLCHAIN)
.if (${OBJECT_FMT} == "ELF") || defined(BOOTSTRAP_ELF)
ELF_PLEASE=
.endif
.if (${MACHINE_ARCH} == "alpha") || \
(${MACHINE_ARCH} == "i386" && defined(ELF_PLEASE)) || \
(${MACHINE_ARCH} == "m68k" && defined(ELF_PLEASE)) || \
(${MACHINE_ARCH} == "mipseb") || \
(${MACHINE_ARCH} == "mipsel") || \
(${MACHINE_ARCH} == "powerpc") || \
(${MACHINE_ARCH} == "sh3eb") || \
(${MACHINE_ARCH} == "sh3el") || \
(${MACHINE_ARCH} == "sparc" && defined(ELF_PLEASE))
PROG= ld
MAN= ld.1
SRCS= ldctor.c ldemul.c ldexp.c ldfile.c ldlang.c ldmain.c ldmisc.c \
ldver.c ldwrite.c lexsup.c mri.c ldcref.c ldgram.y ldlex.l
DPSRCS= ldemul-list.h
.else
NOPROG=
.endif
CPPFLAGS+= -I. -I${.CURDIR} -I${BFDOBJ} -I${DIST}/ld \
-I${DIST}/bfd -I${DIST}/include \
-DDEFAULT_EMULATION='"${DEFAULT_EMUL.${MACHINE_ARCH}}"' \
-DSCRIPTDIR=\"${SCRIPTDIR}\" \
-DTARGET='"${MACHINE_GNU_ARCH}--netbsd"' \
-DEMULATION_LIST='${EMULS:S/^/\&ld_/:S/$/_emulation,/} 0'
LDADD+= -L${BFDOBJ} -lbfd
DPADD+= ${BFDOBJ}/libbfd_pic.a
YHEADER=1
TEXINFO= ld.texi
INFOFLAGS= -I${DIST}/ld -I${DIST}/bfd/doc
DIST= ${.CURDIR}/../../dist
BFDOBJ!= cd ${.CURDIR}/../../lib/libbfd && ${PRINTOBJDIR}
SCRIPTDIR= /usr/share/ldscripts
.PATH: ${DIST}/ld
##### alpha ######
EMULS.alpha= elf64alpha
DEFAULT_EMUL.alpha= elf64alpha
##### i386 #####
EMULS.i386= i386nbsd elf_i386
.if defined(ELF_PLEASE)
DEFAULT_EMUL.i386= elf_i386
.else
DEFAULT_EMUL.i386= i386nbsd
.endif
##### m68k #####
EMULS.m68k= m68knbsd m68kelfnbsd
.if defined(ELF_PLEASE)
DEFAULT_EMUL.m68k= m68kelfnbsd
.else
DEFAULT_EMUL.m68k= m68knbsd
.endif
##### mipseb #####
EMULS.mipseb= elf32lmip elf32bmip
DEFAULT_EMUL.mipseb= elf32bmip
##### mipsel #####
EMULS.mipsel= elf32lmip elf32bmip
DEFAULT_EMUL.mipsel= elf32lmip
##### powerpc #####
EMULS.powerpc= elf32ppc
DEFAULT_EMUL.powerpc= elf32ppc
##### sh3eb #####
EMULS.sh3eb= shunx shlunx elf32shunx elf32shlunx
.if defined(ELF_PLEASE)
DEFAULT_EMUL.sh3eb= elf32shunx
.else
DEFAULT_EMUL.sh3eb= shunx
.endif
##### sh3el #####
EMULS.sh3el= shunx shlunx elf32shunx elf32shlunx
.if defined(ELF_PLEASE)
DEFAULT_EMUL.sh3el= elf32shlunx
.else
DEFAULT_EMUL.sh3el= shlunx
.endif
##### sparc #####
EMULS.sparc= sparcnbsd elf32_sparc sun4
.if defined(ELF_PLEASE)
DEFAULT_EMUL.sparc= elf32_sparc
.else
DEFAULT_EMUL.sparc= sparcnbsd
.endif
##### sparc64 #####
EMULS.sparc64= elf64_sparc sparcnbsd elf32_sparc sun4
DEFAULT_EMUL.sparc64= elf64_sparc
ALL_EMULS!= (for i in ${EMULS.alpha} ${EMULS.i386} ${EMULS.m68k} \
${EMULS.mipseb} ${EMULS.mipsel} ${EMULS.powerpc} \
${EMULS.sh3eb} ${EMULS.sh3el} ${EMULS.sparc} \
${EMULS.sparc64}; do echo $$i; done) | \
sort | uniq
LIB_PATH= ${LIBDIR} # passed to genscripts
# The ldscripts need to be generated even if we don't build ld.
.for _EMUL_ in ${ALL_EMULS}
CLEANFILES+= e${_EMUL_}.c
realall: e${_EMUL_}.c
e${_EMUL_}.c: ${DIST}/ld/genscripts.sh ${DIST}/ld/emulparams/${_EMUL_}.sh
sh ${DIST}/ld/genscripts.sh ${DIST}/ld ${LIBDIR} \
${MACHINE_GNU_ARCH}-netbsd ${MACHINE_GNU_ARCH}-netbsd \
${MACHINE_GNU_ARCH}-netbsd ${_EMUL_} \
"" ${_EMUL_}
.endfor
.if !defined(NOPROG)
#.if defined(UNIFIED_LD)
#EMULS= ${ALL_EMULS} # XXX not quite functional yet
#.else
EMULS= ${EMULS.${MACHINE_ARCH}}
#.endif
.for _EMUL_ in ${EMULS}
SRCS+= e${_EMUL_}.c
.endfor
ldemul-list.h: Makefile
@rm -f $@
@echo updating $@
@for emul in ${EMULS}; do \
echo "extern ld_emulation_xfer_type ld_$${emul}_emulation;" >>$@; \
done
.endif
.include <bsd.own.mk>
afterinstall:
.if ${MKSHARE} != "no"
(cd ldscripts ; pax -rw . ${DESTDIR}${SCRIPTDIR})
.if !defined(UNPRIVED)
chown -R ${BINOWN}:${BINGRP} ${DESTDIR}${SCRIPTDIR}
.endif
find ${DESTDIR}${SCRIPTDIR} -type f | xargs chmod a=rX
find ${DESTDIR}${SCRIPTDIR} -type d | xargs chmod u=rwX,go=rX
.endif
cleanprog: __cleanldscripts
__cleanldscripts:
rm -rf ldscripts
.include <bsd.info.mk>
.endif
.include <bsd.prog.mk>
${OBJS}: ldemul-list.h
|