make/devkit/Makefile
author coleenp
Fri, 09 Mar 2018 12:03:20 -0500
changeset 49366 f95ef5511e1f
parent 48839 042834d56fbf
child 49204 564802b01ded
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
#
48839
042834d56fbf 8196998: Create devkit for Linux with gcc 7.3
erikj
parents: 47253
diff changeset
     2
# Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
18021
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
48839
042834d56fbf 8196998: Create devkit for Linux with gcc 7.3
erikj
parents: 47253
diff changeset
    26
################################################################################
18021
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
48839
042834d56fbf 8196998: Create devkit for Linux with gcc 7.3
erikj
parents: 47253
diff changeset
    34
# 6.4.
18021
680b9b43e2d6 8015377: Support using compiler devkits on Linux
erikj
parents:
diff changeset
    35
#
48839
042834d56fbf 8196998: Create devkit for Linux with gcc 7.3
erikj
parents: 47253
diff changeset
    36
# By default this Makefile will build a native toolchain for the current
042834d56fbf 8196998: Create devkit for Linux with gcc 7.3
erikj
parents: 47253
diff changeset
    37
# platform if called with something like this:
042834d56fbf 8196998: Create devkit for Linux with gcc 7.3
erikj
parents: 47253
diff changeset
    38
#
042834d56fbf 8196998: Create devkit for Linux with gcc 7.3
erikj
parents: 47253
diff changeset
    39
# make tars
18021
680b9b43e2d6 8015377: Support using compiler devkits on Linux
erikj
parents:
diff changeset
    40
#
48839
042834d56fbf 8196998: Create devkit for Linux with gcc 7.3
erikj
parents: 47253
diff changeset
    41
# To build the full set of crosstools for additional platforms, use a command
042834d56fbf 8196998: Create devkit for Linux with gcc 7.3
erikj
parents: 47253
diff changeset
    42
# line looking like this:
18021
680b9b43e2d6 8015377: Support using compiler devkits on Linux
erikj
parents:
diff changeset
    43
#
48839
042834d56fbf 8196998: Create devkit for Linux with gcc 7.3
erikj
parents: 47253
diff changeset
    44
# make tars platforms="x86_64-unknown-linux-gnu sparc64-unknown-linux-gnu"
18021
680b9b43e2d6 8015377: Support using compiler devkits on Linux
erikj
parents:
diff changeset
    45
#
48839
042834d56fbf 8196998: Create devkit for Linux with gcc 7.3
erikj
parents: 47253
diff changeset
    46
# This is the makefile which iterates over all host and target platforms.
18021
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
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
    49
os := $(shell uname -o)
48839
042834d56fbf 8196998: Create devkit for Linux with gcc 7.3
erikj
parents: 47253
diff changeset
    50
cpu := $(shell uname -p)
18021
680b9b43e2d6 8015377: Support using compiler devkits on Linux
erikj
parents:
diff changeset
    51
680b9b43e2d6 8015377: Support using compiler devkits on Linux
erikj
parents:
diff changeset
    52
# Figure out what platform this is building on.
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
    53
me := $(cpu)-$(if $(findstring Linux,$(os)),unknown-linux-gnu)
18021
680b9b43e2d6 8015377: Support using compiler devkits on Linux
erikj
parents:
diff changeset
    54
680b9b43e2d6 8015377: Support using compiler devkits on Linux
erikj
parents:
diff changeset
    55
$(info Building on platform $(me))
680b9b43e2d6 8015377: Support using compiler devkits on Linux
erikj
parents:
diff changeset
    56
48839
042834d56fbf 8196998: Create devkit for Linux with gcc 7.3
erikj
parents: 47253
diff changeset
    57
#
042834d56fbf 8196998: Create devkit for Linux with gcc 7.3
erikj
parents: 47253
diff changeset
    58
# By default just build for the current platform, which is assumed to be Linux
042834d56fbf 8196998: Create devkit for Linux with gcc 7.3
erikj
parents: 47253
diff changeset
    59
#
042834d56fbf 8196998: Create devkit for Linux with gcc 7.3
erikj
parents: 47253
diff changeset
    60
platforms := $(me)
042834d56fbf 8196998: Create devkit for Linux with gcc 7.3
erikj
parents: 47253
diff changeset
    61
host_platforms := $(platforms)
042834d56fbf 8196998: Create devkit for Linux with gcc 7.3
erikj
parents: 47253
diff changeset
    62
target_platforms := $(platforms)
042834d56fbf 8196998: Create devkit for Linux with gcc 7.3
erikj
parents: 47253
diff changeset
    63
$(info host_platforms $(host_platforms))
042834d56fbf 8196998: Create devkit for Linux with gcc 7.3
erikj
parents: 47253
diff changeset
    64
$(info target_platforms $(target_platforms))
042834d56fbf 8196998: Create devkit for Linux with gcc 7.3
erikj
parents: 47253
diff changeset
    65
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
    66
all compile : $(platforms)
18021
680b9b43e2d6 8015377: Support using compiler devkits on Linux
erikj
parents:
diff changeset
    67
680b9b43e2d6 8015377: Support using compiler devkits on Linux
erikj
parents:
diff changeset
    68
ifeq (,$(SKIP_ME))
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
    69
  $(foreach p,$(filter-out $(me),$(platforms)),$(eval $(p) : $$(me)))
18021
680b9b43e2d6 8015377: Support using compiler devkits on Linux
erikj
parents:
diff changeset
    70
endif
680b9b43e2d6 8015377: Support using compiler devkits on Linux
erikj
parents:
diff changeset
    71
48839
042834d56fbf 8196998: Create devkit for Linux with gcc 7.3
erikj
parents: 47253
diff changeset
    72
OUTPUT_ROOT = $(abspath ../../build/devkit)
042834d56fbf 8196998: Create devkit for Linux with gcc 7.3
erikj
parents: 47253
diff changeset
    73
RESULT = $(OUTPUT_ROOT)/result
18021
680b9b43e2d6 8015377: Support using compiler devkits on Linux
erikj
parents:
diff changeset
    74
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
    75
submakevars = HOST=$@ BUILD=$(me) \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
    76
    RESULT=$(RESULT) PREFIX=$(RESULT)/$@ \
48839
042834d56fbf 8196998: Create devkit for Linux with gcc 7.3
erikj
parents: 47253
diff changeset
    77
    OUTPUT_ROOT=$(OUTPUT_ROOT)
042834d56fbf 8196998: Create devkit for Linux with gcc 7.3
erikj
parents: 47253
diff changeset
    78
$(host_platforms) :
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
    79
	@echo 'Building compilers for $@'
48839
042834d56fbf 8196998: Create devkit for Linux with gcc 7.3
erikj
parents: 47253
diff changeset
    80
	@echo 'Targets: $(target_platforms)'
042834d56fbf 8196998: Create devkit for Linux with gcc 7.3
erikj
parents: 47253
diff changeset
    81
	for p in $(filter $@, $(target_platforms)) $(filter-out $@, $(target_platforms)); do \
042834d56fbf 8196998: Create devkit for Linux with gcc 7.3
erikj
parents: 47253
diff changeset
    82
	  $(MAKE) -f Tools.gmk download-rpms $(submakevars) TARGET=$$p && \
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
    83
	  $(MAKE) -f Tools.gmk all $(submakevars) \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
    84
	      TARGET=$$p || exit 1 ; \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
    85
	done
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
    86
	@echo 'Building ccache program for $@'
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
    87
	$(MAKE) -f Tools.gmk ccache $(submakevars) TARGET=$@
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
    88
	@echo 'All done"'
18021
680b9b43e2d6 8015377: Support using compiler devkits on Linux
erikj
parents:
diff changeset
    89
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
    90
today := $(shell date +%Y%m%d)
18021
680b9b43e2d6 8015377: Support using compiler devkits on Linux
erikj
parents:
diff changeset
    91
680b9b43e2d6 8015377: Support using compiler devkits on Linux
erikj
parents:
diff changeset
    92
define Mktar
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
    93
  $(1)_tar = $$(RESULT)/sdk-$(1)-$$(today).tar.gz
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
    94
  $$($(1)_tar) : PLATFORM = $(1)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
    95
  TARFILES += $$($(1)_tar)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
    96
  $$($(1)_tar) : $(1) $$(shell find $$(RESULT)/$(1))
18021
680b9b43e2d6 8015377: Support using compiler devkits on Linux
erikj
parents:
diff changeset
    97
endef
680b9b43e2d6 8015377: Support using compiler devkits on Linux
erikj
parents:
diff changeset
    98
48839
042834d56fbf 8196998: Create devkit for Linux with gcc 7.3
erikj
parents: 47253
diff changeset
    99
$(foreach p,$(host_platforms),$(eval $(call Mktar,$(p))))
18021
680b9b43e2d6 8015377: Support using compiler devkits on Linux
erikj
parents:
diff changeset
   100
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
   101
tars : all $(TARFILES)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
   102
onlytars : $(TARFILES)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
   103
%.tar.gz :
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
   104
	@echo 'Creating compiler package $@'
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
   105
	cd $(RESULT)/$(PLATFORM) && tar -czf $@ *
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
   106
	touch $@
18021
680b9b43e2d6 8015377: Support using compiler devkits on Linux
erikj
parents:
diff changeset
   107
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
   108
clean :
48839
042834d56fbf 8196998: Create devkit for Linux with gcc 7.3
erikj
parents: 47253
diff changeset
   109
	rm -rf $(addprefix ../../build/devkit/, result $(host_platforms))
042834d56fbf 8196998: Create devkit for Linux with gcc 7.3
erikj
parents: 47253
diff changeset
   110
dist-clean: clean
042834d56fbf 8196998: Create devkit for Linux with gcc 7.3
erikj
parents: 47253
diff changeset
   111
	rm -rf $(addprefix ../../build/devkit/, src download)
18021
680b9b43e2d6 8015377: Support using compiler devkits on Linux
erikj
parents:
diff changeset
   112
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 18021
diff changeset
   113
FORCE :
48839
042834d56fbf 8196998: Create devkit for Linux with gcc 7.3
erikj
parents: 47253
diff changeset
   114
.PHONY : all compile tars $(configs) $(host_platforms) clean dist-clean