make/devkit/Makefile

Thu, 31 Aug 2017 15:40:18 +0800

author
aoqi
date
Thu, 31 Aug 2017 15:40:18 +0800
changeset 1133
50aaf272884f
parent 912
a667caba1e84
parent 0
75a576e87639
child 2316
64a3eeabf6e5
permissions
-rw-r--r--

merge

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

mercurial