Let ocamlfind find include and lib files

Summary:public

Pass -pkg flags to ocamlbuild for libraries, instead of manually
constructing includes, libs, and mods.

Reviewed By: jvillard

Differential Revision: D2952945

fb-gh-sync-id: 875ae34
shipit-source-id: 875ae34
master
Josh Berdine 9 years ago committed by facebook-github-bot-4
parent c623b45298
commit c585383fba

@ -26,8 +26,6 @@ MKDIR = mkdir -p
LINK = ln -sf
ATDGEN = @ATDGEN@
OCAML_INCLUDE_DIR = $(shell ocamlc -where)
#### Global declarations ####
BUILD_DIR = $(INFER_DIR)/_build-infer
@ -38,18 +36,7 @@ SCRIPTS_BUILD_DIR = $(BUILD_DIR)/scripts
ANNOT_DIR = $(SRC_DIR)/_build
ETC_DIR = $(INFER_DIR)/etc
#### Infer includes declarations ####
ATDGEN_INCLUDE_DIR = @OCAML_PKG_PATH_atdgen@
BINIOU_INCLUDE_DIR = @OCAML_PKG_PATH_biniou@
EASYFORMAT_INCLUDE_DIR = @OCAML_PKG_PATH_easy_format@
EXTLIB_INCLUDE_DIR = @OCAML_PKG_PATH_extlib@
YOJSON_INCLUDE_DIR = @OCAML_PKG_PATH_yojson@
ZIP_INCLUDE_DIR = @OCAML_PKG_PATH_camlzip@
OCAML_INCLUDES = -I,$(EASYFORMAT_INCLUDE_DIR),-I,$(BINIOU_INCLUDE_DIR),-I,$(YOJSON_INCLUDE_DIR),-I,$(ATDGEN_INCLUDE_DIR),-I,$(EXTLIB_INCLUDE_DIR),-I,$(ZIP_INCLUDE_DIR)
OCAML_LIBS = unix str atdgen extLib zip
OCAML_MODS = easy_format bi_util bi_share bi_outbuf bi_inbuf bi_vint bi_io yojson ag_oj_run ag_ob_run ag_util
#### ocamlbuild options ####
OCAMLBUILD_ANNOT_OPTIONS =
ifeq (@ENABLE_OCAML_ANNOT@,yes)
@ -98,10 +85,7 @@ OCAMLBUILD_OPTIONS = \
-cflags -w,-40..42 \
-tag-line "<*{clang/clang_ast_*,backend/jsonbug_*}>: warn(-27-32-35-39)" \
-tag-line "not <**/{config,iList,utils}.*>: open(Utils)" \
-lflags $(OCAML_INCLUDES) \
-cflags $(OCAML_INCLUDES) \
$(addprefix -lib ,$(OCAML_LIBS)) \
$(addprefix -mod ,$(OCAML_MODS))
-pkgs atdgen,extlib,str,unix,yojson,zip
#### Backend declarations ####
@ -120,13 +104,7 @@ INFERPRINT_MAIN = $(BACKEND_SOURCES)/inferprint
#### Java declarations ####
PTREES_INCLUDE_DIR = @OCAML_PKG_PATH_ptrees@
JAVALIB_INCLUDE_DIR = @OCAML_PKG_PATH_javalib@
SAWJA_INCLUDE_DIR = @OCAML_PKG_PATH_sawja@
JAVA_INCLUDES = -I,$(PTREES_INCLUDE_DIR),-I,$(JAVALIB_INCLUDE_DIR),-I,$(SAWJA_INCLUDE_DIR)
JAVA_LIBS = ptrees javalib sawja
JAVA_OCAMLBUID_OPTIONS = -lflags $(JAVA_INCLUDES) -cflags $(JAVA_INCLUDES) $(addprefix -lib ,$(JAVA_LIBS))
JAVA_OCAMLBUILD_OPTIONS = -pkgs javalib,ptrees,sawja
JAVA_SOURCES = java
@ -199,7 +177,7 @@ llvm: $(INFERLLVM_BIN)
checkCopyright: $(CHECKCOPYRIGHT_BIN)
build_java: init $(INFERPRINT_ATDGEN_STUBS)
$(OCAMLBUILD) -build-dir $(JAVA_BUILD_DIR) $(JAVA_OCAMLBUID_OPTIONS) \
$(OCAMLBUILD) -build-dir $(JAVA_BUILD_DIR) $(JAVA_OCAMLBUILD_OPTIONS) \
$(INFERANALYZE_MAIN).native \
$(INFERPRINT_MAIN).native \
$(INFERJAVA_MAIN).native

Loading…
Cancel
Save