Fix automatic header file dependency for MatCaffe
authorRonghang Hu <huronghang@hotmail.com>
Thu, 28 May 2015 16:23:06 +0000 (00:23 +0800)
committerRonghang Hu <huronghang@hotmail.com>
Fri, 29 May 2015 05:21:26 +0000 (13:21 +0800)
Automatic header file dependency was introduced in #1472, but
not correctly applied to matcaffe. Fix it by moving ./caffe_.d
to build/matlab/+caffe/private/caffe_.d and add it to DEPS

Makefile

index 3748b52..e4e66df 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -118,7 +118,7 @@ GTEST_OBJ := $(addprefix $(BUILD_DIR)/, ${GTEST_SRC:.cpp=.o})
 EXAMPLE_OBJS := $(addprefix $(BUILD_DIR)/, ${EXAMPLE_SRCS:.cpp=.o})
 # Output files for automatic dependency generation
 DEPS := ${CXX_OBJS:.o=.d} ${CU_OBJS:.o=.d} ${TEST_CXX_OBJS:.o=.d} \
-       ${TEST_CU_OBJS:.o=.d}
+       ${TEST_CU_OBJS:.o=.d} $(BUILD_DIR)/${MAT$(PROJECT)_SO:.$(MAT_SO_EXT)=.d}
 # tool, example, and test bins
 TOOL_BINS := ${TOOL_OBJS:.o=.bin}
 EXAMPLE_BINS := ${EXAMPLE_OBJS:.o=.bin}
@@ -460,6 +460,9 @@ $(MAT$(PROJECT)_SO): $(MAT$(PROJECT)_SRC) $(STATIC_NAME)
                        CXX="$(CXX)" \
                        CXXFLAGS="\$$CXXFLAGS $(MATLAB_CXXFLAGS)" \
                        CXXLIBS="\$$CXXLIBS $(STATIC_LINK_COMMAND) $(LDFLAGS)" -output $@
+       @ if [ -f "$(PROJECT)_.d" ]; then \
+               mv -f $(PROJECT)_.d $(BUILD_DIR)/${MAT$(PROJECT)_SO:.$(MAT_SO_EXT)=.d}; \
+       fi
 
 runtest: $(TEST_ALL_BIN)
        $(TOOL_BUILD_DIR)/caffe