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