|
PROJECT := caffe |
|
|
|
CONFIG_FILE := Makefile.config |
|
# Explicitly check for the config file, otherwise make -k will proceed anyway. |
|
ifeq ($(wildcard $(CONFIG_FILE)),) |
|
$(error $(CONFIG_FILE) not found. See $(CONFIG_FILE).example.) |
|
endif |
|
include $(CONFIG_FILE) |
|
|
|
BUILD_DIR_LINK := $(BUILD_DIR) |
|
ifeq ($(RELEASE_BUILD_DIR),) |
|
RELEASE_BUILD_DIR := .$(BUILD_DIR)_release |
|
endif |
|
ifeq ($(DEBUG_BUILD_DIR),) |
|
DEBUG_BUILD_DIR := .$(BUILD_DIR)_debug |
|
endif |
|
|
|
DEBUG ?= 0 |
|
ifeq ($(DEBUG), 1) |
|
BUILD_DIR := $(DEBUG_BUILD_DIR) |
|
OTHER_BUILD_DIR := $(RELEASE_BUILD_DIR) |
|
else |
|
BUILD_DIR := $(RELEASE_BUILD_DIR) |
|
OTHER_BUILD_DIR := $(DEBUG_BUILD_DIR) |
|
endif |
|
|
|
# All of the directories containing code. |
|
SRC_DIRS := $(shell find * -type d -exec bash -c "find {} -maxdepth 1 \ |
|
\( -name '*.cpp' -o -name '*.proto' \) | grep -q ." \; -print) |
|
|
|
# The target shared library name |
|
LIBRARY_NAME := $(PROJECT) |
|
LIB_BUILD_DIR := $(BUILD_DIR)/lib |
|
STATIC_NAME := $(LIB_BUILD_DIR)/lib$(LIBRARY_NAME).a |
|
DYNAMIC_VERSION_MAJOR := 1 |
|
DYNAMIC_VERSION_MINOR := 0 |
|
DYNAMIC_VERSION_REVISION := 0 |
|
DYNAMIC_NAME_SHORT := lib$(LIBRARY_NAME).so |
|
#DYNAMIC_SONAME_SHORT := $(DYNAMIC_NAME_SHORT).$(DYNAMIC_VERSION_MAJOR) |
|
DYNAMIC_VERSIONED_NAME_SHORT := $(DYNAMIC_NAME_SHORT).$(DYNAMIC_VERSION_MAJOR).$(DYNAMIC_VERSION_MINOR).$(DYNAMIC_VERSION_REVISION) |
|
DYNAMIC_NAME := $(LIB_BUILD_DIR)/$(DYNAMIC_VERSIONED_NAME_SHORT) |
|
COMMON_FLAGS += -DCAFFE_VERSION=$(DYNAMIC_VERSION_MAJOR).$(DYNAMIC_VERSION_MINOR).$(DYNAMIC_VERSION_REVISION) |
|
# OpenPose: added C++11 flag to avoid crashing in some old GCC compilers |
|
COMMON_FLAGS += -std=c++11 |
|
# OpenPose: end modified |
|
|
|
############################## |
|
# Get all source files |
|
############################## |
|
# CXX_SRCS are the source files excluding the test ones. |
|
CXX_SRCS := $(shell find src/$(PROJECT) ! -name "test_*.cpp" -name "*.cpp") |
|
# CU_SRCS are the cuda source files |
|
CU_SRCS := $(shell find src/$(PROJECT) ! -name "test_*.cu" -name "*.cu") |
|
# TEST_SRCS are the test source files |
|
TEST_MAIN_SRC := src/$(PROJECT)/test/test_caffe_main.cpp |
|
TEST_SRCS := $(shell find src/$(PROJECT) -name "test_*.cpp") |
|
TEST_SRCS := $(filter-out $(TEST_MAIN_SRC), $(TEST_SRCS)) |
|
TEST_CU_SRCS := $(shell find src/$(PROJECT) -name "test_*.cu") |
|
GTEST_SRC := src/gtest/gtest-all.cpp |
|
# TOOL_SRCS are the source files for the tool binaries |
|
TOOL_SRCS := $(shell find tools -name "*.cpp") |
|
# EXAMPLE_SRCS are the source files for the example binaries |
|
EXAMPLE_SRCS := $(shell find examples -name "*.cpp") |
|
# BUILD_INCLUDE_DIR contains any generated header files we want to include. |
|
BUILD_INCLUDE_DIR := $(BUILD_DIR)/src |
|
# PROTO_SRCS are the protocol buffer definitions |
|
PROTO_SRC_DIR := src/$(PROJECT)/proto |
|
PROTO_SRCS := $(wildcard $(PROTO_SRC_DIR) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
\1/') |
|
XCODE_CLT_GEQ_7 := $(shell [ $(XCODE_CLT_VER) -gt 6 ] && echo 1) |
|
XCODE_CLT_GEQ_6 := $(shell [ $(XCODE_CLT_VER) -gt 5 ] && echo 1) |
|
ifeq ($(XCODE_CLT_GEQ_7), 1) |
|
BLAS_INCLUDE ?= /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/$(shell ls /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/ | sort | tail -1)/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/Headers |
|
else ifeq ($(XCODE_CLT_GEQ_6), 1) |
|
BLAS_INCLUDE ?= /System/Library/Frameworks/Accelerate.framework/Versions/Current/Frameworks/vecLib.framework/Headers/ |
|
LDFLAGS += -framework Accelerate |
|
else |
|
BLAS_INCLUDE ?= /System/Library/Frameworks/vecLib.framework/Versions/Current/Headers/ |
|
LDFLAGS += -framework vecLib |
|
endif |
|
endif |
|
endif |
|
INCLUDE_DIRS += $(BLAS_INCLUDE) |
|
LIBRARY_DIRS += $(BLAS_LIB) |
|
|
|
LIBRARY_DIRS += $(LIB_BUILD_DIR) |
|
|
|
# Automatic dependency generation (nvcc is handled separately) |
|
CXXFLAGS += -MMD -MP |
|
|
|
# Complete build flags. |
|
COMMON_FLAGS += $(foreach includedir,$(INCLUDE_DIRS),-I$(includedir)) |
|
CXXFLAGS += -pthread -fPIC $(COMMON_FLAGS) $(WARNINGS) |
|
NVCCFLAGS += -ccbin=$(CXX) -Xcompiler -fPIC $(COMMON_FLAGS) |
|
# mex may invoke an older gcc that is too liberal with -Wuninitalized |
|
MATLAB_CXXFLAGS := $(CXXFLAGS) -Wno-uninitialized |
|
LINKFLAGS += -pthread -fPIC $(COMMON_FLAGS) $(WARNINGS) |
|
|
|
USE_PKG_CONFIG ?= 0 |
|
ifeq ($(USE_PKG_CONFIG), 1) |
|
PKG_CONFIG := $(shell pkg-config opencv --libs) |
|
else |
|
PKG_CONFIG := |
|
endif |
|
LDFLAGS += $(foreach librarydir,$(LIBRARY_DIRS),-L$(librarydir)) $(PKG_CONFIG) \ |
|
$(foreach library,$(LIBRARIES),-l$(library)) |
|
PYTHON_LDFLAGS := $(LDFLAGS) $(foreach library,$(PYTHON_LIBRARIES),-l$(library)) |
|
|
|
# 'superclean' target recursively* deletes all files ending with an extension |
|
# in $(SUPERCLEAN_EXTS) below. This may be useful if you've built older |
|
# versions of Caffe that do not place all generated files in a location known |
|
# to the 'clean' target. |
|
# |
|
# 'supercleanlist' will list the files to be deleted by make superclean. |
|
# |
|
# * Recursive with the exception that symbolic links are never followed, per the |
|
# default behavior of 'find'. |
|
SUPERCLEAN_EXTS := .so .a .o .bin .testbin .pb.cc .pb.h _pb2.py .cuo |
|
|
|
# Set the sub-targets of the 'everything' target. |
|
EVERYTHING_TARGETS := all py$(PROJECT) test warn lint |
|
# Only build matcaffe as part of "everything" if MATLAB_DIR is specified. |
|
ifneq ($(MATLAB_DIR),) |
|
EVERYTHING_TARGETS += mat$(PROJECT) |
|
endif |
|
|
|
############################## |
|
# Define build targets |
|
############################## |
|
.PHONY: all lib test clean docs linecount lint lintclean tools examples $(DIST_ALIASES) \ |
|
py mat py$(PROJECT) mat$(PROJECT) proto runtest \ |
|
superclean supercleanlist supercleanfiles warn everything |
|
|
|
all: lib tools examples |
|
|
|
lib: $(STATIC_NAME) $(DYNAMIC_NAME) |
|
|
|
everything: $(EVERYTHING_TARGETS) |
|
|
|
linecount: |
|
cloc --read-lang-def=$(PROJECT).cloc \ |
|
src/$(PROJECT) include/$(PROJECT) tools examples \ |
|
python matlab |
|
|
|
lint: $(EMPTY_LINT_REPORT) |
|
|
|
lintclean: |
|
@ $(RM) -r $(LINT_OUTPUT_DIR) $(EMPTY_LINT_REPORT) $(NONEMPTY_LINT_REPORT) |
|
|
|
docs: $(DOXYGEN_OUTPUT_DIR) |
|
@ cd ./docs ; ln -sfn ../$(DOXYGEN_OUTPUT_DIR)/html doxygen |
|
|
|
$(DOXYGEN_OUTPUT_DIR): $(DOXYGEN_CONFIG_FILE) $(DOXYGEN_SOURCES) |
|
$(DOXYGEN_COMMAND) $(DOXYGEN_CONFIG_FILE) |
|
|
|
$(EMPTY_LINT_REPORT): $(LINT_OUTPUTS) | $(BUILD_DIR) |
|
@ cat $(LINT_OUTPUTS) > $@ |
|
@ if [ -s "$@" ]; then \ |
|
cat $@; \ |
|
mv $@ $(NONEMPTY_LINT_REPORT); \ |
|
echo "Found one or more lint errors."; \ |
|
exit 1; \ |
|
fi; \ |
|
$(RM) $(NONEMPTY_LINT_REPORT); \ |
|
echo "No lint errors!"; |
|
|
|
$(LINT_OUTPUTS): $(LINT_OUTPUT_DIR)/%.lint.txt : % $(LINT_SCRIPT) | $(LINT_OUTPUT_DIR) |
|
@ mkdir -p $(dir $@) |
|
@ python $(LINT_SCRIPT) $< 2>&1 \ |
|
| grep -v "^Done processing " \ |
|
| grep -v "^Total errors found: 0" \ |
|
> $@ \ |
|
|| true |
|
|
|
test: $(TEST_ALL_BIN) $(TEST_ALL_DYNLINK_BIN) $(TEST_BINS) |
|
|
|
tools: $(TOOL_BINS) $(TOOL_BIN_LINKS) |
|
|
|
examples: $(EXAMPLE_BINS) |
|
|
|
py$(PROJECT): py |
|
|
|
py: $(PY$(PROJECT)_SO) $(PROTO_GEN_PY) |
|
|
|
$(PY$(PROJECT)_SO): $(PY$(PROJECT)_SRC) $(PY$(PROJECT)_HXX) | $(DYNAMIC_NAME) |
|
@ echo CXX/LD -o $@ $< |
|
$(Q)$(CXX) -shared -o $@ $(PY$(PROJECT)_SRC) \ |
|
-o $@ $(LINKFLAGS) -l$(LIBRARY_NAME) $(PYTHON_LDFLAGS) \ |
|
-Wl,-rpath,$(ORIGIN)/../../build/lib |
|
|
|
mat$(PROJECT): mat |
|
|
|
mat: $(MAT$(PROJECT)_SO) |
|
|
|
$(MAT$(PROJECT)_SO): $(MAT$(PROJECT)_SRC) $(STATIC_NAME) |
|
@ if [ -z "$(MATLAB_DIR)" ]; then \ |
|
echo "MATLAB_DIR must be specified in $(CONFIG_FILE)" \ |
|
"to build mat$(PROJECT)."; \ |
|
exit 1; \ |
|
fi |
|
@ echo MEX $< |
|
$(Q)$(MATLAB_DIR)/bin/mex $(MAT$(PROJECT)_SRC) \ |
|
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 |
|
$(TEST_ALL_BIN) $(TEST_GPUID) --gtest_shuffle $(TEST_FILTER) |
|
|
|
pytest: py |
|
cd python; python -m unittest discover -s caffe/test |
|
|
|
mattest: mat |
|
cd matlab; $(MATLAB_DIR)/bin/matlab -nodisplay -r 'caffe.run_tests(), exit()' |
|
|
|
warn: $(EMPTY_WARN_REPORT) |
|
|
|
$(EMPTY_WARN_REPORT): $(ALL_WARNS) | $(BUILD_DIR) |
|
@ cat $(ALL_WARNS) > $@ |
|
@ if [ -s "$@" ]; then \ |
|
cat $@; \ |
|
mv $@ $(NONEMPTY_WARN_REPORT); \ |
|
echo "Compiler produced one or more warnings."; \ |
|
exit 1; \ |
|
fi; \ |
|
$(RM) $(NONEMPTY_WARN_REPORT); \ |
|
echo "No compiler warnings!"; |
|
|
|
$(ALL_WARNS): %.o.$(WARNS_EXT) : %.o |
|
|
|
$(BUILD_DIR_LINK): $(BUILD_DIR)/.linked |
|
|
|
# Create a target ".linked" in this BUILD_DIR to tell Make that the "build" link |
|
# is currently correct, then delete the one in the OTHER_BUILD_DIR in case it |
|
# exists and $(DEBUG) is toggled later. |
|
$(BUILD_DIR)/.linked: |
|
@ mkdir -p $(BUILD_DIR) |
|
@ $(RM) $(OTHER_BUILD_DIR)/.linked |
|
@ $(RM) -r $(BUILD_DIR_LINK) |
|
@ ln -s $(BUILD_DIR) $(BUILD_DIR_LINK) |
|
@ touch $@ |
|
|
|
$(ALL_BUILD_DIRS): | $(BUILD_DIR_LINK) |
|
@ mkdir -p $@ |
|
|
|
$(DYNAMIC_NAME): $(OBJS) | $(LIB_BUILD_DIR) |
|
@ echo LD -o $@ |
|
$(Q)$(CXX) -shared -o $@ $(OBJS) $(VERSIONFLAGS) $(LINKFLAGS) $(LDFLAGS) |
|
@ cd $(BUILD_DIR)/lib; rm -f $(DYNAMIC_NAME_SHORT); ln -s $(DYNAMIC_VERSIONED_NAME_SHORT) $(DYNAMIC_NAME_SHORT) |
|
|
|
$(STATIC_NAME): $(OBJS) | $(LIB_BUILD_DIR) |
|
@ echo AR -o $@ |
|
$(Q)ar rcs $@ $(OBJS) |
|
|
|
$(BUILD_DIR)/%.o: %.cpp $(PROTO_GEN_HEADER) | $(ALL_BUILD_DIRS) |
|
@ echo CXX $< |
|
$(Q)$(CXX) $< $(CXXFLAGS) -c -o $@ 2> $@.$(WARNS_EXT) \ |
|
|| (cat $@.$(WARNS_EXT); exit 1) |
|
@ cat $@.$(WARNS_EXT) |
|
|
|
$(PROTO_BUILD_DIR)/%.pb.o: $(PROTO_BUILD_DIR)/%.pb.cc $(PROTO_GEN_HEADER) \ |
|
| $(PROTO_BUILD_DIR) |
|
@ echo CXX $< |
|
$(Q)$(CXX) $< $(CXXFLAGS) -c -o $@ 2> $@.$(WARNS_EXT) \ |
|
|| (cat $@.$(WARNS_EXT); exit 1) |
|
@ cat $@.$(WARNS_EXT) |
|
|
|
$(BUILD_DIR)/cuda/%.o: %.cu | $(ALL_BUILD_DIRS) |
|
@ echo NVCC $< |
|
$(Q)$(CUDA_DIR)/bin/nvcc $(NVCCFLAGS) $(CUDA_ARCH) -M $< -o ${@:.o=.d} \ |
|
-odir $(@D) |
|
$(Q)$(CUDA_DIR)/bin/nvcc $(NVCCFLAGS) $(CUDA_ARCH) -c $< -o $@ 2> $@.$(WARNS_EXT) \ |
|
|| (cat $@.$(WARNS_EXT); exit 1) |
|
@ cat $@.$(WARNS_EXT) |
|
|
|
$(TEST_ALL_BIN): $(TEST_MAIN_SRC) $(TEST_OBJS) $(GTEST_OBJ) \ |
|
| $(DYNAMIC_NAME) $(TEST_BIN_DIR) |
|
@ echo CXX/LD -o $@ $< |
|
$(Q)$(CXX) $(TEST_MAIN_SRC) $(TEST_OBJS) $(GTEST_OBJ) \ |
|
-o $@ $(LINKFLAGS) $(LDFLAGS) -l$(LIBRARY_NAME) -Wl,-rpath,$(ORIGIN)/../lib |
|
|
|
$(TEST_CU_BINS): $(TEST_BIN_DIR)/%.testbin: $(TEST_CU_BUILD_DIR)/%.o \ |
|
$(GTEST_OBJ) | $(DYNAMIC_NAME) $(TEST_BIN_DIR) |
|
@ echo LD $< |
|
$(Q)$(CXX) $(TEST_MAIN_SRC) $< $(GTEST_OBJ) \ |
|
-o $@ $(LINKFLAGS) $(LDFLAGS) -l$(LIBRARY_NAME) -Wl,-rpath,$(ORIGIN)/../lib |
|
|
|
$(TEST_CXX_BINS): $(TEST_BIN_DIR)/%.testbin: $(TEST_CXX_BUILD_DIR)/%.o \ |
|
$(GTEST_OBJ) | $(DYNAMIC_NAME) $(TEST_BIN_DIR) |
|
@ echo LD $< |
|
$(Q)$(CXX) $(TEST_MAIN_SRC) $< $(GTEST_OBJ) \ |
|
-o $@ $(LINKFLAGS) $(LDFLAGS) -l$(LIBRARY_NAME) -Wl,-rpath,$(ORIGIN)/../lib |
|
|
|
# Target for extension-less symlinks to tool binaries with extension '*.bin'. |
|
$(TOOL_BUILD_DIR)/%: $(TOOL_BUILD_DIR)/%.bin | $(TOOL_BUILD_DIR) |
|
@ $(RM) $@ |
|
@ ln -s $(notdir $<) $@ |
|
|
|
$(TOOL_BINS): %.bin : %.o | $(DYNAMIC_NAME) |
|
@ echo CXX/LD -o $@ |
|
$(Q)$(CXX) $< -o $@ $(LINKFLAGS) -l$(LIBRARY_NAME) $(LDFLAGS) \ |
|
-Wl,-rpath,$(ORIGIN)/../lib |
|
|
|
$(EXAMPLE_BINS): %.bin : %.o | $(DYNAMIC_NAME) |
|
@ echo CXX/LD -o $@ |
|
$(Q)$(CXX) $< -o $@ $(LINKFLAGS) -l$(LIBRARY_NAME) $(LDFLAGS) \ |
|
-Wl,-rpath,$(ORIGIN)/../../lib |
|
|
|
proto: $(PROTO_GEN_CC) $(PROTO_GEN_HEADER) |
|
|
|
$(PROTO_BUILD_DIR)/%.pb.cc $(PROTO_BUILD_DIR)/%.pb.h : \ |
|
$(PROTO_SRC_DIR)/%.proto | $(PROTO_BUILD_DIR) |
|
@ echo PROTOC $< |
|
$(Q)protoc --proto_path=$(PROTO_SRC_DIR) --cpp_out=$(PROTO_BUILD_DIR) $< |
|
|
|
$(PY_PROTO_BUILD_DIR)/%_pb2.py : $(PROTO_SRC_DIR)/%.proto \ |
|
$(PY_PROTO_INIT) | $(PY_PROTO_BUILD_DIR) |
|
@ echo PROTOC \(python\) $< |
|
$(Q)protoc --proto_path=src --python_out=python $< |
|
|
|
$(PY_PROTO_INIT): | $(PY_PROTO_BUILD_DIR) |
|
touch $(PY_PROTO_INIT) |
|
|
|
clean: |
|
@- $(RM) -rf $(ALL_BUILD_DIRS) |
|
@- $(RM) -rf $(OTHER_BUILD_DIR) |
|
@- $(RM) -rf $(BUILD_DIR_LINK) |
|
@- $(RM) -rf $(DISTRIBUTE_DIR) |
|
@- $(RM) $(PY$(PROJECT)_SO) |
|
@- $(RM) $(MAT$(PROJECT)_SO) |
|
|
|
supercleanfiles: |
|
$(eval SUPERCLEAN_FILES := $(strip \ |
|
$(foreach ext,$(SUPERCLEAN_EXTS), $(shell find . -name '*$(ext)' \ |
|
-not -path './data/*')))) |
|
|
|
supercleanlist: supercleanfiles |
|
@ \ |
|
if [ -z "$(SUPERCLEAN_FILES)" ]; then \ |
|
echo "No generated files found."; \ |
|
else \ |
|
echo $(SUPERCLEAN_FILES) | tr ' ' '\n'; \ |
|
fi |
|
|
|
superclean: clean supercleanfiles |
|
@ \ |
|
if [ -z "$(SUPERCLEAN_FILES)" ]; then \ |
|
echo "No generated files found."; \ |
|
else \ |
|
echo "Deleting the following generated files:"; \ |
|
echo $(SUPERCLEAN_FILES) | tr ' ' '\n'; \ |
|
$(RM) $(SUPERCLEAN_FILES); \ |
|
fi |
|
|
|
$(DIST_ALIASES): $(DISTRIBUTE_DIR) |
|
|
|
$(DISTRIBUTE_DIR): all py | $(DISTRIBUTE_SUBDIRS) |
|
# add proto |
|
cp -r src/caffe/proto $(DISTRIBUTE_DIR)/ |
|
# add include |
|
cp -r include $(DISTRIBUTE_DIR)/ |
|
mkdir -p $(DISTRIBUTE_DIR)/include/caffe/proto |
|
cp $(PROTO_GEN_HEADER_SRCS) $(DISTRIBUTE_DIR)/include/caffe/proto |
|
# add tool and example binaries |
|
cp $(TOOL_BINS) $(DISTRIBUTE_DIR)/bin |
|
cp $(EXAMPLE_BINS) $(DISTRIBUTE_DIR)/bin |
|
# add libraries |
|
cp $(STATIC_NAME) $(DISTRIBUTE_DIR)/lib |
|
install -m 644 $(DYNAMIC_NAME) $(DISTRIBUTE_DIR)/lib |
|
cd $(DISTRIBUTE_DIR)/lib; rm -f $(DYNAMIC_NAME_SHORT); ln -s $(DYNAMIC_VERSIONED_NAME_SHORT) $(DYNAMIC_NAME_SHORT) |
|
# add python - it's not the standard way, indeed... |
|
cp -r python $(DISTRIBUTE_DIR)/ |
|
|
|
-include $(DEPS) |
|
|