summaryrefslogtreecommitdiff
path: root/target/xtensa/patch.in
blob: 3fe5cc80dc90a689677371a452495dea1b37ba18 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
ifneq ($(filter xtensa%,$(ARCH)),)
#############################################################
#
#  Xtensa processor architecture (including Diamond Standard cores)
#
#############################################################

#  The following defines a function to be used like this:
#	$(call XTENSA_PATCH, <module>, <patchdir>, <relative dir list...>)
#  which returns the first overlay patch file for <module> found
#  in the list of directories <relative dir list...> which are
#  relative to <patchdir> (itself either absolute or relative to the
#  current directory).  The returned filename is relative to <patchdir>.
#  For example:
#	$(call XTENSA_PATCH, binutils, some/dir/path, . ..)
#  (no commas between directory paths in the list).
#
#  A selected overlay patch must exist ("fsf" means no specific
#  overlay is selected).  So the function emits a Makefile error
#  if a selected patch file is not found.

XTENSA_CORENAME:=$(call qstrip,$(BR2_xtensa_core_name))
ifeq ($(XTENSA_CORENAME),fsf)
XTENSA_PATCH =
else
XTENSA_PATCH_SUFFIX = $(1)-xtensa_$(XTENSA_CORENAME).tgz
XTENSA_PATCH_FILE = $(firstword $(wildcard $(patsubst %,$(2)/%/*$(XTENSA_PATCH_SUFFIX),$(3))))
# FULLPATH = $(if $(filter /%,$(1)),$(1),$(PWD)/$(1))
XTENSA_PATCH = $(if $(XTENSA_PATCH_FILE),$(patsubst $(2)/%,%,$(XTENSA_PATCH_FILE)),\
	$(error Missing $(1) patch for Xtensa $(XTENSA_CORENAME) processor (*$(XTENSA_PATCH_SUFFIX) in $(addprefix $(2)/,$(3)))))
endif

endif