From c10d2ed32d913f2c733702f9dddd675748f94b30 Mon Sep 17 00:00:00 2001 From: Jules Villard Date: Thu, 11 May 2017 10:17:54 -0700 Subject: [PATCH] [make] install man pages Summary: `man infer` for the win! Reviewed By: mbouaziz Differential Revision: D5036764 fbshipit-source-id: 4567d24 --- .gitignore | 1 + Makefile | 31 ++++++++++++++++++++++++++----- Makefile.autoconf.in | 3 +++ Makefile.config | 6 ++++++ 4 files changed, 36 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 6222ae8dc..24e1eb1f5 100644 --- a/.gitignore +++ b/.gitignore @@ -90,6 +90,7 @@ buck-out/ #other /infer/bin +/infer/man /infer/src/base/Version.ml /infer/models/java/models/ diff --git a/Makefile b/Makefile index f4c1cc7e8..deaeeb11b 100644 --- a/Makefile +++ b/Makefile @@ -136,8 +136,19 @@ ifeq ($(BUILD_C_ANALYZERS),yes) byte src_build test_build: clang_plugin endif -.PHONY: infer -infer: src_build +$(INFER_COMMAND_MANUALS): src_build Makefile + $(QUIET)$(MKDIR_P) $(@D) + $(QUIET)$(INFER_BIN) $(patsubst infer-%.1,%,$(@F)) --help --help-format=groff > $@ + +$(INFER_MANUAL): src_build Makefile + $(QUIET)$(MKDIR_P) $(@D) + $(QUIET)$(INFER_BIN) --help --help-format=groff > $@ + +$(INFER_MANUALS_GZIPPED): %.gz: % + $(QUIET)$(REMOVE) $@ + gzip $< + +infer_models: src_build ifeq ($(BUILD_JAVA_ANALYZERS),yes) $(QUIET)$(call silent_on_success,Building Java annotations,\ $(MAKE) -C $(ANNOTATIONS_DIR)) @@ -145,6 +156,9 @@ endif $(QUIET)$(call silent_on_success,Building Infer models,\ $(MAKE) -C $(MODELS_DIR) all) +.PHONY: infer +infer: src_build $(INFER_MANUALS) infer_models + .PHONY: clang_setup clang_setup: $(QUIET)export CC="$(CC)" CFLAGS="$(CFLAGS)"; \ @@ -350,16 +364,20 @@ test-replace: $(BUILD_SYSTEMS_TESTS:%=build_%_replace) $(DIRECT_TESTS:%=direct_% uninstall: $(REMOVE_DIR) $(DESTDIR)$(libdir)/infer/ $(REMOVE) $(DESTDIR)$(bindir)/infer - $(REMOVE) $(foreach alias,$(INFER_COMMANDS),$(DESTDIR)$(bindir)/$(alias)) + $(REMOVE) $(INFER_COMMANDS:%=$(DESTDIR)$(bindir)/%) + $(REMOVE) $(foreach manual,$(INFER_MANUALS_GZIPPED),\ + $(DESTDIR)$(mandir)/man1/$(notdir $(manual))) .PHONY: test_clean test_clean: $(DIRECT_TESTS:%=direct_%_clean) $(BUILD_SYSTEMS_TESTS:%=build_%_clean) .PHONY: install -install: infer +install: infer $(INFER_MANUALS_GZIPPED) # create directory structure test -d $(DESTDIR)$(bindir) || \ $(MKDIR_P) $(DESTDIR)$(bindir) + test -d $(DESTDIR)$(mandir)/man1 || \ + $(MKDIR_P) $(DESTDIR)$(mandir)/man1 test -d $(DESTDIR)$(libdir)/infer/ || \ $(MKDIR_P) $(DESTDIR)$(libdir)/infer/ ifeq ($(BUILD_C_ANALYZERS),yes) @@ -455,6 +473,9 @@ endif (cd $(DESTDIR)$(bindir)/ && \ $(REMOVE) inferTraceBugs && \ $(LN_S) $(libdir_relative_to_bindir)/infer/infer/lib/python/inferTraceBugs inferTraceBugs) + $(QUIET)for i in $(MAN_DIR)/man1/*; do \ + $(INSTALL_DATA) -C $$i $(DESTDIR)$(mandir)/man1/$$(basename $$i); \ + done ifeq ($(IS_FACEBOOK_TREE),yes) $(QUIET)$(MAKE) -C facebook install @@ -476,7 +497,7 @@ ifeq ($(IS_FACEBOOK_TREE),yes) endif $(QUIET)$(MAKE) -C $(DEPENDENCIES_DIR)/ocamldot clean find $(INFER_DIR)/tests \( -name '*.o' -o -name '*.o.sh' \) -delete - $(REMOVE_DIR) _build_logs + $(QUIET)$(REMOVE_DIR) _build_logs $(MAN_DIR) .PHONY: conf-clean conf-clean: clean diff --git a/Makefile.autoconf.in b/Makefile.autoconf.in index db667509d..dd71beacc 100644 --- a/Makefile.autoconf.in +++ b/Makefile.autoconf.in @@ -22,6 +22,8 @@ CMAKE = @CMAKE@ CPP = @CPP@ CXX = @CXX@ CXXFLAGS = @CXXFLAGS@ +# this is useless but autoconf is picky... +datarootdir = @datarootdir@ ENABLE_OCAMLOPT_CUSTOM_CC = @ENABLE_OCAMLOPT_CUSTOM_CC@ ENABLE_OCAML_BINANNOT = @ENABLE_OCAML_BINANNOT@ exec_prefix = @exec_prefix@ @@ -40,6 +42,7 @@ libdir = @libdir@ # override in your `make` command to make the install relocatable libdir_relative_to_bindir = $(libdir) LIBS = @LIBS@ +mandir = @mandir@ MENHIR = @MENHIR@ MKDIR_P_CMD = case "@MKDIR_P@" in \ ./*) printf "$(ROOT_DIR)/@MKDIR_P@\n";; \ diff --git a/Makefile.config b/Makefile.config index 2d30a0079..93e9f4dd5 100644 --- a/Makefile.config +++ b/Makefile.config @@ -36,6 +36,7 @@ ANNOTATIONS_DIR = $(INFER_DIR)/annotations BIN_DIR = $(INFER_DIR)/bin ETC_DIR = $(INFER_DIR)/etc LIB_DIR = $(INFER_DIR)/lib +MAN_DIR = $(INFER_DIR)/man MODELS_DIR = $(INFER_DIR)/models JAVA_BUILTINS_DIR = $(MODELS_DIR)/java/builtins JAVA_MODELS_DIR = $(MODELS_DIR)/java/src @@ -63,6 +64,11 @@ INFER_COMMANDS = \ INFERTRACEBUGS_BIN = $(BIN_DIR)/inferTraceBugs INFERTRACEBUGS_BIN_RELPATH = infer/bin/inferTraceBugs +INFER_COMMAND_MANUALS = $(INFER_COMMANDS:%=$(MAN_DIR)/man1/%.1) +INFER_MANUAL = $(MAN_DIR)/man1/infer.1 +INFER_MANUALS = $(INFER_COMMAND_MANUALS) $(INFER_MANUAL) +INFER_MANUALS_GZIPPED = $(INFER_MANUALS:=.gz) + ifeq ($(BUILD_JAVA_ANALYZERS),yes) JAVA_HOME=$(USER_JAVA_HOME) endif