From 49aacd8d2b84cf92658983cabe6fc62491c143ba Mon Sep 17 00:00:00 2001 From: Igor Canadi Date: Mon, 15 Sep 2014 15:30:17 -0700 Subject: [PATCH] Fix make install Summary: See https://github.com/facebook/rocksdb/issues/283 Test Plan: make install/uninstall Reviewers: ljin, sdong, yhchiang Reviewed By: yhchiang Subscribers: leveldb Differential Revision: https://reviews.facebook.net/D23373 --- Makefile | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index f37bcf5cc..260a51d1a 100644 --- a/Makefile +++ b/Makefile @@ -53,26 +53,20 @@ endif INSTALL_PATH ?= /usr/local uninstall: - rm -rf $(INSTALL_PATH)/include/rocksdb - if [ -a $(LIBRARY) ]; then \ - rm -rf $(INSTALL_PATH)/lib/$(LIBRARY); \ - fi - if [ -a $(SHARED) ]; then \ - rm -rf $(INSTALL_PATH)/lib/$(SHARED); \ - fi + @rm -rf $(INSTALL_PATH)/include/rocksdb + @rm -rf $(INSTALL_PATH)/lib/$(LIBRARY) + @rm -rf $(INSTALL_PATH)/lib/$(SHARED) install: - install -d $(INSTALL_PATH)/include/rocksdb - install -d $(INSTALL_PATH)/lib - for header in `find "include/rocksdb" -type f -name *.h`; do \ - install -C -m 644 -D $$header $(INSTALL_PATH)/$$header; \ + @install -d $(INSTALL_PATH)/lib + @for header_dir in `find "include/rocksdb" -type d`; do \ + install -d $(INSTALL_PATH)/$$header_dir; \ done - if [ -a $(LIBRARY) ]; then \ - install -C -m 644 $(LIBRARY) $(INSTALL_PATH)/lib/.; \ - fi; - if [ -a $(SHARED) ]; then \ - install -C -m 644 $(SHARED) $(INSTALL_PATH)/lib/.; \ - fi; + @for header in `find "include/rocksdb" -type f -name *.h`; do \ + install -C -m 644 $$header $(INSTALL_PATH)/$$header; \ + done + @[ ! -e $(LIBRARY) ] || install -C -m 644 $(LIBRARY) $(INSTALL_PATH)/lib + @[ ! -e $(SHARED) ] || install -C -m 644 $(SHARED) $(INSTALL_PATH)/lib #------------------------------------------------- WARNING_FLAGS = -Wall -Werror -Wsign-compare