summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/binutils-2.17/Makefile.bsd-wrapper
blob: 223483c63f9799b06ae8b74072c431bea4846091 (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
166
167
168
169
170
171
172
173
174
175
176
#	$OpenBSD: Makefile.bsd-wrapper,v 1.32 2023/09/06 12:15:30 jca Exp $

.include <bsd.own.mk>

TARGET_ARCH?=	${MACHINE_ARCH}

SUBDIRS=	opcodes bfd
CONF_SUBDIRS=	opcodes bfd

CFLAGS+=	-std=gnu89
CFLAGS+=	${PIE_DEFAULT}
XCFLAGS=	CC="${CC}" CFLAGS="${CFLAGS} ${COPTS}" LDFLAGS="${LDSTATIC}"
# This allows moving the whole binutils installation around for 
# testing purposes
PREFIX=/usr
.if ${PREFIX} != "/usr"
MANDIR=${PREFIX}/share/man/man
.endif

MAN=		binutils/doc/addr2line.1 binutils/doc/objcopy.1 \
		binutils/doc/objdump.1 binutils/doc/readelf.1 \
		c++filt.1

#### gdb comes from older binutils at the moment
###CONF_SUBDIRS+=      gdb
###SUBDIRS+=   gdb
###INST_SUBDIRS+=      gdb
###MAN+=               gdb/gdb.1

SUBDIRS+=	binutils
CONF_SUBDIRS+=	binutils
INST_SUBDIRS+=	binutils
MAN+=		binutils/doc/strings.1

.if (${TARGET_ARCH} != "aarch64" && ${TARGET_ARCH} != "powerpc64" && \
    ${TARGET_ARCH} != "riscv64")
SUBDIRS+=	 ld gas
CONF_SUBDIRS+=	 ld gas
INST_SUBDIRS+=	 ld gas
MAN+=		gas/doc/as.1	ld/ld.bfd.1
.endif

.if ${AR_VERSION:L} == "binutils"
MAN+=		binutils/doc/ar.1 binutils/doc/ranlib.1
.else
# skip installing ar(1) and ranlib(1) which is am__EXEEXT_7 and am__EXEEXT_9
SKIP_AR=	am__EXEEXT_7= am__EXEEXT_9=
.endif

.if ${LINKER_VERSION:L} == "bfd"
MAN+=		binutils/doc/strip.1
maninstall:
		cd ${DESTDIR}${MANDIR}1 && rm -f ld.1 && ln ld.bfd.1 ld.1
.else
# skip installing strip(1) which is am__EXEEXT_14
SKIP_STRIP=	am__EXEEXT_14=
.endif

# Used by the GNU Makefile
ALL_MODULES=${SUBDIRS:S/^/all-/g}
CONFIGURE_MODULES=${CONF_SUBDIRS:S/^/configure-/g}
CONFIGURE_HOST_MODULES=${CONF_SUBDIRS:S/^/configure-/g}
ALL_HOST_MODULES=${SUBDIRS:S/^/all-/g}
INSTALL_MODULES=${INST_SUBDIRS:S/^/install-/g}
INFO_HOST_MODULES=${SUBDIRS:S/^/info-/g}
INSTALL_INFO_HOST_MODULES=${INST_SUBDIRS:S/^/install-info-/g}

.if defined(CROSSDIR)
CONFIGTARGET=--target=${TARGET_ARCH}-unknown-openbsd${OSREV}
.else
CONFIGTARGET=
.endif

.if ${TARGET_ARCH} == "aarch64" || ${TARGET_ARCH} == "powerpc64" || \
    ${TARGET_ARCH} == "riscv64"
CONFIGTARGET+=--without-gnu-ld
CONFIGTARGET+=--without-gnu-as
.endif

all:	config.status
.for t in all info
	SUBDIRS='${SUBDIRS}' \
	  CONFIGURE_HOST_MODULES='${CONFIGURE_HOST_MODULES}' \
	  ${MAKE} ${XCFLAGS} \
	    scriptdir=${PREFIX}/libdata \
	    tooldir=${PREFIX} \
	    MAKEINFO='makeinfo --no-split' \
	    MAKEINFOFLAGS='' \
	    BSDSRCDIR=${BSDSRCDIR} \
	    ALL_MODULES="${ALL_MODULES}" \
	    ALL_HOST_MODULES='${ALL_HOST_MODULES}' \
	    INFO_HOST_MODULES='${INFO_HOST_MODULES}' $t
.endfor

.include <bsd.own.mk>

.ifdef GLOBAL_AUTOCONF_CACHE
CF=	--cache-file=${GLOBAL_AUTOCONF_CACHE}
.else
CF=
.endif

do-config: .USE
	PATH="/bin:/usr/bin:/sbin:/usr/sbin" \
	MAKEINFO='makeinfo --no-split' \
	${XCFLAGS} \
	sh ${.CURDIR}/configure --prefix=${PREFIX} \
	    --infodir='$${prefix}/share/info' \
	    --disable-nls --disable-gdbtk --disable-install-libbfd ${CF} \
	    --disable-werror \
	    ${CONFIGTARGET}
	cd ${.OBJDIR} && \
	    sed -e 's,SUBDIRS *=,SUBDIRS ?=,' <Makefile >Makefile.tmp && \
	    mv -f Makefile.tmp Makefile
	cd ${.OBJDIR} && \
	    ${XCFLAGS} \
	    ${MAKE} ${CONFIGURE_MODULES}

gas/doc/as.1: config.status
	cd ${.OBJDIR}/gas/doc && ${MAKE} as.1

ld/ld.bfd.1: config.status
	cd ${.OBJDIR}/ld && ${MAKE} ld.1
	mv ld/ld.1 ld/ld.bfd.1

config: do-config
.ifndef GLOBAL_AUTOCONF_CACHE
	-rm -f config.cache
.endif

config.status: do-config

# Need to pass SUBDIRS because of install-info
install: maninstall
.for t in install install-info
	${INSTALL} -d -o ${BINOWN} -g ${BINGRP} \
	    ${DESTDIR}${PREFIX}/libdata/ldscripts
	SUBDIRS='${INST_SUBDIRS}' ${MAKE} DESTDIR='${DESTDIR}' \
	    INSTALL_MAN= \
	    scriptdir=${PREFIX}/libdata \
	    tooldir=${PREFIX} \
	    BSDSRCDIR=${BSDSRCDIR} \
	    INSTALL_MODULES='${INSTALL_MODULES}' \
	    INSTALL_PROGRAM='${INSTALL} -c ${INSTALL_STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE}' \
	    INSTALL_DATA='${INSTALL} -c -o ${DOCOWN} -g ${DOCGRP} -m ${NONBINMODE}' \
	    INSTALL_INFO_HOST_MODULES='${INSTALL_INFO_HOST_MODULES}' \
	    ${SKIP_AR} ${SKIP_STRIP} \
	      $t
.endfor
.if ${LINKER_VERSION:L} == "bfd"
	rm -f ${DESTDIR}${PREFIX}/bin/ld
	ln ${DESTDIR}${PREFIX}/bin/ld.bfd ${DESTDIR}${PREFIX}/bin/ld
.endif

clean cleandir:
	-@if [ -e Makefile ]; then ${MAKE} distclean; fi

c++filt.1: binutils/doc/cxxfilt.man
	sed -e 's,@PROGRAM@,c++filt,' <${.CURDIR}/binutils/doc/cxxfilt.man >$@

tags:
	# Nothing here so far...

BEFOREMAN=config.status

.PHONY: config

.include <bsd.obj.mk>
.include <bsd.subdir.mk>

.ifdef NOMAN
maninstall:
	@echo NOMAN is set
.else
.include <bsd.man.mk>
.endif