shithub: openh264

Download patch

ref: 488fb7bb20539a756cace24f71adfd017b248b85
parent: cc2ffee5d2178e90407a89cfa7dc644cdb35ac27
author: Martin Storsjö <[email protected]>
date: Wed Jan 8 11:18:01 EST 2014

Add proper dependencies for the command line binaries

This makes sure that all the dependency libs are built before trying
to link them together, fixing parallel make (which occasionally
failed due to trying to link the encoder or decoder command line
binaries before the libs had been built) and also fixes building an
individual component by e.g. "make h264enc".

--- a/Makefile
+++ b/Makefile
@@ -64,11 +64,14 @@
 
 H264DEC_INCLUDES = $(DECODER_INCLUDES) -Icodec/console/dec/inc
 H264DEC_LDFLAGS = -L. -ldecoder -lcommon
+H264DEC_DEPS = $(LIBPREFIX)decoder.$(LIBSUFFIX) $(LIBPREFIX)common.$(LIBSUFFIX)
 
 H264ENC_INCLUDES = $(ENCODER_INCLUDES) -Icodec/console/enc/inc
 H264ENC_LDFLAGS = -L. -lencoder -lprocessing -lcommon
+H264ENC_DEPS = $(LIBPREFIX)encoder.$(LIBSUFFIX) $(LIBPREFIX)processing.$(LIBSUFFIX) $(LIBPREFIX)common.$(LIBSUFFIX)
 
 CODEC_UNITTEST_LDFLAGS = -L. -lgtest -ldecoder -lcommon
+CODEC_UNITTEST_DEPS = $(LIBPREFIX)gtest.$(LIBSUFFIX) $(LIBPREFIX)decoder.$(LIBSUFFIX) $(LIBPREFIX)common.$(LIBSUFFIX)
 
 .PHONY: test
 
--- a/build/mktargets.py
+++ b/build/mktargets.py
@@ -98,7 +98,7 @@
     f.write("LIBRARIES += $(LIBPREFIX)%s.$(LIBSUFFIX)\n"%args.library);
 
 if args.binary is not None:
-    f.write("%s: $(%s_OBJS) $(LIBS) $(%s_LIBS)\n"%(args.binary, PREFIX, PREFIX))
+    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("binaries: %s\n"%args.binary);
     f.write("BINARIES += %s\n"%args.binary);
--- a/codec/console/dec/targets.mk
+++ b/codec/console/dec/targets.mk
@@ -22,7 +22,7 @@
 $(H264DEC_SRCDIR)/./src/read_config.o: $(H264DEC_SRCDIR)/./src/read_config.cpp
 	$(CXX) $(CFLAGS) $(CXXFLAGS) $(INCLUDES) $(H264DEC_CFLAGS) $(H264DEC_INCLUDES) -c -o $(H264DEC_SRCDIR)/./src/read_config.o $(H264DEC_SRCDIR)/./src/read_config.cpp
 
-h264dec: $(H264DEC_OBJS) $(LIBS) $(H264DEC_LIBS)
+h264dec: $(H264DEC_OBJS) $(LIBS) $(H264DEC_LIBS) $(H264DEC_DEPS)
 	$(CXX) -o $@  $(H264DEC_OBJS) $(H264DEC_LDFLAGS) $(H264DEC_LIBS) $(LDFLAGS) $(LIBS)
 
 binaries: h264dec
--- a/codec/console/enc/targets.mk
+++ b/codec/console/enc/targets.mk
@@ -18,7 +18,7 @@
 $(H264ENC_SRCDIR)/./src/welsenc.o: $(H264ENC_SRCDIR)/./src/welsenc.cpp
 	$(CXX) $(CFLAGS) $(CXXFLAGS) $(INCLUDES) $(H264ENC_CFLAGS) $(H264ENC_INCLUDES) -c -o $(H264ENC_SRCDIR)/./src/welsenc.o $(H264ENC_SRCDIR)/./src/welsenc.cpp
 
-h264enc: $(H264ENC_OBJS) $(LIBS) $(H264ENC_LIBS)
+h264enc: $(H264ENC_OBJS) $(LIBS) $(H264ENC_LIBS) $(H264ENC_DEPS)
 	$(CXX) -o $@  $(H264ENC_OBJS) $(H264ENC_LDFLAGS) $(H264ENC_LIBS) $(LDFLAGS) $(LIBS)
 
 binaries: h264enc
--- a/test/targets.mk
+++ b/test/targets.mk
@@ -14,7 +14,7 @@
 $(CODEC_UNITTEST_SRCDIR)/./simple_test.o: $(CODEC_UNITTEST_SRCDIR)/./simple_test.cpp
 	$(CXX) $(CFLAGS) $(CXXFLAGS) $(INCLUDES) $(CODEC_UNITTEST_CFLAGS) $(CODEC_UNITTEST_INCLUDES) -c -o $(CODEC_UNITTEST_SRCDIR)/./simple_test.o $(CODEC_UNITTEST_SRCDIR)/./simple_test.cpp
 
-codec_unittest: $(CODEC_UNITTEST_OBJS) $(LIBS) $(CODEC_UNITTEST_LIBS)
+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)
 
 binaries: codec_unittest