[x264-devel] [PATCH 6/6] make: Fix building bitdepth specific object files with MSVC

Martin Storsjö martin at martin.st
Mon Oct 16 21:46:34 CEST 2017


When building with MSVC, many parameters are similar to gcc, but the
-o parameter for specifying the object file is different. This was
handled before by adding a special rule for building %.o from %.c
in config.mak, but when we have custom rules for building %-8.o
from %.c, we need to use the right version of the output parameter
for the compiler there as well.

This should be squashed into "Unify 8-bit and 10-bit CLI and libraries".
---
 Makefile  | 4 ++--
 configure | 3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index c2f8e84..2f33f93 100644
--- a/Makefile
+++ b/Makefile
@@ -239,10 +239,10 @@ example$(EXE): $(GENERATED) .depend $(OBJEXAMPLE) $(LIBX264)
 $(OBJS) $(OBJASM) $(OBJSO) $(OBJCLI) $(OBJCHK) $(OBJCHK8) $(OBJCHK10) $(OBJEXAMPLE): .depend
 
 %-8.o: %.c
-	$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@ -DHIGH_BIT_DEPTH=0 -DBIT_DEPTH=8
+	$(CC) $(CFLAGS) $(CPPFLAGS) -c $< $(CC_O) -DHIGH_BIT_DEPTH=0 -DBIT_DEPTH=8
 
 %-10.o: %.c
-	$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@ -DHIGH_BIT_DEPTH=1 -DBIT_DEPTH=10
+	$(CC) $(CFLAGS) $(CPPFLAGS) -c $< $(CC_O) -DHIGH_BIT_DEPTH=1 -DBIT_DEPTH=10
 
 %.o: %.asm common/x86/x86inc.asm common/x86/x86util.asm
 	$(AS) $(ASFLAGS) -o $@ $<
diff --git a/configure b/configure
index ce6814e..84fc3fb 100755
--- a/configure
+++ b/configure
@@ -1456,6 +1456,9 @@ EOF
 if [ $compiler_style = MS ]; then
     echo '%.o: %.c' >> config.mak
     echo '	$(CC) $(CFLAGS) -c -Fo$@ $<' >> config.mak
+    echo 'CC_O=-Fo$@' >> config.mak
+else
+    echo 'CC_O=-o $@' >> config.mak
 fi
 
 if [ "$cli" = "yes" ]; then
-- 
2.7.4



More information about the x264-devel mailing list