blob: 5392d057b69ba3aa6f2b4b498b620575afb05531 (
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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
|
# $OpenBSD: Makefile,v 1.42 1998/10/30 18:39:52 millert Exp $
#
# For more information on building in tricky environments, please see
# the list of possible environment variables described in
# /usr/share/mk/bsd.README.
#
# Building recommendations:
#
# 1) If at all possible, put this source tree in /usr/src. If /usr/src
# must be a symbolic link, setenv BSDSRCDIR to point to the real location.
#
# 2) It is also recommended that you compile with objects outside the
# source tree. To do this, ensure /usr/obj exists or points to some
# area of disk of sufficient size. Then do "cd /usr/src; make obj".
# This will make a symbolic link called "obj" in each directory, as
# well as populate the /usr/obj properly with directories for the
# objects.
#
# 3) It is strongly recommended that you build and install a new kernel
# before rebuilding your system. Some of the new programs may use new
# functionality or depend on API changes that your old kernel doesn't have.
#
# 4) If you are reasonably sure that things will compile OK, use the
# "make build" target supplied here. Good luck.
#
# 5) If you want to setup a cross-build environment, there is a "cross-tools"
# target available which upon completion of "make TARGET=<target> cross-tools"
# (where <target> is one of the names in the /sys/arch directory) will produce
# a set of compilation tools along with the includes in the /usr/cross/<target>
# directory.
#
.include <bsd.own.mk> # for NOMAN, if it's there.
SUBDIR+= lib include bin libexec sbin usr.bin usr.sbin share games
SUBDIR+= gnu
SUBDIR+= sys lkm
.if (${KERBEROS} == "yes")
SUBDIR+= kerberosIV
.endif
.if make(clean) || make(cleandir) || make(obj)
SUBDIR+= distrib
.endif
.if exists(regress)
.ifmake !(install)
SUBDIR+= regress
.endif
regression-tests:
@echo Running regression tests...
@(cd ${.CURDIR}/regress && ${MAKE} regress)
.endif
includes:
(cd ${.CURDIR}/include; ${MAKE} includes)
beforeinstall:
.ifndef DESTDIR
(cd ${.CURDIR}/etc && ${MAKE} DESTDIR= distrib-dirs)
.else
(cd ${.CURDIR}/etc && ${MAKE} distrib-dirs)
.endif
(cd ${.CURDIR}/include; ${MAKE} includes)
afterinstall:
.ifndef NOMAN
(cd ${.CURDIR}/share/man && ${MAKE} makedb)
.endif
build:
.ifdef GLOBAL_AUTOCONF_CACHE
rm -f ${GLOBAL_AUTOCONF_CACHE}
.endif
(cd ${.CURDIR}/share/mk && ${SUDO} ${MAKE} install)
(cd ${.CURDIR}/include; ${SUDO} ${MAKE} includes)
${MAKE} cleandir
(cd ${.CURDIR}/lib && ${MAKE} depend && ${MAKE} && \
${SUDO} ${MAKE} install)
(cd ${.CURDIR}/gnu/lib && ${MAKE} depend && ${MAKE} && \
${SUDO} ${MAKE} install)
.if (${MACHINE_ARCH} == "mips")
ldconfig
.endif
.if (${KERBEROS} == "yes")
(cd ${.CURDIR}/kerberosIV && ${MAKE} build)
.endif
.if (${MACHINE_ARCH} == "mips")
ldconfig
.endif
${MAKE} depend && ${MAKE} && ${SUDO} ${MAKE} install
.if !defined(TARGET)
cross-tools:
echo "TARGET must be set"; exit 1
.else
cross-tools: cross-helpers cross-includes cross-binutils cross-gcc cross-lib
CROSSDIR= ${DESTDIR}/usr/cross/${TARGET}
CROSSENV= AR=${CROSSDIR}/usr/bin/ar AS=${CROSSDIR}/usr/bin/as \
CC=${CROSSDIR}/usr/bin/cc CPP=${CROSSDIR}/usr/bin/cpp \
LD=${CROSSDIR}/usr/bin/ld NM=${CROSSDIR}/usr/bin/nm \
RANLIB=${CROSSDIR}/usr/bin/ranlib \
SIZE=${CROSSDIR}/usr/bin/size STRIP=${CROSSDIR}/usr/bin/strip \
HOSTCC=cc
cross-helpers:
-mkdir -p ${CROSSDIR}/usr/include
echo _MACHINE_ARCH | \
cat ${.CURDIR}/sys/arch/${TARGET}/include/param.h - | \
${CPP} -E -I${.CURDIR}/sys/arch | \
sed -n '$$p' >${CROSSDIR}/TARGET_ARCH
eval `grep '^osr=' sys/conf/newvers.sh`; \
sed "s/\$$/-unknown-openbsd$$osr/" ${CROSSDIR}/TARGET_ARCH > \
${CROSSDIR}/TARGET_CANON
cross-includes:
-mkdir -p ${CROSSDIR}/usr/`cat ${CROSSDIR}/TARGET_CANON`/include
${MAKE} MACHINE=${TARGET} MACHINE_ARCH=`cat ${CROSSDIR}/TARGET_ARCH` \
DESTDIR=${CROSSDIR} includes
ln -sf ${CROSSDIR}/usr/include \
${CROSSDIR}/usr/`cat ${CROSSDIR}/TARGET_CANON`/include
.if ${TARGET} == "powerpc" || ${TARGET} == "alpha" || ${TARGET} == "arc" || \
${TARGET} == "pmax" || ${TARGET} == "wgrisc" || ${TARGET} == "hppa"
cross-binutils: cross-binutils-new
.else
cross-binutils: cross-binutils-old
.endif
cross-binutils-new:
-mkdir -p ${CROSSDIR}/usr/obj
-mkdir -p ${CROSSDIR}/usr/bin
export BSDSRCDIR=`pwd`; \
(cd ${.CURDIR}/gnu/usr.bin/binutils; \
BSDOBJDIR=${CROSSDIR}/usr/obj \
MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
${MAKE} -f Makefile.bsd-wrapper obj); \
(cd ${CROSSDIR}/usr/obj/gnu/usr.bin/binutils; \
/bin/sh ${BSDSRCDIR}/gnu/usr.bin/binutils/configure \
--prefix ${CROSSDIR}/usr \
--target `cat ${CROSSDIR}/TARGET_CANON` && \
${MAKE} CFLAGS=${CFLAGS} && ${MAKE} DESTDIR=${CROSSDIR} install)
${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 755 \
${.CURDIR}/usr.bin/lorder/lorder.sh.gnm \
${CROSSDIR}/usr/bin/`cat ${CROSSDIR}/TARGET_CANON`-lorder
ln -sf ${CROSSDIR}/usr/bin/`cat ${CROSSDIR}/TARGET_CANON`-as \
${CROSSDIR}/usr/bin/as
ln -sf ${CROSSDIR}/usr/bin/`cat ${CROSSDIR}/TARGET_CANON`-ar \
${CROSSDIR}/usr/bin/ar
ln -sf ${CROSSDIR}/usr/bin/`cat ${CROSSDIR}/TARGET_CANON`-ld \
${CROSSDIR}/usr/bin/ld
ln -sf ${CROSSDIR}/usr/bin/`cat ${CROSSDIR}/TARGET_CANON`-strip \
${CROSSDIR}/usr/bin/strip
ln -sf ${CROSSDIR}/usr/bin/`cat ${CROSSDIR}/TARGET_CANON`-size \
${CROSSDIR}/usr/bin/size
ln -sf ${CROSSDIR}/usr/bin/`cat ${CROSSDIR}/TARGET_CANON`-ranlib \
${CROSSDIR}/usr/bin/ranlib
ln -sf ${CROSSDIR}/usr/bin/`cat ${CROSSDIR}/TARGET_CANON`-nm \
${CROSSDIR}/usr/bin/nm
ln -sf ${CROSSDIR}/usr/bin/`cat ${CROSSDIR}/TARGET_CANON`-strings \
${CROSSDIR}/usr/bin/strings
ln -sf ${CROSSDIR}/usr/bin/`cat ${CROSSDIR}/TARGET_CANON`-lorder \
${CROSSDIR}/usr/bin/lorder
ln -sf ${CROSSDIR}/usr/bin/`cat ${CROSSDIR}/TARGET_CANON`-objcopy \
${CROSSDIR}/usr/bin/objcopy
ln -sf ${CROSSDIR}/usr/bin/`cat ${CROSSDIR}/TARGET_CANON`-objdump \
${CROSSDIR}/usr/bin/objdump
ln -sf ${CROSSDIR}/usr/bin/`cat ${CROSSDIR}/TARGET_CANON`-gdb \
${CROSSDIR}/usr/bin/gdb
cross-binutils-old: cross-gas cross-ar cross-ld cross-strip cross-size \
cross-ranlib cross-nm
cross-gas:
-mkdir -p ${CROSSDIR}/usr/obj
-mkdir -p ${CROSSDIR}/usr/bin
-mkdir -p ${CROSSDIR}/usr/`cat ${CROSSDIR}/TARGET_CANON`/bin
(cd ${.CURDIR}/gnu/usr.bin/gas; \
BSDOBJDIR=${CROSSDIR}/usr/obj \
BSDSRCDIR=${.CURDIR} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
${MAKE} obj; \
TARGET_MACHINE_ARCH=${TARGET} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
${MAKE}; \
TARGET_MACHINE_ARCH=${TARGET} \
DESTDIR=${CROSSDIR} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
${MAKE} NOMAN= install)
ln -sf ${CROSSDIR}/usr/bin/as \
${CROSSDIR}/usr/`cat ${CROSSDIR}/TARGET_CANON`/bin/as
cross-ld:
-mkdir -p ${CROSSDIR}/usr/obj
-mkdir -p ${CROSSDIR}/usr/bin
(cd ${.CURDIR}/gnu/usr.bin/ld; \
BSDOBJDIR=${CROSSDIR}/usr/obj \
BSDSRCDIR=${.CURDIR} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
${MAKE} obj; \
TARGET_MACHINE_ARCH=${TARGET} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
${MAKE} NOMAN=; \
TARGET_MACHINE_ARCH=${TARGET} \
DESTDIR=${CROSSDIR} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
${MAKE} NOMAN= install)
ln -sf ${CROSSDIR}/usr/bin/ld \
${CROSSDIR}/usr/`cat ${CROSSDIR}/TARGET_CANON`/bin/ld
cross-ar:
-mkdir -p ${CROSSDIR}/usr/obj
-mkdir -p ${CROSSDIR}/usr/bin
(cd ${.CURDIR}/usr.bin/ar; \
BSDOBJDIR=${CROSSDIR}/usr/obj \
BSDSRCDIR=${.CURDIR} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
${MAKE} obj; \
MAKEOBJDIR=obj.${MACHINE}.${TARGET} ${MAKE} NOMAN=; \
DESTDIR=${CROSSDIR} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
${MAKE} NOMAN= install)
ln -sf ${CROSSDIR}/usr/bin/ar \
${CROSSDIR}/usr/`cat ${CROSSDIR}/TARGET_CANON`/bin/ar
cross-ranlib:
-mkdir -p ${CROSSDIR}/usr/obj
-mkdir -p ${CROSSDIR}/usr/bin
(cd ${.CURDIR}/usr.bin/ranlib; \
BSDOBJDIR=${CROSSDIR}/usr/obj \
BSDSRCDIR=${.CURDIR} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
${MAKE} obj; \
MAKEOBJDIR=obj.${MACHINE}.${TARGET} ${MAKE} NOMAN=; \
DESTDIR=${CROSSDIR} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
${MAKE} NOMAN= install)
ln -sf ${CROSSDIR}/usr/bin/ranlib \
${CROSSDIR}/usr/`cat ${CROSSDIR}/TARGET_CANON`/bin/ranlib
cross-strip:
-mkdir -p ${CROSSDIR}/usr/obj
-mkdir -p ${CROSSDIR}/usr/bin
(cd ${.CURDIR}/usr.bin/strip; \
BSDOBJDIR=${CROSSDIR}/usr/obj \
BSDSRCDIR=${.CURDIR} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
${MAKE} obj; \
MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
${MAKE} TARGET_MACHINE_ARCH=${TARGET} NOMAN=; \
DESTDIR=${CROSSDIR} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
${MAKE} TARGET_MACHINE_ARCH=${TARGET} NOMAN= install)
ln -sf ${CROSSDIR}/usr/bin/strip \
${CROSSDIR}/usr/`cat ${CROSSDIR}/TARGET_CANON`/bin/strip
cross-size:
-mkdir -p ${CROSSDIR}/usr/obj
-mkdir -p ${CROSSDIR}/usr/bin
(cd ${.CURDIR}/usr.bin/size; \
BSDOBJDIR=${CROSSDIR}/usr/obj \
BSDSRCDIR=${.CURDIR} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
${MAKE} obj; \
MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
${MAKE} TARGET_MACHINE_ARCH=${TARGET} NOMAN=; \
DESTDIR=${CROSSDIR} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
${MAKE} NOMAN= install)
ln -sf ${CROSSDIR}/usr/bin/size \
${CROSSDIR}/usr/`cat ${CROSSDIR}/TARGET_CANON`/bin/size
cross-nm:
-mkdir -p ${CROSSDIR}/usr/obj
-mkdir -p ${CROSSDIR}/usr/bin
(cd ${.CURDIR}/usr.bin/nm; \
BSDOBJDIR=${CROSSDIR}/usr/obj \
BSDSRCDIR=${.CURDIR} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
${MAKE} obj; \
MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
${MAKE} TARGET_MACHINE_ARCH=${TARGET} NOMAN=; \
DESTDIR=${CROSSDIR} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
${MAKE} NOMAN= install)
ln -sf ${CROSSDIR}/usr/bin/nm \
${CROSSDIR}/usr/`cat ${CROSSDIR}/TARGET_CANON`/bin/nm
cross-gcc:
-mkdir -p ${CROSSDIR}/usr/obj
-mkdir -p ${CROSSDIR}/usr/bin
cd ${.CURDIR}/gnu/usr.bin/gcc; \
BSDOBJDIR=${CROSSDIR}/usr/obj BSDSRCDIR=${.CURDIR} \
MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
${MAKE} -f Makefile.bsd-wrapper obj
(cd ${CROSSDIR}/usr/obj/gnu/usr.bin/gcc; \
/bin/sh ${.CURDIR}/gnu/usr.bin/gcc/configure \
--prefix ${CROSSDIR}/usr \
--target `cat ${CROSSDIR}/TARGET_CANON` && \
${MAKE} BISON=yacc LANGUAGES=c LDFLAGS=${LDSTATIC} \
build_infodir=. \
GCC_FOR_TARGET="./xgcc -B./ -I${CROSSDIR}/usr/include" && \
${MAKE} BISON=yacc LANGUAGES=c LDFLAGS=${LDSTATIC} \
GCC_FOR_TARGET="./xgcc -B./ -I${CROSSDIR}/usr/include" \
build_infodir=. INSTALL_MAN= INSTALL_HEADERS_DIR= install)
ln -sf ${CROSSDIR}/usr/bin/`cat ${CROSSDIR}/TARGET_CANON`-gcc \
${CROSSDIR}/usr/bin/cc
CPP=`${CROSSDIR}/usr/bin/cc -print-libgcc-file-name | \
sed 's/libgcc\.a/cpp/'`; \
sed -e 's#/usr/libexec/cpp#'$$CPP'#' \
-e 's#/usr/include#${CROSSDIR}/usr/include#' \
${.CURDIR}/usr.bin/cpp/cpp.sh > ${CROSSDIR}/usr/bin/cpp
chmod ${BINMODE} ${CROSSDIR}/usr/bin/cpp
chown ${BINOWN}.${BINGRP} ${CROSSDIR}/usr/bin/cpp
cross-lib:
-mkdir -p ${CROSSDIR}/usr/obj
-mkdir -p ${CROSSDIR}/usr/lib
-mkdir -p ${CROSSDIR}/var/db
MACHINE=${TARGET} MACHINE_ARCH=`cat ${CROSSDIR}/TARGET_ARCH`; \
export MACHINE MACHINE_ARCH; \
(cd ${.CURDIR}/lib; \
BSDOBJDIR=${CROSSDIR}/usr/obj \
BSDSRCDIR=${.CURDIR} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
${MAKE} obj; \
for lib in csu libc; do \
(cd $$lib; \
${CROSSENV} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
${MAKE} NOMAN=; \
${CROSSENV} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
DESTDIR=${CROSSDIR} ${MAKE} NOMAN= install); \
done; \
${CROSSENV} MAKEOBJDIR=obj.${MACHINE}.${TARGET} ${MAKE} NOMAN=; \
${CROSSENV} MAKEOBJDIR=obj.${MACHINE}.${TARGET} \
DESTDIR=${CROSSDIR} SKIPDIR=libocurses/PSD.doc \
${MAKE} NOMAN= install)
ln -sf ${CROSSDIR}/usr/lib \
${CROSSDIR}/usr/`cat ${CROSSDIR}/TARGET_CANON`/lib
.endif
.include <bsd.subdir.mk>
|