summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorJeff Donahue <jeff.donahue@gmail.com>2014-03-29 17:47:58 -0700
committerJeff Donahue <jeff.donahue@gmail.com>2014-04-02 10:58:49 -0700
commit3abb10e9107226e2e9353913abef691b37e84377 (patch)
treeff450ff3a3c438a547b2c4a630531216b7c64a2b /Makefile
parent654d8114ed5f7526e2c1755e54cbff224341170c (diff)
downloadcaffe-3abb10e9107226e2e9353913abef691b37e84377.tar.gz
caffe-3abb10e9107226e2e9353913abef691b37e84377.tar.bz2
caffe-3abb10e9107226e2e9353913abef691b37e84377.zip
create superclean Makefile target to delete all files with generated
extensions
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile37
1 files changed, 36 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index a432c871..ac91df72 100644
--- a/Makefile
+++ b/Makefile
@@ -124,7 +124,8 @@ PYTHON_LDFLAGS := $(LDFLAGS) $(foreach library,$(PYTHON_LIBRARIES),-l$(library))
# Define build targets
##############################
.PHONY: all init test clean linecount lint tools examples py mat distribute \
- py$(PROJECT) mat$(PROJECT) proto runtest
+ py$(PROJECT) mat$(PROJECT) proto runtest \
+ superclean supercleanlist supercleanfiles
all: init $(NAME) $(STATIC_NAME) tools examples
@echo $(CXX_OBJS)
@@ -260,6 +261,40 @@ clean:
@- $(RM) -rf $(BUILD_DIR)
@- $(RM) -rf $(DISTRIBUTE_DIR)
+# make superclean recursively* deletes all files ending with an extension
+# suggesting that Caffe built them. This may be useful if you've built older
+# versions of Caffe that do not place all generated files in a location known
+# to make clean.
+#
+# make 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
+
+supercleanfiles:
+ $(eval SUPERCLEAN_FILES := \
+ $(strip $(foreach ext,$(SUPERCLEAN_EXTS), \
+ $(shell find . -name '*$(ext)'))))
+
+supercleanlist: supercleanfiles
+ @ \
+ if [ -z "$(SUPERCLEAN_FILES)" ]; then \
+ echo "No generated files found."; \
+ else \
+ echo $(SUPERCLEAN_FILES); \
+ fi
+
+superclean: clean supercleanfiles
+ @ \
+ if [ -z "$(SUPERCLEAN_FILES)" ]; then \
+ echo "No generated files found."; \
+ else \
+ echo "Deleting the following generated files:"; \
+ echo $(SUPERCLEAN_FILES); \
+ $(RM) $(SUPERCLEAN_FILES); \
+ fi
+
distribute: all
mkdir $(DISTRIBUTE_DIR)
# add include