shithub: openh264

Download patch

ref: c8901c7dcd032cca6c2d083697585c3a8f51ff05
parent: 764f787dcbde7c608fe16f8fe9291dffedbde371
author: Martin Storsjö <[email protected]>
date: Wed Apr 23 06:49:30 EDT 2014

Add support for arm64 assembly source files in mktargets.py

Disambiguate between arm and arm64 sources by checking the directory
names.

The arm assembly sources can be assembled on arm64 and vice versa
without any effect since all of the implementation is hidden behind
the HAVE_NEON and HAVE_NEON_AARCH64 defines, but it still is cleaner
to not build extra empty object files than to build all *.S files
on all arm variants. (The iOS project files build all of the arm
assembly files, regardless of the target architecture, since
individual files can't easily be excluded based on the target
architecture there.)

--- a/build/mktargets.py
+++ b/build/mktargets.py
@@ -112,6 +112,14 @@
 asm = sorted(asm, key=lambda s: s.lower())
 cfiles = sorted(cfiles, key=lambda s: s.lower())
 sfiles = sorted(sfiles, key=lambda s: s.lower())
+armfiles = []
+arm64files = []
+for file in sfiles:
+    c = file.split('/')
+    if 'arm64' in c:
+        arm64files.append(file)
+    elif 'arm' in c:
+        armfiles.append(file)
 
 
 
@@ -140,13 +148,22 @@
     f.write("%s_OBJS += $(%s_ASM_SRCS:.asm=.$(OBJ))\n"%(PREFIX, PREFIX))
     f.write("endif\n\n")
 
-if len(sfiles) > 0:
+if len(armfiles) > 0:
     f.write("ifeq ($(ASM_ARCH), arm)\n")
     f.write("%s_ASM_ARM_SRCS=\\\n"%(PREFIX))
-    for c in sfiles:
+    for c in armfiles:
         f.write("\t$(%s_SRCDIR)/%s\\\n"%(PREFIX, c))
     f.write("\n")
     f.write("%s_OBJS += $(%s_ASM_ARM_SRCS:.S=.$(OBJ))\n"%(PREFIX, PREFIX))
+    f.write("endif\n\n")
+
+if len(arm64files) > 0:
+    f.write("ifeq ($(ASM_ARCH), arm64)\n")
+    f.write("%s_ASM_ARM64_SRCS=\\\n"%(PREFIX))
+    for c in arm64files:
+        f.write("\t$(%s_SRCDIR)/%s\\\n"%(PREFIX, c))
+    f.write("\n")
+    f.write("%s_OBJS += $(%s_ASM_ARM64_SRCS:.S=.$(OBJ))\n"%(PREFIX, PREFIX))
     f.write("endif\n\n")
 
 f.write("OBJS += $(%s_OBJS)\n"%PREFIX)