make/common/Execute.gmk
author herrick
Thu, 28 Mar 2019 13:49:38 -0400
branchJDK-8200758-branch
changeset 57292 7a683c461b80
parent 53995 ecc2bcc3beb0
child 58834 f78e7ce060b0
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
53995
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
     1
#
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
     2
# Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
     3
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
     4
#
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
     5
# This code is free software; you can redistribute it and/or modify it
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
     6
# under the terms of the GNU General Public License version 2 only, as
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
     7
# published by the Free Software Foundation.  Oracle designates this
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
     8
# particular file as subject to the "Classpath" exception as provided
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
     9
# by Oracle in the LICENSE file that accompanied this code.
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    10
#
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    11
# This code is distributed in the hope that it will be useful, but WITHOUT
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    13
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    14
# version 2 for more details (a copy is included in the LICENSE file that
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    15
# accompanied this code).
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    16
#
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    17
# You should have received a copy of the GNU General Public License version
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    18
# 2 along with this work; if not, write to the Free Software Foundation,
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    20
#
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    22
# or visit www.oracle.com if you need additional information or have any
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    23
# questions.
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    24
#
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    25
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    26
ifeq (,$(_MAKEBASE_GMK))
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    27
  $(error You must include MakeBase.gmk prior to including Execute.gmk)
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    28
endif
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    29
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    30
################################################################################
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    31
#
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    32
# Code for handling the SetupExecute macro.
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    33
#
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    34
################################################################################
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    35
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    36
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    37
################################################################################
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    38
# Setup make rules for executing an arbitrary command.
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    39
#
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    40
# Parameter 1 is the name of the rule. This name is used as variable prefix,
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    41
# and the targets generated are listed in a variable by that name.
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    42
#
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    43
# You need to specify a COMMAND, the actual command line to execute. You are
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    44
# strongly recommended to provide a INFO with the text to display for LOG=info
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    45
# on what operation is performed. You can use DEPS to provide additional
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    46
# dependencies for your command to run. You can optionally include a PRE_COMMAND
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    47
# and a POST_COMMAND, intended for simple pre- and post-processing. The latter
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    48
# might be e.g. a mv from a temporary file to the final destination, the former
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    49
# e.g. a simple sed replacement on the input file. If the operations are
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    50
# unrelated to the main COMMAND, this is not a suitable solution.
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    51
#
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    52
# If your command outputs a variety of files, or if it's really a single file
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    53
# but you don't really care about the output from the perspective, you can just
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    54
# supply an OUTPUT_DIR. You are supposed to make sure the command creates files
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    55
# in this directory (which will be created for you if it does not exist), but
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    56
# this can't be enforced by SetupExecute. Additional support files (like logs
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    57
# and markers) are created in this directory. If you want support files in a
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    58
# separate directory (e.g. if you're targeting an OUTPUT_DIR in the image
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    59
# directly), you can specify a SUPPORT_DIR. If your command outputs only a
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    60
# single file, you can get rid of the marker files (but not the log files) by
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    61
# specifying OUTPUT_FILE. Note that if you specify an OUTPUT_FILE, support log
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    62
# files will be placed in the same directory as the OUTPUT_FILE. If you do not
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    63
# want that, use SUPPORT_DIR as well.
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    64
#
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    65
# After the call to SetupExecute, $1 will contain references to all generated
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    66
# files (that make knows about), and $1_TARGET will contain a reference to the
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    67
# final target (that is OUTPUT_FILE if it exists, or the $1_exec.marker file
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    68
# otherwise).
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    69
#
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    70
# All the above keep functioning as expected even if PRE_COMMAND and
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    71
# POST_COMMAND are given. One special case worth noting is that if OUTPUT_FILE
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    72
# and POST_COMMAND is both given, the actual OUTPUT_FILE is considered to be a
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    73
# result of running the POST_COMMAND.
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    74
#
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    75
# Remaining parameters are named arguments. These include:
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    76
#   COMMAND     : The command to execute
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    77
#   PRE_COMMAND : A helper command to execute before COMMAND
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    78
#   POST_COMMAND: A helper command to execute after COMMAND
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    79
#   OUTPUT_DIR  : The directory that will contain the result from the command
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    80
#   OUTPUT_FILE : Use this if the command results in a single output file
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    81
#   SUPPORT_DIR : Where to store generated support files
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    82
#   INFO        : Message to display at LOG=info level when running command (optional)
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    83
#   WARN        : Message to display at LOG=warn level when running command (optional)
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    84
#   DEPS        : Dependencies for the execution to take place
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    85
#
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    86
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    87
# Setup make rules for copying files, with an option to do more complex
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    88
SetupExecute = $(NamedParamsMacroTemplate)
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    89
define SetupExecuteBody
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    90
  ifeq ($$($1_COMMAND), )
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    91
    $$(error COMMAND is missing in SetupExecute $1)
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    92
  endif
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    93
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    94
  ifneq ($$($1_OUTPUT_FILE), )
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    95
    ifneq ($$($1_OUTPUT_DIR), )
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    96
      $$(error Cannot specify both OUTPUT_DIR and OUTPUT_FILE in SetupExecute $1)
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    97
    endif
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    98
    # We need to know output dir since we will make sure it is created.
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
    99
    $1_OUTPUT_DIR := $$(patsubst %/,%, $$(dir $$($1_OUTPUT_FILE)))
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   100
    ifeq ($$($1_SUPPORT_DIR), )
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   101
      # If support dir is not given, use base dir of output file.
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   102
      $1_SUPPORT_DIR := $$($1_OUTPUT_DIR)
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   103
    endif
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   104
  else ifneq ($$($1_OUTPUT_DIR), )
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   105
    ifeq ($$($1_SUPPORT_DIR), )
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   106
      # If support dir is not given, use output dir.
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   107
      $1_SUPPORT_DIR := $$($1_OUTPUT_DIR)
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   108
    endif
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   109
  else
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   110
    $$(error OUTPUT_DIR or OUTPUT_FILE is required in SetupExecute $1)
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   111
  endif
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   112
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   113
  $1_BASE := $$($1_SUPPORT_DIR)/_$1
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   114
  $1_PRE_MARKER := $$($1_BASE)_pre.marker
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   115
  $1_EXEC_MARKER := $$($1_BASE)_exec.marker
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   116
  $1_POST_MARKER := $$($1_BASE)_post.marker
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   117
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   118
  ifeq ($$($1_OUTPUT_FILE), )
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   119
    # No specified output file, use markers everywhere
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   120
    $1_EXEC_RESULT := $$($1_EXEC_MARKER)
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   121
    ifeq ($$($1_POST_COMMAND), )
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   122
      $1_FINAL_RESULT := $$($1_EXEC_MARKER)
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   123
    else
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   124
      $1_FINAL_RESULT := $$($1_POST_MARKER)
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   125
    endif
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   126
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   127
  else
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   128
    # If we have a single output file, we don't need a separate marker
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   129
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   130
    ifeq ($$($1_POST_COMMAND), )
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   131
      $1_EXEC_RESULT := $$($1_OUTPUT_FILE)
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   132
      $1_FINAL_RESULT := $$($1_EXEC_RESULT)
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   133
    else
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   134
      $1_EXEC_RESULT := $$($1_EXEC_MARKER)
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   135
      $1_FINAL_RESULT := $$($1_OUTPUT_FILE)
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   136
    endif
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   137
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   138
  endif
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   139
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   140
  ifeq ($$($1_INFO)$$($1_WARN), )
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   141
    # If neither info nor warn is provided, add basic info text.
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   142
    $1_INFO := Running commands for $1
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   143
  endif
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   144
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   145
  ifneq ($$($1_PRE_COMMAND), )
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   146
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   147
    $$($1_PRE_MARKER): $$($1_DEPS)
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   148
        ifneq ($$($1_WARN), )
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   149
	  $$(call LogWarn, $$($1_WARN))
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   150
        endif
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   151
        ifneq ($$($1_INFO), )
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   152
	  $$(call LogInfo, $$($1_INFO))
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   153
        endif
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   154
	$$(call MakeDir, $$($1_SUPPORT_DIR) $$($1_OUTPUT_DIR))
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   155
	$$(call ExecuteWithLog, $$($1_BASE)_pre, \
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   156
	    $$($1_PRE_COMMAND))
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   157
	$$(TOUCH) $$@
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   158
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   159
    $$($1_EXEC_RESULT): $$($1_PRE_MARKER)
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   160
	$$(call ExecuteWithLog, $$($1_BASE)_exec, \
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   161
	    $$($1_COMMAND))
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   162
        ifeq ($$($1_EXEC_RESULT), $$($1_EXEC_MARKER))
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   163
	  $$(TOUCH) $$@
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   164
        endif
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   165
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   166
    $1 := $$($1_PRE_MARKER) $$($1_EXEC_RESULT)
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   167
  else
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   168
    $$($1_EXEC_RESULT): $$($1_DEPS)
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   169
        ifneq ($$($1_WARN), )
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   170
	  $$(call LogWarn, $$($1_WARN))
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   171
        endif
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   172
        ifneq ($$($1_INFO), )
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   173
	  $$(call LogInfo, $$($1_INFO))
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   174
        endif
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   175
	$$(call MakeDir, $$(call EncodeSpace, $$($1_SUPPORT_DIR)) $$(call EncodeSpace, $$($1_OUTPUT_DIR)))
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   176
	$$(call ExecuteWithLog, $$($1_BASE)_exec, \
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   177
	    $$($1_COMMAND))
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   178
        ifeq ($$($1_EXEC_RESULT), $$($1_EXEC_MARKER))
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   179
	  $$(TOUCH) $$@
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   180
        endif
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   181
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   182
    $1 := $$($1_EXEC_RESULT)
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   183
  endif
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   184
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   185
  ifneq ($$($1_POST_COMMAND), )
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   186
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   187
    $$($1_FINAL_RESULT): $$($1_EXEC_RESULT)
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   188
	$$(call ExecuteWithLog, $$($1_BASE)_post, \
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   189
	    $$($1_POST_COMMAND))
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   190
	$$(TOUCH) $$@
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   191
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   192
    $1 += $$($1_FINAL_RESULT)
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   193
  endif
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   194
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   195
  # Export all our generated targets in $1, and the final target in $1_TARGET.
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   196
  $1_TARGET := $$($1_FINAL_RESULT)
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   197
ecc2bcc3beb0 8219971: Introduce SetupExecute in build system
ihse
parents:
diff changeset
   198
endef