Makefile revision 1788:015cff85d10d
11817Sdg# 21817Sdg# Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. 31817Sdg# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 41817Sdg# 51817Sdg# This code is free software; you can redistribute it and/or modify it 61817Sdg# under the terms of the GNU General Public License version 2 only, as 71817Sdg# published by the Free Software Foundation. Oracle designates this 81817Sdg# particular file as subject to the "Classpath" exception as provided 91817Sdg# by Oracle in the LICENSE file that accompanied this code. 101817Sdg# 111817Sdg# This code is distributed in the hope that it will be useful, but WITHOUT 121817Sdg# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 131817Sdg# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 141817Sdg# version 2 for more details (a copy is included in the LICENSE file that 151817Sdg# accompanied this code). 161817Sdg# 171817Sdg# You should have received a copy of the GNU General Public License version 181817Sdg# 2 along with this work; if not, write to the Free Software Foundation, 191817Sdg# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 201817Sdg# 211817Sdg# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 221817Sdg# or visit www.oracle.com if you need additional information or have any 231817Sdg# questions. 241817Sdg# 251817Sdg 261817Sdg########################################################################################## 271817Sdg# 281817Sdg# This Makefile, together with Tools.gmk, can be used to compile a set of 291817Sdg# gcc based cross compilation, portable, self contained packages, capable 301817Sdg# of building OpenJDK. 311817Sdg# 321817Sdg# In addition to the makefiles, access to Oracle Linux installation 3321673Sjkh# media is required. This has been tested against Oracle Enterprise Linux 341817Sdg# 5.5. Set variables RPM_DIR_x86_64 and RPM_DIR_i686 respectively to point 351817Sdg# to directory containing the RPMs. 362579Sbde# 372579Sbde# By default this Makefile will build crosstools for: 382123Sjkh# * i686-unknown-linux-gnu 392579Sbde# * x86_64-unknown-linux-gnu 4016029Speter# The x86_64 version of the compilers will work in multi arch mode and will 412579Sbde# be able to compile 32bit binaries with the -m32 flag. This makes the 4218961Sbde# explicit cross compiler for i686 somewhat redundant and is a known issue. 4313107Sbde# 44757Sdg# To build the full set of crosstools, use a command line looking like this: 4522636Sbde# 4622636Sbde# make tars RPM_DIR_x86_64=/tmp/oel64-x86_64/Packages/ RPM_DIR_i686=/tmp/oel64-i686/Packages/ 4722636Sbde# 48757Sdg# To create a x86_64 package without the redundant i686 cross compiler, do 4922636Sbde# like this: 5018961Sbde# 51757Sdg# make tars platforms=x86_64-unknown-linux-gnu RPM_DIR_x86_64=/tmp/oel64-x86_64/Packages/ RPM_DIR_i686=/tmp/oel64-i686/Packages/ 5218961Sbde 5318961Sbde# 5413107Sbde# Main makefile which iterates over all host and target platforms. 5518961Sbde# 56757Sdg 57757Sdgos := $(shell uname -o) 58757Sdgcpu := x86_64 5913107Sbde#$(shell uname -p) 6013107Sbde 6113107Sbde# 6213107Sbde# This wrapper script can handle exactly these platforms 6313107Sbde# 6413107Sbdeplatforms := $(foreach p,x86_64 i686,$(p)-unknown-linux-gnu) 6513107Sbde#platforms := $(foreach p,x86_64,$(p)-unknown-linux-gnu) 6613107Sbde 6713107Sbde# Figure out what platform this is building on. 6818961Sbdeme := $(cpu)-$(if $(findstring Linux,$(os)),unknown-linux-gnu) 6918961Sbde 7018961Sbde$(info Building on platform $(me)) 7118961Sbde 7218961Sbdeall compile : $(platforms) 7318961Sbde 7413107Sbdeifeq (,$(SKIP_ME)) 7513107Sbde $(foreach p,$(filter-out $(me),$(platforms)),$(eval $(p) : $$(me))) 7613107Sbdeendif 7713107Sbde 7818961SbdeOUTPUT_ROOT = $(abspath ../../build/devkit) 7918961SbdeRESULT = $(OUTPUT_ROOT)/result 8018961Sbde 8118961Sbdesubmakevars = HOST=$@ BUILD=$(me) \ 8218961Sbde RESULT=$(RESULT) PREFIX=$(RESULT)/$@ \ 8313107Sbde OUTPUT_ROOT=$(OUTPUT_ROOT) 8413107Sbde$(platforms) : 8513107Sbde @echo 'Building compilers for $@' 8613107Sbde @echo 'Targets: $(platforms)' 8713107Sbde for p in $@ $(filter-out $@,$(platforms)); do \ 8813107Sbde $(MAKE) -f Tools.gmk all $(submakevars) \ 8913107Sbde TARGET=$$p || exit 1 ; \ 9013107Sbde done 9113107Sbde @echo 'Building ccache program for $@' 9218961Sbde $(MAKE) -f Tools.gmk ccache $(submakevars) TARGET=$@ 9318961Sbde @echo 'All done"' 9418961Sbde 9518961Sbde$(foreach a,i686 x86_64,$(eval $(a) : $(filter $(a)%,$(platforms)))) 96757Sdg 9713107Sbdeia32 : i686 9818961Sbdetoday := $(shell date +%Y%m%d) 9918961Sbde 10018961Sbde 10118961Sbdedefine Mktar 10213107Sbde $(1)_tar = $$(RESULT)/sdk-$(1)-$$(today).tar.gz 10313107Sbde $$($(1)_tar) : PLATFORM = $(1) 10413107Sbde TARFILES += $$($(1)_tar) 10513107Sbde $$($(1)_tar) : $(1) $$(shell find $$(RESULT)/$(1)) 10613107Sbdeendef 10718961Sbde 10818961Sbde$(foreach p,$(platforms),$(eval $(call Mktar,$(p)))) 10918961Sbde 110757Sdgtars : all $(TARFILES) 111757Sdgonlytars : $(TARFILES) 112757Sdg%.tar.gz : 11313107Sbde @echo 'Creating compiler package $@' 11413107Sbde cd $(RESULT)/$(PLATFORM) && tar -czf $@ * 115757Sdg touch $@ 11613107Sbde 11718961Sbdeclean : 11818961Sbde rm -rf build result 11913107Sbde 12013107SbdeFORCE : 1211321Sdg.PHONY : $(configs) $(platforms) 12213107Sbde