4194N/A# The contents of this file are subject to the terms of the
4194N/A# Common Development and Distribution License (the "License").
4194N/A# You may not use this file except in compliance with the License.
4194N/A# See the License for the specific language governing permissions
4194N/A# and limitations under the License.
4194N/A# When distributing Covered Code, include this CDDL HEADER in each
4194N/A# If applicable, add the following below this CDDL HEADER, with the
4194N/A# fields enclosed by brackets "[]" replaced with your own identifying
4194N/A# information: Portions Copyright [yyyy] [name of copyright owner]
4194N/A# Copyright (c) 2010, 2015, Oracle
and/or its affiliates. All rights reserved.
4194N/AGPATCH_BACKUP = --backup --version-control=numbered
4194N/AGPATCH_FLAGS = --strip=$(PATCH_LEVEL) $(GPATCH_BACKUP)
4194N/A# Rules for patching source that is downloaded and unpacked or pulled from
4194N/A# a source repository. Patches should be named
4194N/A# patches/{patch-file-name}.patch{version} where {patch-file-name} is a
4194N/A# meaningful name for the patch contents and {version} corresponds to the
4194N/A# COMPONENT_NAME{version} of the source to be patched. Typically, version
4194N/A# would be something like "_1", "_2", ... After all {version} patches have
4194N/A# been applied, a final set of patches without a {version} suffix may be
4194N/A# PATCH_DIR can be overridden to move patches to a different location
4194N/A# PATCH_PATTERN can be overridden to adjust the patch naming scheme that the
4194N/A# EXTRA_PATCHES{version} can be defined in the component Makefile to include
4194N/A# patches specific to parfait builds.
4252N/Aifeq ($(strip $(PARFAIT_BUILD)),yes)
4194N/APATCHES = $(shell find $(PATCH_DIR) $(PARFAIT_PATCH_DIR) -type f \
4249N/APCH_SUFFIXES = $(patsubst .patch_%,%, $(filter-out .patch,$(suffix $(PATCHES))))
4194N/APATCH_PATTERN$(1) ?= %.patch
4194N/APATCHES$(1) = $(filter %.patch,$(PATCHES))
4194N/APATCH_PATTERN$(1) ?= %.patch$(1)
4194N/APATCHES$(1) = $(filter %.patch$(1),$(PATCHES))
4194N/APATCH_STAMPS$(1) += $$(PATCHES$(1):$(PATCH_DIR)/%=$$(SOURCE_DIR$(1))/.patched-%)
4252N/Aifeq ($(strip $(PARFAIT_BUILD)),yes)
4252N/APATCH_STAMPS$(1) += $$(PATCHES$(1):$(PARFAIT_PATCH_DIR)/%=$$(SOURCE_DIR$(1))/.patched-%)
4194N/A# We should unpack the source that we patch before we patch it.
4194N/A$$(PATCH_STAMPS$(1):: $$(UNPACK_STAMP$(1)) unpack
4194N/A$$(SOURCE_DIR$(1))/.patched-%: $(PATCH_DIR)/%
4194N/A $(GPATCH) -d $$(@D) $$(GPATCH_FLAGS) < $$<
4252N/A$$(SOURCE_DIR$(1))/.patched-%: $(PARFAIT_PATCH_DIR)/%
4252N/A $(GPATCH) -d $$(@D) $$(GPATCH_FLAGS) < $$<
4194N/Apatch:: $$(PATCH_STAMPS$(1))
4194N/A# Define the rules required to download any source archives and augment any
4249N/A$(foreach suffix, $(PCH_SUFFIXES), $(eval $(call patch-rule,_$(suffix))))
4194N/A$(eval $(call patch-rule,)) # this must be last so we don't drop *.patch_%.