From bf3fd9d8fa3ae5f0e3573ed5c9d19e291244d3ac Mon Sep 17 00:00:00 2001 From: Patrick Williams Date: Mon, 3 Aug 2015 06:53:11 -0500 Subject: Infra: Build FAPI2. Change-Id: Ia899f5a400ac9e0d3237a98795676efa104c20c8 Original-Change-Id: Id0a9f52204f388d66de41f41bcde78c956969c4f Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/19554 Tested-by: Jenkins Server Reviewed-by: STEPHEN M. CPREK Reviewed-by: Jennifer A. Stofer --- src/import/tools/build/common.dir/script.rules.mk | 74 +++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 src/import/tools/build/common.dir/script.rules.mk (limited to 'src') diff --git a/src/import/tools/build/common.dir/script.rules.mk b/src/import/tools/build/common.dir/script.rules.mk new file mode 100644 index 000000000..e7b915cef --- /dev/null +++ b/src/import/tools/build/common.dir/script.rules.mk @@ -0,0 +1,74 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: tools/build/common.d/script.rules.mk $ +# +# IBM CONFIDENTIAL +# +# EKB Project +# +# COPYRIGHT 2015 +# [+] International Business Machines Corp. +# +# +# The source code for this program is not published or otherwise +# divested of its trade secrets, irrespective of what has been +# deposited with the U.S. Copyright Office. +# +# IBM_PROLOG_END_TAG + +# Makefile that defines how we build generated files, often from scripts that +# process other content in the repository, such as XML files. + +# BUILD_GENERATED +# This macro will automatically generate all the recipes for running a tool +# that generates other files. Requires that the following variables are +# defined prior to calling this macro: +# * GENERATED=name - Give a name to this generator. +# * COMMAND=tool - Name of the tool to run. +# * SOURCES=file1 file2 - List of files as 'input' to the tool. +# * TARGETS=file3 file4 - List of files that are created as 'output'. +# * $(GENERATED)_RUN - A macro that identifies how to run this tool. +# Special variables: +# * $(GENERATED)_PATH - Optional path to put output into. +# * $(GENERATED)_COMMAND_PATH - Path to tool, assumed to be the current +# directory of the .mk file if not given. +BUILD_GENERATED = $(eval $(call __BUILD_GENERATED)) + +# Order of operations: +# * Define _PATH and _COMMAND_PATH if they do not exist. +# * Define a recipe for a $(GENERATED).built timestamp file. +# - Depend on $(COMMAND) and $(SOURCES) +# - Ensure $(GENERATED)_PATH output path exists. +# - Call $(GENERATED)_RUN macro. +# - Touch timestamp file. +# * Add dependency from TARGETS to .built timestamp file. +# * Add timestamp and TARGETS to 'clean' target. +# * Add timestamp to GEN_TARGETS. +# * Clear out GENERATED, COMMAND, SOURCES, and TARGETS variables. +define __BUILD_GENERATED +$(GENERATED)_PATH ?= $$(GENPATH) +$(GENERATED)_COMMAND_PATH ?= $(dir $(lastword $(MAKEFILE_LIST))) + +$$($(GENERATED)_PATH)/.$(GENERATED).built : \ + $$($(GENERATED)_COMMAND_PATH)$(COMMAND) $(SOURCES) + $(C2) " GEN $(GENERATED)" + $(C1) mkdir -p $$($(GENERATED)_PATH) + $(call $(GENERATED)_RUN) + @touch $$@ + +$$(addprefix $$($(GENERATED)_PATH)/,$(TARGETS)): \ + $$($(GENERATED)_PATH)/.$(GENERATED).built + +$(call __CLEAN_TARGET,$$($(GENERATED)_PATH)/.$(GENERATED).built) +$(foreach target,$(TARGETS),\ + $(call __CLEAN_TARGET,$$($(GENERATED)_PATH)/$(target))) + +GEN_TARGETS += $$($(GENERATED)_PATH)/.$(GENERATED).built + +GENERATED:= +COMMAND:= +SOURCES:= +TARGETS:= +endef + -- cgit v1.2.1