Wed, 17 Dec 2014 22:55:30 +0300
Merge
erikj@740 | 1 | # |
erikj@740 | 2 | # Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
erikj@740 | 3 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
erikj@740 | 4 | # |
erikj@740 | 5 | # This code is free software; you can redistribute it and/or modify it |
erikj@740 | 6 | # under the terms of the GNU General Public License version 2 only, as |
erikj@740 | 7 | # published by the Free Software Foundation. Oracle designates this |
erikj@740 | 8 | # particular file as subject to the "Classpath" exception as provided |
erikj@740 | 9 | # by Oracle in the LICENSE file that accompanied this code. |
erikj@740 | 10 | # |
erikj@740 | 11 | # This code is distributed in the hope that it will be useful, but WITHOUT |
erikj@740 | 12 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
erikj@740 | 13 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
erikj@740 | 14 | # version 2 for more details (a copy is included in the LICENSE file that |
erikj@740 | 15 | # accompanied this code). |
erikj@740 | 16 | # |
erikj@740 | 17 | # You should have received a copy of the GNU General Public License version |
erikj@740 | 18 | # 2 along with this work; if not, write to the Free Software Foundation, |
erikj@740 | 19 | # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
erikj@740 | 20 | # |
erikj@740 | 21 | # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
erikj@740 | 22 | # or visit www.oracle.com if you need additional information or have any |
erikj@740 | 23 | # questions. |
erikj@740 | 24 | # |
erikj@740 | 25 | |
erikj@740 | 26 | ########################################################################################## |
erikj@740 | 27 | # |
ihse@839 | 28 | # This Makefile, together with Tools.gmk, can be used to compile a set of |
ihse@839 | 29 | # gcc based cross compilation, portable, self contained packages, capable |
erikj@740 | 30 | # of building OpenJDK. |
ihse@839 | 31 | # |
ihse@839 | 32 | # In addition to the makefiles, access to Oracle Linux installation |
ihse@839 | 33 | # media is required. This has been tested against Oracle Enterprise Linux |
erikj@740 | 34 | # 5.5. Set variables RPM_DIR_x86_64 and RPM_DIR_i686 respectively to point |
erikj@740 | 35 | # to directory containing the RPMs. |
erikj@740 | 36 | # |
erikj@740 | 37 | # By default this Makefile will build crosstools for: |
erikj@740 | 38 | # * i686-unknown-linux-gnu |
erikj@740 | 39 | # * x86_64-unknown-linux-gnu |
erikj@740 | 40 | # The x86_64 version of the compilers will work in multi arch mode and will |
erikj@740 | 41 | # be able to compile 32bit binaries with the -m32 flag. This makes the |
erikj@740 | 42 | # explicit cross compiler for i686 somewhat redundant and is a known issue. |
erikj@740 | 43 | # |
erikj@740 | 44 | # To build the full set of crosstools, use a command line looking like this: |
erikj@740 | 45 | # |
ihse@839 | 46 | # make tars RPM_DIR_x86_64=/tmp/oel55-x86_64/Server/ RPM_DIR_i686=/tmp/oel55-i686/Server/ |
erikj@740 | 47 | # |
ihse@839 | 48 | # To create a x86_64 package without the redundant i686 cross compiler, do |
erikj@740 | 49 | # like this: |
erikj@740 | 50 | # |
erikj@740 | 51 | # 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 | 52 | |
erikj@740 | 53 | # |
erikj@740 | 54 | # Main makefile which iterates over all host and target platforms. |
erikj@740 | 55 | # |
erikj@740 | 56 | |
ihse@839 | 57 | os := $(shell uname -o) |
ihse@839 | 58 | cpu := x86_64 |
erikj@740 | 59 | #$(shell uname -p) |
erikj@740 | 60 | |
erikj@740 | 61 | # |
erikj@740 | 62 | # This wrapper script can handle exactly these platforms |
erikj@740 | 63 | # |
ihse@839 | 64 | platforms := $(foreach p,x86_64 i686,$(p)-unknown-linux-gnu) |
ihse@839 | 65 | #platforms := $(foreach p,x86_64,$(p)-unknown-linux-gnu) |
erikj@740 | 66 | |
erikj@740 | 67 | # Figure out what platform this is building on. |
ihse@839 | 68 | me := $(cpu)-$(if $(findstring Linux,$(os)),unknown-linux-gnu) |
erikj@740 | 69 | |
erikj@740 | 70 | $(info Building on platform $(me)) |
erikj@740 | 71 | |
ihse@839 | 72 | all compile : $(platforms) |
erikj@740 | 73 | |
erikj@740 | 74 | ifeq (,$(SKIP_ME)) |
ihse@839 | 75 | $(foreach p,$(filter-out $(me),$(platforms)),$(eval $(p) : $$(me))) |
erikj@740 | 76 | endif |
erikj@740 | 77 | |
ihse@839 | 78 | OUTPUT_ROOT = $(abspath ../../../build/devkit) |
ihse@839 | 79 | RESULT = $(OUTPUT_ROOT)/result |
erikj@740 | 80 | |
ihse@839 | 81 | submakevars = HOST=$@ BUILD=$(me) \ |
ihse@839 | 82 | RESULT=$(RESULT) PREFIX=$(RESULT)/$@ \ |
ihse@839 | 83 | OUTPUT_ROOT=$(OUTPUT_ROOT) |
ihse@839 | 84 | $(platforms) : |
ihse@839 | 85 | @echo 'Building compilers for $@' |
ihse@839 | 86 | @echo 'Targets: $(platforms)' |
ihse@839 | 87 | for p in $@ $(filter-out $@,$(platforms)); do \ |
ihse@839 | 88 | $(MAKE) -f Tools.gmk all $(submakevars) \ |
ihse@839 | 89 | TARGET=$$p || exit 1 ; \ |
ihse@839 | 90 | done |
ihse@839 | 91 | @echo 'Building ccache program for $@' |
ihse@839 | 92 | $(MAKE) -f Tools.gmk ccache $(submakevars) TARGET=$@ |
ihse@839 | 93 | @echo 'All done"' |
erikj@740 | 94 | |
erikj@740 | 95 | $(foreach a,i686 x86_64,$(eval $(a) : $(filter $(a)%,$(platforms)))) |
erikj@740 | 96 | |
ihse@839 | 97 | ia32 : i686 |
ihse@839 | 98 | today := $(shell date +%Y%m%d) |
erikj@740 | 99 | |
erikj@740 | 100 | |
erikj@740 | 101 | define Mktar |
ihse@839 | 102 | $(1)_tar = $$(RESULT)/sdk-$(1)-$$(today).tar.gz |
ihse@839 | 103 | $$($(1)_tar) : PLATFORM = $(1) |
ihse@839 | 104 | TARFILES += $$($(1)_tar) |
ihse@839 | 105 | $$($(1)_tar) : $(1) $$(shell find $$(RESULT)/$(1)) |
erikj@740 | 106 | endef |
erikj@740 | 107 | |
erikj@740 | 108 | $(foreach p,$(platforms),$(eval $(call Mktar,$(p)))) |
erikj@740 | 109 | |
ihse@839 | 110 | tars : all $(TARFILES) |
ihse@839 | 111 | onlytars : $(TARFILES) |
ihse@839 | 112 | %.tar.gz : |
ihse@839 | 113 | @echo 'Creating compiler package $@' |
ihse@839 | 114 | cd $(RESULT)/$(PLATFORM) && tar -czf $@ * |
ihse@839 | 115 | touch $@ |
erikj@740 | 116 | |
ihse@839 | 117 | clean : |
erikj@740 | 118 | rm -rf build result |
erikj@740 | 119 | |
ihse@839 | 120 | FORCE : |
ihse@839 | 121 | .PHONY : $(configs) $(platforms) |