author | chegar |
Sat, 10 Mar 2018 10:11:43 +0000 | |
branch | http-client-branch |
changeset 56274 | 56e6b3f2e09f |
parent 48839 | 042834d56fbf |
child 49204 | 564802b01ded |
child 49357 | aaedb8343784 |
permissions | -rw-r--r-- |
18021 | 1 |
# |
48839 | 2 |
# Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. |
18021 | 3 |
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
# |
|
5 |
# This code is free software; you can redistribute it and/or modify it |
|
6 |
# under the terms of the GNU General Public License version 2 only, as |
|
7 |
# published by the Free Software Foundation. Oracle designates this |
|
8 |
# particular file as subject to the "Classpath" exception as provided |
|
9 |
# by Oracle in the LICENSE file that accompanied this code. |
|
10 |
# |
|
11 |
# This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
# version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
# accompanied this code). |
|
16 |
# |
|
17 |
# You should have received a copy of the GNU General Public License version |
|
18 |
# 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
# |
|
21 |
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
22 |
# or visit www.oracle.com if you need additional information or have any |
|
23 |
# questions. |
|
24 |
# |
|
25 |
||
26 |
########################################################################################## |
|
27 |
# |
|
28 |
# Workhorse makefile for creating ONE cross compiler |
|
20363 | 29 |
# Needs either to be from BUILD -> BUILD OR have |
18021 | 30 |
# BUILD -> HOST prebuilt |
31 |
# |
|
20363 | 32 |
# NOTE: There is a bug here. We don't limit the |
33 |
# PATH when building BUILD -> BUILD, which means that |
|
18021 | 34 |
# if you configure after you've once build the BUILD->BUILD |
35 |
# compiler THAT one will be picked up as the compiler for itself. |
|
36 |
# This is not so great, especially if you did a partial delete |
|
20363 | 37 |
# of the target tree. |
18021 | 38 |
# |
39 |
# Fix this... |
|
40 |
# |
|
41 |
||
42 |
$(info TARGET=$(TARGET)) |
|
43 |
$(info HOST=$(HOST)) |
|
44 |
$(info BUILD=$(BUILD)) |
|
45 |
||
20363 | 46 |
ARCH := $(word 1,$(subst -, ,$(TARGET))) |
48839 | 47 |
$(info ARCH=$(ARCH)) |
18021 | 48 |
|
49 |
########################################################################################## |
|
50 |
# Define external dependencies |
|
51 |
||
52 |
# Latest that could be made to work. |
|
48839 | 53 |
GCC_VER := 7.3.0 |
54 |
ifeq ($(GCC_VER), 7.3.0) |
|
55 |
gcc_ver := gcc-7.3.0 |
|
56 |
binutils_ver := binutils-2.30 |
|
57 |
ccache_ver := ccache-3.3.6 |
|
58 |
mpfr_ver := mpfr-3.1.5 |
|
59 |
gmp_ver := gmp-6.1.2 |
|
60 |
mpc_ver := mpc-1.0.3 |
|
61 |
gdb_ver := gdb-8.1 |
|
62 |
else ifeq ($(GCC_VER), 4.9.2) |
|
63 |
gcc_ver := gcc-4.9.2 |
|
64 |
binutils_ver := binutils-2.25 |
|
65 |
ccache_ver := ccache-3.2.1 |
|
66 |
mpfr_ver := mpfr-3.0.1 |
|
67 |
gmp_ver := gmp-4.3.2 |
|
68 |
mpc_ver := mpc-1.0.1 |
|
69 |
gdb_ver := gdb-7.12.1 |
|
70 |
else |
|
71 |
$(error Unsupported GCC version) |
|
72 |
endif |
|
18021 | 73 |
|
48839 | 74 |
GCC := http://ftp.gnu.org/pub/gnu/gcc/$(gcc_ver)/$(gcc_ver).tar.xz |
75 |
BINUTILS := http://ftp.gnu.org/pub/gnu/binutils/$(binutils_ver).tar.xz |
|
76 |
CCACHE := https://samba.org/ftp/ccache/$(ccache_ver).tar.xz |
|
20363 | 77 |
MPFR := http://www.mpfr.org/${mpfr_ver}/${mpfr_ver}.tar.bz2 |
78 |
GMP := http://ftp.gnu.org/pub/gnu/gmp/${gmp_ver}.tar.bz2 |
|
48839 | 79 |
MPC := http://ftp.gnu.org/pub/gnu/mpc/${mpc_ver}.tar.gz |
80 |
GDB := http://ftp.gnu.org/gnu/gdb/${gdb_ver}.tar.xz |
|
81 |
||
82 |
OEL_URL := http://yum.oracle.com/repo/OracleLinux/OL6/4/base/$(ARCH)/ |
|
18021 | 83 |
|
34100
e3293031f83d
8143236: Update devkit creation makefiles for linux
erikj
parents:
33029
diff
changeset
|
84 |
# RPMs in OEL6.4 |
e3293031f83d
8143236: Update devkit creation makefiles for linux
erikj
parents:
33029
diff
changeset
|
85 |
LINUX_VERSION := OEL6.4 |
20363 | 86 |
RPM_LIST := \ |
87 |
kernel-headers \ |
|
34100
e3293031f83d
8143236: Update devkit creation makefiles for linux
erikj
parents:
33029
diff
changeset
|
88 |
glibc glibc-headers glibc-devel \ |
20363 | 89 |
cups-libs cups-devel \ |
90 |
libX11 libX11-devel \ |
|
91 |
xorg-x11-proto-devel \ |
|
92 |
alsa-lib alsa-lib-devel \ |
|
93 |
libXext libXext-devel \ |
|
94 |
libXtst libXtst-devel \ |
|
95 |
libXrender libXrender-devel \ |
|
96 |
freetype freetype-devel \ |
|
97 |
libXt libXt-devel \ |
|
98 |
libSM libSM-devel \ |
|
99 |
libICE libICE-devel \ |
|
100 |
libXi libXi-devel \ |
|
101 |
libXdmcp libXdmcp-devel \ |
|
102 |
libXau libXau-devel \ |
|
34592 | 103 |
libgcc \ |
42425 | 104 |
zlib zlib-devel \ |
47433
6331ad007664
8189119: Devkit for Linux needs to include fontconfig-devel
erikj
parents:
47253
diff
changeset
|
105 |
libffi libffi-devel \ |
48839 | 106 |
fontconfig fontconfig-devel \ |
107 |
systemtap-sdt-devel \ |
|
108 |
# |
|
18021 | 109 |
|
110 |
########################################################################################## |
|
111 |
# Define common directories and files |
|
112 |
||
113 |
# Ensure we have 32-bit libs also for x64. We enable mixed-mode. |
|
114 |
ifeq (x86_64,$(ARCH)) |
|
20363 | 115 |
LIBDIRS := lib64 lib |
116 |
CFLAGS_lib := -m32 |
|
18021 | 117 |
else |
20363 | 118 |
LIBDIRS := lib |
18021 | 119 |
endif |
120 |
||
121 |
# Define directories |
|
48839 | 122 |
RESULT := $(OUTPUT_ROOT)/result |
123 |
BUILDDIR := $(OUTPUT_ROOT)/$(HOST)/$(TARGET) |
|
20363 | 124 |
PREFIX := $(RESULT)/$(HOST) |
125 |
TARGETDIR := $(PREFIX)/$(TARGET) |
|
23428
3c8a05bf4656
8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents:
21759
diff
changeset
|
126 |
SYSROOT := $(TARGETDIR)/sysroot |
48839 | 127 |
DOWNLOAD := $(OUTPUT_ROOT)/download |
128 |
DOWNLOAD_RPMS := $(DOWNLOAD)/rpms |
|
129 |
SRCDIR := $(OUTPUT_ROOT)/src |
|
18021 | 130 |
|
131 |
# Marker file for unpacking rpms |
|
20363 | 132 |
rpms := $(SYSROOT)/rpms_unpacked |
18021 | 133 |
|
20363 | 134 |
# Need to patch libs that are linker scripts to use non-absolute paths |
135 |
libs := $(SYSROOT)/libs_patched |
|
18021 | 136 |
|
48839 | 137 |
################################################################################ |
138 |
# Download RPMs |
|
139 |
download-rpms: |
|
140 |
mkdir -p $(DOWNLOAD_RPMS) |
|
141 |
# Only run this if rpm dir is empty. |
|
142 |
ifeq ($(wildcard $(DOWNLOAD_RPMS)/*.rpm), ) |
|
143 |
cd $(DOWNLOAD_RPMS) && \ |
|
144 |
wget -r -np -nd $(patsubst %, -A "*%*.rpm", $(RPM_LIST)) $(OEL_URL) |
|
145 |
endif |
|
146 |
||
18021 | 147 |
########################################################################################## |
148 |
# Unpack source packages |
|
149 |
||
20363 | 150 |
# Generate downloading + unpacking of sources. |
18021 | 151 |
define Download |
20363 | 152 |
$(1)_DIR = $(abspath $(SRCDIR)/$(basename $(basename $(notdir $($(1)))))) |
153 |
$(1)_CFG = $$($(1)_DIR)/configure |
|
154 |
$(1)_FILE = $(DOWNLOAD)/$(notdir $($(1))) |
|
18021 | 155 |
|
20363 | 156 |
$$($(1)_CFG) : $$($(1)_FILE) |
157 |
mkdir -p $$(SRCDIR) |
|
48839 | 158 |
tar -C $$(SRCDIR) -xf $$< |
20363 | 159 |
$$(foreach p,$$(abspath $$(wildcard $$(notdir $$($(1)_DIR)).patch)), \ |
160 |
echo PATCHING $$(p) ; \ |
|
161 |
patch -d $$($(1)_DIR) -p1 -i $$(p) ; \ |
|
162 |
) |
|
163 |
touch $$@ |
|
18021 | 164 |
|
20363 | 165 |
$$($(1)_FILE) : |
166 |
wget -P $(DOWNLOAD) $$($(1)) |
|
18021 | 167 |
endef |
168 |
||
169 |
# Download and unpack all source packages |
|
48839 | 170 |
$(foreach p,GCC BINUTILS CCACHE MPFR GMP MPC GDB,$(eval $(call Download,$(p)))) |
18021 | 171 |
|
172 |
########################################################################################## |
|
173 |
# Unpack RPMS |
|
174 |
||
48839 | 175 |
ifeq ($(ARCH),x86_64) |
176 |
RPM_ARCHS := x86_64 noarch |
|
177 |
ifeq ($(BUILD),$(HOST)) |
|
178 |
ifeq ($(TARGET),$(HOST)) |
|
179 |
# When building the native compiler for x86_64, enable mixed mode. |
|
180 |
RPM_ARCHS += i386 i686 |
|
181 |
endif |
|
182 |
endif |
|
183 |
else ifeq ($(ARCH),i686)) |
|
184 |
RPM_ARCHS := i386 i686 |
|
185 |
else |
|
186 |
RPM_ARCHS := $(ARCH) |
|
187 |
endif |
|
188 |
||
189 |
RPM_FILE_LIST := $(sort $(foreach a, $(RPM_ARCHS), \ |
|
190 |
$(wildcard $(patsubst %,$(DOWNLOAD_RPMS)/%*$a.rpm,$(RPM_LIST))) \ |
|
191 |
)) |
|
192 |
||
20363 | 193 |
# Note. For building linux you should install rpm2cpio. |
18021 | 194 |
define unrpm |
48839 | 195 |
$(SYSROOT)/$(notdir $(1)).unpacked : $(1) |
20363 | 196 |
$$(rpms) : $(SYSROOT)/$(notdir $(1)).unpacked |
18021 | 197 |
endef |
198 |
||
20363 | 199 |
%.unpacked : |
200 |
$(info Unpacking target rpms and libraries from $<) |
|
201 |
@(mkdir -p $(@D); \ |
|
202 |
cd $(@D); \ |
|
203 |
rpm2cpio $< | \ |
|
204 |
cpio --extract --make-directories \ |
|
205 |
-f \ |
|
206 |
"./usr/share/doc/*" \ |
|
207 |
"./usr/share/man/*" \ |
|
208 |
"./usr/X11R6/man/*" \ |
|
209 |
"*/X11/locale/*" \ |
|
210 |
|| die ; ) |
|
211 |
touch $@ |
|
18021 | 212 |
|
213 |
$(foreach p,$(RPM_FILE_LIST),$(eval $(call unrpm,$(p)))) |
|
214 |
||
215 |
########################################################################################## |
|
216 |
||
23428
3c8a05bf4656
8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents:
21759
diff
changeset
|
217 |
# Note: MUST create a <sysroot>/usr/lib even if not really needed. |
20363 | 218 |
# gcc will use a path relative to it to resolve lib64. (x86_64). |
219 |
# we're creating multi-lib compiler with 32bit libc as well, so we should |
|
18021 | 220 |
# have it anyway, but just to make sure... |
221 |
# Patch libc.so and libpthread.so to force linking against libraries in sysroot |
|
222 |
# and not the ones installed on the build machine. |
|
20363 | 223 |
$(libs) : $(rpms) |
224 |
@echo Patching libc and pthreads |
|
225 |
@(for f in `find $(SYSROOT) -name libc.so -o -name libpthread.so`; do \ |
|
226 |
(cat $$f | sed -e 's|/usr/lib64/||g' \ |
|
227 |
-e 's|/usr/lib/||g' \ |
|
228 |
-e 's|/lib64/||g' \ |
|
229 |
-e 's|/lib/||g' ) > $$f.tmp ; \ |
|
230 |
mv $$f.tmp $$f ; \ |
|
231 |
done) |
|
232 |
@mkdir -p $(SYSROOT)/usr/lib |
|
233 |
@touch $@ |
|
18021 | 234 |
|
235 |
########################################################################################## |
|
42425 | 236 |
# Create links for ffi header files so that they become visible by default when using the |
237 |
# devkit. |
|
48839 | 238 |
ifeq ($(ARCH), x86_64) |
239 |
$(SYSROOT)/usr/include/ffi.h: $(rpms) |
|
240 |
cd $(@D) && rm -f $(@F) && ln -s ../lib/libffi-*/include/$(@F) . |
|
42425 | 241 |
|
48839 | 242 |
$(SYSROOT)/usr/include/ffitarget.h: $(rpms) |
243 |
cd $(@D) && rm -f $(@F) && ln -s ../lib/libffi-*/include/$(@F) . |
|
42425 | 244 |
|
48839 | 245 |
SYSROOT_LINKS += $(SYSROOT)/usr/include/ffi.h $(SYSROOT)/usr/include/ffitarget.h |
246 |
endif |
|
42425 | 247 |
|
248 |
########################################################################################## |
|
18021 | 249 |
|
250 |
# Define marker files for each source package to be compiled |
|
48839 | 251 |
$(foreach t,binutils mpfr gmp mpc gcc ccache gdb,$(eval $(t) = $(TARGETDIR)/$($(t)_ver).done)) |
18021 | 252 |
|
253 |
########################################################################################## |
|
254 |
||
255 |
# Default base config |
|
20363 | 256 |
CONFIG = --target=$(TARGET) \ |
257 |
--host=$(HOST) --build=$(BUILD) \ |
|
258 |
--prefix=$(PREFIX) |
|
18021 | 259 |
|
20363 | 260 |
PATHEXT = $(RESULT)/$(BUILD)/bin: |
18021 | 261 |
|
20363 | 262 |
PATHPRE = PATH=$(PATHEXT)$(PATH) |
48839 | 263 |
NUM_CORES := $(shell cat /proc/cpuinfo | grep -c processor) |
264 |
BUILDPAR = -j$(NUM_CORES) |
|
18021 | 265 |
|
266 |
# Default commands to when making |
|
20363 | 267 |
MAKECMD = |
268 |
INSTALLCMD = install |
|
18021 | 269 |
|
270 |
||
20363 | 271 |
declare_tools = CC$(1)=$(2)gcc LD$(1)=$(2)ld AR$(1)=$(2)ar AS$(1)=$(2)as RANLIB$(1)=$(2)ranlib CXX$(1)=$(2)g++ OBJDUMP$(1)=$(2)objdump |
18021 | 272 |
|
273 |
ifeq ($(HOST),$(BUILD)) |
|
20363 | 274 |
ifeq ($(HOST),$(TARGET)) |
275 |
TOOLS = $(call declare_tools,_FOR_TARGET,) |
|
276 |
endif |
|
18021 | 277 |
endif |
278 |
||
20363 | 279 |
TOOLS ?= $(call declare_tools,_FOR_TARGET,$(TARGET)-) |
18021 | 280 |
|
281 |
########################################################################################## |
|
282 |
||
20363 | 283 |
# Create a TARGET bfd + libiberty only. |
18021 | 284 |
# Configure one or two times depending on mulitlib arch. |
20363 | 285 |
# If multilib, the second should be 32-bit, and we resolve |
18021 | 286 |
# CFLAG_<name> to most likely -m32. |
287 |
define mk_bfd |
|
20363 | 288 |
$$(info Libs for $(1)) |
289 |
$$(BUILDDIR)/$$(binutils_ver)-$(subst /,-,$(1))/Makefile \ |
|
290 |
: CFLAGS += $$(CFLAGS_$(1)) |
|
291 |
$$(BUILDDIR)/$$(binutils_ver)-$(subst /,-,$(1))/Makefile \ |
|
292 |
: LIBDIRS = --libdir=$(TARGETDIR)/$(1) |
|
18021 | 293 |
|
20363 | 294 |
bfdlib += $$(TARGETDIR)/$$(binutils_ver)-$(subst /,-,$(1)).done |
295 |
bfdmakes += $$(BUILDDIR)/$$(binutils_ver)-$(subst /,-,$(1))/Makefile |
|
18021 | 296 |
endef |
297 |
||
298 |
# Create one set of bfds etc for each multilib arch |
|
299 |
$(foreach l,$(LIBDIRS),$(eval $(call mk_bfd,$(l)))) |
|
300 |
||
301 |
# Only build these two libs. |
|
20363 | 302 |
$(bfdlib) : MAKECMD = all-libiberty all-bfd |
303 |
$(bfdlib) : INSTALLCMD = install-libiberty install-bfd |
|
18021 | 304 |
|
20363 | 305 |
# Building targets libbfd + libiberty. HOST==TARGET, i.e not |
306 |
# for a cross env. |
|
307 |
$(bfdmakes) : CONFIG = --target=$(TARGET) \ |
|
308 |
--host=$(TARGET) --build=$(BUILD) \ |
|
309 |
--prefix=$(TARGETDIR) \ |
|
310 |
--with-sysroot=$(SYSROOT) \ |
|
311 |
$(LIBDIRS) |
|
18021 | 312 |
|
20363 | 313 |
$(bfdmakes) : TOOLS = $(call declare_tools,_FOR_TARGET,$(TARGET)-) $(call declare_tools,,$(TARGET)-) |
18021 | 314 |
|
315 |
########################################################################################## |
|
316 |
||
20363 | 317 |
$(gcc) \ |
318 |
$(binutils) \ |
|
319 |
$(gmp) \ |
|
320 |
$(mpfr) \ |
|
321 |
$(mpc) \ |
|
322 |
$(bfdmakes) \ |
|
323 |
$(ccache) : ENVS += $(TOOLS) |
|
18021 | 324 |
|
325 |
# libdir to work around hateful bfd stuff installing into wrong dirs... |
|
20363 | 326 |
# ensure we have 64 bit bfd support in the HOST library. I.e our |
18021 | 327 |
# compiler on i686 will know 64 bit symbols, BUT later |
20363 | 328 |
# we build just the libs again for TARGET, then with whatever the arch |
18021 | 329 |
# wants. |
330 |
$(BUILDDIR)/$(binutils_ver)/Makefile : CONFIG += --enable-64-bit-bfd --libdir=$(PREFIX)/$(word 1,$(LIBDIRS)) |
|
331 |
||
332 |
# Makefile creation. Simply run configure in build dir. |
|
20363 | 333 |
$(bfdmakes) \ |
334 |
$(BUILDDIR)/$(binutils_ver)/Makefile \ |
|
335 |
: $(BINUTILS_CFG) |
|
336 |
$(info Configuring $@. Log in $(@D)/log.config) |
|
337 |
@mkdir -p $(@D) |
|
338 |
( \ |
|
339 |
cd $(@D) ; \ |
|
340 |
$(PATHPRE) $(ENVS) CFLAGS="$(CFLAGS)" \ |
|
341 |
$(BINUTILS_CFG) \ |
|
342 |
$(CONFIG) \ |
|
343 |
--with-sysroot=$(SYSROOT) \ |
|
344 |
--disable-nls \ |
|
345 |
--program-prefix=$(TARGET)- \ |
|
346 |
--enable-multilib \ |
|
48839 | 347 |
--enable-gold \ |
348 |
--enable-plugins \ |
|
20363 | 349 |
) > $(@D)/log.config 2>&1 |
350 |
@echo 'done' |
|
18021 | 351 |
|
20363 | 352 |
$(BUILDDIR)/$(mpfr_ver)/Makefile \ |
353 |
: $(MPFR_CFG) |
|
354 |
$(info Configuring $@. Log in $(@D)/log.config) |
|
355 |
@mkdir -p $(@D) |
|
356 |
( \ |
|
357 |
cd $(@D) ; \ |
|
358 |
$(PATHPRE) $(ENVS) CFLAGS="$(CFLAGS)" \ |
|
359 |
$(MPFR_CFG) \ |
|
360 |
$(CONFIG) \ |
|
361 |
--program-prefix=$(TARGET)- \ |
|
362 |
--enable-shared=no \ |
|
363 |
--with-gmp=$(PREFIX) \ |
|
364 |
) > $(@D)/log.config 2>&1 |
|
365 |
@echo 'done' |
|
18021 | 366 |
|
20363 | 367 |
$(BUILDDIR)/$(gmp_ver)/Makefile \ |
368 |
: $(GMP_CFG) |
|
369 |
$(info Configuring $@. Log in $(@D)/log.config) |
|
370 |
@mkdir -p $(@D) |
|
371 |
( \ |
|
372 |
cd $(@D) ; \ |
|
373 |
$(PATHPRE) $(ENVS) CFLAGS="$(CFLAGS)" \ |
|
374 |
$(GMP_CFG) \ |
|
375 |
--host=$(HOST) --build=$(BUILD) \ |
|
376 |
--prefix=$(PREFIX) \ |
|
377 |
--disable-nls \ |
|
378 |
--program-prefix=$(TARGET)- \ |
|
379 |
--enable-shared=no \ |
|
380 |
--with-mpfr=$(PREFIX) \ |
|
381 |
) > $(@D)/log.config 2>&1 |
|
382 |
@echo 'done' |
|
18021 | 383 |
|
20363 | 384 |
$(BUILDDIR)/$(mpc_ver)/Makefile \ |
385 |
: $(MPC_CFG) |
|
386 |
$(info Configuring $@. Log in $(@D)/log.config) |
|
387 |
@mkdir -p $(@D) |
|
388 |
( \ |
|
389 |
cd $(@D) ; \ |
|
390 |
$(PATHPRE) $(ENVS) CFLAGS="$(CFLAGS)" \ |
|
391 |
$(MPC_CFG) \ |
|
392 |
$(CONFIG) \ |
|
393 |
--program-prefix=$(TARGET)- \ |
|
394 |
--enable-shared=no \ |
|
395 |
--with-mpfr=$(PREFIX) \ |
|
396 |
--with-gmp=$(PREFIX) \ |
|
397 |
) > $(@D)/log.config 2>&1 |
|
398 |
@echo 'done' |
|
18021 | 399 |
|
400 |
# Only valid if glibc target -> linux |
|
401 |
# proper destructor handling for c++ |
|
402 |
ifneq (,$(findstring linux,$(TARGET))) |
|
20363 | 403 |
$(BUILDDIR)/$(gcc_ver)/Makefile : CONFIG += --enable-__cxa_atexit |
18021 | 404 |
endif |
405 |
||
406 |
# Want: |
|
20363 | 407 |
# c,c++ |
408 |
# shared libs |
|
409 |
# multilib (-m32/-m64 on x64) |
|
410 |
# skip native language. |
|
411 |
# and link and assemble with the binutils we created |
|
412 |
# earlier, so --with-gnu* |
|
413 |
$(BUILDDIR)/$(gcc_ver)/Makefile \ |
|
414 |
: $(GCC_CFG) |
|
415 |
$(info Configuring $@. Log in $(@D)/log.config) |
|
416 |
mkdir -p $(@D) |
|
417 |
( \ |
|
418 |
cd $(@D) ; \ |
|
419 |
$(PATHPRE) $(ENVS) $(GCC_CFG) $(EXTRA_CFLAGS) \ |
|
420 |
$(CONFIG) \ |
|
421 |
--with-sysroot=$(SYSROOT) \ |
|
422 |
--enable-languages=c,c++ \ |
|
423 |
--enable-shared \ |
|
424 |
--disable-nls \ |
|
425 |
--with-gnu-as \ |
|
426 |
--with-gnu-ld \ |
|
427 |
--with-mpfr=$(PREFIX) \ |
|
428 |
--with-gmp=$(PREFIX) \ |
|
429 |
--with-mpc=$(PREFIX) \ |
|
430 |
) > $(@D)/log.config 2>&1 |
|
431 |
@echo 'done' |
|
18021 | 432 |
|
433 |
# need binutils for gcc |
|
20363 | 434 |
$(gcc) : $(binutils) |
18021 | 435 |
|
436 |
# as of 4.3 or so need these for doing config |
|
437 |
$(BUILDDIR)/$(gcc_ver)/Makefile : $(gmp) $(mpfr) $(mpc) |
|
20363 | 438 |
$(mpfr) : $(gmp) |
439 |
$(mpc) : $(gmp) $(mpfr) |
|
18021 | 440 |
|
48839 | 441 |
################################################################################ |
442 |
# Build gdb but only where host and target match |
|
443 |
ifeq ($(HOST), $(TARGET)) |
|
444 |
$(BUILDDIR)/$(gdb_ver)/Makefile: $(GDB_CFG) |
|
445 |
$(info Configuring $@. Log in $(@D)/log.config) |
|
446 |
mkdir -p $(@D) |
|
447 |
( \ |
|
448 |
cd $(@D) ; \ |
|
449 |
$(PATHPRE) $(ENVS) CFLAGS="$(CFLAGS)" $(GDB_CFG) \ |
|
450 |
$(CONFIG) \ |
|
451 |
--with-sysroot=$(SYSROOT) \ |
|
452 |
) > $(@D)/log.config 2>&1 |
|
453 |
@echo 'done' |
|
454 |
||
455 |
$(gdb): $(gcc) |
|
456 |
endif |
|
457 |
||
18021 | 458 |
########################################################################################## |
20363 | 459 |
# very straightforward. just build a ccache. it is only for host. |
460 |
$(BUILDDIR)/$(ccache_ver)/Makefile \ |
|
461 |
: $(CCACHE_CFG) |
|
462 |
$(info Configuring $@. Log in $(@D)/log.config) |
|
463 |
@mkdir -p $(@D) |
|
464 |
@( \ |
|
465 |
cd $(@D) ; \ |
|
466 |
$(PATHPRE) $(ENVS) $(CCACHE_CFG) \ |
|
467 |
$(CONFIG) \ |
|
468 |
) > $(@D)/log.config 2>&1 |
|
469 |
@echo 'done' |
|
18021 | 470 |
|
20363 | 471 |
gccpatch = $(TARGETDIR)/gcc-patched |
18021 | 472 |
|
473 |
########################################################################################## |
|
20363 | 474 |
# For some reason cpp is not created as a target-compiler |
18021 | 475 |
ifeq ($(HOST),$(TARGET)) |
20363 | 476 |
$(gccpatch) : $(gcc) link_libs |
477 |
@echo -n 'Creating compiler symlinks...' |
|
478 |
@for f in cpp; do \ |
|
479 |
if [ ! -e $(PREFIX)/bin/$(TARGET)-$$f ]; \ |
|
480 |
then \ |
|
481 |
cd $(PREFIX)/bin && \ |
|
48839 | 482 |
ln -fs $$f $(TARGET)-$$f ; \ |
20363 | 483 |
fi \ |
484 |
done |
|
485 |
@touch $@ |
|
486 |
@echo 'done' |
|
18021 | 487 |
|
20363 | 488 |
########################################################################################## |
489 |
# Ugly at best. Seems that when we compile host->host compiler, that are NOT |
|
490 |
# the BUILD compiler, the result will not try searching for libs in package root. |
|
491 |
# "Solve" this by create links from the target libdirs to where they are. |
|
492 |
link_libs: |
|
493 |
@echo -n 'Creating library symlinks...' |
|
494 |
@$(foreach l,$(LIBDIRS), \ |
|
495 |
for f in `cd $(PREFIX)/$(l) && ls`; do \ |
|
496 |
if [ ! -e $(TARGETDIR)/$(l)/$$f ]; then \ |
|
497 |
mkdir -p $(TARGETDIR)/$(l) && \ |
|
498 |
cd $(TARGETDIR)/$(l)/ && \ |
|
48839 | 499 |
ln -fs $(if $(findstring /,$(l)),../,)../../$(l)/$$f $$f; \ |
20363 | 500 |
fi \ |
501 |
done;) |
|
502 |
@echo 'done' |
|
18021 | 503 |
else |
20363 | 504 |
$(gccpatch) : |
505 |
@echo 'done' |
|
18021 | 506 |
endif |
507 |
||
508 |
########################################################################################## |
|
20363 | 509 |
# Build in two steps. |
18021 | 510 |
# make <default> |
20363 | 511 |
# make install. |
18021 | 512 |
# Use path to our build hosts cross tools |
20363 | 513 |
# Always need to build cross tools for build host self. |
514 |
$(TARGETDIR)/%.done : $(BUILDDIR)/%/Makefile |
|
515 |
$(info Building $(basename $@). Log in $(<D)/log.build) |
|
516 |
$(PATHPRE) $(ENVS) $(MAKE) $(BUILDPAR) -f $< -C $(<D) $(MAKECMD) $(MAKECMD.$(notdir $@)) > $(<D)/log.build 2>&1 |
|
517 |
@echo -n 'installing...' |
|
518 |
$(PATHPRE) $(MAKE) $(INSTALLPAR) -f $< -C $(<D) $(INSTALLCMD) $(MAKECMD.$(notdir $@)) > $(<D)/log.install 2>&1 |
|
48839 | 519 |
@mkdir -p $(@D) |
20363 | 520 |
@touch $@ |
521 |
@echo 'done' |
|
18021 | 522 |
|
523 |
########################################################################################## |
|
524 |
||
23428
3c8a05bf4656
8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents:
21759
diff
changeset
|
525 |
$(PREFIX)/devkit.info: FRC |
3c8a05bf4656
8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents:
21759
diff
changeset
|
526 |
@echo 'Creating devkit.info in the root of the kit' |
3c8a05bf4656
8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents:
21759
diff
changeset
|
527 |
rm -f $@ |
3c8a05bf4656
8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents:
21759
diff
changeset
|
528 |
touch $@ |
3c8a05bf4656
8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents:
21759
diff
changeset
|
529 |
echo '# This file describes to configure how to interpret the contents of this' >> $@ |
3c8a05bf4656
8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents:
21759
diff
changeset
|
530 |
echo '# devkit' >> $@ |
3c8a05bf4656
8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents:
21759
diff
changeset
|
531 |
echo '' >> $@ |
3c8a05bf4656
8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents:
21759
diff
changeset
|
532 |
echo 'DEVKIT_NAME="$(gcc_ver) - $(LINUX_VERSION)"' >> $@ |
3c8a05bf4656
8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents:
21759
diff
changeset
|
533 |
echo 'DEVKIT_TOOLCHAIN_PATH="$$DEVKIT_ROOT/bin"' >> $@ |
3c8a05bf4656
8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents:
21759
diff
changeset
|
534 |
echo 'DEVKIT_SYSROOT="$$DEVKIT_ROOT/$$host/sysroot"' >> $@ |
48839 | 535 |
echo 'DEVKIT_EXTRA_PATH="$$DEVKIT_ROOT/bin"' >> $@ |
536 |
||
537 |
########################################################################################## |
|
538 |
# Copy these makefiles into the root of the kit |
|
539 |
$(PREFIX)/Makefile: ./Makefile |
|
540 |
rm -rf $@ |
|
541 |
cp $< $@ |
|
542 |
||
543 |
$(PREFIX)/Tools.gmk: ./Tools.gmk |
|
544 |
rm -rf $@ |
|
545 |
cp $< $@ |
|
546 |
||
547 |
THESE_MAKEFILES := $(PREFIX)/Makefile $(PREFIX)/Tools.gmk |
|
23428
3c8a05bf4656
8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents:
21759
diff
changeset
|
548 |
|
3c8a05bf4656
8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents:
21759
diff
changeset
|
549 |
########################################################################################## |
3c8a05bf4656
8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents:
21759
diff
changeset
|
550 |
|
34100
e3293031f83d
8143236: Update devkit creation makefiles for linux
erikj
parents:
33029
diff
changeset
|
551 |
ifeq ($(TARGET), $(HOST)) |
48839 | 552 |
# To build with dtrace support, the build needs access to the dtrace executable from the |
553 |
# sysroot. Generally we don't want to add binaries in the sysroot to the path, but |
|
554 |
# luckily this seems to execute well enough on a different host Linux distro, so symlink |
|
555 |
# it into the main bin dir. |
|
556 |
$(PREFIX)/bin/dtrace: |
|
557 |
@echo 'Creating dtrace soft link' |
|
558 |
ln -s ../$(HOST)/sysroot/usr/bin/dtrace $@ |
|
559 |
||
34100
e3293031f83d
8143236: Update devkit creation makefiles for linux
erikj
parents:
33029
diff
changeset
|
560 |
$(PREFIX)/bin/%: |
e3293031f83d
8143236: Update devkit creation makefiles for linux
erikj
parents:
33029
diff
changeset
|
561 |
@echo 'Creating missing $* soft link' |
e3293031f83d
8143236: Update devkit creation makefiles for linux
erikj
parents:
33029
diff
changeset
|
562 |
ln -s $(TARGET)-$* $@ |
e3293031f83d
8143236: Update devkit creation makefiles for linux
erikj
parents:
33029
diff
changeset
|
563 |
|
e3293031f83d
8143236: Update devkit creation makefiles for linux
erikj
parents:
33029
diff
changeset
|
564 |
missing-links := $(addprefix $(PREFIX)/bin/, \ |
e3293031f83d
8143236: Update devkit creation makefiles for linux
erikj
parents:
33029
diff
changeset
|
565 |
addr2line ar as c++ c++filt elfedit g++ gcc gprof ld nm objcopy ranlib readelf \ |
48839 | 566 |
size strings strip ld.bfd ld.gold dtrace) |
34100
e3293031f83d
8143236: Update devkit creation makefiles for linux
erikj
parents:
33029
diff
changeset
|
567 |
endif |
e3293031f83d
8143236: Update devkit creation makefiles for linux
erikj
parents:
33029
diff
changeset
|
568 |
|
e3293031f83d
8143236: Update devkit creation makefiles for linux
erikj
parents:
33029
diff
changeset
|
569 |
########################################################################################## |
e3293031f83d
8143236: Update devkit creation makefiles for linux
erikj
parents:
33029
diff
changeset
|
570 |
|
20363 | 571 |
bfdlib : $(bfdlib) |
572 |
binutils : $(binutils) |
|
573 |
rpms : $(rpms) |
|
574 |
libs : $(libs) |
|
575 |
sysroot : rpms libs |
|
576 |
gcc : sysroot $(gcc) $(gccpatch) |
|
48839 | 577 |
gdb : $(gdb) |
578 |
all : binutils gcc bfdlib $(PREFIX)/devkit.info $(missing-links) $(SYSROOT_LINKS) \ |
|
579 |
$(THESE_MAKEFILES) gdb |
|
18021 | 580 |
|
20363 | 581 |
# this is only built for host. so separate. |
582 |
ccache : $(ccache) |
|
18021 | 583 |
|
23428
3c8a05bf4656
8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents:
21759
diff
changeset
|
584 |
# Force target |
3c8a05bf4656
8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents:
21759
diff
changeset
|
585 |
FRC: |
3c8a05bf4656
8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents:
21759
diff
changeset
|
586 |
|
20363 | 587 |
.PHONY : gcc all binutils bfdlib link_libs rpms libs sysroot |