Makefile revision 1008:9786ef8ca58c
1234287Sdim# 2234287Sdim# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 3234287Sdim# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4234287Sdim# 5234287Sdim# This code is free software; you can redistribute it and/or modify it 6234287Sdim# under the terms of the GNU General Public License version 2 only, as 7234287Sdim# published by the Free Software Foundation. Oracle designates this 8234287Sdim# particular file as subject to the "Classpath" exception as provided 9234287Sdim# by Oracle in the LICENSE file that accompanied this code. 10234287Sdim# 11234287Sdim# This code is distributed in the hope that it will be useful, but WITHOUT 12234287Sdim# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13234287Sdim# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14249423Sdim# version 2 for more details (a copy is included in the LICENSE file that 15234287Sdim# accompanied this code). 16234287Sdim# 17234287Sdim# You should have received a copy of the GNU General Public License version 18234287Sdim# 2 along with this work; if not, write to the Free Software Foundation, 19234287Sdim# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20234287Sdim# 21234287Sdim# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22234287Sdim# or visit www.oracle.com if you need additional information or have any 23234287Sdim# questions. 24234287Sdim# 25234287Sdim 26234287Sdim########################################################################################## 27234287Sdim# 28234287Sdim# This Makefile, together with Tools.gmk, can be used to compile a set of 29234287Sdim# gcc based cross compilation, portable, self contained packages, capable 30234287Sdim# of building OpenJDK. 31234287Sdim# 32234287Sdim# In addition to the makefiles, access to Oracle Linux installation 33234287Sdim# media is required. This has been tested against Oracle Enterprise Linux 34234287Sdim# 5.5. Set variables RPM_DIR_x86_64 and RPM_DIR_i686 respectively to point 35234287Sdim# to directory containing the RPMs. 36234287Sdim# 37234287Sdim# By default this Makefile will build crosstools for: 38234287Sdim# * i686-unknown-linux-gnu 39234287Sdim# * x86_64-unknown-linux-gnu 40234287Sdim# The x86_64 version of the compilers will work in multi arch mode and will 41234287Sdim# be able to compile 32bit binaries with the -m32 flag. This makes the 42234287Sdim# explicit cross compiler for i686 somewhat redundant and is a known issue. 43234287Sdim# 44234287Sdim# To build the full set of crosstools, use a command line looking like this: 45234287Sdim# 46234287Sdim# make tars RPM_DIR_x86_64=/tmp/oel55-x86_64/Server/ RPM_DIR_i686=/tmp/oel55-i686/Server/ 47234287Sdim# 48234287Sdim# To create a x86_64 package without the redundant i686 cross compiler, do 49234287Sdim# like this: 50234287Sdim# 51234287Sdim# make tars platforms=x86_64-unknown-linux-gnu RPM_DIR_x86_64=/tmp/oel55-x86_64/Server/ RPM_DIR_i686=/tmp/oel55-i686/Server/ 52234287Sdim 53234287Sdim# 54234287Sdim# Main makefile which iterates over all host and target platforms. 55243830Sdim# 56234287Sdim 57234287Sdimos := $(shell uname -o) 58234287Sdimcpu := x86_64 59234287Sdim#$(shell uname -p) 60234287Sdim 61234287Sdim# 62234287Sdim# This wrapper script can handle exactly these platforms 63# 64platforms := $(foreach p,x86_64 i686,$(p)-unknown-linux-gnu) 65#platforms := $(foreach p,x86_64,$(p)-unknown-linux-gnu) 66 67# Figure out what platform this is building on. 68me := $(cpu)-$(if $(findstring Linux,$(os)),unknown-linux-gnu) 69 70$(info Building on platform $(me)) 71 72all compile : $(platforms) 73 74ifeq (,$(SKIP_ME)) 75 $(foreach p,$(filter-out $(me),$(platforms)),$(eval $(p) : $$(me))) 76endif 77 78OUTPUT_ROOT = $(abspath ../../build/devkit) 79RESULT = $(OUTPUT_ROOT)/result 80 81submakevars = HOST=$@ BUILD=$(me) \ 82 RESULT=$(RESULT) PREFIX=$(RESULT)/$@ \ 83 OUTPUT_ROOT=$(OUTPUT_ROOT) 84$(platforms) : 85 @echo 'Building compilers for $@' 86 @echo 'Targets: $(platforms)' 87 for p in $@ $(filter-out $@,$(platforms)); do \ 88 $(MAKE) -f Tools.gmk all $(submakevars) \ 89 TARGET=$$p || exit 1 ; \ 90 done 91 @echo 'Building ccache program for $@' 92 $(MAKE) -f Tools.gmk ccache $(submakevars) TARGET=$@ 93 @echo 'All done"' 94 95$(foreach a,i686 x86_64,$(eval $(a) : $(filter $(a)%,$(platforms)))) 96 97ia32 : i686 98today := $(shell date +%Y%m%d) 99 100 101define Mktar 102 $(1)_tar = $$(RESULT)/sdk-$(1)-$$(today).tar.gz 103 $$($(1)_tar) : PLATFORM = $(1) 104 TARFILES += $$($(1)_tar) 105 $$($(1)_tar) : $(1) $$(shell find $$(RESULT)/$(1)) 106endef 107 108$(foreach p,$(platforms),$(eval $(call Mktar,$(p)))) 109 110tars : all $(TARFILES) 111onlytars : $(TARFILES) 112%.tar.gz : 113 @echo 'Creating compiler package $@' 114 cd $(RESULT)/$(PLATFORM) && tar -czf $@ * 115 touch $@ 116 117clean : 118 rm -rf build result 119 120FORCE : 121.PHONY : $(configs) $(platforms) 122