From 79c1b021a7e146815a58d88d9dc2ec973a1c2715 Mon Sep 17 00:00:00 2001 From: Igor Canadi Date: Mon, 20 Apr 2015 19:39:51 -0700 Subject: [PATCH] Fix Makefile Summary: The current version tries to install librocksdb.so even though it doesn't exist. This version will install librocksdb.so.3.10.0 and then create soft links in place Test Plan: `make static_lib; sudo make install` does not try to install librocksdb.so `make shared_lib; sudo make install` installs one library and 3 symlinks. Before, four libraries were installed Reviewers: sdong, meyering Reviewed By: meyering Subscribers: dhruba, leveldb Differential Revision: https://reviews.facebook.net/D37425 --- Makefile | 73 +++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 51 insertions(+), 22 deletions(-) diff --git a/Makefile b/Makefile index 63fc9d56f..4af714e58 100644 --- a/Makefile +++ b/Makefile @@ -34,10 +34,22 @@ ifeq ($(MAKECMDGOALS),shared_lib) OPT += -DNDEBUG endif +ifeq ($(MAKECMDGOALS),install-shared) +OPT += -DNDEBUG +endif + ifeq ($(MAKECMDGOALS),static_lib) OPT += -DNDEBUG endif +ifeq ($(MAKECMDGOALS),install-static) +OPT += -DNDEBUG +endif + +ifeq ($(MAKECMDGOALS),install) +OPT += -DNDEBUG +endif + #----------------------------------------------- include src.mk @@ -124,27 +136,6 @@ PLATFORM_CXXFLAGS += -isystem $(GTEST_DIR) # This (the first rule) must depend on "all". default: all -#------------------------------------------------- -# make install related stuff -INSTALL_PATH ?= /usr/local - -uninstall: - rm -rf $(INSTALL_PATH)/include/rocksdb \ - $(INSTALL_PATH)/lib/$(LIBRARY) \ - $(INSTALL_PATH)/lib/$(SHARED) - -install: - install -d $(INSTALL_PATH)/lib - for header_dir in `find "include/rocksdb" -type d`; do \ - install -d $(INSTALL_PATH)/$$header_dir; \ - done - 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 755 $(LIBRARY) $(INSTALL_PATH)/lib - [ -n '$(SHARED)' ] && install -C -m 755 $(SHARED) $(INSTALL_PATH)/lib -#------------------------------------------------- - WARNING_FLAGS = -W -Wextra -Wall -Wsign-compare -Wshadow \ -Wno-unused-parameter @@ -325,7 +316,8 @@ endif # PLATFORM_SHARED_EXT .PHONY: blackbox_crash_test check clean coverage crash_test ldb_tests package \ release tags valgrind_check whitebox_crash_test format static_lib shared_lib all \ - dbg rocksdbjavastatic rocksdbjava install uninstall analyze + dbg rocksdbjavastatic rocksdbjava install install-static install-shared uninstall \ + analyze all: $(LIBRARY) $(BENCHMARKS) $(TOOLS) $(TESTS) @@ -812,6 +804,43 @@ sst_dump: tools/sst_dump.o $(LIBOBJECTS) ldb: tools/ldb.o $(LIBOBJECTS) $(AM_LINK) +#------------------------------------------------- +# make install related stuff +INSTALL_PATH ?= /usr/local + +uninstall: + rm -rf $(INSTALL_PATH)/include/rocksdb \ + $(INSTALL_PATH)/lib/$(LIBRARY) \ + $(INSTALL_PATH)/lib/$(SHARED4) \ + $(INSTALL_PATH)/lib/$(SHARED3) \ + $(INSTALL_PATH)/lib/$(SHARED2) \ + $(INSTALL_PATH)/lib/$(SHARED1) + +install-headers: + install -d $(INSTALL_PATH)/lib + for header_dir in `find "include/rocksdb" -type d`; do \ + install -d $(INSTALL_PATH)/$$header_dir; \ + done + for header in `find "include/rocksdb" -type f -name *.h`; do \ + install -C -m 644 $$header $(INSTALL_PATH)/$$header; \ + done + +install-static: install-headers $(LIBRARY) + install -C -m 755 $(LIBRARY) $(INSTALL_PATH)/lib + +install-shared: install-headers $(SHARED4) + install -C -m 755 $(SHARED4) $(INSTALL_PATH)/lib && \ + ln -fs $(SHARED4) $(INSTALL_PATH)/lib/$(SHARED3) && \ + ln -fs $(SHARED4) $(INSTALL_PATH)/lib/$(SHARED2) && \ + ln -fs $(SHARED4) $(INSTALL_PATH)/lib/$(SHARED1) + +# install static by default + install shared if it exists +install: install-static + [ -e $(SHARED4) ] && $(MAKE) install-shared + +#------------------------------------------------- + + # --------------------------------------------------------------------------- # Jni stuff # ---------------------------------------------------------------------------