NewMakefile.gmk
author mgerdin
Fri, 08 Nov 2013 23:49:20 +0000
changeset 21555 2f66a8ee6265
parent 20651 5240bd58485a
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents:
diff changeset
     1
#
20651
5240bd58485a 8027068: Update to NewMakefile.gmk check of MAKE_VERSION broke jdk8-build nightly builds on windows, saying 3.82.90 is too low
katleman
parents: 20647
diff changeset
     2
# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents:
diff changeset
     4
#
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents:
diff changeset
     7
# published by the Free Software Foundation.  Oracle designates this
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents:
diff changeset
     8
# particular file as subject to the "Classpath" exception as provided
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents:
diff changeset
     9
# by Oracle in the LICENSE file that accompanied this code.
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents:
diff changeset
    10
#
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents:
diff changeset
    15
# accompanied this code).
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents:
diff changeset
    16
#
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents:
diff changeset
    20
#
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents:
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents:
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents:
diff changeset
    23
# questions.
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents:
diff changeset
    24
#
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents:
diff changeset
    25
15053
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
    26
# This must be the first rule
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
    27
default:
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents:
diff changeset
    28
15053
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
    29
# Inclusion of this pseudo-target will cause make to execute this file
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
    30
# serially, regardless of -j. Recursively called makefiles will not be
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
    31
# affected, however. This is required for correct dependency management.
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
    32
.NOTPARALLEL:
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents:
diff changeset
    33
15053
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
    34
# The shell code below will be executed on /usr/ccs/bin/make on Solaris, but not in GNU make.
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
    35
# /usr/ccs/bin/make lacks basically every other flow control mechanism.
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
    36
TEST_FOR_NON_GNUMAKE:sh=echo You are not using GNU make/gmake, this is a requirement. Check your path. 1>&2 && exit 1
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents:
diff changeset
    37
15053
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
    38
# Assume we have GNU make, but check version.
20651
5240bd58485a 8027068: Update to NewMakefile.gmk check of MAKE_VERSION broke jdk8-build nightly builds on windows, saying 3.82.90 is too low
katleman
parents: 20647
diff changeset
    39
ifeq ($(strip $(foreach v, 3.81% 3.82% 4.%, $(filter $v, $(MAKE_VERSION)))), )
20647
6e4748010c70 8026528: [build] configure does not recognize newer make in cygwin
erikj
parents: 20363
diff changeset
    40
  $(error This version of GNU Make is too low ($(MAKE_VERSION)). Check your path, or upgrade to 3.81 or newer.)
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents:
diff changeset
    41
endif
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents:
diff changeset
    42
15053
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
    43
# Locate this Makefile
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
    44
ifeq ($(filter /%,$(lastword $(MAKEFILE_LIST))),)
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
    45
  makefile_path:=$(CURDIR)/$(lastword $(MAKEFILE_LIST))
15053
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
    46
else
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
    47
  makefile_path:=$(lastword $(MAKEFILE_LIST))
15053
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
    48
endif
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
    49
root_dir:=$(dir $(makefile_path))
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents:
diff changeset
    50
15053
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
    51
# ... and then we can include our helper functions
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
    52
include $(root_dir)/common/makefiles/MakeHelpers.gmk
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents:
diff changeset
    53
15053
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
    54
$(eval $(call ParseLogLevel))
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
    55
$(eval $(call ParseConfAndSpec))
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents:
diff changeset
    56
15053
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
    57
# Now determine if we have zero, one or several configurations to build.
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
    58
ifeq ($(SPEC),)
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
    59
  # Since we got past ParseConfAndSpec, we must be building a global target. Do nothing.
15053
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
    60
else
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
    61
  ifeq ($(words $(SPEC)),1)
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
    62
    # We are building a single configuration. This is the normal case. Execute the Main.gmk file.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
    63
    include $(root_dir)/common/makefiles/Main.gmk
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
    64
  else
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
    65
    # We are building multiple configurations.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
    66
    # First, find out the valid targets
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
    67
    # Run the makefile with an arbitrary SPEC using -p -q (quiet dry-run and dump rules) to find
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
    68
    # available PHONY targets. Use this list as valid targets to pass on to the repeated calls.
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
    69
    all_phony_targets=$(filter-out $(global_targets) bundles-only, $(strip $(shell \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
    70
        $(MAKE) -p -q -f common/makefiles/Main.gmk FRC SPEC=$(firstword $(SPEC)) | \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
    71
        grep ^.PHONY: | head -n 1 | cut -d " " -f 2-)))
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents:
diff changeset
    72
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
    73
    $(all_phony_targets):
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
    74
	@$(foreach spec,$(SPEC),($(MAKE) -f NewMakefile.gmk SPEC=$(spec) \
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
    75
	    $(VERBOSE) VERBOSE=$(VERBOSE) LOG_LEVEL=$(LOG_LEVEL) $@) &&) true
18424
a158f53837e2 8016303: make CONF= isn't working
erikj
parents: 17352
diff changeset
    76
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
    77
    .PHONY: $(all_phony_targets)
13697
5262b00bc10c 7197849: Update new build-infra makefiles
ohair
parents:
diff changeset
    78
20363
fa7663fc5d50 8001931: The new build system whitespace cleanup
ihse
parents: 20273
diff changeset
    79
  endif
15053
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
    80
endif
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    81
15072
71f6bf463347 8006100: build-infra: Bundle up the correct images in jprt
erikj
parents: 15053
diff changeset
    82
# Include this after a potential spec file has been included so that the bundles target
71f6bf463347 8006100: build-infra: Bundle up the correct images in jprt
erikj
parents: 15053
diff changeset
    83
# has access to the spec variables.
71f6bf463347 8006100: build-infra: Bundle up the correct images in jprt
erikj
parents: 15053
diff changeset
    84
include $(root_dir)/common/makefiles/Jprt.gmk
71f6bf463347 8006100: build-infra: Bundle up the correct images in jprt
erikj
parents: 15053
diff changeset
    85
15053
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
    86
# Here are "global" targets, i.e. targets that can be executed without specifying a single configuration.
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
    87
# If you addd more global targets, please update the variable global_targets in MakeHelpers.
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    88
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
    89
help:
15053
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
    90
	$(info )
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
    91
	$(info OpenJDK Makefile help)
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
    92
	$(info =====================)
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
    93
	$(info )
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
    94
	$(info Common make targets)
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
    95
	$(info .  make [default]         # Compile all product in langtools, hotspot, jaxp, jaxws,)
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
    96
	$(info .                         # corba and jdk)
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
    97
	$(info .  make all               # Compile everything, all repos and images)
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
    98
	$(info .  make images            # Create complete j2sdk and j2re images)
19519
ae956fe7b468 8023433: Improve 'make help'
mduigou
parents: 18424
diff changeset
    99
	$(info .  make docs              # Create javadocs)
15053
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
   100
	$(info .  make overlay-images    # Create limited images for sparc 64 bit platforms)
15584
83a66923c332 8004265: Add build support for Compact Profiles
dholmes
parents: 15072
diff changeset
   101
	$(info .  make profiles          # Create complete j2re compact profile images)
15053
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
   102
	$(info .  make bootcycle-images  # Build images twice, second time with newly build JDK)
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
   103
	$(info .  make install           # Install the generated images locally)
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
   104
	$(info .  make clean             # Remove all files generated by make, but not those)
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
   105
	$(info .                         # generated by configure)
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
   106
	$(info .  make dist-clean        # Remove all files, including configuration)
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
   107
	$(info .  make help              # Give some help on using make)
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
   108
	$(info .  make test              # Run tests, default is all tests (see TEST below))
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
   109
	$(info )
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
   110
	$(info Targets for specific components)
19519
ae956fe7b468 8023433: Improve 'make help'
mduigou
parents: 18424
diff changeset
   111
	$(info (Component is any of langtools, corba, jaxp, jaxws, hotspot, jdk, nashorn, images, overlay-images, docs or test))
15053
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
   112
	$(info .  make <component>       # Build <component> and everything it depends on. )
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
   113
	$(info .  make <component>-only  # Build <component> only, without dependencies. This)
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
   114
	$(info .                         # is faster but can result in incorrect build results!)
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
   115
	$(info .  make clean-<component> # Remove files generated by make for <component>)
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
   116
	$(info )
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
   117
	$(info Useful make variables)
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
   118
	$(info .  make CONF=             # Build all configurations (note, assignment is empty))
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
   119
	$(info .  make CONF=<substring>  # Build the configuration(s) with a name matching)
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
   120
	$(info .                         # <substring>)
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
   121
	$(info )
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
   122
	$(info .  make LOG=<loglevel>    # Change the log level from warn to <loglevel>)
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
   123
	$(info .                         # Available log levels are:)
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
   124
	$(info .                         # 'warn' (default), 'info', 'debug' and 'trace')
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
   125
	$(info .                         # To see executed command lines, use LOG=debug)
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
   126
	$(info )
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
   127
	$(info .  make JOBS=<n>          # Run <n> parallel make jobs)
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
   128
	$(info .                         # Note that -jN does not work as expected!)
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
   129
	$(info )
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
   130
	$(info .  make test TEST=<test>  # Only run the given test or tests, e.g.)
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
   131
	$(info .                         # make test TEST="jdk_lang jdk_net")
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
   132
	$(info )
14111
2a82ecb35fc7 8000992: Update new build-infra makefiles
ohair
parents: 13697
diff changeset
   133
15053
64278cb83950 8005549: build-infra: Merge NewMakefile.gmk and common/makefiles/Makefile
erikj
parents: 14111
diff changeset
   134
.PHONY: help