diff --git a/Makefile b/Makefile index a438230cb..f37bcf5cc 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,6 @@ # found in the LICENSE file. See the AUTHORS file for names of contributors. # Inherit some settings from environment variables, if available -INSTALL_PATH ?= $(CURDIR) #----------------------------------------------- @@ -49,6 +48,33 @@ else PLATFORM_CCFLAGS += $(JEMALLOC_INCLUDE) -DHAVE_JEMALLOC endif +#------------------------------------------------- +# make install related stuff +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 + +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; \ + 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; +#------------------------------------------------- + WARNING_FLAGS = -Wall -Werror -Wsign-compare CFLAGS += $(WARNING_FLAGS) -I. -I./include $(PLATFORM_CCFLAGS) $(OPT) CXXFLAGS += $(WARNING_FLAGS) -I. -I./include $(PLATFORM_CXXFLAGS) $(OPT) -Woverloaded-virtual @@ -178,7 +204,7 @@ endif # PLATFORM_SHARED_EXT .PHONY: blackbox_crash_test check clean coverage crash_test ldb_tests \ release tags valgrind_check whitebox_crash_test format static_lib shared_lib all \ - dbg + dbg install uninstall all: $(LIBRARY) $(PROGRAMS) $(TESTS)