blob: f3144b0bb2ef9268d34894a649e74913e0a221f9 (
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
|
#! /usr/bin/make -f
CFLAGS = -g -O2
configure:
# Generate the main makefile.
# Use shared BFD and opcodes libraries for all utilities.
# Don't enable multilib (multiarch is better).
# Enable plugins.
# Don't expect to find Gettext.
for target in $$(cat ../targets); do \
CFLAGS='$(CFLAGS)' oh-autoconfigure \
-B "build-$${target}" -t "$${target}" -- \
$$([ -n "$${OPK_SYSROOT}" ] && \
printf "--with-sysroot='%s'" "$${OPK_SYSROOT}") \
--program-transform-name="s&^&$${target}-&" \
--enable-shared --disable-multilib \
--enable-plugins --disable-nls \
--with-pkgversion='GNU Binutils for ProteanOS' || \
exit 1; \
done
# Generate all the individual program makefiles.
for target in $$(cat ../targets); do \
oh-autobuild -B "build-$${target}" -T configure-host \
tooldir='/usr/tool' scriptdir="/usr/lib/$${target}" \
bfdlibdir="/usr/lib/$(OPK_HOST_ARCH)/$${target}" \
bfdincludedir="/usr/include/$(OPK_HOST_ARCH)/$${target}" || \
exit 1; \
done
touch $@
build: configure
# Build BFD header files.
for target in $$(cat ../targets); do \
oh-autobuild -B "build-$${target}/bfd" -T headers \
tooldir='/usr/tool' scriptdir="/usr/lib/$${target}" \
bfdlibdir="/usr/lib/$(OPK_HOST_ARCH)/$${target}" \
bfdincludedir="/usr/include/$(OPK_HOST_ARCH)/$${target}" || \
exit 1; \
done
# Build ALL the things!
for target in $$(cat ../targets); do \
oh-autobuild -B "build-$${target}" CFLAGS='$(CFLAGS)' \
tooldir='/usr/tool' scriptdir="/usr/lib/$${target}" \
bfdlibdir="/usr/lib/$(OPK_HOST_ARCH)/$${target}" \
bfdincludedir="/usr/include/$(OPK_HOST_ARCH)/$${target}" || \
exit 1; \
done
touch $@
install: build
# Install everything.
# scriptdir contains target ldscripts.
# ldscripts should be independent of the host architecture and therefore
# coinstallable with themselves across host architectures (I hope).
# All of these macro settings are effective thanks to
# `patches/01_pass-some-dirs-to-child-makes.patch`.
for target in $$(cat ../targets); do \
oh-autoinstall -B "build-$${target}" CFLAGS='$(CFLAGS)' \
tooldir='/usr/tool' scriptdir="/usr/lib/$${target}" \
bfdlibdir="/usr/lib/$(OPK_HOST_ARCH)/$${target}" \
bfdincludedir="/usr/include/$(OPK_HOST_ARCH)/$${target}" || \
exit 1; \
done
# /usr/tool/bin (TOOLBINDIR) contains hard links to tools. A quick look at
# the code suggests we don't need them; ld *should* work without them in any
# sane configuration.
rm -Rf dest/usr/tool
# We don't need a static libiberty.
find dest/usr/lib -name 'libiberty.a' -exec rm -f '{}' ';'
# Remove static library dependency metadata generated by libtool.
find dest/usr/lib -name '*.la' -exec rm -f '{}' ';'
# Make symbolic links to native utilities.
for target in $$(cat ../targets); do \
if [ '$(OPK_HOST_ARCH)' = "$${target}" ]; then \
for util in "../dest/usr/bin/$${target}-"*; do \
ln -sf "$${util##*/}" "$${util%/*}/$${util##*/$${target}}"; \
done \
fi; \
done
# Write GNU ld configuration to point to BFD libraries.
mkdir -p dest/etc/ld.so.conf.d
for target in $$(cat ../targets); do \
echo '# GNU BFD libraries' \
>"dest/etc/ld.so.conf.d/bfd_$(OPK_HOST_ARCH)_$${target}" && \
echo "/usr/lib/$(OPK_HOST_ARCH)/$${target}" \
>>"dest/etc/ld.so.conf.d/bfd_$(OPK_HOST_ARCH)_$${target}"; \
done
# Post-process and install everything.
oh-fixperms
oh-strip
oh-installfiles
touch $@
clean:
for target in $$(cat ../targets); do \
oh-autoclean -B "build-$${target}" || \
exit 1; \
done
rm -f configure build
rm -Rf *.data
|