author | stefank |
Mon, 11 Apr 2016 08:51:53 +0200 | |
changeset 37458 | 5a20a686b58d |
parent 36540 | bba2e82b305b |
child 41458 | f285e333e8db |
permissions | -rw-r--r-- |
18021 | 1 |
# |
34100
e3293031f83d
8143236: Update devkit creation makefiles for linux
erikj
parents:
33029
diff
changeset
|
2 |
# Copyright (c) 2013, 2015, 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))) |
18021 | 47 |
|
48 |
########################################################################################## |
|
49 |
# Define external dependencies |
|
50 |
||
51 |
# Latest that could be made to work. |
|
33029
06a8c5e5959b
8139735: Switch compilers in JPRT for windows and linux
erikj
parents:
23428
diff
changeset
|
52 |
gcc_ver := gcc-4.9.2 |
06a8c5e5959b
8139735: Switch compilers in JPRT for windows and linux
erikj
parents:
23428
diff
changeset
|
53 |
binutils_ver := binutils-2.25 |
06a8c5e5959b
8139735: Switch compilers in JPRT for windows and linux
erikj
parents:
23428
diff
changeset
|
54 |
ccache_ver := ccache-3.2.1 |
20363 | 55 |
mpfr_ver := mpfr-3.0.1 |
56 |
gmp_ver := gmp-4.3.2 |
|
57 |
mpc_ver := mpc-1.0.1 |
|
18021 | 58 |
|
20363 | 59 |
GCC := http://ftp.gnu.org/pub/gnu/gcc/$(gcc_ver)/$(gcc_ver).tar.bz2 |
60 |
BINUTILS := http://ftp.gnu.org/pub/gnu/binutils/$(binutils_ver).tar.bz2 |
|
61 |
CCACHE := http://samba.org/ftp/ccache/$(ccache_ver).tar.gz |
|
62 |
MPFR := http://www.mpfr.org/${mpfr_ver}/${mpfr_ver}.tar.bz2 |
|
63 |
GMP := http://ftp.gnu.org/pub/gnu/gmp/${gmp_ver}.tar.bz2 |
|
64 |
MPC := http://www.multiprecision.org/mpc/download/${mpc_ver}.tar.gz |
|
18021 | 65 |
|
34100
e3293031f83d
8143236: Update devkit creation makefiles for linux
erikj
parents:
33029
diff
changeset
|
66 |
# RPMs in OEL6.4 |
e3293031f83d
8143236: Update devkit creation makefiles for linux
erikj
parents:
33029
diff
changeset
|
67 |
LINUX_VERSION := OEL6.4 |
20363 | 68 |
RPM_LIST := \ |
69 |
kernel-headers \ |
|
34100
e3293031f83d
8143236: Update devkit creation makefiles for linux
erikj
parents:
33029
diff
changeset
|
70 |
glibc glibc-headers glibc-devel \ |
20363 | 71 |
cups-libs cups-devel \ |
72 |
libX11 libX11-devel \ |
|
73 |
xorg-x11-proto-devel \ |
|
74 |
alsa-lib alsa-lib-devel \ |
|
75 |
libXext libXext-devel \ |
|
76 |
libXtst libXtst-devel \ |
|
77 |
libXrender libXrender-devel \ |
|
78 |
freetype freetype-devel \ |
|
79 |
libXt libXt-devel \ |
|
80 |
libSM libSM-devel \ |
|
81 |
libICE libICE-devel \ |
|
82 |
libXi libXi-devel \ |
|
83 |
libXdmcp libXdmcp-devel \ |
|
84 |
libXau libXau-devel \ |
|
34592 | 85 |
libgcc \ |
36540
bba2e82b305b
8149545: Add zlib devel package to devkit sysroot on Linux
erikj
parents:
34592
diff
changeset
|
86 |
elfutils elfutils-libs elfutils-devel \ |
bba2e82b305b
8149545: Add zlib devel package to devkit sysroot on Linux
erikj
parents:
34592
diff
changeset
|
87 |
elfutils-libelf elfutils-libelf-devel \ |
bba2e82b305b
8149545: Add zlib devel package to devkit sysroot on Linux
erikj
parents:
34592
diff
changeset
|
88 |
zlib zlib-devel |
18021 | 89 |
|
90 |
||
91 |
ifeq ($(ARCH),x86_64) |
|
92 |
RPM_DIR ?= $(RPM_DIR_x86_64) |
|
34100
e3293031f83d
8143236: Update devkit creation makefiles for linux
erikj
parents:
33029
diff
changeset
|
93 |
RPM_ARCHS := x86_64 noarch |
18021 | 94 |
ifeq ($(BUILD),$(HOST)) |
95 |
ifeq ($(TARGET),$(HOST)) |
|
96 |
# When building the native compiler for x86_64, enable mixed mode. |
|
20363 | 97 |
RPM_ARCHS += i386 i686 |
18021 | 98 |
endif |
99 |
endif |
|
100 |
else |
|
101 |
RPM_DIR ?= $(RPM_DIR_i686) |
|
102 |
RPM_ARCHS := i386 i686 |
|
103 |
endif |
|
104 |
||
105 |
# Sort to remove duplicates |
|
106 |
RPM_FILE_LIST := $(sort $(foreach a,$(RPM_ARCHS),$(wildcard $(patsubst %,$(RPM_DIR)/%*$a.rpm,$(RPM_LIST))))) |
|
107 |
||
34100
e3293031f83d
8143236: Update devkit creation makefiles for linux
erikj
parents:
33029
diff
changeset
|
108 |
#$(info RPM_FILE_LIST $(RPM_FILE_LIST)) |
e3293031f83d
8143236: Update devkit creation makefiles for linux
erikj
parents:
33029
diff
changeset
|
109 |
|
18021 | 110 |
ifeq ($(RPM_FILE_LIST),) |
111 |
$(error Found no RPMs, RPM_DIR must point to list of directories to search for RPMs) |
|
112 |
endif |
|
113 |
||
114 |
########################################################################################## |
|
115 |
# Define common directories and files |
|
116 |
||
117 |
# Ensure we have 32-bit libs also for x64. We enable mixed-mode. |
|
118 |
ifeq (x86_64,$(ARCH)) |
|
20363 | 119 |
LIBDIRS := lib64 lib |
120 |
CFLAGS_lib := -m32 |
|
18021 | 121 |
else |
20363 | 122 |
LIBDIRS := lib |
18021 | 123 |
endif |
124 |
||
125 |
# Define directories |
|
20363 | 126 |
RESULT := $(OUTPUT_ROOT)/result |
127 |
BUILDDIR := $(OUTPUT_ROOT)/$(HOST)/$(TARGET) |
|
128 |
PREFIX := $(RESULT)/$(HOST) |
|
129 |
TARGETDIR := $(PREFIX)/$(TARGET) |
|
23428
3c8a05bf4656
8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents:
21759
diff
changeset
|
130 |
SYSROOT := $(TARGETDIR)/sysroot |
20363 | 131 |
DOWNLOAD := $(OUTPUT_ROOT)/download |
132 |
SRCDIR := $(OUTPUT_ROOT)/src |
|
18021 | 133 |
|
134 |
# Marker file for unpacking rpms |
|
20363 | 135 |
rpms := $(SYSROOT)/rpms_unpacked |
18021 | 136 |
|
20363 | 137 |
# Need to patch libs that are linker scripts to use non-absolute paths |
138 |
libs := $(SYSROOT)/libs_patched |
|
18021 | 139 |
|
140 |
########################################################################################## |
|
141 |
# Unpack source packages |
|
142 |
||
20363 | 143 |
# Generate downloading + unpacking of sources. |
18021 | 144 |
define Download |
20363 | 145 |
$(1)_DIR = $(abspath $(SRCDIR)/$(basename $(basename $(notdir $($(1)))))) |
146 |
$(1)_CFG = $$($(1)_DIR)/configure |
|
147 |
$(1)_FILE = $(DOWNLOAD)/$(notdir $($(1))) |
|
18021 | 148 |
|
20363 | 149 |
$$($(1)_CFG) : $$($(1)_FILE) |
150 |
mkdir -p $$(SRCDIR) |
|
151 |
tar -C $$(SRCDIR) -x$$(if $$(findstring .gz, $$<),z,j)f $$< |
|
152 |
$$(foreach p,$$(abspath $$(wildcard $$(notdir $$($(1)_DIR)).patch)), \ |
|
153 |
echo PATCHING $$(p) ; \ |
|
154 |
patch -d $$($(1)_DIR) -p1 -i $$(p) ; \ |
|
155 |
) |
|
156 |
touch $$@ |
|
18021 | 157 |
|
20363 | 158 |
$$($(1)_FILE) : |
159 |
wget -P $(DOWNLOAD) $$($(1)) |
|
18021 | 160 |
endef |
161 |
||
162 |
# Download and unpack all source packages |
|
163 |
$(foreach p,GCC BINUTILS CCACHE MPFR GMP MPC,$(eval $(call Download,$(p)))) |
|
164 |
||
165 |
########################################################################################## |
|
166 |
# Unpack RPMS |
|
167 |
||
20363 | 168 |
# Note. For building linux you should install rpm2cpio. |
18021 | 169 |
define unrpm |
20363 | 170 |
$(SYSROOT)/$(notdir $(1)).unpacked \ |
171 |
: $(1) |
|
172 |
$$(rpms) : $(SYSROOT)/$(notdir $(1)).unpacked |
|
18021 | 173 |
endef |
174 |
||
20363 | 175 |
%.unpacked : |
176 |
$(info Unpacking target rpms and libraries from $<) |
|
177 |
@(mkdir -p $(@D); \ |
|
178 |
cd $(@D); \ |
|
179 |
rpm2cpio $< | \ |
|
180 |
cpio --extract --make-directories \ |
|
181 |
-f \ |
|
182 |
"./usr/share/doc/*" \ |
|
183 |
"./usr/share/man/*" \ |
|
184 |
"./usr/X11R6/man/*" \ |
|
185 |
"*/X11/locale/*" \ |
|
186 |
|| die ; ) |
|
187 |
touch $@ |
|
18021 | 188 |
|
189 |
$(foreach p,$(RPM_FILE_LIST),$(eval $(call unrpm,$(p)))) |
|
190 |
||
191 |
########################################################################################## |
|
192 |
||
23428
3c8a05bf4656
8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents:
21759
diff
changeset
|
193 |
# Note: MUST create a <sysroot>/usr/lib even if not really needed. |
20363 | 194 |
# gcc will use a path relative to it to resolve lib64. (x86_64). |
195 |
# we're creating multi-lib compiler with 32bit libc as well, so we should |
|
18021 | 196 |
# have it anyway, but just to make sure... |
197 |
# Patch libc.so and libpthread.so to force linking against libraries in sysroot |
|
198 |
# and not the ones installed on the build machine. |
|
20363 | 199 |
$(libs) : $(rpms) |
200 |
@echo Patching libc and pthreads |
|
201 |
@(for f in `find $(SYSROOT) -name libc.so -o -name libpthread.so`; do \ |
|
202 |
(cat $$f | sed -e 's|/usr/lib64/||g' \ |
|
203 |
-e 's|/usr/lib/||g' \ |
|
204 |
-e 's|/lib64/||g' \ |
|
205 |
-e 's|/lib/||g' ) > $$f.tmp ; \ |
|
206 |
mv $$f.tmp $$f ; \ |
|
207 |
done) |
|
208 |
@mkdir -p $(SYSROOT)/usr/lib |
|
209 |
@touch $@ |
|
18021 | 210 |
|
211 |
########################################################################################## |
|
212 |
||
213 |
# Define marker files for each source package to be compiled |
|
214 |
$(foreach t,binutils mpfr gmp mpc gcc ccache,$(eval $(t) = $(TARGETDIR)/$($(t)_ver).done)) |
|
215 |
||
216 |
########################################################################################## |
|
217 |
||
218 |
# Default base config |
|
20363 | 219 |
CONFIG = --target=$(TARGET) \ |
220 |
--host=$(HOST) --build=$(BUILD) \ |
|
221 |
--prefix=$(PREFIX) |
|
18021 | 222 |
|
20363 | 223 |
PATHEXT = $(RESULT)/$(BUILD)/bin: |
18021 | 224 |
|
20363 | 225 |
PATHPRE = PATH=$(PATHEXT)$(PATH) |
226 |
BUILDPAR = -j16 |
|
18021 | 227 |
|
228 |
# Default commands to when making |
|
20363 | 229 |
MAKECMD = |
230 |
INSTALLCMD = install |
|
18021 | 231 |
|
232 |
||
20363 | 233 |
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 | 234 |
|
235 |
ifeq ($(HOST),$(BUILD)) |
|
20363 | 236 |
ifeq ($(HOST),$(TARGET)) |
237 |
TOOLS = $(call declare_tools,_FOR_TARGET,) |
|
238 |
endif |
|
18021 | 239 |
endif |
240 |
||
20363 | 241 |
TOOLS ?= $(call declare_tools,_FOR_TARGET,$(TARGET)-) |
18021 | 242 |
|
243 |
########################################################################################## |
|
244 |
||
20363 | 245 |
# Create a TARGET bfd + libiberty only. |
18021 | 246 |
# Configure one or two times depending on mulitlib arch. |
20363 | 247 |
# If multilib, the second should be 32-bit, and we resolve |
18021 | 248 |
# CFLAG_<name> to most likely -m32. |
249 |
define mk_bfd |
|
20363 | 250 |
$$(info Libs for $(1)) |
251 |
$$(BUILDDIR)/$$(binutils_ver)-$(subst /,-,$(1))/Makefile \ |
|
252 |
: CFLAGS += $$(CFLAGS_$(1)) |
|
253 |
$$(BUILDDIR)/$$(binutils_ver)-$(subst /,-,$(1))/Makefile \ |
|
254 |
: LIBDIRS = --libdir=$(TARGETDIR)/$(1) |
|
18021 | 255 |
|
20363 | 256 |
bfdlib += $$(TARGETDIR)/$$(binutils_ver)-$(subst /,-,$(1)).done |
257 |
bfdmakes += $$(BUILDDIR)/$$(binutils_ver)-$(subst /,-,$(1))/Makefile |
|
18021 | 258 |
endef |
259 |
||
260 |
# Create one set of bfds etc for each multilib arch |
|
261 |
$(foreach l,$(LIBDIRS),$(eval $(call mk_bfd,$(l)))) |
|
262 |
||
263 |
# Only build these two libs. |
|
20363 | 264 |
$(bfdlib) : MAKECMD = all-libiberty all-bfd |
265 |
$(bfdlib) : INSTALLCMD = install-libiberty install-bfd |
|
18021 | 266 |
|
20363 | 267 |
# Building targets libbfd + libiberty. HOST==TARGET, i.e not |
268 |
# for a cross env. |
|
269 |
$(bfdmakes) : CONFIG = --target=$(TARGET) \ |
|
270 |
--host=$(TARGET) --build=$(BUILD) \ |
|
271 |
--prefix=$(TARGETDIR) \ |
|
272 |
--with-sysroot=$(SYSROOT) \ |
|
273 |
$(LIBDIRS) |
|
18021 | 274 |
|
20363 | 275 |
$(bfdmakes) : TOOLS = $(call declare_tools,_FOR_TARGET,$(TARGET)-) $(call declare_tools,,$(TARGET)-) |
18021 | 276 |
|
277 |
########################################################################################## |
|
278 |
||
20363 | 279 |
$(gcc) \ |
280 |
$(binutils) \ |
|
281 |
$(gmp) \ |
|
282 |
$(mpfr) \ |
|
283 |
$(mpc) \ |
|
284 |
$(bfdmakes) \ |
|
285 |
$(ccache) : ENVS += $(TOOLS) |
|
18021 | 286 |
|
287 |
# libdir to work around hateful bfd stuff installing into wrong dirs... |
|
20363 | 288 |
# ensure we have 64 bit bfd support in the HOST library. I.e our |
18021 | 289 |
# compiler on i686 will know 64 bit symbols, BUT later |
20363 | 290 |
# we build just the libs again for TARGET, then with whatever the arch |
18021 | 291 |
# wants. |
292 |
$(BUILDDIR)/$(binutils_ver)/Makefile : CONFIG += --enable-64-bit-bfd --libdir=$(PREFIX)/$(word 1,$(LIBDIRS)) |
|
293 |
||
294 |
# Makefile creation. Simply run configure in build dir. |
|
20363 | 295 |
$(bfdmakes) \ |
296 |
$(BUILDDIR)/$(binutils_ver)/Makefile \ |
|
297 |
: $(BINUTILS_CFG) |
|
298 |
$(info Configuring $@. Log in $(@D)/log.config) |
|
299 |
@mkdir -p $(@D) |
|
300 |
( \ |
|
301 |
cd $(@D) ; \ |
|
302 |
$(PATHPRE) $(ENVS) CFLAGS="$(CFLAGS)" \ |
|
303 |
$(BINUTILS_CFG) \ |
|
304 |
$(CONFIG) \ |
|
305 |
--with-sysroot=$(SYSROOT) \ |
|
306 |
--disable-nls \ |
|
307 |
--program-prefix=$(TARGET)- \ |
|
308 |
--enable-multilib \ |
|
309 |
) > $(@D)/log.config 2>&1 |
|
310 |
@echo 'done' |
|
18021 | 311 |
|
20363 | 312 |
$(BUILDDIR)/$(mpfr_ver)/Makefile \ |
313 |
: $(MPFR_CFG) |
|
314 |
$(info Configuring $@. Log in $(@D)/log.config) |
|
315 |
@mkdir -p $(@D) |
|
316 |
( \ |
|
317 |
cd $(@D) ; \ |
|
318 |
$(PATHPRE) $(ENVS) CFLAGS="$(CFLAGS)" \ |
|
319 |
$(MPFR_CFG) \ |
|
320 |
$(CONFIG) \ |
|
321 |
--program-prefix=$(TARGET)- \ |
|
322 |
--enable-shared=no \ |
|
323 |
--with-gmp=$(PREFIX) \ |
|
324 |
) > $(@D)/log.config 2>&1 |
|
325 |
@echo 'done' |
|
18021 | 326 |
|
20363 | 327 |
$(BUILDDIR)/$(gmp_ver)/Makefile \ |
328 |
: $(GMP_CFG) |
|
329 |
$(info Configuring $@. Log in $(@D)/log.config) |
|
330 |
@mkdir -p $(@D) |
|
331 |
( \ |
|
332 |
cd $(@D) ; \ |
|
333 |
$(PATHPRE) $(ENVS) CFLAGS="$(CFLAGS)" \ |
|
334 |
$(GMP_CFG) \ |
|
335 |
--host=$(HOST) --build=$(BUILD) \ |
|
336 |
--prefix=$(PREFIX) \ |
|
337 |
--disable-nls \ |
|
338 |
--program-prefix=$(TARGET)- \ |
|
339 |
--enable-shared=no \ |
|
340 |
--with-mpfr=$(PREFIX) \ |
|
341 |
) > $(@D)/log.config 2>&1 |
|
342 |
@echo 'done' |
|
18021 | 343 |
|
20363 | 344 |
$(BUILDDIR)/$(mpc_ver)/Makefile \ |
345 |
: $(MPC_CFG) |
|
346 |
$(info Configuring $@. Log in $(@D)/log.config) |
|
347 |
@mkdir -p $(@D) |
|
348 |
( \ |
|
349 |
cd $(@D) ; \ |
|
350 |
$(PATHPRE) $(ENVS) CFLAGS="$(CFLAGS)" \ |
|
351 |
$(MPC_CFG) \ |
|
352 |
$(CONFIG) \ |
|
353 |
--program-prefix=$(TARGET)- \ |
|
354 |
--enable-shared=no \ |
|
355 |
--with-mpfr=$(PREFIX) \ |
|
356 |
--with-gmp=$(PREFIX) \ |
|
357 |
) > $(@D)/log.config 2>&1 |
|
358 |
@echo 'done' |
|
18021 | 359 |
|
360 |
# Only valid if glibc target -> linux |
|
361 |
# proper destructor handling for c++ |
|
362 |
ifneq (,$(findstring linux,$(TARGET))) |
|
20363 | 363 |
$(BUILDDIR)/$(gcc_ver)/Makefile : CONFIG += --enable-__cxa_atexit |
18021 | 364 |
endif |
365 |
||
366 |
# Want: |
|
20363 | 367 |
# c,c++ |
368 |
# shared libs |
|
369 |
# multilib (-m32/-m64 on x64) |
|
370 |
# skip native language. |
|
371 |
# and link and assemble with the binutils we created |
|
372 |
# earlier, so --with-gnu* |
|
373 |
$(BUILDDIR)/$(gcc_ver)/Makefile \ |
|
374 |
: $(GCC_CFG) |
|
375 |
$(info Configuring $@. Log in $(@D)/log.config) |
|
376 |
mkdir -p $(@D) |
|
377 |
( \ |
|
378 |
cd $(@D) ; \ |
|
379 |
$(PATHPRE) $(ENVS) $(GCC_CFG) $(EXTRA_CFLAGS) \ |
|
380 |
$(CONFIG) \ |
|
381 |
--with-sysroot=$(SYSROOT) \ |
|
382 |
--enable-languages=c,c++ \ |
|
383 |
--enable-shared \ |
|
384 |
--enable-multilib \ |
|
385 |
--disable-nls \ |
|
386 |
--with-gnu-as \ |
|
387 |
--with-gnu-ld \ |
|
388 |
--with-mpfr=$(PREFIX) \ |
|
389 |
--with-gmp=$(PREFIX) \ |
|
390 |
--with-mpc=$(PREFIX) \ |
|
391 |
) > $(@D)/log.config 2>&1 |
|
392 |
@echo 'done' |
|
18021 | 393 |
|
394 |
# need binutils for gcc |
|
20363 | 395 |
$(gcc) : $(binutils) |
18021 | 396 |
|
397 |
# as of 4.3 or so need these for doing config |
|
398 |
$(BUILDDIR)/$(gcc_ver)/Makefile : $(gmp) $(mpfr) $(mpc) |
|
20363 | 399 |
$(mpfr) : $(gmp) |
400 |
$(mpc) : $(gmp) $(mpfr) |
|
18021 | 401 |
|
402 |
########################################################################################## |
|
20363 | 403 |
# very straightforward. just build a ccache. it is only for host. |
404 |
$(BUILDDIR)/$(ccache_ver)/Makefile \ |
|
405 |
: $(CCACHE_CFG) |
|
406 |
$(info Configuring $@. Log in $(@D)/log.config) |
|
407 |
@mkdir -p $(@D) |
|
408 |
@( \ |
|
409 |
cd $(@D) ; \ |
|
410 |
$(PATHPRE) $(ENVS) $(CCACHE_CFG) \ |
|
411 |
$(CONFIG) \ |
|
412 |
) > $(@D)/log.config 2>&1 |
|
413 |
@echo 'done' |
|
18021 | 414 |
|
20363 | 415 |
gccpatch = $(TARGETDIR)/gcc-patched |
18021 | 416 |
|
417 |
########################################################################################## |
|
20363 | 418 |
# For some reason cpp is not created as a target-compiler |
18021 | 419 |
ifeq ($(HOST),$(TARGET)) |
20363 | 420 |
$(gccpatch) : $(gcc) link_libs |
421 |
@echo -n 'Creating compiler symlinks...' |
|
422 |
@for f in cpp; do \ |
|
423 |
if [ ! -e $(PREFIX)/bin/$(TARGET)-$$f ]; \ |
|
424 |
then \ |
|
425 |
cd $(PREFIX)/bin && \ |
|
426 |
ln -s $$f $(TARGET)-$$f ; \ |
|
427 |
fi \ |
|
428 |
done |
|
429 |
@touch $@ |
|
430 |
@echo 'done' |
|
18021 | 431 |
|
20363 | 432 |
########################################################################################## |
433 |
# Ugly at best. Seems that when we compile host->host compiler, that are NOT |
|
434 |
# the BUILD compiler, the result will not try searching for libs in package root. |
|
435 |
# "Solve" this by create links from the target libdirs to where they are. |
|
436 |
link_libs: |
|
437 |
@echo -n 'Creating library symlinks...' |
|
438 |
@$(foreach l,$(LIBDIRS), \ |
|
439 |
for f in `cd $(PREFIX)/$(l) && ls`; do \ |
|
440 |
if [ ! -e $(TARGETDIR)/$(l)/$$f ]; then \ |
|
441 |
mkdir -p $(TARGETDIR)/$(l) && \ |
|
442 |
cd $(TARGETDIR)/$(l)/ && \ |
|
443 |
ln -s $(if $(findstring /,$(l)),../,)../../$(l)/$$f $$f; \ |
|
444 |
fi \ |
|
445 |
done;) |
|
446 |
@echo 'done' |
|
18021 | 447 |
else |
20363 | 448 |
$(gccpatch) : |
449 |
@echo 'done' |
|
18021 | 450 |
endif |
451 |
||
452 |
########################################################################################## |
|
20363 | 453 |
# Build in two steps. |
18021 | 454 |
# make <default> |
20363 | 455 |
# make install. |
18021 | 456 |
# Use path to our build hosts cross tools |
20363 | 457 |
# Always need to build cross tools for build host self. |
458 |
$(TARGETDIR)/%.done : $(BUILDDIR)/%/Makefile |
|
459 |
$(info Building $(basename $@). Log in $(<D)/log.build) |
|
460 |
$(PATHPRE) $(ENVS) $(MAKE) $(BUILDPAR) -f $< -C $(<D) $(MAKECMD) $(MAKECMD.$(notdir $@)) > $(<D)/log.build 2>&1 |
|
461 |
@echo -n 'installing...' |
|
462 |
$(PATHPRE) $(MAKE) $(INSTALLPAR) -f $< -C $(<D) $(INSTALLCMD) $(MAKECMD.$(notdir $@)) > $(<D)/log.install 2>&1 |
|
463 |
@touch $@ |
|
464 |
@echo 'done' |
|
18021 | 465 |
|
466 |
########################################################################################## |
|
467 |
||
23428
3c8a05bf4656
8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents:
21759
diff
changeset
|
468 |
$(PREFIX)/devkit.info: FRC |
3c8a05bf4656
8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents:
21759
diff
changeset
|
469 |
@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
|
470 |
rm -f $@ |
3c8a05bf4656
8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents:
21759
diff
changeset
|
471 |
touch $@ |
3c8a05bf4656
8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents:
21759
diff
changeset
|
472 |
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
|
473 |
echo '# devkit' >> $@ |
3c8a05bf4656
8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents:
21759
diff
changeset
|
474 |
echo '' >> $@ |
3c8a05bf4656
8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents:
21759
diff
changeset
|
475 |
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
|
476 |
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
|
477 |
echo 'DEVKIT_SYSROOT="$$DEVKIT_ROOT/$$host/sysroot"' >> $@ |
3c8a05bf4656
8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents:
21759
diff
changeset
|
478 |
|
3c8a05bf4656
8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents:
21759
diff
changeset
|
479 |
########################################################################################## |
3c8a05bf4656
8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents:
21759
diff
changeset
|
480 |
|
34100
e3293031f83d
8143236: Update devkit creation makefiles for linux
erikj
parents:
33029
diff
changeset
|
481 |
ifeq ($(TARGET), $(HOST)) |
e3293031f83d
8143236: Update devkit creation makefiles for linux
erikj
parents:
33029
diff
changeset
|
482 |
$(PREFIX)/bin/%: |
e3293031f83d
8143236: Update devkit creation makefiles for linux
erikj
parents:
33029
diff
changeset
|
483 |
@echo 'Creating missing $* soft link' |
e3293031f83d
8143236: Update devkit creation makefiles for linux
erikj
parents:
33029
diff
changeset
|
484 |
ln -s $(TARGET)-$* $@ |
e3293031f83d
8143236: Update devkit creation makefiles for linux
erikj
parents:
33029
diff
changeset
|
485 |
|
e3293031f83d
8143236: Update devkit creation makefiles for linux
erikj
parents:
33029
diff
changeset
|
486 |
missing-links := $(addprefix $(PREFIX)/bin/, \ |
e3293031f83d
8143236: Update devkit creation makefiles for linux
erikj
parents:
33029
diff
changeset
|
487 |
addr2line ar as c++ c++filt elfedit g++ gcc gprof ld nm objcopy ranlib readelf \ |
e3293031f83d
8143236: Update devkit creation makefiles for linux
erikj
parents:
33029
diff
changeset
|
488 |
size strings strip) |
e3293031f83d
8143236: Update devkit creation makefiles for linux
erikj
parents:
33029
diff
changeset
|
489 |
endif |
e3293031f83d
8143236: Update devkit creation makefiles for linux
erikj
parents:
33029
diff
changeset
|
490 |
|
e3293031f83d
8143236: Update devkit creation makefiles for linux
erikj
parents:
33029
diff
changeset
|
491 |
########################################################################################## |
e3293031f83d
8143236: Update devkit creation makefiles for linux
erikj
parents:
33029
diff
changeset
|
492 |
|
20363 | 493 |
bfdlib : $(bfdlib) |
494 |
binutils : $(binutils) |
|
495 |
rpms : $(rpms) |
|
496 |
libs : $(libs) |
|
497 |
sysroot : rpms libs |
|
498 |
gcc : sysroot $(gcc) $(gccpatch) |
|
34100
e3293031f83d
8143236: Update devkit creation makefiles for linux
erikj
parents:
33029
diff
changeset
|
499 |
all : binutils gcc bfdlib $(PREFIX)/devkit.info $(missing-links) |
18021 | 500 |
|
20363 | 501 |
# this is only built for host. so separate. |
502 |
ccache : $(ccache) |
|
18021 | 503 |
|
23428
3c8a05bf4656
8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents:
21759
diff
changeset
|
504 |
# Force target |
3c8a05bf4656
8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents:
21759
diff
changeset
|
505 |
FRC: |
3c8a05bf4656
8038340: Cleanup and fix sysroot and devkit handling on Linux and Solaris
erikj
parents:
21759
diff
changeset
|
506 |
|
20363 | 507 |
.PHONY : gcc all binutils bfdlib link_libs rpms libs sysroot |