[x264-devel] [PATCH 29/29] Duplicate checkasm targets

Vittorio Giovara vittorio.giovara at gmail.com
Thu Feb 2 10:05:41 CET 2017


Each bitdepth needs different compilation rules, so split the
main checkasm target in two executables.
---
 Makefile         | 35 +++++++++++++++++++++++++----------
 tools/checkasm.c |  5 +++++
 2 files changed, 30 insertions(+), 10 deletions(-)

diff --git a/Makefile b/Makefile
index 48eecc7..55cba3b 100644
--- a/Makefile
+++ b/Makefile
@@ -34,6 +34,8 @@ SRCCLI = x264.c input/input.c input/timecode.c input/raw.c input/y4m.c \
 
 SRCCLIBD = filters/video/depth.c filters/video/cache.c
 
+SRCCHK = tools/checkasm.c
+
 SRCSO =
 SRCSOCL =
 
@@ -41,8 +43,6 @@ OBJS =
 OBJSO =
 OBJCLI =
 
-OBJCHK = tools/checkasm.o
-
 OBJEXAMPLE = example.o
 
 CONFIG := $(shell cat config.h)
@@ -114,7 +114,7 @@ OBJASM += $(ASMSRC:%.asm=10bit/%.o) $(ASMSRC10:%.asm=10bit/%.o)
 endif
 
 $(OBJASM): common/x86/x86inc.asm common/x86/x86util.asm
-OBJCHK += tools/checkasm-a.o
+SRCCHK += tools/checkasm-a.c
 endif
 endif
 
@@ -142,7 +142,7 @@ ifneq ($(findstring HAVE_BITDEPTH10, $(CONFIG)),)
 OBJASM += $(ASMSRC:%.S=10bit/%.o)
 endif
 
-OBJCHK += tools/checkasm-arm.o
+SRCCHK += tools/checkasm-arm.c
 endif
 endif
 
@@ -168,7 +168,7 @@ ifneq ($(findstring HAVE_BITDEPTH10, $(CONFIG)),)
 OBJASM += $(ASMSRC:%.S=10bit/%.o)
 endif
 
-OBJCHK += tools/checkasm-aarch64.o
+SRCCHK += tools/checkasm-aarch64.c
 endif
 endif
 
@@ -207,10 +207,13 @@ OBJSO  += $(SRCSO:%.c=%.o)
 ifneq ($(findstring HAVE_BITDEPTH8, $(CONFIG)),)
 OBJS += $(SRCS:%.c=8bit/%.o) $(SRCSOCL:%.c=8bit/%.o)
 OBJCLI += $(SRCCLIBD:%.c=8bit/%.o)
+OBJCHK8 = $(SRCCHK:%.c=8bit/%.o)
 endif
 ifneq ($(findstring HAVE_BITDEPTH10, $(CONFIG)),)
 OBJS += $(SRCS:%.c=10bit/%.o)
 OBJCLI += $(SRCCLIBD:%.c=10bit/%.o)
+$(info ${SRCCHK})
+OBJCHK10 = $(SRCCHK:%.c=10bit/%.o)
 endif
 
 .PHONY: all default fprofiled clean distclean install install-* uninstall cli lib-* etags
@@ -228,22 +231,34 @@ $(SONAME): $(GENERATED) .depend $(OBJS) $(OBJASM) $(OBJSO)
 	$(LD)$@ $(OBJS) $(OBJASM) $(OBJSO) $(SOFLAGS) $(LDFLAGS)
 
 ifneq ($(EXE),)
-.PHONY: x264 checkasm example
+.PHONY: x264 checkasm8 checkasm10 example
 x264: x264$(EXE)
-checkasm: checkasm$(EXE)
+ifneq ($(findstring HAVE_BITDEPTH8, $(CONFIG)),)
+checkasm8: checkasm8$(EXE)
+endif
+ifneq ($(findstring HAVE_BITDEPTH10, $(CONFIG)),)
+checkasm10: checkasm10$(EXE)
+endif
 example: example$(EXE)
 endif
 
 x264$(EXE): $(GENERATED) .depend $(OBJCLI) $(CLI_LIBX264)
 	$(LD)$@ $(OBJCLI) $(CLI_LIBX264) $(LDFLAGSCLI) $(LDFLAGS)
 
-checkasm$(EXE): $(GENERATED) .depend $(OBJCHK) $(LIBX264)
-	$(LD)$@ $(OBJCHK) $(LIBX264) $(LDFLAGS)
+ifneq ($(findstring HAVE_BITDEPTH8, $(CONFIG)),)
+checkasm8$(EXE): $(GENERATED) .depend $(OBJCHK8) $(LIBX264)
+	$(LD)$@ $(OBJCHK8) $(LIBX264) $(LDFLAGS)
+endif
+
+ifneq ($(findstring HAVE_BITDEPTH10, $(CONFIG)),)
+checkasm10$(EXE): $(GENERATED) .depend $(OBJCHK10) $(LIBX264)
+	$(LD)$@ $(OBJCHK10) $(LIBX264) $(LDFLAGS)
+endif
 
 example$(EXE): $(GENERATED) .depend $(OBJEXAMPLE) $(LIBX264)
 	$(LD)$@ $(OBJEXAMPLE) $(LIBX264) $(LDFLAGS)
 
-$(OBJS) $(OBJASM) $(OBJSO) $(OBJCLI) $(OBJCHK) $(OBJEXAMPLE): .depend
+$(OBJS) $(OBJASM) $(OBJSO) $(OBJCLI) $(OBJCHK8) $(OBJCHK10) $(OBJEXAMPLE): .depend
 
 %.o: %.c
 	$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
diff --git a/tools/checkasm.c b/tools/checkasm.c
index 1b2e0a1..7aa9cbe 100644
--- a/tools/checkasm.c
+++ b/tools/checkasm.c
@@ -222,6 +222,8 @@ static void print_bench(void)
         }
 }
 
+#define x264_checkasm_call x264_template(checkasm_call)
+#define x264_stack_pagealign x264_template(stack_pagealign)
 #if ARCH_X86 || ARCH_X86_64
 int x264_stack_pagealign( int (*func)(), int align );
 
@@ -237,13 +239,16 @@ intptr_t x264_checkasm_call( intptr_t (*func)(), int *ok, ... );
 #endif
 
 #if ARCH_ARM
+#define x264_checkasm_call_neon x264_template(checkasm_call_neon)
 intptr_t x264_checkasm_call_neon( intptr_t (*func)(), int *ok, ... );
+#define x264_checkasm_call_noneon x264_template(checkasm_call_noneon)
 intptr_t x264_checkasm_call_noneon( intptr_t (*func)(), int *ok, ... );
 intptr_t (*x264_checkasm_call)( intptr_t (*func)(), int *ok, ... ) = x264_checkasm_call_noneon;
 #endif
 
 #define call_c1(func,...) func(__VA_ARGS__)
 
+#define x264_checkasm_stack_clobber x264_template(checkasm_stack_clobber)
 #if ARCH_X86_64
 /* Evil hack: detect incorrect assumptions that 32-bit ints are zero-extended to 64-bit.
  * This is done by clobbering the stack with junk around the stack pointer and calling the
-- 
2.10.0



More information about the x264-devel mailing list