1 # 2 # Copyright (c) 2013, 2018, 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 # This Makefile, together with Tools.gmk, can be used to compile a set of 29 # gcc based cross compilation, portable, self contained packages, capable 30 # of building OpenJDK. 31 # 32 # In addition to the makefiles, access to Oracle Linux installation 33 # media is required. This has been tested against Oracle Enterprise Linux 34 # 6.4. 35 # 36 # By default this Makefile will build a native toolchain for the current 37 # platform if called with something like this: 38 # 39 # make tars BASE_OS=OEL6 40 # 41 # To build the full set of crosstools for additional platforms, use a command 42 # line looking like this: 43 # 44 # make cross_compile_target="aarch64-linux-gnu" BASE_OS=Fedora27 45 # or 46 # make cross_compile_target="arm-linux-gnueabihf" BASE_OS=Fedora27 47 # 48 # This is the makefile which iterates over all host and target platforms. 49 # 50 51 os := $(shell uname -o) 52 cpu := $(shell uname -p) 53 54 # Figure out what platform this is building on. 55 me := $(cpu)-$(if $(findstring Linux,$(os)),unknown-linux-gnu) 56 57 $(info Building on platform $(me)) 58 59 # 60 # By default just build for the current platform, which is assumed to be Linux 61 # 62 ifeq ($(cross_compile_target), ) 63 platforms := $(me) 64 host_platforms := $(platforms) 65 else 66 platforms := $(cross_compile_target) 67 host_platforms := $(me) 68 endif 69 target_platforms := $(platforms) 70 $(info host_platforms $(host_platforms)) 71 $(info target_platforms $(target_platforms)) 72 73 all compile : $(platforms) 74 75 ifeq (,$(SKIP_ME)) 76 $(foreach p,$(filter-out $(me),$(platforms)),$(eval $(p) : $$(me))) 77 endif 78 79 OUTPUT_ROOT = $(abspath ../../build/devkit) 80 RESULT = $(OUTPUT_ROOT)/result 81 82 submakevars = HOST=$@ BUILD=$(me) \ 83 RESULT=$(RESULT) PREFIX=$(RESULT)/$@ \ 84 OUTPUT_ROOT=$(OUTPUT_ROOT) 85 $(host_platforms) : 86 @echo 'Building compilers for $@' 87 @echo 'Targets: $(target_platforms)' 88 for p in $(filter $@, $(target_platforms)) $(filter-out $@, $(target_platforms)); do \ 89 $(MAKE) -f Tools.gmk download-rpms $(submakevars) TARGET=$$p && \ 90 $(MAKE) -f Tools.gmk all $(submakevars) \ 91 TARGET=$$p || exit 1 ; \ 92 done 93 @echo 'Building ccache program for $@' 94 $(MAKE) -f Tools.gmk ccache $(submakevars) TARGET=$@ 95 @echo 'All done"' 96 97 today := $(shell date +%Y%m%d) 98 99 define Mktar 100 $(1)_tar = $$(RESULT)/sdk-$(1)-$$(today).tar.gz 101 $$($(1)_tar) : PLATFORM = $(1) 102 TARFILES += $$($(1)_tar) 103 $$($(1)_tar) : $(1) $$(shell find $$(RESULT)/$(1)) 104 endef 105 106 $(foreach p,$(host_platforms),$(eval $(call Mktar,$(p)))) 107 108 tars : all $(TARFILES) 109 onlytars : $(TARFILES) 110 %.tar.gz : 111 @echo 'Creating compiler package $@' 112 cd $(RESULT)/$(PLATFORM) && tar -czf $@ * 113 touch $@ 114 115 clean : 116 rm -rf $(addprefix ../../build/devkit/, result $(host_platforms)) 117 dist-clean: clean 118 rm -rf $(addprefix ../../build/devkit/, src download) 119 120 FORCE : 121 .PHONY : all compile tars $(configs) $(host_platforms) clean dist-clean