1# Rules to generate GAS compatible assembly from RVCT syntax files.
2# Input variables:
3#   libvpx_2nd_arch
4#   libvpx_source_dir
5#   libvpx_codec_srcs_asm_<arch>
6#
7# Output variables:
8#   LOCAL_GENERATED_SOURCES_<arch>
9
10ifneq ($(strip $(libvpx_codec_srcs_asm_$(TARGET_$(libvpx_2nd_arch)ARCH))),)
11libvpx_intermediates := $(call local-intermediates-dir,,$(libvpx_2nd_arch))
12# This step is only required for ARM. MIPS uses intrinsics exclusively and x86
13# requires 'yasm' to pre-process its assembly files.
14# The ARM assembly sources must be converted from ADS to GAS compatible format.
15VPX_ASM := $(addprefix $(libvpx_intermediates)/, $(libvpx_codec_srcs_asm_$(TARGET_$(libvpx_2nd_arch)ARCH)))
16# The build system will accept arm assembly which ends in '.s' or '.S'
17# Other build systems prefer capital S so smooth things out here.
18VPX_GEN := $(addsuffix .S, $(VPX_ASM))
19$(VPX_GEN) : PRIVATE_SOURCE_DIR := $(libvpx_source_dir)
20$(VPX_GEN) : PRIVATE_CUSTOM_TOOL = cat $< | perl $(PRIVATE_SOURCE_DIR)/build/make/ads2gas.pl > $@
21$(VPX_GEN) : $(libvpx_intermediates)/%.S : $(libvpx_source_dir)/% \
22		$(libvpx_source_dir)/build/make/ads2gas.pl \
23		$(libvpx_source_dir)/build/make/thumb.pm
24	$(transform-generated-source)
25
26LOCAL_GENERATED_SOURCES_$(TARGET_$(libvpx_2nd_arch)ARCH) += $(VPX_GEN)
27endif
28