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