erikj@740: # erikj@740: # Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. erikj@740: # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. erikj@740: # erikj@740: # This code is free software; you can redistribute it and/or modify it erikj@740: # under the terms of the GNU General Public License version 2 only, as erikj@740: # published by the Free Software Foundation. Oracle designates this erikj@740: # particular file as subject to the "Classpath" exception as provided erikj@740: # by Oracle in the LICENSE file that accompanied this code. erikj@740: # erikj@740: # This code is distributed in the hope that it will be useful, but WITHOUT erikj@740: # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or erikj@740: # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License erikj@740: # version 2 for more details (a copy is included in the LICENSE file that erikj@740: # accompanied this code). erikj@740: # erikj@740: # You should have received a copy of the GNU General Public License version erikj@740: # 2 along with this work; if not, write to the Free Software Foundation, erikj@740: # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. erikj@740: # erikj@740: # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA erikj@740: # or visit www.oracle.com if you need additional information or have any erikj@740: # questions. erikj@740: # erikj@740: erikj@740: ########################################################################################## erikj@740: # ihse@839: # This Makefile, together with Tools.gmk, can be used to compile a set of ihse@839: # gcc based cross compilation, portable, self contained packages, capable erikj@740: # of building OpenJDK. ihse@839: # ihse@839: # In addition to the makefiles, access to Oracle Linux installation ihse@839: # media is required. This has been tested against Oracle Enterprise Linux erikj@740: # 5.5. Set variables RPM_DIR_x86_64 and RPM_DIR_i686 respectively to point erikj@740: # to directory containing the RPMs. erikj@740: # erikj@740: # By default this Makefile will build crosstools for: erikj@740: # * i686-unknown-linux-gnu erikj@740: # * x86_64-unknown-linux-gnu erikj@740: # The x86_64 version of the compilers will work in multi arch mode and will erikj@740: # be able to compile 32bit binaries with the -m32 flag. This makes the erikj@740: # explicit cross compiler for i686 somewhat redundant and is a known issue. erikj@740: # erikj@740: # To build the full set of crosstools, use a command line looking like this: erikj@740: # ihse@839: # make tars RPM_DIR_x86_64=/tmp/oel55-x86_64/Server/ RPM_DIR_i686=/tmp/oel55-i686/Server/ erikj@740: # ihse@839: # To create a x86_64 package without the redundant i686 cross compiler, do erikj@740: # like this: erikj@740: # erikj@740: # make tars platforms=x86_64-unknown-linux-gnu RPM_DIR_x86_64=/tmp/oel55-x86_64/Server/ RPM_DIR_i686=/tmp/oel55-i686/Server/ erikj@740: erikj@740: # erikj@740: # Main makefile which iterates over all host and target platforms. erikj@740: # erikj@740: ihse@839: os := $(shell uname -o) ihse@839: cpu := x86_64 erikj@740: #$(shell uname -p) erikj@740: erikj@740: # erikj@740: # This wrapper script can handle exactly these platforms erikj@740: # ihse@839: platforms := $(foreach p,x86_64 i686,$(p)-unknown-linux-gnu) ihse@839: #platforms := $(foreach p,x86_64,$(p)-unknown-linux-gnu) erikj@740: erikj@740: # Figure out what platform this is building on. ihse@839: me := $(cpu)-$(if $(findstring Linux,$(os)),unknown-linux-gnu) erikj@740: erikj@740: $(info Building on platform $(me)) erikj@740: ihse@839: all compile : $(platforms) erikj@740: erikj@740: ifeq (,$(SKIP_ME)) ihse@839: $(foreach p,$(filter-out $(me),$(platforms)),$(eval $(p) : $$(me))) erikj@740: endif erikj@740: kevinw@2215: OUTPUT_ROOT = $(abspath ../../build/devkit) ihse@839: RESULT = $(OUTPUT_ROOT)/result erikj@740: ihse@839: submakevars = HOST=$@ BUILD=$(me) \ ihse@839: RESULT=$(RESULT) PREFIX=$(RESULT)/$@ \ ihse@839: OUTPUT_ROOT=$(OUTPUT_ROOT) ihse@839: $(platforms) : ihse@839: @echo 'Building compilers for $@' ihse@839: @echo 'Targets: $(platforms)' ihse@839: for p in $@ $(filter-out $@,$(platforms)); do \ ihse@839: $(MAKE) -f Tools.gmk all $(submakevars) \ ihse@839: TARGET=$$p || exit 1 ; \ ihse@839: done ihse@839: @echo 'Building ccache program for $@' ihse@839: $(MAKE) -f Tools.gmk ccache $(submakevars) TARGET=$@ ihse@839: @echo 'All done"' erikj@740: erikj@740: $(foreach a,i686 x86_64,$(eval $(a) : $(filter $(a)%,$(platforms)))) erikj@740: ihse@839: ia32 : i686 ihse@839: today := $(shell date +%Y%m%d) erikj@740: erikj@740: erikj@740: define Mktar ihse@839: $(1)_tar = $$(RESULT)/sdk-$(1)-$$(today).tar.gz ihse@839: $$($(1)_tar) : PLATFORM = $(1) ihse@839: TARFILES += $$($(1)_tar) ihse@839: $$($(1)_tar) : $(1) $$(shell find $$(RESULT)/$(1)) erikj@740: endef erikj@740: erikj@740: $(foreach p,$(platforms),$(eval $(call Mktar,$(p)))) erikj@740: ihse@839: tars : all $(TARFILES) ihse@839: onlytars : $(TARFILES) ihse@839: %.tar.gz : ihse@839: @echo 'Creating compiler package $@' ihse@839: cd $(RESULT)/$(PLATFORM) && tar -czf $@ * ihse@839: touch $@ erikj@740: ihse@839: clean : erikj@740: rm -rf build result erikj@740: ihse@839: FORCE : ihse@839: .PHONY : $(configs) $(platforms)