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

Vittorio Giovara vittorio.giovara at gmail.com
Fri Feb 10 22:19:04 CET 2017


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

diff --git a/Makefile b/Makefile
index 9faef8e..56741a0 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=%-10.o) $(ASMSRC10:%.asm=%-10.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=%-10.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=%-10.o)
 endif
 
-OBJCHK += tools/checkasm-aarch64.o
+SRCCHK += tools/checkasm-aarch64.c
 endif
 endif
 
@@ -207,10 +207,12 @@ OBJSO  += $(SRCSO:%.c=%.o)
 ifneq ($(findstring HAVE_BITDEPTH8, $(CONFIG)),)
 OBJS += $(SRCS:%.c=%-8.o) $(SRCSOCL:%.c=%-8.o)
 OBJCLI += $(SRCCLIBD:%.c=%-8.o)
+OBJCHK8 = $(SRCCHK:%.c=%-8.o)
 endif
 ifneq ($(findstring HAVE_BITDEPTH10, $(CONFIG)),)
 OBJS += $(SRCS:%.c=%-10.o)
 OBJCLI += $(SRCCLIBD:%.c=%-10.o)
+OBJCHK10 = $(SRCCHK:%.c=%-10.o)
 endif
 
 .PHONY: all default fprofiled clean distclean install install-* uninstall cli lib-* etags
@@ -228,22 +230,39 @@ $(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)
+.PHONY: checkasm
+ifneq ($(findstring HAVE_BITDEPTH8, $(CONFIG)),)
+checkasm: checkasm8$(EXE)
+endif
+ifneq ($(findstring HAVE_BITDEPTH10, $(CONFIG)),)
+checkasm: checkasm10$(EXE)
+endif
+
+checkasm8$(EXE): CHECKASMOBJS = $(OBJCHK8)
+checkasm10$(EXE): CHECKASMOBJS = $(OBJCHK10)
+checkasm8$(EXE): $(OBJCHK8)
+checkasm10$(EXE): $(OBJCHK10)
+checkasm8$(EXE) checkasm10$(EXE): $(GENERATED) .depend $(LIBX264)
+	$(LD)$@ $(CHECKASMOBJS) $(LIBX264) $(LDFLAGS)
 
 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
 
 %-8.o: %.c
 	$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@ -DHIGH_BIT_DEPTH=0 -DBIT_DEPTH=8
diff --git a/tools/checkasm.c b/tools/checkasm.c
index d160951..008fef9 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