aboutsummaryrefslogtreecommitdiffstats
path: root/devel/cross-binutils/Makefile
blob: dfe2a0d1905c1e76b54b328c8944f984e721c5f4 (plain) (blame)
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
# Created by: Stanislav Sedov <stas@FreeBSD.org>
# $FreeBSD$

PORTNAME=   binutils
PORTVERSION=    2.23.2
CATEGORIES= devel
MASTER_SITES=   ${MASTER_SITE_SOURCEWARE}
MASTER_SITE_SUBDIR= binutils/releases
PKGNAMEPREFIX=  ${TGTARCH}-${TGTABI}-

PATCH_SITES=    ftp://ftp.rtems.com/pub/rtems/SOURCES/4.11/
PATCH_DIST_STRIP=   -p1

MAINTAINER= christoph.mallon@gmx.de
COMMENT=    GNU binutils port for cross-target development

USE_BZIP2=  yes
USE_GMAKE=  yes
GNU_CONFIGURE=  yes
ALL_TARGET= all info
MAKE_JOBS_UNSAFE=   yes

OPTIONS_DEFINE=     RTEMS_PATCHES

RTEMS_PATCHES_DESC= Apply RTEMS patches

NO_STAGE=   yes
.include <bsd.port.options.mk>

CONFIGURE_ARGS+=    --disable-nls \
            --with-system-zlib \
            --target=${OURTARGET} \
            --disable-werror

OURTARGET=  ${TGTARCH}-${TGTABI}

MAN1=       ${OURTARGET}-addr2line.1 \
        ${OURTARGET}-ar.1 \
        ${OURTARGET}-as.1 \
        ${OURTARGET}-c++filt.1 \
        ${OURTARGET}-elfedit.1 \
        ${OURTARGET}-dlltool.1 \
        ${OURTARGET}-ld.1 \
        ${OURTARGET}-nlmconv.1 \
        ${OURTARGET}-nm.1 \
        ${OURTARGET}-objcopy.1 \
        ${OURTARGET}-objdump.1 \
        ${OURTARGET}-ranlib.1 \
        ${OURTARGET}-readelf.1 \
        ${OURTARGET}-size.1 \
        ${OURTARGET}-strings.1 \
        ${OURTARGET}-strip.1 \
        ${OURTARGET}-windmc.1 \
        ${OURTARGET}-windres.1

INFO=       ${OURTARGET}-as \
        ${OURTARGET}-bfd \
        ${OURTARGET}-binutils \
        ${OURTARGET}-ld

PLIST_FILES=    bin/${OURTARGET}-addr2line \
        bin/${OURTARGET}-ar \
        bin/${OURTARGET}-as \
        bin/${OURTARGET}-c++filt \
        bin/${OURTARGET}-elfedit \
        bin/${OURTARGET}-ld \
        bin/${OURTARGET}-ld.bfd \
        bin/${OURTARGET}-nm \
        bin/${OURTARGET}-objcopy \
        bin/${OURTARGET}-objdump \
        bin/${OURTARGET}-ranlib \
        bin/${OURTARGET}-readelf \
        bin/${OURTARGET}-size \
        bin/${OURTARGET}-strings \
        bin/${OURTARGET}-strip

.if defined(TGTARCH) && ${TGTARCH} != mips
MAN1+=      ${OURTARGET}-gprof.1
INFO+=      ${OURTARGET}-gprof
PLIST_FILES+=   bin/${OURTARGET}-gprof
.endif

.if defined(TGTABI) && (${TGTABI} == pc-mingw32 || ${TGTABI} == mingw32)
PLIST_FILES+=   bin/${OURTARGET}-dlltool \
        bin/${OURTARGET}-dllwrap \
        bin/${OURTARGET}-windmc \
        bin/${OURTARGET}-windres
.endif

.if ${PORT_OPTIONS:MRTEMS_PATCHES}
PATCHFILES+=    ${PORTNAME}-${PORTVERSION}-rtems4.11-20130326.diff
.endif

.if !defined(TGTARCH) || !defined(TGTABI)
PKGNAMEPREFIX=  cross-
IGNORE=     you should define TGTARCH and TGTABI to build port
.endif

#
# Macro to fix up info referencies
#
FIXREFS=    ${SH} -c '${REINPLACE_CMD} -E \
        -e "s,$$0\.(texi|info),${OURTARGET}-$$0.\1,g" \
        -e "s,(@file)\{$$0\},\1\{${OURTARGET}-$$0\},g" \
        -e "s,\($$0\),\(${OURTARGET}-$$0\),g" $$*' --

.include <bsd.port.pre.mk>

post-patch:
#
# Patch and rename info files
#
    @${FIXREFS} as ${WRKSRC}/gas/doc/as.texinfo \
        ${WRKSRC}/gas/doc/Makefile.in
    @${FIXREFS} bfd ${WRKSRC}/bfd/doc/bfd.texinfo \
        ${WRKSRC}/bfd/doc/Makefile.in
    @${FIXREFS} binutils ${WRKSRC}/binutils/doc/binutils.texi \
        ${WRKSRC}/binutils/doc/Makefile.in
    @${FIXREFS} ld ${WRKSRC}/ld/ld.texinfo \
        ${WRKSRC}/ld/Makefile.in
    @${FIXREFS} gprof ${WRKSRC}/gprof/gprof.texi \
        ${WRKSRC}/gprof/Makefile.in

    @${MV} ${WRKSRC}/gas/doc/as.texinfo \
        ${WRKSRC}/gas/doc/${OURTARGET}-as.texinfo
    @${MV} ${WRKSRC}/bfd/doc/bfd.texinfo \
        ${WRKSRC}/bfd/doc/${OURTARGET}-bfd.texinfo
    @${MV} ${WRKSRC}/binutils/doc/binutils.texi \
        ${WRKSRC}/binutils/doc/${OURTARGET}-binutils.texi
    @${MV} ${WRKSRC}/ld/ld.texinfo \
        ${WRKSRC}/ld/${OURTARGET}-ld.texinfo
    @${MV} ${WRKSRC}/gprof/gprof.texi \
        ${WRKSRC}/gprof/${OURTARGET}-gprof.texi

    @${RM} ${WRKSRC}/etc/*.info ${WRKSRC}/etc/*.texi

#
# Disable install target in some directories
#
    @${REINPLACE_CMD} -E -e 's,^(install:).*,\1,' \
        ${WRKSRC}/etc/Makefile.in \
        ${WRKSRC}/libiberty/Makefile.in \
        ${WRKSRC}/opcodes/Makefile.in

post-install:
#
# Add some plist items (we don't list them directly, since the set varies
# across different targets)
#
    @${FIND} -ds ${PREFIX}/${OURTARGET} ! -type d | \
        ${SED} -e 's,^${PREFIX}/,,' >> ${TMPPLIST}
    @${FIND} -ds ${PREFIX}/${OURTARGET} -type d | \
        ${SED} -e 's,^${PREFIX}/,@dirrm ,' >> ${TMPPLIST}

.include <bsd.port.post.mk>