create "install" target

Summary:public
This create `make install` and `make uninstall` targets that can be used to
install Infer on a system. All the files needed are installed under
"/usr/local/lib/infer" (by default, but can be configured with ./configure
flags as usual), pretty much like their git infer/ counterparts. Moreover,
"infer" and "inferTraceBugs" are installed in /usr/local/bin (similarly
configurable).

As a bonus, `opam install infer` and `opam remove infer` now work. To use
these, it's better to pin the git repo with "-k git":

  cd ~/infer/ # where the repo is
  opam pin add -k git --yes infer .

The reason is that otherwise, and only if the repo is not clean, opam will
convert symlinks into regular files, which is not good (compilation will fail).

Reviewed By: jberdine

Differential Revision: D3109337

fb-gh-sync-id: 96c9fd1
fbshipit-source-id: 96c9fd1
master
Jules Villard 9 years ago committed by Facebook Github Bot 9
parent 2a41d7b0ff
commit 27f4b99a7a

@ -68,13 +68,13 @@ CLANG_DEPS = $(addprefix $(PYTHON_LIB_DIR)/, \
JAVA_MODELS_JAR = $(LIB_DIR)/java/models.jar
ifneq (,$(findstring s,$(MAKEFLAGS)))
REMOVE = @rm -f
REMOVE_DIR = @rm -rf
REMOVE = rm -f
REMOVE_DIR = rm -rf
else
REMOVE = @rm -vf
REMOVE_DIR = @rm -rvf
REMOVE = rm -vf
REMOVE_DIR = rm -rvf
endif
COPY = cp -f -p
COPY_DIR = cp -rf
MKDIR = mkdir -p
LINK = ln -sf
COPY_DIR = cp -Rf
MKDIR_P = @MKDIR_P@
LN_S = @LN_S@

@ -9,6 +9,14 @@
ROOT_DIR = .
include $(ROOT_DIR)/Makefile.config
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
libdir = @libdir@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
TARGETS_TO_TEST=
ifeq (@BUILD_C_ANALYZERS@,yes)
TARGETS_TO_TEST += c cpp
@ -135,6 +143,100 @@ test: ocaml_unit_test buck_test inferTraceBugs_test
test_xml: buck_test_xml
uninstall:
$(REMOVE_DIR) $(DESTDIR)$(libdir)/infer/
$(REMOVE) $(DESTDIR)$(bindir)/inferTraceBugs
$(REMOVE) $(DESTDIR)$(bindir)/infer
install: $(INFER_ANALYZERS) inferTraceBugs
# create directory structure
test -d $(DESTDIR)$(bindir) || \
$(MKDIR_P) $(DESTDIR)$(bindir)
test -d $(DESTDIR)$(libdir)/infer/ || \
$(MKDIR_P) $(DESTDIR)$(libdir)/infer/
ifeq (@BUILD_C_ANALYZERS@,yes)
test -d $(DESTDIR)$(libdir)/infer/facebook-clang-plugins/libtooling/build/ || \
$(MKDIR_P) $(DESTDIR)$(libdir)/infer/facebook-clang-plugins/libtooling/build/
@for i in $$(find facebook-clang-plugins/clang/ -not -wholename 'src/*' -type d); do \
test -d $(DESTDIR)$(libdir)/infer/$$i || \
$(MKDIR_P) $(DESTDIR)$(libdir)/infer/$$i; \
done
test -d $(DESTDIR)$(libdir)/infer/infer/lib/clang_wrappers/ || \
$(MKDIR_P) $(DESTDIR)$(libdir)/infer/infer/lib/clang_wrappers/
endif
ifeq (@BUILD_JAVA_ANALYZERS@,yes)
test -d $(DESTDIR)$(libdir)/infer/infer/lib/java/ || \
$(MKDIR_P) $(DESTDIR)$(libdir)/infer/infer/lib/java/
endif
ifneq (@XCODE_SELECT@,no)
test -d $(DESTDIR)$(libdir)/infer/infer/lib/xcode_wrappers/ || \
$(MKDIR_P) $(DESTDIR)$(libdir)/infer/infer/lib/xcode_wrappers/
endif
test -d $(DESTDIR)$(libdir)/infer/infer/annotations/ || \
$(MKDIR_P) $(DESTDIR)$(libdir)/infer/infer/annotations/
test -d $(DESTDIR)$(libdir)/infer/infer/lib/wrappers/ || \
$(MKDIR_P) $(DESTDIR)$(libdir)/infer/infer/lib/wrappers/
test -d $(DESTDIR)$(libdir)/infer/infer/lib/specs/ || \
$(MKDIR_P) $(DESTDIR)$(libdir)/infer/infer/lib/specs/
test -d $(DESTDIR)$(libdir)/infer/infer/lib/python/ || \
$(MKDIR_P) $(DESTDIR)$(libdir)/infer/infer/lib/python/
test -d $(DESTDIR)$(libdir)/infer/infer/lib/python/inferlib/ || \
$(MKDIR_P) $(DESTDIR)$(libdir)/infer/infer/lib/python/inferlib/
test -d $(DESTDIR)$(libdir)/infer/infer/lib/python/inferlib/capture/ || \
$(MKDIR_P) $(DESTDIR)$(libdir)/infer/infer/lib/python/inferlib/capture/
test -d $(DESTDIR)$(libdir)/infer/infer/bin/ || \
$(MKDIR_P) $(DESTDIR)$(libdir)/infer/infer/bin/
# copy files
ifeq (@BUILD_C_ANALYZERS@,yes)
$(INSTALL_DATA) -C facebook-clang-plugins/libtooling/build/FacebookClangPlugin.dylib \
$(DESTDIR)$(libdir)/infer/facebook-clang-plugins/libtooling/build/FacebookClangPlugin.dylib
@for i in $$(find facebook-clang-plugins/clang/ -not -wholename 'src/*' -not -name setup.sh -not -name installed.version -not -type d); do \
$(INSTALL_PROGRAM) -C $$i $(DESTDIR)$(libdir)/infer/$$i; \
done
@for i in $$(find infer/lib/clang_wrappers/*); do \
$(INSTALL_PROGRAM) -C $$i $(DESTDIR)$(libdir)/infer/$$i; \
done
@for i in $$(find infer/lib/specs/*); do \
$(INSTALL_DATA) -C $$i $(DESTDIR)$(libdir)/infer/$$i; \
done
$(INSTALL_PROGRAM) -C $(INFERCLANG_BIN) $(DESTDIR)$(libdir)/infer/infer/bin/
endif
ifneq (@XCODE_SELECT@,no)
@for i in $$(find infer/lib/xcode_wrappers/*); do \
$(INSTALL_PROGRAM) -C $$i $(DESTDIR)$(libdir)/infer/$$i; \
done
endif
ifeq (@BUILD_JAVA_ANALYZERS@,yes)
$(INSTALL_DATA) -C infer/annotations/annotations.jar \
$(DESTDIR)$(libdir)/infer/infer/annotations/annotations.jar
@for i in infer/lib/java/*.jar; do \
$(INSTALL_DATA) -C $$i $(DESTDIR)$(libdir)/infer/$$i; \
done
$(INSTALL_PROGRAM) -C $(INFERJAVA_BIN) $(DESTDIR)$(libdir)/infer/infer/bin/
endif
@for i in $$(find infer/lib/wrappers/*); do \
$(INSTALL_PROGRAM) -C $$i $(DESTDIR)$(libdir)/infer/$$i; \
done
@for i in $$(find infer/lib/python/inferlib/* -type f); do \
$(INSTALL_DATA) -C $$i $(DESTDIR)$(libdir)/infer/$$i; \
done
$(INSTALL_PROGRAM) -C infer/lib/python/infer \
$(DESTDIR)$(libdir)/infer/infer/lib/python/infer
$(INSTALL_PROGRAM) -C infer/lib/python/inferTraceBugs \
$(DESTDIR)$(libdir)/infer/infer/lib/python/inferTraceBugs
$(INSTALL_PROGRAM) -C $(INFERANALYZE_BIN) $(DESTDIR)$(libdir)/infer/infer/bin/
$(INSTALL_PROGRAM) -C $(INFERPRINT_BIN) $(DESTDIR)$(libdir)/infer/infer/bin/
(cd $(DESTDIR)$(libdir)/infer/infer/bin/ && \
$(REMOVE) infer && \
$(LN_S) $(DESTDIR)$(libdir)/infer/infer/lib/python/infer infer)
(cd $(DESTDIR)$(bindir)/ && \
$(REMOVE) infer && \
$(LN_S) $(DESTDIR)$(libdir)/infer/infer/lib/python/infer infer)
(cd $(DESTDIR)$(bindir)/ && \
$(REMOVE) inferTraceBugs && \
$(LN_S) $(DESTDIR)$(libdir)/infer/infer/lib/python/inferTraceBugs inferTraceBugs)
clean:
@rm -fv test.xml
ifeq (@BUILD_C_ANALYZERS@,yes)
@ -146,3 +248,4 @@ endif
.PHONY: all buck_test buck_test_xml clean clang
.PHONY: clang_plugin clang_setup inferTraceBugs inferTraceBugs_test java
.PHONY: ocaml_unit_test test test_xml test_build unit
.PHONY: install uninstall

@ -108,6 +108,7 @@ AC_PROG_AWK
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_MKDIR_P
if test "x$enable_c_analyzers" = "xyes"; then
AC_PROG_CPP

@ -1,10 +0,0 @@
bin: [
"infer/bin/infer"
"infer/bin/inferTest"
"infer/bin/inferTraceBugs"
"infer/bin/InferJava"
"?infer/bin/InferClang"
"infer/bin/InferAnalyze"
"infer/bin/InferPrint"
]

@ -13,7 +13,9 @@ include $(ROOT_DIR)/Makefile.config
all: clang java llvm $(INFER_BIN) $(INFERTRACEBUGS_BIN) checkCopyright
$(INFER_BIN) $(INFERTRACEBUGS_BIN):
ln -sf ../lib/python/$(@F) $@
($(REMOVE) $@ && \
cd $(@D) && \
$(LN_S) ../lib/python/$(@F) $(@F))
java: $(INFER_BIN)
$(MAKE) -C $(SRC_DIR) java

@ -276,7 +276,7 @@ version: backend/version.ml.in Makefile
rm -f "$$TMPFILE"
$(BUILD_DIR):
$(MKDIR) $(BUILD_DIR)
$(MKDIR_P) $(BUILD_DIR)
$(INFERJAVA_BIN): build_java
$(COPY) $(JAVA_BUILD_DIR)/$(INFERANALYZE_MAIN).native $(INFERANALYZE_BIN)

19
opam

@ -8,11 +8,22 @@ bug-reports: "https://github.com/facebook/infer/issues"
dev-repo: "https://github.com/facebook/infer.git"
license: "BSD"
build: [
["echo" "building from opam is not supported yet"]
["exit" "1"]
["./autogen.sh"]
["./configure"
"--disable-c-analyzers"
"--prefix=%{prefix}%"]
["make" "-j%{jobs}%"]
]
install: [
["make" "install"]
]
remove: [
["./autogen.sh"]
["./configure"
"--disable-c-analyzers"
"--prefix=%{prefix}%"]
["make" "uninstall"]
]
install: []
remove: []
ocaml-version: [ >= "4.02.1" ]
depends: [
"ocamlfind" {build}

Loading…
Cancel
Save