shithub: openh264

Download patch

ref: d0eec6df78c031eff1699735e54e5e496a6c4f4e
parent: c8ee9a030870c4a28a07cb119efb1ccbaac3c765
parent: aa0fa56cdc1358292f7e743ddf9e2e88a07d27b0
author: sijchen <[email protected]>
date: Mon Apr 20 07:18:28 EDT 2015

Merge pull request #1902 from mstorsjo/makefile-cleanup

Simplify the makefile rules for unit test libraries for mobile platforms

--- a/Makefile
+++ b/Makefile
@@ -159,13 +159,19 @@
 
 ifeq ($(HAVE_GTEST),Yes)
 
-test: codec_unittest$(EXEEXT)
 ifneq (android,$(OS))
 ifneq (ios,$(OS))
-	./codec_unittest
+ifneq (msvc-wp,$(OS))
+BUILD_UT_EXE=Yes
 endif
 endif
+endif
 
+test: codec_unittest$(EXEEXT)
+ifeq ($(BUILD_UT_EXE), Yes)
+	./codec_unittest
+endif
+
 else
 test:
 	@echo "./gtest : No such file or directory."
@@ -191,15 +197,12 @@
 endif
 endif
 
+libraries: $(LIBPREFIX)$(PROJECT_NAME).$(LIBSUFFIX)
+
+# No point in building dylib for ios
 ifneq (ios, $(OS))
-ifeq (msvc-wp, $(OS))
-libraries: $(LIBPREFIX)$(PROJECT_NAME).$(LIBSUFFIX) $(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIX) $(LIBPREFIX)ut.$(SHAREDLIBSUFFIX)
-else
-libraries: $(LIBPREFIX)$(PROJECT_NAME).$(LIBSUFFIX) $(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIX)
+libraries: $(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIX)
 endif
-else
-libraries: $(LIBPREFIX)$(PROJECT_NAME).$(LIBSUFFIX)
-endif
 
 LIBRARIES += $(LIBPREFIX)$(PROJECT_NAME).$(LIBSUFFIX) $(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIXVER)
 
@@ -267,7 +270,10 @@
 install: install-static-lib install-shared
 	@:
 
-ifeq ($(HAVE_GTEST),Yes)
+ifneq ($(HAVE_GTEST),Yes)
+binaries:
+	@:
+else
 include $(SRC_PATH)build/gtest-targets.mk
 include $(SRC_PATH)test/api/targets.mk
 include $(SRC_PATH)test/decoder/targets.mk
@@ -282,7 +288,7 @@
 
 
 LIBRARIES +=$(LIBPREFIX)ut.$(SHAREDLIBSUFFIX)
-$(LIBPREFIX)ut.$(SHAREDLIBSUFFIX): $(DECODER_UNITTEST_OBJS) $(ENCODER_UNITTEST_OBJS) $(PROCESSING_UNITTEST_OBJS) $(API_TEST_OBJS) $(COMMON_UNITTEST_OBJS)  $(CODEC_UNITTEST_DEPS)
+$(LIBPREFIX)ut.$(SHAREDLIBSUFFIX): $(DECODER_UNITTEST_OBJS) $(ENCODER_UNITTEST_OBJS) $(PROCESSING_UNITTEST_OBJS) $(API_TEST_OBJS) $(COMMON_UNITTEST_OBJS) $(CODEC_UNITTEST_DEPS)
 	$(QUIET)rm -f $@
 	$(QUIET_CXX)$(CXX) $(SHARED) $(CXX_LINK_O) $+ $(LDFLAGS) $(UTSHLDFLAGS) $(CODEC_UNITTEST_LDFLAGS)
 
@@ -289,42 +295,35 @@
 binaries: codec_unittest$(EXEEXT)
 BINARIES += codec_unittest$(EXEEXT)
 
+ifeq ($(BUILD_UT_EXE), Yes)
+# Build a normal command line executable
+codec_unittest$(EXEEXT): $(DECODER_UNITTEST_OBJS) $(ENCODER_UNITTEST_OBJS) $(PROCESSING_UNITTEST_OBJS) $(API_TEST_OBJS) $(COMMON_UNITTEST_OBJS) $(CODEC_UNITTEST_DEPS) | res
+	$(QUIET)rm -f $@
+	$(QUIET_CXX)$(CXX) $(CXX_LINK_O) $+ $(CODEC_UNITTEST_LDFLAGS) $(LDFLAGS)
+
+res:
+	$(QUIET)if [ ! -e res ]; then ln -s $(SRC_PATH)res .; fi
+else
+
+# Build the unit test suite into a library that is included in a project file
 ifeq (ios,$(OS))
 codec_unittest$(EXEEXT): $(LIBPREFIX)ut.$(LIBSUFFIX) $(LIBPREFIX)gtest.$(LIBSUFFIX) $(LIBPREFIX)$(PROJECT_NAME).$(LIBSUFFIX)
-
 else
+codec_unittest$(EXEEXT): $(LIBPREFIX)ut.$(SHAREDLIBSUFFIX)
+endif
+
 ifeq (android,$(OS))
 ifeq (./,$(SRC_PATH))
-codec_unittest$(EXEEXT): $(LIBPREFIX)ut.$(SHAREDLIBSUFFIX)
+codec_unittest$(EXEEXT):
 	cd ./test/build/android && $(NDKROOT)/ndk-build -B APP_ABI=$(APP_ABI) && android update project -t $(TARGET) -p . && ant debug
 
 clean_Android: clean_Android_ut
 clean_Android_ut:
 	-cd ./test/build/android && $(NDKROOT)/ndk-build APP_ABI=$(APP_ABI) clean && ant clean
-
-else
-codec_unittest$(EXEEXT):
-	@:
 endif
-else
-ifneq (msvc-wp,$(OS))
-codec_unittest$(EXEEXT): $(DECODER_UNITTEST_OBJS) $(ENCODER_UNITTEST_OBJS) $(PROCESSING_UNITTEST_OBJS) $(API_TEST_OBJS) $(COMMON_UNITTEST_OBJS) $(CODEC_UNITTEST_DEPS) | res
-	$(QUIET)rm -f $@
-	$(QUIET_CXX)$(CXX) $(CXX_LINK_O) $+ $(CODEC_UNITTEST_LDFLAGS) $(LDFLAGS)
-
-res:
-	$(QUIET)if [ ! -e res ]; then ln -s $(SRC_PATH)res .; fi
-else
-codec_unittest$(EXEEXT):
-	@:
 endif
 
 endif
-endif
-
-else
-binaries:
-	@:
 endif
 
 -include $(OBJS:.$(OBJ)=.d)