diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/build/mkrules/script.rules.mk | 89 | ||||
-rw-r--r-- | src/usr/isteps/mss/makefile | 72 |
2 files changed, 159 insertions, 2 deletions
diff --git a/src/build/mkrules/script.rules.mk b/src/build/mkrules/script.rules.mk new file mode 100644 index 000000000..7d344cfc8 --- /dev/null +++ b/src/build/mkrules/script.rules.mk @@ -0,0 +1,89 @@ +# IBM_PROLOG_BEGIN_TAG +# This is an automatically generated prolog. +# +# $Source: src/build/mkrules/script.rules.mk $ +# +# OpenPOWER HostBoot Project +# +# Contributors Listed Below - COPYRIGHT 2015,2019 +# [+] International Business Machines Corp. +# +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. See the License for the specific language governing +# permissions and limitations under the License. +# +# 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. +# Input: +# * Optional input to delay the running of BUILD_GENERATED macro to a +# later phase EXE or MODULE. +# +BUILD_GENERATED = $(eval $(call __BUILD_GENERATED,$1)) + +GENPATH = $(OUTPATH) + +# 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))) + + +GEN_PASS: $$($(GENERATED)_PATH)/.$(GENERATED).built + +$$($(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))) + +$(or $1,GEN)_TARGETS += $$($(GENERATED)_PATH)/.$(GENERATED).built + +GENERATED:= +COMMAND:= +SOURCES:= +TARGETS:= +endef + diff --git a/src/usr/isteps/mss/makefile b/src/usr/isteps/mss/makefile index 24dd0062b..cbe61724f 100644 --- a/src/usr/isteps/mss/makefile +++ b/src/usr/isteps/mss/makefile @@ -5,7 +5,7 @@ # # OpenPOWER HostBoot Project # -# Contributors Listed Below - COPYRIGHT 2016,2018 +# Contributors Listed Below - COPYRIGHT 2016,2019 # [+] International Business Machines Corp. # # @@ -24,7 +24,8 @@ # IBM_PROLOG_END_TAG ROOTPATH = ../../../.. -PROCEDURES_PATH = ${ROOTPATH}/src/import/chips/p9/procedures +IMPORT_PATH = ${ROOTPATH}/src/import +PROCEDURES_PATH = ${IMPORT_PATH}/chips/p9/procedures #Add all the extra include paths EXTRAINCDIR += ${ROOTPATH}/src/import/hwpf/fapi2/include @@ -62,6 +63,73 @@ MSS_LIB += ${ROOTPATH}/src/import/generic/memory/lib/utils/freq/ EXTRAINCDIR += ${MSS_LIB} +include ${ROOTPATH}/src/build/mkrules/script.rules.mk +include ${ROOTPATH}/src/build/mkrules/verbose.rules.mk + +# Generate generic_system_accessors header file +MSS_GENERIC_PATH := $(IMPORT_PATH)/generic/memory/lib +MSS_GENERIC_INCLUDES := $(shell find $(MSS_GENERIC_PATH) -type d) + +GENERATED = generic_system_accessors +COMMAND = gen_accessors.pl +$(GENERATED)_COMMAND_PATH = $(IMPORT_PATH)/generic/memory/tools/ + +OUTPATH = ${ROOTPATH}/obj/genfiles/generic/memory/lib/ +FILE_PREFIX = mss_generic_system + +SOURCES += $(IMPORT_PATH)/hwpf/fapi2/xml/attribute_info/system_attributes.xml + +CLEAN_TARGETS += ${OUTPATH}/mss_generic_system_attribute_getters.H +CLEAN_TARGETS += ${OUTPATH}/.generic_system_accessors.built + +define generic_system_accessors_RUN + $(C1) mkdir $(OUTPATH) -p + $(C1) $$< --system=AXONE --output-dir=$(OUTPATH) --output-file-prefix=$(FILE_PREFIX) $$(filter-out $$<,$$^) +endef + +$(call BUILD_GENERATED) + +# Generate generic_memory_accessors header file +GENERATED = generic_accessors +COMMAND = gen_accessors.pl +$(GENERATED)_COMMAND_PATH = $(IMPORT_PATH)/generic/memory/tools/ + +OUTPATH = ${ROOTPATH}/obj/genfiles/generic/memory/lib +FILE_PREFIX = mss_generic + +SOURCES += $(shell find $(IMPORT_PATH)/generic/procedures/xml/attribute_info/ -type f) + +CLEAN_TARGETS += ${OUTPATH}/mss_generic_attribute_getters.H +CLEAN_TARGETS += ${OUTPATH}/mss_generic_attribute_setters.H +CLEAN_TARGETS += ${OUTPATH}/.generic_accessors.built + +define generic_accessors_RUN + $(C1) mkdir $(OUTPATH) -p + $(C1) $$< --system=AXONE --output-dir=$(OUTPATH) --output-file-prefix=$(FILE_PREFIX) $$(filter-out $$<,$$^) +endef + +$(call BUILD_GENERATED) + +# Generate explorer_memory_accessors header file +GENERATED = gen_exp_accessors +COMMAND = gen_accessors.pl +$(GENERATED)_COMMAND_PATH = $(IMPORT_PATH)/generic/memory/tools/ + +OUTPATH = ${ROOTPATH}/obj/genfiles/chips/ocmb/explorer/procedures/hwp/memory/lib/ +FILE_PREFIX = mss_explorer + +SOURCES += $(shell find $(IMPORT_PATH)/chips/ocmb/explorer/procedures/xml/attribute_info/ -type f) + +CLEAN_TARGETS += ${OUTPATH}/mss_explorer_attribute_getters.H +CLEAN_TARGETS += ${OUTPATH}/mss_explorer_attribute_setters.H +CLEAN_TARGETS += ${OUTPATH}/.gen_exp_accessors.built + +define gen_exp_accessors_RUN + $(C1) mkdir $(OUTPATH) -p + $(C1) $$< --system=AXONE --output-dir=$(OUTPATH) --output-file-prefix=$(FILE_PREFIX) $$(filter-out $$<,$$^) +endef + +$(call BUILD_GENERATED) # Add common and generated parts to object list. MSS_PATH := $(PROCEDURES_PATH)/hwp/memory/lib |