common/makefiles/Makefile
author erikj
Thu, 07 Jun 2012 20:25:06 -0700
changeset 12801 948f8ad66ee7
parent 12258 6ec26f6cc53e
child 13132 bd88bb8dd3af
permissions -rw-r--r--
7170079: Adjustments to build-infra makefiles Reviewed-by: ohair, ohrstrom, ihse, jonas Contributed-by: jonas <jonas.oreland@oracle.com>, erikj <erik.joelsson@oracle.com>, ihse <magnus.ihse.bursie@oracle.com>, tgranat <torbjorn.granat@oracle.com>, ykantser <yekaterina.kantserova@oracle.com>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
     1
#
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
     2
# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
     4
#
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
     7
# published by the Free Software Foundation.  Oracle designates this
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
     8
# particular file as subject to the "Classpath" exception as provided
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
     9
# by Oracle in the LICENSE file that accompanied this code.
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    10
#
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    15
# accompanied this code).
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    16
#
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    20
#
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    23
# questions.
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    24
#
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    25
12801
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    26
# This must be the first rule
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    27
default: all
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    28
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    29
# Find out which variables were passed explicitely on the make command line. These
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    30
# will be passed on to sub-makes, overriding spec.gmk settings.
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    31
MAKE_ARGS=$(foreach var,$(subst =command,,$(filter %=command,$(foreach var,$(.VARIABLES),$(var)=$(firstword $(origin $(var)))))),$(var)=$($(var)))
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    32
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    33
define fatal-error
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    34
    # If the user specificed a "global" target (e.g. 'help'), do not exit but continue running
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    35
    $$(if $$(findstring help,$$(MAKECMDGOALS)),,$$(error Cannot continue))
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    36
endef
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    37
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    38
ifeq ($(origin VERBOSE),undefined)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    39
    # Setup logging according to LOG (but only if VERBOSE is not given)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    40
    ifeq ($(LOG),)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    41
        # Set LOG to "warn" as default if not set (and no VERBOSE given)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    42
        LOG=warn
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    43
    endif
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    44
    ifeq ($(LOG),warn)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    45
        VERBOSE=-s
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    46
    else ifeq ($(LOG),info)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    47
        VERBOSE=
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    48
    else ifeq ($(LOG),debug)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    49
        VERBOSE=
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    50
    else ifeq ($(LOG),trace)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    51
        VERBOSE=-d -p
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    52
    else
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    53
        $(info Error: LOG must be one of: warn, info, debug or trace.)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    54
        $(eval $(call fatal-error))
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    55
    endif
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    56
else
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    57
    ifneq ($(LOG),)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    58
        # We have both a VERBOSE and a LOG argument. This is OK only if this is a repeated call by ourselves,
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    59
        # but complain if this is the top-level make call.
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    60
        ifeq ($(MAKELEVEL),0)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    61
            $(info Cannot use LOG=$(LOG) and VERBOSE=$(VERBOSE) at the same time. Choose one.)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    62
            $(eval $(call fatal-error))
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    63
        endif
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    64
    endif
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    65
endif
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    66
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    67
# TODO: Fix duplication in MakeBase.gmk
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    68
define SetupLogging
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    69
    ifneq ($(findstring $(LOG),debug trace),)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    70
        # Shell redefinition trick inspired by http://www.cmcrossroads.com/ask-mr-make/6535-tracing-rule-execution-in-gnu-make
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    71
        OLD_SHELL:=$$(SHELL)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    72
        SHELL = $$(warning Building $$@$$(if $$<, (from $$<))$(if $$?, ($$? newer)))$$(OLD_SHELL) -x
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    73
    endif
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    74
endef
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    75
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    76
$(eval $(call SetupLogging))
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    77
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    78
# Find all environment or command line variables that begin with ALT.
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    79
list_alt_overrides_with_origins = $(filter ALT_%=environment ALT_%=command,$(foreach var,$(.VARIABLES),$(var)=$(firstword $(origin $(var)))))
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    80
list_alt_overrides=$(subst =command,,$(subst =environment,,$(list_alt_overrides_with_origins)))
12801
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    81
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    82
ifeq ($(filter /%,$(lastword $(MAKEFILE_LIST))),)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    83
    makefile_path=$(CURDIR)/$(lastword $(MAKEFILE_LIST))
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    84
else
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    85
    makefile_path=$(lastword $(MAKEFILE_LIST))
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
    86
endif
12801
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    87
root_dir=$(patsubst %/common/makefiles/Makefile,%,$(makefile_path))
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    88
output_dir=$(root_dir)/build
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    89
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    90
ifneq ($(origin SPEC),undefined)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    91
    # We have been given a SPEC, check that it works out properly
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    92
    ifeq ($(wildcard $(SPEC)),)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    93
        $(info Cannot locate spec.gmk, given by SPEC=$(SPEC))
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    94
        $(eval $(call fatal-error))
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    95
    endif
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    96
    ifneq ($(origin CONF),undefined)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    97
        # We also have a CONF argument. This is OK only if this is a repeated call by ourselves,
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    98
        # but complain if this is the top-level make call.
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
    99
        ifeq ($(MAKELEVEL),0)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   100
            $(info Cannot use CONF=$(CONF) and SPEC=$(SPEC) at the same time. Choose one.)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   101
            $(eval $(call fatal-error))
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   102
        endif
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   103
    endif
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   104
    # ... OK, we're satisfied, we'll use this SPEC later on
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   105
else
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   106
    # Find all spec.gmk files in the build output directory
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   107
    all_spec_files=$(wildcard $(output_dir)/*/spec.gmk)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   108
    ifeq ($(all_spec_files),)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   109
        $(info No configurations found for $(root_dir)! Please run configure to create a configuration.)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   110
        $(eval $(call fatal-error))
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   111
    endif
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   112
    # Extract the configuration names from the path
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   113
    all_confs=$(patsubst %/spec.gmk,%,$(patsubst $(output_dir)/%,%,$(all_spec_files)))
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   114
12801
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   115
    ifneq ($(origin CONF),undefined)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   116
        # User have given a CONF= argument.
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   117
        ifeq ($(CONF),)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   118
            # If given CONF=, match all configurations
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   119
            matching_confs=$(strip $(all_confs))
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   120
        else
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   121
            # Otherwise select those that contain the given CONF string
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   122
            matching_confs=$(strip $(foreach var,$(all_confs),$(if $(findstring $(CONF),$(var)),$(var))))
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   123
        endif
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   124
        ifeq ($(matching_confs),)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   125
            $(info No configurations found matching CONF=$(CONF))
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   126
            $(info Available configurations:)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   127
            $(foreach var,$(all_confs),$(info * $(var)))
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   128
            $(eval $(call fatal-error))
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   129
        else
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   130
            ifeq ($(words $(matching_confs)),1)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   131
                $(info Building '$(matching_confs)' (matching CONF=$(CONF)))
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   132
            else
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   133
                $(info Building the following configurations (matching CONF=$(CONF)):)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   134
                $(foreach var,$(matching_confs),$(info * $(var)))
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   135
            endif
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   136
        endif
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   137
12801
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   138
        # Create a SPEC definition. This will contain the path to one or more spec.gmk files.
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   139
        SPEC=$(addsuffix /spec.gmk,$(addprefix $(output_dir)/,$(matching_confs)))
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   140
    else
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   141
        # No CONF or SPEC given, check the available configurations
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   142
        ifneq ($(words $(all_spec_files)),1)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   143
            $(info No CONF or SPEC given, but more than one spec.gmk found in $(output_dir).)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   144
            $(info Available configurations:)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   145
            $(foreach var,$(all_confs),$(info * $(var)))
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   146
            $(info Please retry building with CONF=<config> or SPEC=<specfile>)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   147
            $(eval $(call fatal-error))
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   148
        endif
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   149
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   150
        # We found exactly one configuration, use it
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   151
        SPEC=$(strip $(all_spec_files))
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   152
    endif
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   153
endif
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   154
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   155
ifneq ($(words $(SPEC)),1)
12801
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   156
# We have multiple configurations to build, call make repeatedly
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   157
all jdk hotspot jaxws jaxp corba langtools install images packages clean dist-clean:
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   158
	@$(foreach spec,$(SPEC),($(MAKE) -f $(makefile_path) SPEC=$(spec) $(VERBOSE) VERBOSE=$(VERBOSE) $@ $(MAKE_ARGS)) &&) true
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   159
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   160
.PHONY: all jdk hotspot jaxws jaxp corba langtools install images packages clean dist-clean
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   161
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   162
else
12801
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   163
# This is the main part of the Makefile, for the normal case with SPEC specifying a single existing spec.gmk file.
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   164
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   165
# Now load the spec
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   166
-include $(SPEC)
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   167
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   168
# Load the vital tools for all the makefiles. 
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   169
-include $(SRC_ROOT)/common/makefiles/MakeBase.gmk
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   170
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   171
# Remove any build.log from a previous run
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   172
ifneq (,$(BUILD_LOG))
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   173
    $(shell $(RM) $(BUILD_LOG))
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   174
endif
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   175
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   176
# Remove any javac server logs and port files. This
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   177
# prevents a new make run to reuse the previous servers.
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   178
ifneq (,$(JAVAC_SERVERS))
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   179
    $(shell mkdir -p $(JAVAC_SERVERS) && rm -rf $(JAVAC_SERVERS)/*)
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   180
endif
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   181
# Reset the build timers.
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   182
$(eval $(call ResetTimers))
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   183
# Clean out any notifications from the previous build.
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   184
$(shell find $(OUTPUT_ROOT) -name "_the.*.notify" $(FIND_DELETE))
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   185
12801
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   186
# If make was called explicitely with -j, don't add a -j ourself to sub-makes, since
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   187
# this will be inherited automatically by make. Otherwise use our default for sub-makes.
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   188
# The -j in MAKEFLAGS is only visible when executing a recipe, hence this macro.
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   189
define GetMakeJobFlag
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   190
    $(if $(findstring -j,$(MAKEFLAGS)),,-j$(NUM_CORES))
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   191
endef
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   192
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   193
define CheckEnvironment
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   194
    $(if $(list_alt_overrides),
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   195
        @$(PRINTF) "\nWARNING: You have the following ALT_ variables set:\n"
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   196
    @$(PRINTF) "$(foreach var,$(list_alt_overrides),$(var)=$$$(var))\n"
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   197
    @$(PRINTF) "ALT_ variables are deprecated and will be ignored. Please clean your environment.\n"
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   198
    )
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   199
endef
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   200
12801
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   201
define PrintStartMessage
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   202
    $(if $(VERBOSE),,@$(ECHO) Running make as $(MAKE) $(MFLAGS) $(MAKE_ARGS))
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   203
    $(call CheckEnvironment)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   204
    @$(ECHO) "Building OpenJDK for target $(if $(MAKECMDGOALS),'$(MAKECMDGOALS)','all') in configuration '$(CONF_NAME)'"
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   205
endef
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   206
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   207
define PrintEndMessage
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   208
    @$(ECHO) "Finished building OpenJDK for target '$@'"
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   209
    $(call CheckEnvironment)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   210
endef
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   211
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   212
all: jdk
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   213
	@$(if $(JAVAC_SERVERS),rm -rf $(JAVAC_SERVERS)/*.port)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   214
	@$(call AtRootMakeEnd)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   215
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   216
langtools: start-make
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   217
	@$(call MakeStart,langtools,all)
12801
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   218
	@($(CD) $(LANGTOOLS_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(call GetMakeJobFlag) $(LANGTOOLS_MAKE_ARGS) $(MAKE_ARGS))
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   219
	@$(call MakeFinish,langtools,all)
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   220
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   221
corba: langtools
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   222
	@$(call MakeStart,corba,all)
12801
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   223
	@($(CD) $(CORBA_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(call GetMakeJobFlag) $(CORBA_MAKE_ARGS) $(MAKE_ARGS))
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   224
	@$(call MakeFinish,corba,all)
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   225
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   226
jaxp: langtools
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   227
	@$(call MakeStart,jaxp,all)
12801
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   228
	@($(CD) $(JAXP_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(call GetMakeJobFlag) $(CORBA_MAKE_ARGS) $(MAKE_ARGS))
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   229
	@$(call MakeFinish,jaxp,all)
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   230
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   231
jaxws: langtools jaxp
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   232
	@$(call MakeStart,jaxws,all)
12801
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   233
	@($(CD) $(JAXWS_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(call GetMakeJobFlag) $(CORBA_MAKE_ARGS) $(MAKE_ARGS))
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   234
	@$(call MakeFinish,jaxws,all)
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   235
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   236
hotspot: langtools
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   237
	@$(call MakeStart,hotspot,all)
12801
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   238
	@($(CD) $(HOTSPOT_TOPDIR)/make && $(BUILD_LOG_WRAPPER) $(MAKE) -j1 $(HOTSPOT_MAKE_ARGS) $(MAKE_ARGS))
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   239
	@$(call MakeFinish,hotspot,all)
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   240
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   241
jdk: langtools corba jaxp jaxws hotspot
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   242
	@$(call MakeStart,jdk,all)
12801
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   243
	@($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(call GetMakeJobFlag) $(JDK_MAKE_ARGS) $(MAKE_ARGS))
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   244
	@$(call MakeFinish,jdk,all)
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   245
12801
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   246
images install packages: source-tips start-make jdk langtools corba jaxp jaxws hotspot
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   247
	@$(call MakeStart,jdk-images,$@)
12801
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   248
	@($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(call GetMakeJobFlag) $(JDK_MAKE_ARGS) $(MAKE_ARGS) $@)
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   249
	@$(call MakeFinish,jdk-images,$@)
12801
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   250
	@$(if $(JAVAC_SERVERS),rm -rf $(JAVAC_SERVERS)/*.port)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   251
	@$(call AtRootMakeEnd)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   252
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   253
old-images: source-tips start-make jdk langtools corba jaxp jaxws hotspot
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   254
	@$(call MakeStart,jdk-old-images,$@)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   255
	@($(CD) $(JDK_TOPDIR)/makefiles && $(BUILD_LOG_WRAPPER) $(MAKE) $(call GetMakeJobFlag) $(JDK_MAKE_ARGS) $(MAKE_ARGS) $@)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   256
	@$(call MakeFinish,old-jdk-images,$@)
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   257
	@$(if $(JAVAC_SERVERS),rm -rf $(JAVAC_SERVERS)/*.port)
12801
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   258
	@$(call AtRootMakeEnd)
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   259
12801
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   260
start-make:
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   261
	@$(call AtRootMakeStart)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   262
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   263
.PHONY: jdk hotspot jaxws jaxp corba langtools install images packages start-make
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   264
12801
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   265
test: start-make
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   266
	@$(call MakeStart,test,$(if $(TEST),$(TEST),all))
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   267
	@($(CD) $(SRC_ROOT)/test && $(BUILD_LOG_WRAPPER) $(MAKE) MAKEFLAGS= -j1 PRODUCT_HOME=$(OUTPUT_ROOT)/jdk JPRT_JAVA_HOME=$(OUTPUT_ROOT)/jdk ALT_OUTPUTDIR=$(OUTPUT_ROOT) $(TEST)) || true
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   268
	@$(call MakeFinish,test,$(if $(TEST),$(TEST),all))
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   269
	@$(call AtRootMakeEnd)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   270
.PHONY: test
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   271
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   272
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   273
# Stores the tips for each repository. This file is be used when constructing the jdk image and can be
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   274
# used to track the exact sources used to build that image.
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   275
source-tips: $(OUTPUT_ROOT)/source_tips
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   276
$(OUTPUT_ROOT)/source_tips: FRC
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   277
	@$(MKDIR) -p $(@D)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   278
	@$(RM) $@
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   279
	@$(call GetSourceTips)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   280
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   281
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   282
# Remove everything, except the output from configure.
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   283
clean:
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   284
	@(cd $(OUTPUT_ROOT) && $(RM) -r `$(LS) $(OUTPUT_ROOT) | grep -v spec.gmk | grep -v Makefile | grep -v config.status | grep -v config.log | grep -v config.h | grep -v configure-arguments | grep -v "localdevenv.*" | grep -v uncygdrive.exe`)
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   285
	@$(ECHO) Cleaned everything except the build configuration.
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   286
.PHONY: clean
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   287
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   288
# Remove everything, you have to rerun configure.
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   289
dist-clean:
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   290
	@$(RM) -r $(OUTPUT_ROOT)
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   291
	@$(ECHO) Cleaned everything, you will have to re-run configure.
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   292
.PHONY: dist-clean
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   293
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   294
clean-jdk:
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   295
	@(cd $(OUTPUT_ROOT) && $(RM) -r `$(LS) $(OUTPUT_ROOT) | grep -v spec.gmk | grep -v Makefile | grep -v config.status | grep -v config.log |  grep -v config.h | grep -v configure-arguments | \
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   296
                               grep -v langtools | grep -v corba | grep -v jaxp | grep -v jaxws | grep -v hotspot`)
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   297
	@$(ECHO) "Cleaned jdk build artifacts (but not langtools,corba,jaxp,jaxws,hotspot nor the build configuration)"
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   298
.PHONY: clean
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   299
12801
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   300
endif
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   301
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   302
# Here are "global" targets, i.e. targets that can be executed without specifying a single configuration.
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   303
# If you addd more global targets, please update the fatal-error macro.
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   304
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   305
help:
12801
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   306
	$(info )
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   307
	$(info OpenJDK Makefile help)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   308
	$(info =====================)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   309
	$(info )
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   310
	$(info Common make targets)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   311
	$(info .  make [all]            # Compile all code but do not create images)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   312
	$(info .  make images           # Create complete j2sdk and j2re images)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   313
	$(info .  make install          # Install the generated images locally)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   314
	$(info .  make clean            # Remove all files generated by make, but not those generated by configure)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   315
	$(info .  make dist-clean       # Remove all files generated by both make and configure)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   316
	$(info .  make help             # Give some help on using make)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   317
	$(info .  make test             # Run tests, default is all tests (see TEST below))
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   318
	$(info )
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   319
	$(info Useful make variables)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   320
	$(info .  make CONF=            # Build all configurations (note, assignment is empty))
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   321
	$(info .  make CONF=<substring> # Build the configuration(s) with a name matching the given substring)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   322
	$(info )
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   323
	$(info .  make LOG=<loglevel>   # Change loglevel from warn (default) to the given loglevel)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   324
	$(info .                        # Available loglevels are: warn, info, debug and trace)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   325
	$(info .                        # To see executed command lines, use LOG=info)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   326
	$(info )
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   327
	$(info .  make test TEST=<test> # Only run the given test or tests, e.g.)
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   328
	$(info .                        # make test TEST="jdk_lang jdk_net")
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   329
	$(info )
12258
6ec26f6cc53e 7074397: Build infrastructure changes (makefile re-write)
ohair
parents:
diff changeset
   330
.PHONY: help
12801
948f8ad66ee7 7170079: Adjustments to build-infra makefiles
erikj
parents: 12258
diff changeset
   331
FRC: # Force target