[make] only build inferunit for bytecode mode

Summary:
Native compilation seems to take a couple of seconds to build the unit test
binary, but we don't need it to be native (and neither do users building infer
to install it on their machines). In fact, the test mode rebuilds it in
bytecode mode. For the sake of being able to run the unit tests when developing
on infer (and thus possibly while having some fatal warnings showing up in the
code, preventing us from building the test target), also build InferUnit in
bytecode mode.

Reviewed By: sblackshear, martinoluca

Differential Revision: D4537455

fbshipit-source-id: 374c84c
master
Jules Villard 8 years ago committed by Facebook Github Bot
parent 574d640af0
commit 55ceb64ba6

@ -133,8 +133,7 @@ OCAMLBUILD_ALL = $(OCAMLBUILD_BASE) $(JAVA_OCAMLBUILD_OPTIONS)
INFER_BASE_TARGETS = \ INFER_BASE_TARGETS = \
$(INFER_MAIN).native \ $(INFER_MAIN).native \
$(INFERANALYZE_MAIN).native \ $(INFERANALYZE_MAIN).native \
$(INFERPRINT_MAIN).native \ $(INFERPRINT_MAIN).native
$(INFERUNIT_MAIN).native
INFER_ALL_TARGETS = $(INFER_BASE_TARGETS) \ INFER_ALL_TARGETS = $(INFER_BASE_TARGETS) \
$(INFERCLANG_MAIN).native \ $(INFERCLANG_MAIN).native \
@ -184,7 +183,6 @@ $(BIN_DIR): Makefile
$(INFER_BIN).native: $(INFER_BUILD_DIR)/$(INFER_MAIN).native $(BIN_DIR) $(INFER_BIN).native: $(INFER_BUILD_DIR)/$(INFER_MAIN).native $(BIN_DIR)
$(INSTALL_PROGRAM) $(INFER_BUILD_DIR)/$(INFERANALYZE_MAIN).native $(INFERANALYZE_BIN) $(INSTALL_PROGRAM) $(INFER_BUILD_DIR)/$(INFERANALYZE_MAIN).native $(INFERANALYZE_BIN)
$(INSTALL_PROGRAM) $(INFER_BUILD_DIR)/$(INFERPRINT_MAIN).native $(INFERPRINT_BIN) $(INSTALL_PROGRAM) $(INFER_BUILD_DIR)/$(INFERPRINT_MAIN).native $(INFERPRINT_BIN)
$(INSTALL_PROGRAM) $(INFER_BUILD_DIR)/$(INFERUNIT_MAIN).native $(INFERUNIT_BIN)
ifeq ($(BUILD_C_ANALYZERS),yes) ifeq ($(BUILD_C_ANALYZERS),yes)
$(INSTALL_PROGRAM) $(INFER_BUILD_DIR)/$(INFERCLANG_MAIN).native $(INFERCLANG_BIN) $(INSTALL_PROGRAM) $(INFER_BUILD_DIR)/$(INFERCLANG_MAIN).native $(INFERCLANG_BIN)
endif endif
@ -199,7 +197,8 @@ infer: $(CLANG_BINIOU_DICT)
endif endif
$(INFER_BUILD_DIR)/$(INFER_MAIN).byte: base/Version.ml $(BUILD_DIR) $(OCAML_ALL_SOURCES) $(INFER_BUILD_DIR)/$(INFER_MAIN).byte: base/Version.ml $(BUILD_DIR) $(OCAML_ALL_SOURCES)
$(OCAMLBUILD_ALL) -build-dir $(INFER_BUILD_DIR) $(INFER_ALL_TARGETS:.native=.byte) $(OCAMLBUILD_ALL) -build-dir $(INFER_BUILD_DIR) \
$(INFER_ALL_TARGETS:.native=.byte) $(INFERUNIT_MAIN).byte
@touch $@ @touch $@
$(INFER_BIN).byte: $(INFER_BUILD_DIR)/$(INFER_MAIN).byte $(BIN_DIR) $(INFER_BIN).byte: $(INFER_BUILD_DIR)/$(INFER_MAIN).byte $(BIN_DIR)
@ -231,7 +230,7 @@ module: base/Version.ml $(BUILD_DIR) $(OCAML_ALL_SOURCES)
$(TEST_BUILD_DIR)/$(INFER_MAIN).byte: base/Version.ml $(BUILD_DIR) $(OCAML_ALL_SOURCES) toplevel.mlpack $(TEST_BUILD_DIR)/$(INFER_MAIN).byte: base/Version.ml $(BUILD_DIR) $(OCAML_ALL_SOURCES) toplevel.mlpack
$(OCAMLBUILD_ALL) -build-dir $(TEST_BUILD_DIR) \ $(OCAMLBUILD_ALL) -build-dir $(TEST_BUILD_DIR) \
-cflags -warn-error,$(OCAML_FATAL_WARNINGS) \ -cflags -warn-error,$(OCAML_FATAL_WARNINGS) \
$(INFER_ALL_TARGETS:.native=.byte) toplevel.cmo $(INFER_ALL_TARGETS:.native=.byte) $(INFERUNIT_MAIN).byte toplevel.cmo
@touch $@ @touch $@
.PHONY: test_build .PHONY: test_build

Loading…
Cancel
Save