build: running "make" with no arguments must not "uninstall"

Summary:
Before this change, running "make" with no arguments would
silently run the rules for the "uninstall" target(!).  Don't do that.
* Makefile (default): New, first target; depend on "all".
(uninstall, install): Do not hide the commands we run.

Test Plan:
  Run "make" and verify that the rules for "uninstall" are no longer run.
  Instead, note that many files are compiled and linked.  Before, none were.

Reviewers: sdong, ljin, igor

Reviewed By: igor

Subscribers: dhruba

Differential Revision: https://reviews.facebook.net/D33531
This commit is contained in:
Jim Meyering 2015-02-17 11:17:44 -08:00
parent e60bc99fe0
commit daebb1f916

View File

@ -71,25 +71,28 @@ ifndef DISABLE_JEMALLOC
PLATFORM_CCFLAGS += $(JEMALLOC_INCLUDE) -DHAVE_JEMALLOC PLATFORM_CCFLAGS += $(JEMALLOC_INCLUDE) -DHAVE_JEMALLOC
endif endif
# This (the first rule) must depend on "all".
default: all
#------------------------------------------------- #-------------------------------------------------
# make install related stuff # make install related stuff
INSTALL_PATH ?= /usr/local INSTALL_PATH ?= /usr/local
uninstall: uninstall:
@rm -rf $(INSTALL_PATH)/include/rocksdb rm -rf $(INSTALL_PATH)/include/rocksdb \
@rm -rf $(INSTALL_PATH)/lib/$(LIBRARY) $(INSTALL_PATH)/lib/$(LIBRARY) \
@rm -rf $(INSTALL_PATH)/lib/$(SHARED) $(INSTALL_PATH)/lib/$(SHARED)
install: install:
@install -d $(INSTALL_PATH)/lib install -d $(INSTALL_PATH)/lib
@for header_dir in `find "include/rocksdb" -type d`; do \ for header_dir in `find "include/rocksdb" -type d`; do \
install -d $(INSTALL_PATH)/$$header_dir; \ install -d $(INSTALL_PATH)/$$header_dir; \
done done
@for header in `find "include/rocksdb" -type f -name *.h`; do \ for header in `find "include/rocksdb" -type f -name *.h`; do \
install -C -m 644 $$header $(INSTALL_PATH)/$$header; \ install -C -m 644 $$header $(INSTALL_PATH)/$$header; \
done done
@[ ! -e $(LIBRARY) ] || install -C -m 644 $(LIBRARY) $(INSTALL_PATH)/lib [ ! -e $(LIBRARY) ] || install -C -m 644 $(LIBRARY) $(INSTALL_PATH)/lib
@[ ! -e $(SHARED) ] || install -C -m 644 $(SHARED) $(INSTALL_PATH)/lib [ ! -e $(SHARED) ] || install -C -m 644 $(SHARED) $(INSTALL_PATH)/lib
#------------------------------------------------- #-------------------------------------------------
WARNING_FLAGS = -Wall -Werror -Wsign-compare -Wshadow WARNING_FLAGS = -Wall -Werror -Wsign-compare -Wshadow