make/devkit/Makefile
author lana
Tue, 11 Feb 2014 11:25:18 -0800
changeset 22670 fdf4454a8368
parent 21759 e24e22311718
child 23428 3c8a05bf4656
permissions -rw-r--r--
Merge
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
#
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
    28
# This Makefile, together with Tools.gmk, can be used to compile a set of
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
    29
# gcc based cross compilation, portable, self contained packages, capable
18021
680b9b43e2d6 8015377: Support using compiler devkits on Linux
erikj
parents:
diff changeset
    30
# of building OpenJDK.
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
    31
#
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
    32
# In addition to the makefiles, access to Oracle Linux installation
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
    33
# media is required. This has been tested against Oracle Enterprise Linux
18021
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
#
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
    46
# make tars RPM_DIR_x86_64=/tmp/oel55-x86_64/Server/ RPM_DIR_i686=/tmp/oel55-i686/Server/
18021
680b9b43e2d6 8015377: Support using compiler devkits on Linux
erikj
parents:
diff changeset
    47
#
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
    48
# To create a x86_64 package without the redundant i686 cross compiler, do
18021
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
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
    57
os := $(shell uname -o)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
    58
cpu := x86_64
18021
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
#
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
    64
platforms := $(foreach p,x86_64 i686,$(p)-unknown-linux-gnu)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
    65
#platforms := $(foreach p,x86_64,$(p)-unknown-linux-gnu)
18021
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.
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
    68
me := $(cpu)-$(if $(findstring Linux,$(os)),unknown-linux-gnu)
18021
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
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
    72
all compile : $(platforms)
18021
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))
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
    75
  $(foreach p,$(filter-out $(me),$(platforms)),$(eval $(p) : $$(me)))
18021
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
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
    78
OUTPUT_ROOT = $(abspath ../../../build/devkit)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
    79
RESULT = $(OUTPUT_ROOT)/result
18021
680b9b43e2d6 8015377: Support using compiler devkits on Linux
erikj
parents:
diff changeset
    80
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
    81
submakevars = HOST=$@ BUILD=$(me) \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
    82
    RESULT=$(RESULT) PREFIX=$(RESULT)/$@ \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
    83
    OUTPUT_ROOT=$(OUTPUT_ROOT)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
    84
$(platforms) :
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
    85
	@echo 'Building compilers for $@'
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
    86
	@echo 'Targets: $(platforms)'
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
    87
	for p in $@ $(filter-out $@,$(platforms)); do \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
    88
	  $(MAKE) -f Tools.gmk all $(submakevars) \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
    89
	      TARGET=$$p || exit 1 ; \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
    90
	done
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
    91
	@echo 'Building ccache program for $@'
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
    92
	$(MAKE) -f Tools.gmk ccache $(submakevars) TARGET=$@
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
    93
	@echo 'All done"'
18021
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
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
    97
ia32 : i686
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
    98
today := $(shell date +%Y%m%d)
18021
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
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
   102
  $(1)_tar = $$(RESULT)/sdk-$(1)-$$(today).tar.gz
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
   103
  $$($(1)_tar) : PLATFORM = $(1)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
   104
  TARFILES += $$($(1)_tar)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
   105
  $$($(1)_tar) : $(1) $$(shell find $$(RESULT)/$(1))
18021
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
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
   110
tars : all $(TARFILES)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
   111
onlytars : $(TARFILES)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
   112
%.tar.gz :
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
   113
	@echo 'Creating compiler package $@'
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
   114
	cd $(RESULT)/$(PLATFORM) && tar -czf $@ *
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
   115
	touch $@
18021
680b9b43e2d6 8015377: Support using compiler devkits on Linux
erikj
parents:
diff changeset
   116
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
   117
clean :
18021
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
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
   120
FORCE :
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
   121
.PHONY : $(configs) $(platforms)