shithub: openh264

Download patch

ref: b842ff30e5b6575b6e73af6abcad6c0a829812b1
parent: d7c907198b9b834bbb93eb48d23ddf3e96540e61
author: Martin Storsjö <[email protected]>
date: Tue Dec 17 08:57:27 EST 2013

Make the compiler/ar/linker file output parameters overrideable

This is in preparation for allowing building using MSVC via
makefiles.

--- a/Makefile
+++ b/Makefile
@@ -3,6 +3,9 @@
 LIBSUFFIX=a
 CP=cp
 ROOTDIR=$(PWD)
+CXX_O=-o $@
+CXX_LINK_O=-o $@
+AR_OPTS=cr $@
 
 
 
--- a/build/mktargets.py
+++ b/build/mktargets.py
@@ -21,7 +21,7 @@
     dst = "$(%s_SRCDIR)/%%.o"%(PREFIX)
 
     f.write("%s: %s\n"%(dst, src))
-    f.write('\t$(CXX) $(CFLAGS) $(CXXFLAGS) $(INCLUDES) $(' + PREFIX + '_CFLAGS) $(' + PREFIX + '_INCLUDES) -c -o $@ $<\n');
+    f.write('\t$(CXX) $(CFLAGS) $(CXXFLAGS) $(INCLUDES) $(' + PREFIX + '_CFLAGS) $(' + PREFIX + '_INCLUDES) -c $(CXX_O) $<\n');
     f.write("\n")
 
 def write_asm_rule_pattern(f):
@@ -90,7 +90,7 @@
 if args.library is not None:
     f.write("$(LIBPREFIX)%s.$(LIBSUFFIX): $(%s_OBJS)\n"%(args.library, PREFIX));
     f.write("\trm -f $(LIBPREFIX)%s.$(LIBSUFFIX)\n"%args.library)
-    f.write("\t$(AR) cr $@ $(%s_OBJS)\n"%PREFIX);
+    f.write("\t$(AR) $(AR_OPTS) $(%s_OBJS)\n"%PREFIX);
     f.write("\n");
     f.write("libraries: $(LIBPREFIX)%s.$(LIBSUFFIX)\n"%args.library);
     f.write("LIBRARIES += $(LIBPREFIX)%s.$(LIBSUFFIX)\n"%args.library);
@@ -97,6 +97,6 @@
 
 if args.binary is not None:
     f.write("%s: $(%s_OBJS) $(LIBS) $(%s_LIBS) $(%s_DEPS)\n"%(args.binary, PREFIX, PREFIX, PREFIX))
-    f.write("\t$(CXX) -o $@  $(%s_OBJS) $(%s_LDFLAGS) $(%s_LIBS) $(LDFLAGS) $(LIBS)\n\n"%(PREFIX, PREFIX, PREFIX))
+    f.write("\t$(CXX) $(CXX_LINK_O)  $(%s_OBJS) $(%s_LDFLAGS) $(%s_LIBS) $(LDFLAGS) $(LIBS)\n\n"%(PREFIX, PREFIX, PREFIX))
     f.write("binaries: %s\n"%args.binary);
     f.write("BINARIES += %s\n"%args.binary);
--- a/codec/common/targets.mk
+++ b/codec/common/targets.mk
@@ -22,7 +22,7 @@
 
 OBJS += $(COMMON_OBJS)
 $(COMMON_SRCDIR)/%.o: $(COMMON_SRCDIR)/%.cpp
-	$(CXX) $(CFLAGS) $(CXXFLAGS) $(INCLUDES) $(COMMON_CFLAGS) $(COMMON_INCLUDES) -c -o $@ $<
+	$(CXX) $(CFLAGS) $(CXXFLAGS) $(INCLUDES) $(COMMON_CFLAGS) $(COMMON_INCLUDES) -c $(CXX_O) $<
 
 $(COMMON_SRCDIR)/%.o: $(COMMON_SRCDIR)/%.asm
 	$(ASM) $(ASMFLAGS) $(ASM_INCLUDES) $(COMMON_ASMFLAGS) $(COMMON_ASM_INCLUDES) -o $@ $<
@@ -29,7 +29,7 @@
 
 $(LIBPREFIX)common.$(LIBSUFFIX): $(COMMON_OBJS)
 	rm -f $(LIBPREFIX)common.$(LIBSUFFIX)
-	$(AR) cr $@ $(COMMON_OBJS)
+	$(AR) $(AR_OPTS) $(COMMON_OBJS)
 
 libraries: $(LIBPREFIX)common.$(LIBSUFFIX)
 LIBRARIES += $(LIBPREFIX)common.$(LIBSUFFIX)
--- a/codec/console/dec/targets.mk
+++ b/codec/console/dec/targets.mk
@@ -14,13 +14,13 @@
 
 OBJS += $(H264DEC_OBJS)
 $(H264DEC_SRCDIR)/%.o: $(H264DEC_SRCDIR)/%.cpp
-	$(CXX) $(CFLAGS) $(CXXFLAGS) $(INCLUDES) $(H264DEC_CFLAGS) $(H264DEC_INCLUDES) -c -o $@ $<
+	$(CXX) $(CFLAGS) $(CXXFLAGS) $(INCLUDES) $(H264DEC_CFLAGS) $(H264DEC_INCLUDES) -c $(CXX_O) $<
 
 $(H264DEC_SRCDIR)/%.o: $(H264DEC_SRCDIR)/%.asm
 	$(ASM) $(ASMFLAGS) $(ASM_INCLUDES) $(H264DEC_ASMFLAGS) $(H264DEC_ASM_INCLUDES) -o $@ $<
 
 h264dec: $(H264DEC_OBJS) $(LIBS) $(H264DEC_LIBS) $(H264DEC_DEPS)
-	$(CXX) -o $@  $(H264DEC_OBJS) $(H264DEC_LDFLAGS) $(H264DEC_LIBS) $(LDFLAGS) $(LIBS)
+	$(CXX) $(CXX_LINK_O)  $(H264DEC_OBJS) $(H264DEC_LDFLAGS) $(H264DEC_LIBS) $(LDFLAGS) $(LIBS)
 
 binaries: h264dec
 BINARIES += h264dec
--- a/codec/console/enc/targets.mk
+++ b/codec/console/enc/targets.mk
@@ -13,13 +13,13 @@
 
 OBJS += $(H264ENC_OBJS)
 $(H264ENC_SRCDIR)/%.o: $(H264ENC_SRCDIR)/%.cpp
-	$(CXX) $(CFLAGS) $(CXXFLAGS) $(INCLUDES) $(H264ENC_CFLAGS) $(H264ENC_INCLUDES) -c -o $@ $<
+	$(CXX) $(CFLAGS) $(CXXFLAGS) $(INCLUDES) $(H264ENC_CFLAGS) $(H264ENC_INCLUDES) -c $(CXX_O) $<
 
 $(H264ENC_SRCDIR)/%.o: $(H264ENC_SRCDIR)/%.asm
 	$(ASM) $(ASMFLAGS) $(ASM_INCLUDES) $(H264ENC_ASMFLAGS) $(H264ENC_ASM_INCLUDES) -o $@ $<
 
 h264enc: $(H264ENC_OBJS) $(LIBS) $(H264ENC_LIBS) $(H264ENC_DEPS)
-	$(CXX) -o $@  $(H264ENC_OBJS) $(H264ENC_LDFLAGS) $(H264ENC_LIBS) $(LDFLAGS) $(LIBS)
+	$(CXX) $(CXX_LINK_O)  $(H264ENC_OBJS) $(H264ENC_LDFLAGS) $(H264ENC_LIBS) $(LDFLAGS) $(LIBS)
 
 binaries: h264enc
 BINARIES += h264enc
--- a/codec/decoder/targets.mk
+++ b/codec/decoder/targets.mk
@@ -36,7 +36,7 @@
 
 OBJS += $(DECODER_OBJS)
 $(DECODER_SRCDIR)/%.o: $(DECODER_SRCDIR)/%.cpp
-	$(CXX) $(CFLAGS) $(CXXFLAGS) $(INCLUDES) $(DECODER_CFLAGS) $(DECODER_INCLUDES) -c -o $@ $<
+	$(CXX) $(CFLAGS) $(CXXFLAGS) $(INCLUDES) $(DECODER_CFLAGS) $(DECODER_INCLUDES) -c $(CXX_O) $<
 
 $(DECODER_SRCDIR)/%.o: $(DECODER_SRCDIR)/%.asm
 	$(ASM) $(ASMFLAGS) $(ASM_INCLUDES) $(DECODER_ASMFLAGS) $(DECODER_ASM_INCLUDES) -o $@ $<
@@ -43,7 +43,7 @@
 
 $(LIBPREFIX)decoder.$(LIBSUFFIX): $(DECODER_OBJS)
 	rm -f $(LIBPREFIX)decoder.$(LIBSUFFIX)
-	$(AR) cr $@ $(DECODER_OBJS)
+	$(AR) $(AR_OPTS) $(DECODER_OBJS)
 
 libraries: $(LIBPREFIX)decoder.$(LIBSUFFIX)
 LIBRARIES += $(LIBPREFIX)decoder.$(LIBSUFFIX)
--- a/codec/encoder/targets.mk
+++ b/codec/encoder/targets.mk
@@ -50,7 +50,7 @@
 
 OBJS += $(ENCODER_OBJS)
 $(ENCODER_SRCDIR)/%.o: $(ENCODER_SRCDIR)/%.cpp
-	$(CXX) $(CFLAGS) $(CXXFLAGS) $(INCLUDES) $(ENCODER_CFLAGS) $(ENCODER_INCLUDES) -c -o $@ $<
+	$(CXX) $(CFLAGS) $(CXXFLAGS) $(INCLUDES) $(ENCODER_CFLAGS) $(ENCODER_INCLUDES) -c $(CXX_O) $<
 
 $(ENCODER_SRCDIR)/%.o: $(ENCODER_SRCDIR)/%.asm
 	$(ASM) $(ASMFLAGS) $(ASM_INCLUDES) $(ENCODER_ASMFLAGS) $(ENCODER_ASM_INCLUDES) -o $@ $<
@@ -57,7 +57,7 @@
 
 $(LIBPREFIX)encoder.$(LIBSUFFIX): $(ENCODER_OBJS)
 	rm -f $(LIBPREFIX)encoder.$(LIBSUFFIX)
-	$(AR) cr $@ $(ENCODER_OBJS)
+	$(AR) $(AR_OPTS) $(ENCODER_OBJS)
 
 libraries: $(LIBPREFIX)encoder.$(LIBSUFFIX)
 LIBRARIES += $(LIBPREFIX)encoder.$(LIBSUFFIX)
--- a/codec/processing/targets.mk
+++ b/codec/processing/targets.mk
@@ -35,7 +35,7 @@
 
 OBJS += $(PROCESSING_OBJS)
 $(PROCESSING_SRCDIR)/%.o: $(PROCESSING_SRCDIR)/%.cpp
-	$(CXX) $(CFLAGS) $(CXXFLAGS) $(INCLUDES) $(PROCESSING_CFLAGS) $(PROCESSING_INCLUDES) -c -o $@ $<
+	$(CXX) $(CFLAGS) $(CXXFLAGS) $(INCLUDES) $(PROCESSING_CFLAGS) $(PROCESSING_INCLUDES) -c $(CXX_O) $<
 
 $(PROCESSING_SRCDIR)/%.o: $(PROCESSING_SRCDIR)/%.asm
 	$(ASM) $(ASMFLAGS) $(ASM_INCLUDES) $(PROCESSING_ASMFLAGS) $(PROCESSING_ASM_INCLUDES) -o $@ $<
@@ -42,7 +42,7 @@
 
 $(LIBPREFIX)processing.$(LIBSUFFIX): $(PROCESSING_OBJS)
 	rm -f $(LIBPREFIX)processing.$(LIBSUFFIX)
-	$(AR) cr $@ $(PROCESSING_OBJS)
+	$(AR) $(AR_OPTS) $(PROCESSING_OBJS)
 
 libraries: $(LIBPREFIX)processing.$(LIBSUFFIX)
 LIBRARIES += $(LIBPREFIX)processing.$(LIBSUFFIX)
--- a/test/targets.mk
+++ b/test/targets.mk
@@ -14,13 +14,13 @@
 
 OBJS += $(CODEC_UNITTEST_OBJS)
 $(CODEC_UNITTEST_SRCDIR)/%.o: $(CODEC_UNITTEST_SRCDIR)/%.cpp
-	$(CXX) $(CFLAGS) $(CXXFLAGS) $(INCLUDES) $(CODEC_UNITTEST_CFLAGS) $(CODEC_UNITTEST_INCLUDES) -c -o $@ $<
+	$(CXX) $(CFLAGS) $(CXXFLAGS) $(INCLUDES) $(CODEC_UNITTEST_CFLAGS) $(CODEC_UNITTEST_INCLUDES) -c $(CXX_O) $<
 
 $(CODEC_UNITTEST_SRCDIR)/%.o: $(CODEC_UNITTEST_SRCDIR)/%.asm
 	$(ASM) $(ASMFLAGS) $(ASM_INCLUDES) $(CODEC_UNITTEST_ASMFLAGS) $(CODEC_UNITTEST_ASM_INCLUDES) -o $@ $<
 
 codec_unittest: $(CODEC_UNITTEST_OBJS) $(LIBS) $(CODEC_UNITTEST_LIBS) $(CODEC_UNITTEST_DEPS)
-	$(CXX) -o $@  $(CODEC_UNITTEST_OBJS) $(CODEC_UNITTEST_LDFLAGS) $(CODEC_UNITTEST_LIBS) $(LDFLAGS) $(LIBS)
+	$(CXX) $(CXX_LINK_O)  $(CODEC_UNITTEST_OBJS) $(CODEC_UNITTEST_LDFLAGS) $(CODEC_UNITTEST_LIBS) $(LDFLAGS) $(LIBS)
 
 binaries: codec_unittest
 BINARIES += codec_unittest