ref: 1118dd4f71cf2551cf71a1a26c24e59c54ab8eea
parent: ff94e7053df980111eb7f22a04e4c0cfd6b84c97
author: Martin Storsjö <[email protected]>
date: Wed Feb 26 09:31:52 EST 2014
Update the makefile generator to support .S arm assembly files These are built if ASM_ARCH is set to arm.
--- a/Makefile
+++ b/Makefile
@@ -2,6 +2,7 @@
ARCH=$(shell uname -m)
LIBPREFIX=lib
LIBSUFFIX=a
+CCAS=$(CC)
CXX_O=-o $@
CXX_LINK_O=-o $@
AR_OPTS=cr $@
@@ -44,6 +45,7 @@
ifneq ($(V),Yes)
QUIET_CXX = @printf "CXX\t$@\n";
QUIET_CC = @printf "CC\t$@\n";
+ QUIET_CCAS = @printf "CCAS\t$@\n";
QUIET_ASM = @printf "ASM\t$@\n";
QUIET_AR = @printf "AR\t$@\n";
QUIET = @
--- a/build/mktargets.py
+++ b/build/mktargets.py
@@ -46,11 +46,20 @@
f.write('\t$(QUIET_ASM)$(ASM) $(ASMFLAGS) $(ASM_INCLUDES) $(' + PREFIX + '_ASMFLAGS) $(' + PREFIX + '_ASM_INCLUDES) -o $@ $<\n')
f.write("\n")
+def write_asm_s_rule_pattern(f):
+ src = "$(%s_SRCDIR)/%%.S"%(PREFIX)
+ dst = "$(%s_SRCDIR)/%%.o"%(PREFIX)
+ f.write("%s: %s\n"%(dst, src))
+ f.write('\t$(QUIET_CCAS)$(CCAS) $(CFLAGS) $(ASMFLAGS) $(INCLUDES) $(' + PREFIX + '_CFLAGS) $(' + PREFIX + '_INCLUDES) -c -o $@ $<\n')
+ f.write("\n")
+
+
def find_sources():
cpp_files = []
asm_files = []
c_files = []
+ s_files = []
print EXCLUDE
for dir in os.walk("."):
for file in dir[2]:
@@ -61,7 +70,9 @@
asm_files.append(os.path.join(dir[0].strip('./'), file))
if os.path.splitext(file)[1] == '.c':
c_files.append(os.path.join(dir[0].strip('./'), file))
- return [cpp_files, asm_files, c_files]
+ if os.path.splitext(file)[1] == '.S':
+ s_files.append(os.path.join(dir[0].strip('./'), file))
+ return [cpp_files, asm_files, c_files, s_files]
args = parser.parse_args()
@@ -91,7 +102,7 @@
except:
sys.exit(1)
-(cpp, asm, cfiles) = find_sources()
+(cpp, asm, cfiles, sfiles) = find_sources()
@@ -120,6 +131,15 @@
f.write("%s_OBJS += $(%s_ASM_SRCS:.asm=.o)\n"%(PREFIX, PREFIX))
f.write("endif\n\n")
+if len(sfiles) > 0:
+ f.write("ifeq ($(ASM_ARCH), arm)\n")
+ f.write("%s_ASM_S_SRCS=\\\n"%(PREFIX))
+ for c in sfiles:
+ f.write("\t$(%s_SRCDIR)/%s\\\n"%(PREFIX, c))
+ f.write("\n")
+ f.write("%s_OBJS += $(%s_ASM_S_SRCS:.S=.o)\n"%(PREFIX, PREFIX))
+ f.write("endif\n\n")
+
f.write("OBJS += $(%s_OBJS)\n"%PREFIX)
write_cpp_rule_pattern(f)
@@ -129,6 +149,9 @@
if len(asm) > 0:
write_asm_rule_pattern(f)
+
+if len(sfiles) > 0:
+ write_asm_s_rule_pattern(f)
if args.library is not None:
f.write("$(LIBPREFIX)%s.$(LIBSUFFIX): $(%s_OBJS)\n"%(args.library, PREFIX))
--- a/codec/common/targets.mk
+++ b/codec/common/targets.mk
@@ -23,6 +23,14 @@
COMMON_OBJS += $(COMMON_ASM_SRCS:.asm=.o)
endif
+ifeq ($(ASM_ARCH), arm)
+COMMON_ASM_S_SRCS=\
+ $(COMMON_SRCDIR)/arm_arch_common_macro.S\
+ $(COMMON_SRCDIR)/deblocking_neon.S\
+
+COMMON_OBJS += $(COMMON_ASM_S_SRCS:.S=.o)
+endif
+
OBJS += $(COMMON_OBJS)
$(COMMON_SRCDIR)/%.o: $(COMMON_SRCDIR)/%.cpp
$(QUIET_CXX)$(CXX) $(CFLAGS) $(CXXFLAGS) $(INCLUDES) $(COMMON_CFLAGS) $(COMMON_INCLUDES) -c $(CXX_O) $<
@@ -29,6 +37,9 @@
$(COMMON_SRCDIR)/%.o: $(COMMON_SRCDIR)/%.asm
$(QUIET_ASM)$(ASM) $(ASMFLAGS) $(ASM_INCLUDES) $(COMMON_ASMFLAGS) $(COMMON_ASM_INCLUDES) -o $@ $<
+
+$(COMMON_SRCDIR)/%.o: $(COMMON_SRCDIR)/%.S
+ $(QUIET_CCAS)$(CCAS) $(CFLAGS) $(ASMFLAGS) $(INCLUDES) $(COMMON_CFLAGS) $(COMMON_INCLUDES) -c -o $@ $<
$(LIBPREFIX)common.$(LIBSUFFIX): $(COMMON_OBJS)
$(QUIET)rm -f $@
--- a/codec/decoder/targets.mk
+++ b/codec/decoder/targets.mk
@@ -34,6 +34,15 @@
DECODER_OBJS += $(DECODER_ASM_SRCS:.asm=.o)
endif
+ifeq ($(ASM_ARCH), arm)
+DECODER_ASM_S_SRCS=\
+ $(DECODER_SRCDIR)/core/arm/block_add_neon.S\
+ $(DECODER_SRCDIR)/core/arm/intra_pred_neon.S\
+ $(DECODER_SRCDIR)/core/arm/mc_neon.S\
+
+DECODER_OBJS += $(DECODER_ASM_S_SRCS:.S=.o)
+endif
+
OBJS += $(DECODER_OBJS)
$(DECODER_SRCDIR)/%.o: $(DECODER_SRCDIR)/%.cpp
$(QUIET_CXX)$(CXX) $(CFLAGS) $(CXXFLAGS) $(INCLUDES) $(DECODER_CFLAGS) $(DECODER_INCLUDES) -c $(CXX_O) $<
@@ -40,6 +49,9 @@
$(DECODER_SRCDIR)/%.o: $(DECODER_SRCDIR)/%.asm
$(QUIET_ASM)$(ASM) $(ASMFLAGS) $(ASM_INCLUDES) $(DECODER_ASMFLAGS) $(DECODER_ASM_INCLUDES) -o $@ $<
+
+$(DECODER_SRCDIR)/%.o: $(DECODER_SRCDIR)/%.S
+ $(QUIET_CCAS)$(CCAS) $(CFLAGS) $(ASMFLAGS) $(INCLUDES) $(DECODER_CFLAGS) $(DECODER_INCLUDES) -c -o $@ $<
$(LIBPREFIX)decoder.$(LIBSUFFIX): $(DECODER_OBJS)
$(QUIET)rm -f $@