|
|
|
# Copyright (c) 2015 - present Facebook, Inc.
|
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# This source code is licensed under the BSD style license found in the
|
|
|
|
# LICENSE file in the root directory of this source tree. An additional grant
|
|
|
|
# of patent rights can be found in the PATENTS file in the same directory.
|
|
|
|
|
|
|
|
.PHONY: default
|
|
|
|
default: infer
|
|
|
|
|
|
|
|
ROOT_DIR = .
|
|
|
|
include $(ROOT_DIR)/Makefile.config
|
|
|
|
|
[make] s/ocamlbuild/jbuilder/g
Summary:
Use jbuilder to build infer instead of ocamlbuild. This is mainly to get faster builds:
```
times in 10ms, ±differences measured in speedups, 4 cores
| | ocb total | jb | ±total | ocb user | jb | ±user | ocb cpu | jb | ±cpu | ocb sys | jb | ±sys |
|-----------------------------------+-----------+------+--------+----------+------+-------+---------+-----+------+---------+------+------|
| byte from scratch | 6428 | 2456 | 2.62 | 7743 | 6662 | 1.16 | 138 | 331 | 2.40 | 1184 | 1477 | 0.80 |
| native from scratch | 9841 | 4289 | 2.29 | 9530 | 8834 | 1.08 | 110 | 245 | 2.23 | 1373 | 1712 | 0.80 |
| byte after native | 29578 | 1602 | 18.46 | 4514 | 4640 | 0.97 | 170 | 325 | 1.91 | 543 | 576 | 0.94 |
| change infer.ml byte | 344 | 282 | 1.22 | 292 | 215 | 1.36 | 96 | 99 | 1.03 | 040 | 066 | 0.61 |
| change infer.ml native | 837 | 223 | 3.75 | 789 | 174 | 4.53 | 98 | 99 | 1.01 | 036 | 47 | 0.77 |
| change Config.ml byte | 451 | 339 | 1.33 | 382 | 336 | 1.14 | 97 | 122 | 1.26 | 056 | 80 | 0.70 |
| change Config.ml native | 4024 | 1760 | 2.29 | 4585 | 4225 | 1.09 | 127 | 276 | 2.17 | 559 | 644 | 0.87 |
| change cFrontend_config.ml byte | 348 | 643 | 0.54 | 297 | 330 | 0.90 | 96 | 67 | 0.70 | 038 | 102 | 0.37 |
| change cFrontend_config.ml native | 1480 | 584 | 2.53 | 1435 | 906 | 1.58 | 106 | 185 | 1.75 | 136 | 178 | 0.76 |
#+TBLFM: $4=$2/$3;f2::$7=$5/$6;f2::$10=$9/$8;f2::$13=$11/$12;f2
50 cores
| | ocb total | jb | ±total | ocb user | jb | ±user | ocb cpu | jb | ±cpu | ocb sys | jb | ±sys |
|---------------------+-----------+------+--------+----------+------+-------+---------+----+------+---------+------+------|
| byte from scratch | 9114 | 2061 | 4.42 | 9334 | 5133 | 1.82 | | | 0/0 | 2566 | 1726 | 1.49 |
| native from scratch | 13481 | 3967 | 3.40 | 12291 | 7608 | 1.62 | | | 0/0 | 3003 | 2100 | 1.43 |
| byte after native | 3467 | 1476 | 2.35 | 5067 | 3912 | 1.30 | | | 0/0 | 971 | 801 | 1.21 |
#+TBLFM: $4=$2/$3;f2::$7=$5/$6;f2::$10=$9/$8;f2::$13=$11/$12;f2
```
Menu:
1. Write a jbuild file, autogenerated from jbuild.in because we need to fill in
some information at build-time (really, at configure time, but TODO), such as
whether or not clang is enabled.
2. Nuke lots of stuff from infer/src/Makefile that is now in the jbuild file
3. The jbuild file lives in infer/src/ so it can see all the sources. If we put it somewhere else, eg, infer/, then `jbuilder` scans too many files (all irrelevant) and takes 2.5s to start instead of .8s. Adding irrelevant directories to jbuild-ignore does not help.
4. jbuilder does not support subdirectories, so resort to listing all the
source files in the generated jbuild (only source directories need to be
manually listed in jbuild.in though). Still, the generated .merlin is wrong
and makes merlin find source files in _build, so manually tune it to get
good merlin support. We also lose some of merlin for unit tests as it
cannot see their build artefacts anymore.
5. checkCopyright gets its own jbuild because it's standalone. Also, remove
some deprecation warnings in checkCopyright due to the new version of Core from
a while ago.
6. Drop less-used Makefile features (they had regressed anyway) such as
building individual modules. Also, building mod_dep.pdf now takes all the
source files available so they better build (before, it would only take the
source files from the config, eg with or without clang) (that's pretty minor).
7. The toplevel is now built as a custom toplevel because that was easier. It
should soon be even easier: https://github.com/janestreet/jbuilder/issues/210
8. Move BUILTINS.mli to BUILTINS.ml because jbuilder is not happy about
interface files without implementations.
In particular, I did not try to migrate too much of the Makefile logic to jbuilder,
more can be done in the future.
Reviewed By: jberdine
Differential Revision: D5573661
fbshipit-source-id: 4ca6d8f
7 years ago
|
|
|
ifneq ($(UTOP),no)
|
|
|
|
BUILD_SYSTEMS_TESTS += infertop
|
|
|
|
build_infertop_print build_infertop_replace build_infertop_test: toplevel_test
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(BUILD_C_ANALYZERS),yes)
|
|
|
|
BUILD_SYSTEMS_TESTS += \
|
|
|
|
assembly \
|
|
|
|
ck_analytics ck_imports \
|
|
|
|
clang_compilation_db_escaped clang_compilation_db_relpath \
|
|
|
|
clang_multiple_files \
|
|
|
|
clang_translation \
|
|
|
|
clang_unknown_ext \
|
|
|
|
clang_with_E_flag \
|
|
|
|
clang_with_M_flag \
|
|
|
|
clang_with_MD_flag \
|
|
|
|
delete_results_dir \
|
|
|
|
diff \
|
|
|
|
diff_gen_build_script \
|
|
|
|
fail_on_issue \
|
|
|
|
j1 \
|
|
|
|
linters \
|
|
|
|
project_root_rel \
|
|
|
|
reactive \
|
|
|
|
run_hidden_linters \
|
|
|
|
tracebugs \
|
|
|
|
utf8_in_procname \
|
|
|
|
|
|
|
|
DIRECT_TESTS += \
|
|
|
|
c_biabduction c_bufferoverrun c_errors c_frontend \
|
|
|
|
cpp_bufferoverrun cpp_errors cpp_frontend cpp_liveness cpp_quandary cpp_siof cpp_threadsafety \
|
|
|
|
|
|
|
|
ifneq ($(BUCK),no)
|
|
|
|
BUILD_SYSTEMS_TESTS += buck-clang-db buck_flavors buck_flavors_run buck_flavors_deterministic
|
|
|
|
endif
|
|
|
|
ifneq ($(CMAKE),no)
|
|
|
|
BUILD_SYSTEMS_TESTS += clang_compilation_db cmake inferconfig
|
|
|
|
endif
|
|
|
|
ifneq ($(NDKBUILD),no)
|
|
|
|
BUILD_SYSTEMS_TESTS += ndk_build
|
|
|
|
endif
|
|
|
|
ifneq ($(PYTHON_lxml),no)
|
|
|
|
BUILD_SYSTEMS_TESTS += results_xml
|
|
|
|
endif
|
|
|
|
ifneq ($(XCODE_SELECT),no)
|
|
|
|
BUILD_SYSTEMS_TESTS += xcodebuild_no_xcpretty
|
|
|
|
DIRECT_TESTS += \
|
|
|
|
objc_frontend objc_errors objc_linters objc_ioslints \
|
|
|
|
objcpp_frontend objcpp_linters objc_linters-for-test-only objcpp_linters-for-test-only \
|
|
|
|
objc_linters-def-folder
|
|
|
|
ifneq ($(XCPRETTY),no)
|
|
|
|
BUILD_SYSTEMS_TESTS += xcodebuild
|
|
|
|
endif
|
|
|
|
endif # XCODE_SELECT
|
|
|
|
endif # BUILD_C_ANALYZERS
|
|
|
|
|
|
|
|
ifeq ($(BUILD_JAVA_ANALYZERS),yes)
|
|
|
|
BUILD_SYSTEMS_TESTS += \
|
|
|
|
differential_interesting_paths_filter \
|
|
|
|
differential_skip_anonymous_class_renamings \
|
|
|
|
differential_skip_duplicated_types_on_filenames \
|
|
|
|
differential_skip_duplicated_types_on_filenames_with_renamings \
|
|
|
|
gradle \
|
|
|
|
javac \
|
|
|
|
resource_leak_exception_lines \
|
|
|
|
|
|
|
|
DIRECT_TESTS += \
|
|
|
|
java_checkers java_eradicate java_infer java_tracing java_quandary java_threadsafety \
|
|
|
|
java_crashcontext java_harness
|
|
|
|
ifneq ($(ANT),no)
|
|
|
|
BUILD_SYSTEMS_TESTS += ant
|
|
|
|
endif
|
|
|
|
ifneq ($(BUCK),no)
|
|
|
|
BUILD_SYSTEMS_TESTS += buck genrule
|
|
|
|
# do not run these two tests in parallel otherwise Buck has a bad time
|
[make] s/ocamlbuild/jbuilder/g
Summary:
Use jbuilder to build infer instead of ocamlbuild. This is mainly to get faster builds:
```
times in 10ms, ±differences measured in speedups, 4 cores
| | ocb total | jb | ±total | ocb user | jb | ±user | ocb cpu | jb | ±cpu | ocb sys | jb | ±sys |
|-----------------------------------+-----------+------+--------+----------+------+-------+---------+-----+------+---------+------+------|
| byte from scratch | 6428 | 2456 | 2.62 | 7743 | 6662 | 1.16 | 138 | 331 | 2.40 | 1184 | 1477 | 0.80 |
| native from scratch | 9841 | 4289 | 2.29 | 9530 | 8834 | 1.08 | 110 | 245 | 2.23 | 1373 | 1712 | 0.80 |
| byte after native | 29578 | 1602 | 18.46 | 4514 | 4640 | 0.97 | 170 | 325 | 1.91 | 543 | 576 | 0.94 |
| change infer.ml byte | 344 | 282 | 1.22 | 292 | 215 | 1.36 | 96 | 99 | 1.03 | 040 | 066 | 0.61 |
| change infer.ml native | 837 | 223 | 3.75 | 789 | 174 | 4.53 | 98 | 99 | 1.01 | 036 | 47 | 0.77 |
| change Config.ml byte | 451 | 339 | 1.33 | 382 | 336 | 1.14 | 97 | 122 | 1.26 | 056 | 80 | 0.70 |
| change Config.ml native | 4024 | 1760 | 2.29 | 4585 | 4225 | 1.09 | 127 | 276 | 2.17 | 559 | 644 | 0.87 |
| change cFrontend_config.ml byte | 348 | 643 | 0.54 | 297 | 330 | 0.90 | 96 | 67 | 0.70 | 038 | 102 | 0.37 |
| change cFrontend_config.ml native | 1480 | 584 | 2.53 | 1435 | 906 | 1.58 | 106 | 185 | 1.75 | 136 | 178 | 0.76 |
#+TBLFM: $4=$2/$3;f2::$7=$5/$6;f2::$10=$9/$8;f2::$13=$11/$12;f2
50 cores
| | ocb total | jb | ±total | ocb user | jb | ±user | ocb cpu | jb | ±cpu | ocb sys | jb | ±sys |
|---------------------+-----------+------+--------+----------+------+-------+---------+----+------+---------+------+------|
| byte from scratch | 9114 | 2061 | 4.42 | 9334 | 5133 | 1.82 | | | 0/0 | 2566 | 1726 | 1.49 |
| native from scratch | 13481 | 3967 | 3.40 | 12291 | 7608 | 1.62 | | | 0/0 | 3003 | 2100 | 1.43 |
| byte after native | 3467 | 1476 | 2.35 | 5067 | 3912 | 1.30 | | | 0/0 | 971 | 801 | 1.21 |
#+TBLFM: $4=$2/$3;f2::$7=$5/$6;f2::$10=$9/$8;f2::$13=$11/$12;f2
```
Menu:
1. Write a jbuild file, autogenerated from jbuild.in because we need to fill in
some information at build-time (really, at configure time, but TODO), such as
whether or not clang is enabled.
2. Nuke lots of stuff from infer/src/Makefile that is now in the jbuild file
3. The jbuild file lives in infer/src/ so it can see all the sources. If we put it somewhere else, eg, infer/, then `jbuilder` scans too many files (all irrelevant) and takes 2.5s to start instead of .8s. Adding irrelevant directories to jbuild-ignore does not help.
4. jbuilder does not support subdirectories, so resort to listing all the
source files in the generated jbuild (only source directories need to be
manually listed in jbuild.in though). Still, the generated .merlin is wrong
and makes merlin find source files in _build, so manually tune it to get
good merlin support. We also lose some of merlin for unit tests as it
cannot see their build artefacts anymore.
5. checkCopyright gets its own jbuild because it's standalone. Also, remove
some deprecation warnings in checkCopyright due to the new version of Core from
a while ago.
6. Drop less-used Makefile features (they had regressed anyway) such as
building individual modules. Also, building mod_dep.pdf now takes all the
source files available so they better build (before, it would only take the
source files from the config, eg with or without clang) (that's pretty minor).
7. The toplevel is now built as a custom toplevel because that was easier. It
should soon be even easier: https://github.com/janestreet/jbuilder/issues/210
8. Move BUILTINS.mli to BUILTINS.ml because jbuilder is not happy about
interface files without implementations.
In particular, I did not try to migrate too much of the Makefile logic to jbuilder,
more can be done in the future.
Reviewed By: jberdine
Differential Revision: D5573661
fbshipit-source-id: 4ca6d8f
7 years ago
|
|
|
build_genrule_test: | build_buck_test
|
|
|
|
build_genrule_print: | build_buck_print
|
|
|
|
endif
|
|
|
|
ifneq ($(MVN),no)
|
|
|
|
BUILD_SYSTEMS_TESTS += mvn
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(BUILD_C_ANALYZERS)+$(BUILD_JAVA_ANALYZERS),yes+yes)
|
|
|
|
BUILD_SYSTEMS_TESTS += make utf8_in_pwd waf
|
|
|
|
# the waf test and the make test run the same `make` command
|
|
|
|
build_waf_test: build_make_test
|
|
|
|
build_waf_print: build_make_print
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(IS_INFER_RELEASE),no)
|
|
|
|
configure: configure.ac $(wildcard m4/*.m4)
|
|
|
|
# rerun ./autogen.sh in case of failure as the failure may be due to needing to rerun
|
|
|
|
# ./configure
|
|
|
|
$(QUIET)($(call silent_on_success,Generate ./configure,./autogen.sh)) || \
|
|
|
|
./autogen.sh
|
|
|
|
|
|
|
|
Makefile.autoconf: configure Makefile.autoconf.in
|
|
|
|
# rerun ./configure with the flags that were used last time it was run (if available)
|
|
|
|
# retry in case of failure as the failure may be due to needing to rerun ./configure
|
|
|
|
$(QUIET)($(call silent_on_success,Running\
|
|
|
|
./configure $(shell ./config.status --config || true),\
|
|
|
|
./configure $(shell ./config.status --config || true))) || \
|
|
|
|
./configure $(shell ./config.status --config || true)
|
|
|
|
endif
|
|
|
|
|
|
|
|
.PHONY: fb-setup
|
|
|
|
fb-setup:
|
|
|
|
$(QUIET)$(call silent_on_success,Facebook setup,\
|
|
|
|
$(MAKE) -C facebook setup)
|
|
|
|
|
|
|
|
OCAMLFORMAT_EXE=facebook/dependencies/ocamlformat/src/_build/opt/ocamlformat.exe
|
|
|
|
|
|
|
|
.PHONY: fmt
|
|
|
|
fmt:
|
|
|
|
parallel $(OCAMLFORMAT_EXE) --no-warn-error -i ::: $$(git diff --name-only $$(git merge-base origin/master HEAD) | grep "\.mli\?$$")
|
|
|
|
|
|
|
|
SRC_ML:=$(shell find * \( -name _build -or -name facebook-clang-plugins -or -path facebook/dependencies \) -not -prune -or -type f -and -name '*'.ml -or -name '*'.mli 2>/dev/null)
|
|
|
|
|
|
|
|
.PHONY: fmt_all
|
|
|
|
fmt_all:
|
|
|
|
parallel $(OCAMLFORMAT_EXE) --no-warn-error -i ::: $(SRC_ML)
|
|
|
|
|
|
|
|
# pre-building these avoids race conditions when building, eg src_build and test_build in parallel
|
|
|
|
.PHONY: src_build_common
|
|
|
|
src_build_common:
|
|
|
|
$(QUIET)$(call silent_on_success,Generating source dependencies,\
|
|
|
|
$(MAKE) -C $(SRC_DIR) src_build_common)
|
|
|
|
|
|
|
|
.PHONY: src_build
|
|
|
|
src_build: src_build_common
|
|
|
|
$(QUIET)$(call silent_on_success,Building native Infer,\
|
|
|
|
$(MAKE) -C $(SRC_DIR) infer)
|
|
|
|
|
|
|
|
.PHONY: byte
|
|
|
|
byte: src_build_common
|
|
|
|
$(QUIET)$(call silent_on_success,Building byte Infer,\
|
|
|
|
$(MAKE) -C $(SRC_DIR) byte)
|
|
|
|
|
|
|
|
.PHONY: test_build
|
|
|
|
test_build: src_build_common
|
|
|
|
$(QUIET)$(call silent_on_success,Testing Infer builds without warnings,\
|
|
|
|
$(MAKE) -C $(SRC_DIR) TEST=1 byte_no_install)
|
|
|
|
|
|
|
|
ifeq ($(IS_FACEBOOK_TREE),yes)
|
[make] s/ocamlbuild/jbuilder/g
Summary:
Use jbuilder to build infer instead of ocamlbuild. This is mainly to get faster builds:
```
times in 10ms, ±differences measured in speedups, 4 cores
| | ocb total | jb | ±total | ocb user | jb | ±user | ocb cpu | jb | ±cpu | ocb sys | jb | ±sys |
|-----------------------------------+-----------+------+--------+----------+------+-------+---------+-----+------+---------+------+------|
| byte from scratch | 6428 | 2456 | 2.62 | 7743 | 6662 | 1.16 | 138 | 331 | 2.40 | 1184 | 1477 | 0.80 |
| native from scratch | 9841 | 4289 | 2.29 | 9530 | 8834 | 1.08 | 110 | 245 | 2.23 | 1373 | 1712 | 0.80 |
| byte after native | 29578 | 1602 | 18.46 | 4514 | 4640 | 0.97 | 170 | 325 | 1.91 | 543 | 576 | 0.94 |
| change infer.ml byte | 344 | 282 | 1.22 | 292 | 215 | 1.36 | 96 | 99 | 1.03 | 040 | 066 | 0.61 |
| change infer.ml native | 837 | 223 | 3.75 | 789 | 174 | 4.53 | 98 | 99 | 1.01 | 036 | 47 | 0.77 |
| change Config.ml byte | 451 | 339 | 1.33 | 382 | 336 | 1.14 | 97 | 122 | 1.26 | 056 | 80 | 0.70 |
| change Config.ml native | 4024 | 1760 | 2.29 | 4585 | 4225 | 1.09 | 127 | 276 | 2.17 | 559 | 644 | 0.87 |
| change cFrontend_config.ml byte | 348 | 643 | 0.54 | 297 | 330 | 0.90 | 96 | 67 | 0.70 | 038 | 102 | 0.37 |
| change cFrontend_config.ml native | 1480 | 584 | 2.53 | 1435 | 906 | 1.58 | 106 | 185 | 1.75 | 136 | 178 | 0.76 |
#+TBLFM: $4=$2/$3;f2::$7=$5/$6;f2::$10=$9/$8;f2::$13=$11/$12;f2
50 cores
| | ocb total | jb | ±total | ocb user | jb | ±user | ocb cpu | jb | ±cpu | ocb sys | jb | ±sys |
|---------------------+-----------+------+--------+----------+------+-------+---------+----+------+---------+------+------|
| byte from scratch | 9114 | 2061 | 4.42 | 9334 | 5133 | 1.82 | | | 0/0 | 2566 | 1726 | 1.49 |
| native from scratch | 13481 | 3967 | 3.40 | 12291 | 7608 | 1.62 | | | 0/0 | 3003 | 2100 | 1.43 |
| byte after native | 3467 | 1476 | 2.35 | 5067 | 3912 | 1.30 | | | 0/0 | 971 | 801 | 1.21 |
#+TBLFM: $4=$2/$3;f2::$7=$5/$6;f2::$10=$9/$8;f2::$13=$11/$12;f2
```
Menu:
1. Write a jbuild file, autogenerated from jbuild.in because we need to fill in
some information at build-time (really, at configure time, but TODO), such as
whether or not clang is enabled.
2. Nuke lots of stuff from infer/src/Makefile that is now in the jbuild file
3. The jbuild file lives in infer/src/ so it can see all the sources. If we put it somewhere else, eg, infer/, then `jbuilder` scans too many files (all irrelevant) and takes 2.5s to start instead of .8s. Adding irrelevant directories to jbuild-ignore does not help.
4. jbuilder does not support subdirectories, so resort to listing all the
source files in the generated jbuild (only source directories need to be
manually listed in jbuild.in though). Still, the generated .merlin is wrong
and makes merlin find source files in _build, so manually tune it to get
good merlin support. We also lose some of merlin for unit tests as it
cannot see their build artefacts anymore.
5. checkCopyright gets its own jbuild because it's standalone. Also, remove
some deprecation warnings in checkCopyright due to the new version of Core from
a while ago.
6. Drop less-used Makefile features (they had regressed anyway) such as
building individual modules. Also, building mod_dep.pdf now takes all the
source files available so they better build (before, it would only take the
source files from the config, eg with or without clang) (that's pretty minor).
7. The toplevel is now built as a custom toplevel because that was easier. It
should soon be even easier: https://github.com/janestreet/jbuilder/issues/210
8. Move BUILTINS.mli to BUILTINS.ml because jbuilder is not happy about
interface files without implementations.
In particular, I did not try to migrate too much of the Makefile logic to jbuilder,
more can be done in the future.
Reviewed By: jberdine
Differential Revision: D5573661
fbshipit-source-id: 4ca6d8f
7 years ago
|
|
|
byte src_build_common src_build test_build: fb-setup
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(BUILD_C_ANALYZERS),yes)
|
|
|
|
byte src_build src_build_common test_build: clang_plugin
|
|
|
|
endif
|
|
|
|
|
|
|
|
$(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))
|
|
|
|
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)"; \
|
|
|
|
export CXX="$(CXX)" CXXFLAGS="$(CXXFLAGS)"; \
|
|
|
|
export CPP="$(CPP)" LDFLAGS="$(LDFLAGS)" LIBS="$(LIBS)"; \
|
|
|
|
$(FCP_DIR)/clang/setup.sh --only-check-install || \
|
|
|
|
$(FCP_DIR)/clang/setup.sh $(INFER_FCP_SETUP_OPTS)
|
|
|
|
|
|
|
|
.PHONY: clang_plugin
|
|
|
|
clang_plugin: clang_setup
|
|
|
|
ifeq ($(IS_RELEASE_TREE),no)
|
|
|
|
$(QUIET)$(call silent_on_success,Building clang plugin,\
|
|
|
|
$(MAKE) -C $(FCP_DIR)/libtooling all \
|
|
|
|
CC=$(CC) CXX=$(CXX) \
|
|
|
|
CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" \
|
|
|
|
CPP="$(CPP)" LDFLAGS="$(LDFLAGS)" LIBS="$(LIBS)" \
|
|
|
|
LOCAL_CLANG=$(CLANG_PREFIX)/bin/clang \
|
|
|
|
CLANG_PREFIX=$(CLANG_PREFIX) \
|
|
|
|
CLANG_INCLUDES=$(CLANG_INCLUDES))
|
|
|
|
$(QUIET)$(call silent_on_success,Building clang plugin OCaml interface,\
|
|
|
|
$(MAKE) -C $(FCP_DIR)/clang-ocaml all \
|
|
|
|
build/clang_ast_proj.ml build/clang_ast_proj.mli \
|
|
|
|
CC=$(CC) CXX=$(CXX) \
|
|
|
|
CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" \
|
|
|
|
CPP="$(CPP)" LDFLAGS="$(LDFLAGS)" LIBS="$(LIBS)" \
|
|
|
|
LOCAL_CLANG=$(CLANG_PREFIX)/bin/clang \
|
|
|
|
CLANG_PREFIX=$(CLANG_PREFIX) \
|
|
|
|
CLANG_INCLUDES=$(CLANG_INCLUDES))
|
|
|
|
endif
|
|
|
|
|
|
|
|
.PHONY: ocaml_unit_test
|
|
|
|
ocaml_unit_test: test_build
|
|
|
|
$(QUIET)$(call silent_on_success,Running OCaml unit tests,\
|
[make] s/ocamlbuild/jbuilder/g
Summary:
Use jbuilder to build infer instead of ocamlbuild. This is mainly to get faster builds:
```
times in 10ms, ±differences measured in speedups, 4 cores
| | ocb total | jb | ±total | ocb user | jb | ±user | ocb cpu | jb | ±cpu | ocb sys | jb | ±sys |
|-----------------------------------+-----------+------+--------+----------+------+-------+---------+-----+------+---------+------+------|
| byte from scratch | 6428 | 2456 | 2.62 | 7743 | 6662 | 1.16 | 138 | 331 | 2.40 | 1184 | 1477 | 0.80 |
| native from scratch | 9841 | 4289 | 2.29 | 9530 | 8834 | 1.08 | 110 | 245 | 2.23 | 1373 | 1712 | 0.80 |
| byte after native | 29578 | 1602 | 18.46 | 4514 | 4640 | 0.97 | 170 | 325 | 1.91 | 543 | 576 | 0.94 |
| change infer.ml byte | 344 | 282 | 1.22 | 292 | 215 | 1.36 | 96 | 99 | 1.03 | 040 | 066 | 0.61 |
| change infer.ml native | 837 | 223 | 3.75 | 789 | 174 | 4.53 | 98 | 99 | 1.01 | 036 | 47 | 0.77 |
| change Config.ml byte | 451 | 339 | 1.33 | 382 | 336 | 1.14 | 97 | 122 | 1.26 | 056 | 80 | 0.70 |
| change Config.ml native | 4024 | 1760 | 2.29 | 4585 | 4225 | 1.09 | 127 | 276 | 2.17 | 559 | 644 | 0.87 |
| change cFrontend_config.ml byte | 348 | 643 | 0.54 | 297 | 330 | 0.90 | 96 | 67 | 0.70 | 038 | 102 | 0.37 |
| change cFrontend_config.ml native | 1480 | 584 | 2.53 | 1435 | 906 | 1.58 | 106 | 185 | 1.75 | 136 | 178 | 0.76 |
#+TBLFM: $4=$2/$3;f2::$7=$5/$6;f2::$10=$9/$8;f2::$13=$11/$12;f2
50 cores
| | ocb total | jb | ±total | ocb user | jb | ±user | ocb cpu | jb | ±cpu | ocb sys | jb | ±sys |
|---------------------+-----------+------+--------+----------+------+-------+---------+----+------+---------+------+------|
| byte from scratch | 9114 | 2061 | 4.42 | 9334 | 5133 | 1.82 | | | 0/0 | 2566 | 1726 | 1.49 |
| native from scratch | 13481 | 3967 | 3.40 | 12291 | 7608 | 1.62 | | | 0/0 | 3003 | 2100 | 1.43 |
| byte after native | 3467 | 1476 | 2.35 | 5067 | 3912 | 1.30 | | | 0/0 | 971 | 801 | 1.21 |
#+TBLFM: $4=$2/$3;f2::$7=$5/$6;f2::$10=$9/$8;f2::$13=$11/$12;f2
```
Menu:
1. Write a jbuild file, autogenerated from jbuild.in because we need to fill in
some information at build-time (really, at configure time, but TODO), such as
whether or not clang is enabled.
2. Nuke lots of stuff from infer/src/Makefile that is now in the jbuild file
3. The jbuild file lives in infer/src/ so it can see all the sources. If we put it somewhere else, eg, infer/, then `jbuilder` scans too many files (all irrelevant) and takes 2.5s to start instead of .8s. Adding irrelevant directories to jbuild-ignore does not help.
4. jbuilder does not support subdirectories, so resort to listing all the
source files in the generated jbuild (only source directories need to be
manually listed in jbuild.in though). Still, the generated .merlin is wrong
and makes merlin find source files in _build, so manually tune it to get
good merlin support. We also lose some of merlin for unit tests as it
cannot see their build artefacts anymore.
5. checkCopyright gets its own jbuild because it's standalone. Also, remove
some deprecation warnings in checkCopyright due to the new version of Core from
a while ago.
6. Drop less-used Makefile features (they had regressed anyway) such as
building individual modules. Also, building mod_dep.pdf now takes all the
source files available so they better build (before, it would only take the
source files from the config, eg with or without clang) (that's pretty minor).
7. The toplevel is now built as a custom toplevel because that was easier. It
should soon be even easier: https://github.com/janestreet/jbuilder/issues/210
8. Move BUILTINS.mli to BUILTINS.ml because jbuilder is not happy about
interface files without implementations.
In particular, I did not try to migrate too much of the Makefile logic to jbuilder,
more can be done in the future.
Reviewed By: jberdine
Differential Revision: D5573661
fbshipit-source-id: 4ca6d8f
7 years ago
|
|
|
$(BUILD_DIR)/test/inferunit.bc)
|
|
|
|
|
|
|
|
define silence_make
|
|
|
|
($(1) 2> >(grep -v "warning: \(ignoring old\|overriding\) \(commands\|recipe\) for target") \
|
|
|
|
; exit $${PIPESTATUS[0]})
|
|
|
|
endef
|
|
|
|
|
|
|
|
.PHONY: $(DIRECT_TESTS:%=direct_%_test)
|
|
|
|
$(DIRECT_TESTS:%=direct_%_test): infer
|
|
|
|
$(QUIET)$(call silent_on_success,Running test: $(subst _, ,$@),\
|
|
|
|
$(call silence_make,\
|
|
|
|
$(MAKE) -C \
|
|
|
|
$(INFER_DIR)/tests/codetoanalyze/$(shell printf $@ | cut -f 2 -d _)/$(shell printf $@ | cut -f 3 -d _) \
|
|
|
|
test))
|
|
|
|
|
|
|
|
.PHONY: $(DIRECT_TESTS:%=direct_%_print)
|
|
|
|
$(DIRECT_TESTS:%=direct_%_print): infer
|
|
|
|
$(QUIET)$(call silent_on_success,Running: $(subst _, ,$@),\
|
|
|
|
$(call silence_make,\
|
|
|
|
$(MAKE) -C \
|
|
|
|
$(INFER_DIR)/tests/codetoanalyze/$(shell printf $@ | cut -f 2 -d _)/$(shell printf $@ | cut -f 3 -d _) \
|
|
|
|
print))
|
|
|
|
|
|
|
|
.PHONY: $(DIRECT_TESTS:%=direct_%_clean)
|
|
|
|
$(DIRECT_TESTS:%=direct_%_clean):
|
|
|
|
$(QUIET)$(call silent_on_success,Cleaning: $(subst _, ,$@),\
|
|
|
|
$(call silence_make,\
|
|
|
|
$(MAKE) -C \
|
|
|
|
$(INFER_DIR)/tests/codetoanalyze/$(shell printf $@ | cut -f 2 -d _)/$(shell printf $@ | cut -f 3 -d _) \
|
|
|
|
clean))
|
|
|
|
|
|
|
|
.PHONY: $(DIRECT_TESTS:%=direct_%_replace)
|
|
|
|
$(DIRECT_TESTS:%=direct_%_replace): infer
|
|
|
|
$(QUIET)$(call silent_on_success,Recording: $(subst _, ,$@),\
|
|
|
|
$(call silence_make,\
|
|
|
|
$(MAKE) -C \
|
|
|
|
$(INFER_DIR)/tests/codetoanalyze/$(shell printf $@ | cut -f 2 -d _)/$(shell printf $@ | cut -f 3 -d _) \
|
|
|
|
replace))
|
|
|
|
|
|
|
|
.PHONY: direct_tests
|
|
|
|
direct_tests: $(DIRECT_TESTS:%=direct_%_test)
|
|
|
|
|
|
|
|
.PHONY: $(BUILD_SYSTEMS_TESTS:%=build_%_test)
|
|
|
|
$(BUILD_SYSTEMS_TESTS:%=build_%_test): infer
|
|
|
|
$(QUIET)$(call silent_on_success,Running test: $(subst _, ,$@),\
|
|
|
|
$(call silence_make,\
|
|
|
|
$(MAKE) -C $(INFER_DIR)/tests/build_systems/$(patsubst build_%_test,%,$@) test))
|
|
|
|
|
|
|
|
.PHONY: $(BUILD_SYSTEMS_TESTS:%=build_%_print)
|
|
|
|
$(BUILD_SYSTEMS_TESTS:%=build_%_print): infer
|
|
|
|
$(QUIET)$(call silent_on_success,Running: $(subst _, ,$@),\
|
|
|
|
$(call silence_make,\
|
|
|
|
$(MAKE) -C $(INFER_DIR)/tests/build_systems/$(patsubst build_%_print,%,$@) print))
|
|
|
|
|
|
|
|
.PHONY: $(BUILD_SYSTEMS_TESTS:%=build_%_clean)
|
|
|
|
$(BUILD_SYSTEMS_TESTS:%=build_%_clean):
|
|
|
|
$(QUIET)$(call silent_on_success,Cleaning: $(subst _, ,$@),\
|
|
|
|
$(call silence_make,\
|
|
|
|
$(MAKE) -C $(INFER_DIR)/tests/build_systems/$(patsubst build_%_clean,%,$@) clean))
|
|
|
|
|
|
|
|
.PHONY: $(BUILD_SYSTEMS_TESTS:%=build_%_replace)
|
|
|
|
$(BUILD_SYSTEMS_TESTS:%=build_%_replace): infer
|
|
|
|
$(QUIET)$(call silent_on_success,Recording: $(subst _, ,$@),\
|
|
|
|
$(call silence_make,\
|
|
|
|
$(MAKE) -C $(INFER_DIR)/tests/build_systems/$(patsubst build_%_replace,%,$@) replace))
|
|
|
|
|
|
|
|
.PHONY: build_systems_tests
|
|
|
|
build_systems_tests: $(BUILD_SYSTEMS_TESTS:%=build_%_test)
|
|
|
|
|
|
|
|
.PHONY: endtoend_test
|
|
|
|
endtoend_test: $(BUILD_SYSTEMS_TESTS:%=build_%_test) $(DIRECT_TESTS:%=direct_%_test)
|
|
|
|
|
|
|
|
.PHONY: check_missing_mli
|
|
|
|
check_missing_mli:
|
|
|
|
$(QUIET)for x in $$(find $(INFER_DIR)/src -name "*.ml"); do \
|
|
|
|
test -f "$$x"i || echo Missing "$$x"i; done
|
|
|
|
|
[make] s/ocamlbuild/jbuilder/g
Summary:
Use jbuilder to build infer instead of ocamlbuild. This is mainly to get faster builds:
```
times in 10ms, ±differences measured in speedups, 4 cores
| | ocb total | jb | ±total | ocb user | jb | ±user | ocb cpu | jb | ±cpu | ocb sys | jb | ±sys |
|-----------------------------------+-----------+------+--------+----------+------+-------+---------+-----+------+---------+------+------|
| byte from scratch | 6428 | 2456 | 2.62 | 7743 | 6662 | 1.16 | 138 | 331 | 2.40 | 1184 | 1477 | 0.80 |
| native from scratch | 9841 | 4289 | 2.29 | 9530 | 8834 | 1.08 | 110 | 245 | 2.23 | 1373 | 1712 | 0.80 |
| byte after native | 29578 | 1602 | 18.46 | 4514 | 4640 | 0.97 | 170 | 325 | 1.91 | 543 | 576 | 0.94 |
| change infer.ml byte | 344 | 282 | 1.22 | 292 | 215 | 1.36 | 96 | 99 | 1.03 | 040 | 066 | 0.61 |
| change infer.ml native | 837 | 223 | 3.75 | 789 | 174 | 4.53 | 98 | 99 | 1.01 | 036 | 47 | 0.77 |
| change Config.ml byte | 451 | 339 | 1.33 | 382 | 336 | 1.14 | 97 | 122 | 1.26 | 056 | 80 | 0.70 |
| change Config.ml native | 4024 | 1760 | 2.29 | 4585 | 4225 | 1.09 | 127 | 276 | 2.17 | 559 | 644 | 0.87 |
| change cFrontend_config.ml byte | 348 | 643 | 0.54 | 297 | 330 | 0.90 | 96 | 67 | 0.70 | 038 | 102 | 0.37 |
| change cFrontend_config.ml native | 1480 | 584 | 2.53 | 1435 | 906 | 1.58 | 106 | 185 | 1.75 | 136 | 178 | 0.76 |
#+TBLFM: $4=$2/$3;f2::$7=$5/$6;f2::$10=$9/$8;f2::$13=$11/$12;f2
50 cores
| | ocb total | jb | ±total | ocb user | jb | ±user | ocb cpu | jb | ±cpu | ocb sys | jb | ±sys |
|---------------------+-----------+------+--------+----------+------+-------+---------+----+------+---------+------+------|
| byte from scratch | 9114 | 2061 | 4.42 | 9334 | 5133 | 1.82 | | | 0/0 | 2566 | 1726 | 1.49 |
| native from scratch | 13481 | 3967 | 3.40 | 12291 | 7608 | 1.62 | | | 0/0 | 3003 | 2100 | 1.43 |
| byte after native | 3467 | 1476 | 2.35 | 5067 | 3912 | 1.30 | | | 0/0 | 971 | 801 | 1.21 |
#+TBLFM: $4=$2/$3;f2::$7=$5/$6;f2::$10=$9/$8;f2::$13=$11/$12;f2
```
Menu:
1. Write a jbuild file, autogenerated from jbuild.in because we need to fill in
some information at build-time (really, at configure time, but TODO), such as
whether or not clang is enabled.
2. Nuke lots of stuff from infer/src/Makefile that is now in the jbuild file
3. The jbuild file lives in infer/src/ so it can see all the sources. If we put it somewhere else, eg, infer/, then `jbuilder` scans too many files (all irrelevant) and takes 2.5s to start instead of .8s. Adding irrelevant directories to jbuild-ignore does not help.
4. jbuilder does not support subdirectories, so resort to listing all the
source files in the generated jbuild (only source directories need to be
manually listed in jbuild.in though). Still, the generated .merlin is wrong
and makes merlin find source files in _build, so manually tune it to get
good merlin support. We also lose some of merlin for unit tests as it
cannot see their build artefacts anymore.
5. checkCopyright gets its own jbuild because it's standalone. Also, remove
some deprecation warnings in checkCopyright due to the new version of Core from
a while ago.
6. Drop less-used Makefile features (they had regressed anyway) such as
building individual modules. Also, building mod_dep.pdf now takes all the
source files available so they better build (before, it would only take the
source files from the config, eg with or without clang) (that's pretty minor).
7. The toplevel is now built as a custom toplevel because that was easier. It
should soon be even easier: https://github.com/janestreet/jbuilder/issues/210
8. Move BUILTINS.mli to BUILTINS.ml because jbuilder is not happy about
interface files without implementations.
In particular, I did not try to migrate too much of the Makefile logic to jbuilder,
more can be done in the future.
Reviewed By: jberdine
Differential Revision: D5573661
fbshipit-source-id: 4ca6d8f
7 years ago
|
|
|
# depend on test_build because jbuilder doesn't like running concurrently with itself
|
|
|
|
.PHONY: toplevel_test
|
|
|
|
toplevel_test: src_build_common | test_build
|
|
|
|
# build with TEST=1 as the infer_repl scripts expects to find the toplevel in the test build
|
|
|
|
$(QUIET)$(call silent_on_success,Building infer toplevel (test mode),\
|
|
|
|
$(MAKE) -C $(SRC_DIR) TEST=1 toplevel)
|
|
|
|
|
[make] s/ocamlbuild/jbuilder/g
Summary:
Use jbuilder to build infer instead of ocamlbuild. This is mainly to get faster builds:
```
times in 10ms, ±differences measured in speedups, 4 cores
| | ocb total | jb | ±total | ocb user | jb | ±user | ocb cpu | jb | ±cpu | ocb sys | jb | ±sys |
|-----------------------------------+-----------+------+--------+----------+------+-------+---------+-----+------+---------+------+------|
| byte from scratch | 6428 | 2456 | 2.62 | 7743 | 6662 | 1.16 | 138 | 331 | 2.40 | 1184 | 1477 | 0.80 |
| native from scratch | 9841 | 4289 | 2.29 | 9530 | 8834 | 1.08 | 110 | 245 | 2.23 | 1373 | 1712 | 0.80 |
| byte after native | 29578 | 1602 | 18.46 | 4514 | 4640 | 0.97 | 170 | 325 | 1.91 | 543 | 576 | 0.94 |
| change infer.ml byte | 344 | 282 | 1.22 | 292 | 215 | 1.36 | 96 | 99 | 1.03 | 040 | 066 | 0.61 |
| change infer.ml native | 837 | 223 | 3.75 | 789 | 174 | 4.53 | 98 | 99 | 1.01 | 036 | 47 | 0.77 |
| change Config.ml byte | 451 | 339 | 1.33 | 382 | 336 | 1.14 | 97 | 122 | 1.26 | 056 | 80 | 0.70 |
| change Config.ml native | 4024 | 1760 | 2.29 | 4585 | 4225 | 1.09 | 127 | 276 | 2.17 | 559 | 644 | 0.87 |
| change cFrontend_config.ml byte | 348 | 643 | 0.54 | 297 | 330 | 0.90 | 96 | 67 | 0.70 | 038 | 102 | 0.37 |
| change cFrontend_config.ml native | 1480 | 584 | 2.53 | 1435 | 906 | 1.58 | 106 | 185 | 1.75 | 136 | 178 | 0.76 |
#+TBLFM: $4=$2/$3;f2::$7=$5/$6;f2::$10=$9/$8;f2::$13=$11/$12;f2
50 cores
| | ocb total | jb | ±total | ocb user | jb | ±user | ocb cpu | jb | ±cpu | ocb sys | jb | ±sys |
|---------------------+-----------+------+--------+----------+------+-------+---------+----+------+---------+------+------|
| byte from scratch | 9114 | 2061 | 4.42 | 9334 | 5133 | 1.82 | | | 0/0 | 2566 | 1726 | 1.49 |
| native from scratch | 13481 | 3967 | 3.40 | 12291 | 7608 | 1.62 | | | 0/0 | 3003 | 2100 | 1.43 |
| byte after native | 3467 | 1476 | 2.35 | 5067 | 3912 | 1.30 | | | 0/0 | 971 | 801 | 1.21 |
#+TBLFM: $4=$2/$3;f2::$7=$5/$6;f2::$10=$9/$8;f2::$13=$11/$12;f2
```
Menu:
1. Write a jbuild file, autogenerated from jbuild.in because we need to fill in
some information at build-time (really, at configure time, but TODO), such as
whether or not clang is enabled.
2. Nuke lots of stuff from infer/src/Makefile that is now in the jbuild file
3. The jbuild file lives in infer/src/ so it can see all the sources. If we put it somewhere else, eg, infer/, then `jbuilder` scans too many files (all irrelevant) and takes 2.5s to start instead of .8s. Adding irrelevant directories to jbuild-ignore does not help.
4. jbuilder does not support subdirectories, so resort to listing all the
source files in the generated jbuild (only source directories need to be
manually listed in jbuild.in though). Still, the generated .merlin is wrong
and makes merlin find source files in _build, so manually tune it to get
good merlin support. We also lose some of merlin for unit tests as it
cannot see their build artefacts anymore.
5. checkCopyright gets its own jbuild because it's standalone. Also, remove
some deprecation warnings in checkCopyright due to the new version of Core from
a while ago.
6. Drop less-used Makefile features (they had regressed anyway) such as
building individual modules. Also, building mod_dep.pdf now takes all the
source files available so they better build (before, it would only take the
source files from the config, eg with or without clang) (that's pretty minor).
7. The toplevel is now built as a custom toplevel because that was easier. It
should soon be even easier: https://github.com/janestreet/jbuilder/issues/210
8. Move BUILTINS.mli to BUILTINS.ml because jbuilder is not happy about
interface files without implementations.
In particular, I did not try to migrate too much of the Makefile logic to jbuilder,
more can be done in the future.
Reviewed By: jberdine
Differential Revision: D5573661
fbshipit-source-id: 4ca6d8f
7 years ago
|
|
|
.PHONY: toplevel
|
|
|
|
toplevel: src_build_common
|
|
|
|
$(QUIET)$(call silent_on_success,Building infer toplevel,\
|
|
|
|
$(MAKE) -C $(SRC_DIR) toplevel)
|
|
|
|
|
|
|
|
.PHONY: checkCopyright
|
|
|
|
checkCopyright: src_build_common
|
|
|
|
$(QUIET)$(call silent_on_success,Building checkCopyright,\
|
|
|
|
$(MAKE) -C $(SRC_DIR) checkCopyright)
|
|
|
|
|
|
|
|
.PHONY: validate-skel
|
|
|
|
validate-skel:
|
|
|
|
ifeq ($(IS_FACEBOOK_TREE),yes)
|
|
|
|
$(QUIET)$(call silent_on_success,Validating facebook/,\
|
|
|
|
$(MAKE) -C facebook validate)
|
|
|
|
endif
|
|
|
|
|
|
|
|
.PHONY: crash_if_not_all_analyzers_enabled
|
|
|
|
crash_if_not_all_analyzers_enabled:
|
|
|
|
ifneq ($(BUILD_C_ANALYZERS)+$(BUILD_JAVA_ANALYZERS),yes+yes)
|
|
|
|
ifneq ($(BUILD_C_ANALYZERS),yes)
|
|
|
|
@echo '*** ERROR: Cannot run the full tests: the Clang analyzers are disabled.'
|
|
|
|
@echo '*** ERROR: You can run clang-only tests with:'
|
|
|
|
@echo '*** ERROR:'
|
|
|
|
@echo '*** ERROR: make config_tests'
|
|
|
|
@echo '*** ERROR:'
|
|
|
|
endif
|
|
|
|
ifneq ($(BUILD_JAVA_ANALYZERS),yes)
|
|
|
|
@echo '*** ERROR: Cannot run the full tests: the Java analyzers are disabled.'
|
|
|
|
@echo '*** ERROR: You can run Java-only tests with:'
|
|
|
|
@echo '*** ERROR:'
|
|
|
|
@echo '*** ERROR: make config_tests'
|
|
|
|
@echo '*** ERROR:'
|
|
|
|
endif
|
|
|
|
@echo '*** ERROR: To run the full set of tests, please enable all the analyzers.'
|
|
|
|
@exit 1
|
|
|
|
else
|
|
|
|
@:
|
|
|
|
endif
|
|
|
|
|
|
|
|
.PHONY: mod_dep
|
|
|
|
mod_dep: src_build_common
|
|
|
|
$(QUIET)$(call silent_on_success,Building Infer source dependency graph,\
|
|
|
|
$(MAKE) -C $(SRC_DIR) mod_dep.dot)
|
|
|
|
|
|
|
|
.PHONY: config_tests
|
|
|
|
config_tests: test_build ocaml_unit_test endtoend_test checkCopyright validate-skel mod_dep
|
|
|
|
|
|
|
|
.PHONY: test
|
|
|
|
test: crash_if_not_all_analyzers_enabled config_tests
|
|
|
|
ifeq (,$(findstring s,$(MAKEFLAGS)))
|
|
|
|
$(QUIET)echo "$(TERM_INFO)ALL TESTS PASSED$(TERM_RESET)"
|
|
|
|
endif
|
|
|
|
|
|
|
|
.PHONY: quick-test
|
|
|
|
quick-test: test_build ocaml_unit_test
|
|
|
|
|
|
|
|
.PHONY: test-replace
|
|
|
|
test-replace: $(BUILD_SYSTEMS_TESTS:%=build_%_replace) $(DIRECT_TESTS:%=direct_%_replace)
|
|
|
|
|
|
|
|
.PHONY: uninstall
|
|
|
|
uninstall:
|
|
|
|
$(REMOVE_DIR) $(DESTDIR)$(libdir)/infer/
|
|
|
|
$(REMOVE) $(DESTDIR)$(bindir)/infer
|
|
|
|
$(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 $(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)
|
|
|
|
test -d $(DESTDIR)$(libdir)/infer/facebook-clang-plugins/libtooling/build/ || \
|
|
|
|
$(MKDIR_P) $(DESTDIR)$(libdir)/infer/facebook-clang-plugins/libtooling/build/
|
|
|
|
$(QUIET)for i in $$(find facebook-clang-plugins/clang/install -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/
|
|
|
|
$(QUIET)for i in $$(find infer/models/cpp/include/ -type d); do \
|
|
|
|
test -d $(DESTDIR)$(libdir)/infer/$$i || \
|
|
|
|
$(MKDIR_P) $(DESTDIR)$(libdir)/infer/$$i; \
|
|
|
|
done
|
|
|
|
test -d $(DESTDIR)$(libdir)/infer/infer/lib/linter_rules/ || \
|
|
|
|
$(MKDIR_P) $(DESTDIR)$(libdir)/infer/infer/lib/linter_rules
|
|
|
|
endif
|
|
|
|
ifeq ($(BUILD_JAVA_ANALYZERS),yes)
|
|
|
|
test -d $(DESTDIR)$(libdir)/infer/infer/lib/java/ || \
|
|
|
|
$(MKDIR_P) $(DESTDIR)$(libdir)/infer/infer/lib/java/
|
|
|
|
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
|
|
|
|
$(QUIET)for i in $$(find facebook-clang-plugins/clang/install -not -type d); do \
|
|
|
|
$(INSTALL_PROGRAM) -C $$i $(DESTDIR)$(libdir)/infer/$$i; \
|
|
|
|
done
|
|
|
|
$(QUIET)for i in $$(find infer/lib/clang_wrappers/*); do \
|
|
|
|
$(INSTALL_PROGRAM) -C $$i $(DESTDIR)$(libdir)/infer/$$i; \
|
|
|
|
done
|
[CLI] switch to infer-<command> (symlinks) executables
Summary:
Introduce `infer-<command>` for each command, except for internal commands
(only `infer-clang` for now) which are not exported. Install these executables
(which are just symlinks to `infer`) on `make install`. The main executable
looks at the name it was invoked with to figure out if it should behave as a
particular command.
Get rid of `InferClang`, `InferAnalyze`, and `InferPrint`. As a bonus, we now
only need to build one executable: `infer`, which should be a few seconds
faster (less link time).
`InferAnalyze` is now `infer-analyze` and `InferPrint` is `infer-print`. To run
`InferClang`, use a symlink named `clang`, `clang++`, etc. to `infer`. There
are such symlinks available in "infer/lib/wrappers/" already.
I also noticed that the scripts in xcodebuild_wrappers/ don't seem useful
anymore, so use wrappers/ instead, as for `make`.
Reviewed By: mbouaziz
Differential Revision: D5036495
fbshipit-source-id: 4a90030
8 years ago
|
|
|
# only for files that point to infer
|
|
|
|
(cd $(DESTDIR)$(libdir)/infer/infer/lib/wrappers/ && \
|
|
|
|
$(foreach cc,$(shell find $(LIB_DIR)/wrappers -type l), \
|
[CLI] switch to infer-<command> (symlinks) executables
Summary:
Introduce `infer-<command>` for each command, except for internal commands
(only `infer-clang` for now) which are not exported. Install these executables
(which are just symlinks to `infer`) on `make install`. The main executable
looks at the name it was invoked with to figure out if it should behave as a
particular command.
Get rid of `InferClang`, `InferAnalyze`, and `InferPrint`. As a bonus, we now
only need to build one executable: `infer`, which should be a few seconds
faster (less link time).
`InferAnalyze` is now `infer-analyze` and `InferPrint` is `infer-print`. To run
`InferClang`, use a symlink named `clang`, `clang++`, etc. to `infer`. There
are such symlinks available in "infer/lib/wrappers/" already.
I also noticed that the scripts in xcodebuild_wrappers/ don't seem useful
anymore, so use wrappers/ instead, as for `make`.
Reviewed By: mbouaziz
Differential Revision: D5036495
fbshipit-source-id: 4a90030
8 years ago
|
|
|
[ $(cc) -ef $(INFER_BIN) ] && \
|
|
|
|
$(REMOVE) $(notdir $(cc)) && \
|
[CLI] switch to infer-<command> (symlinks) executables
Summary:
Introduce `infer-<command>` for each command, except for internal commands
(only `infer-clang` for now) which are not exported. Install these executables
(which are just symlinks to `infer`) on `make install`. The main executable
looks at the name it was invoked with to figure out if it should behave as a
particular command.
Get rid of `InferClang`, `InferAnalyze`, and `InferPrint`. As a bonus, we now
only need to build one executable: `infer`, which should be a few seconds
faster (less link time).
`InferAnalyze` is now `infer-analyze` and `InferPrint` is `infer-print`. To run
`InferClang`, use a symlink named `clang`, `clang++`, etc. to `infer`. There
are such symlinks available in "infer/lib/wrappers/" already.
I also noticed that the scripts in xcodebuild_wrappers/ don't seem useful
anymore, so use wrappers/ instead, as for `make`.
Reviewed By: mbouaziz
Differential Revision: D5036495
fbshipit-source-id: 4a90030
8 years ago
|
|
|
$(LN_S) ../../bin/infer $(notdir $(cc));))
|
|
|
|
$(QUIET)for i in $$(find infer/lib/specs/*); do \
|
|
|
|
$(INSTALL_DATA) -C $$i $(DESTDIR)$(libdir)/infer/$$i; \
|
|
|
|
done
|
|
|
|
$(QUIET)for i in $$(find infer/models/cpp/include/ -not -type d); do \
|
|
|
|
$(INSTALL_DATA) -C $$i $(DESTDIR)$(libdir)/infer/$$i; \
|
|
|
|
done
|
|
|
|
$(INSTALL_DATA) -C infer/lib/linter_rules/linters.al \
|
|
|
|
$(DESTDIR)$(libdir)/infer/infer/lib/linter_rules/linters.al
|
|
|
|
endif
|
|
|
|
ifeq ($(BUILD_JAVA_ANALYZERS),yes)
|
|
|
|
$(INSTALL_DATA) -C infer/annotations/annotations.jar \
|
|
|
|
$(DESTDIR)$(libdir)/infer/infer/annotations/annotations.jar
|
|
|
|
$(QUIET)for i in infer/lib/java/*.jar; do \
|
|
|
|
$(INSTALL_DATA) -C $$i $(DESTDIR)$(libdir)/infer/$$i; \
|
|
|
|
done
|
|
|
|
$(INSTALL_PROGRAM) -C $(LIB_DIR)/wrappers/javac \
|
|
|
|
$(DESTDIR)$(libdir)/infer/infer/lib/wrappers/
|
|
|
|
endif
|
|
|
|
$(QUIET)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.py \
|
|
|
|
$(DESTDIR)$(libdir)/infer/infer/lib/python/infer.py
|
|
|
|
$(INSTALL_PROGRAM) -C infer/lib/python/inferTraceBugs \
|
|
|
|
$(DESTDIR)$(libdir)/infer/infer/lib/python/inferTraceBugs
|
|
|
|
$(INSTALL_PROGRAM) -C infer/lib/python/report.py \
|
|
|
|
$(DESTDIR)$(libdir)/infer/infer/lib/python/report.py
|
|
|
|
$(INSTALL_PROGRAM) -C $(INFER_BIN) $(DESTDIR)$(libdir)/infer/infer/bin/
|
|
|
|
(cd $(DESTDIR)$(bindir)/ && \
|
|
|
|
$(REMOVE) infer && \
|
|
|
|
$(LN_S) $(libdir_relative_to_bindir)/infer/infer/bin/infer infer)
|
[CLI] switch to infer-<command> (symlinks) executables
Summary:
Introduce `infer-<command>` for each command, except for internal commands
(only `infer-clang` for now) which are not exported. Install these executables
(which are just symlinks to `infer`) on `make install`. The main executable
looks at the name it was invoked with to figure out if it should behave as a
particular command.
Get rid of `InferClang`, `InferAnalyze`, and `InferPrint`. As a bonus, we now
only need to build one executable: `infer`, which should be a few seconds
faster (less link time).
`InferAnalyze` is now `infer-analyze` and `InferPrint` is `infer-print`. To run
`InferClang`, use a symlink named `clang`, `clang++`, etc. to `infer`. There
are such symlinks available in "infer/lib/wrappers/" already.
I also noticed that the scripts in xcodebuild_wrappers/ don't seem useful
anymore, so use wrappers/ instead, as for `make`.
Reviewed By: mbouaziz
Differential Revision: D5036495
fbshipit-source-id: 4a90030
8 years ago
|
|
|
for alias in $(INFER_COMMANDS); do \
|
|
|
|
(cd $(DESTDIR)$(bindir)/ && \
|
|
|
|
$(REMOVE) $$alias && \
|
|
|
|
$(LN_S) infer $$alias); done
|
|
|
|
for alias in $(INFER_COMMANDS); do \
|
|
|
|
(cd $(DESTDIR)$(libdir)/infer/infer/bin && \
|
|
|
|
$(REMOVE) $$alias && \
|
|
|
|
$(LN_S) infer $$alias); done
|
|
|
|
$(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
|
|
|
|
endif
|
|
|
|
|
|
|
|
# Nuke objects built from OCaml. Useful when changing the OCaml compiler, for instance.
|
|
|
|
.PHONY: ocaml_clean
|
|
|
|
ocaml_clean:
|
|
|
|
ifeq ($(IS_RELEASE_TREE),no)
|
|
|
|
ifeq ($(BUILD_C_ANALYZERS),yes)
|
|
|
|
$(QUIET)$(call silent_on_success,Cleaning facebook-clang-plugins OCaml build,\
|
|
|
|
$(MAKE) -C $(FCP_DIR)/clang-ocaml clean)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
$(QUIET)$(call silent_on_success,Cleaning infer OCaml build,\
|
|
|
|
$(MAKE) -C $(SRC_DIR) clean)
|
|
|
|
$(QUIET)$(call silent_on_success,Cleaning ocamldot,\
|
|
|
|
$(MAKE) -C $(DEPENDENCIES_DIR)/ocamldot clean)
|
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
clean: test_clean ocaml_clean
|
|
|
|
ifeq ($(IS_RELEASE_TREE),no)
|
|
|
|
ifeq ($(BUILD_C_ANALYZERS),yes)
|
|
|
|
$(QUIET)$(call silent_on_success,Cleaning facebook-clang-plugins C++ build,\
|
|
|
|
$(MAKE) -C $(FCP_DIR) clean)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
$(QUIET)$(call silent_on_success,Cleaning Java annotations,\
|
|
|
|
$(MAKE) -C $(ANNOTATIONS_DIR) clean)
|
|
|
|
$(QUIET)$(call silent_on_success,Cleaning infer models,\
|
|
|
|
$(MAKE) -C $(MODELS_DIR) clean)
|
|
|
|
ifeq ($(IS_FACEBOOK_TREE),yes)
|
|
|
|
$(QUIET)$(call silent_on_success,Cleaning facebook/,\
|
|
|
|
$(MAKE) -C facebook clean)
|
|
|
|
endif
|
|
|
|
$(QUIET)$(call silent_on_success,Removing *.o and *.o.sh,\
|
|
|
|
find $(INFER_DIR)/tests \( -name '*.o' -o -name '*.o.sh' \) -delete)
|
|
|
|
$(QUIET)$(call silent_on_success,Removing build logs,\
|
|
|
|
$(REMOVE_DIR) _build_logs $(MAN_DIR))
|
|
|
|
|
|
|
|
.PHONY: conf-clean
|
|
|
|
conf-clean: clean
|
|
|
|
$(REMOVE) $(PYTHON_DIR)/inferlib/*.pyc
|
|
|
|
$(REMOVE) $(PYTHON_DIR)/inferlib/*/*.pyc
|
|
|
|
$(REMOVE) .buckversion
|
|
|
|
$(REMOVE) Makefile.config
|
|
|
|
$(REMOVE) acinclude.m4
|
|
|
|
$(REMOVE) aclocal.m4
|
|
|
|
$(REMOVE_DIR) autom4te.cache/
|
|
|
|
$(REMOVE) config.log
|
|
|
|
$(REMOVE) config.status
|
|
|
|
$(REMOVE) configure
|
|
|
|
$(REMOVE_DIR) $(MODELS_DIR)/c/out/
|
|
|
|
$(REMOVE_DIR) $(MODELS_DIR)/cpp/out/
|
|
|
|
$(REMOVE_DIR) $(MODELS_DIR)/java/infer-out/
|
|
|
|
$(REMOVE_DIR) $(MODELS_DIR)/objc/out/
|
|
|
|
|
|
|
|
|
|
|
|
# opam package to hold infer dependencies
|
|
|
|
INFER_PKG_OPAMLOCK=infer-lock-deps
|
|
|
|
|
|
|
|
# phony because it depends on opam's internal state
|
|
|
|
.PHONY: opam.lock
|
|
|
|
opam.lock: opam
|
|
|
|
$(QUIET)if test x"$$(git status --porcelain -- opam)" != "x"; then \
|
|
|
|
echo "ERROR: Changes to 'opam' detected." 1>&2; \
|
|
|
|
echo "ERROR: Please commit or revert your changes before updating opam.lock." 1>&2; \
|
|
|
|
echo "ERROR: This is because opam.lock is generated from the HEAD commit." 1>&2; \
|
|
|
|
exit 1; \
|
|
|
|
fi
|
|
|
|
$(QUIET)$(call silent_on_success,opam update,$(OPAM) update)
|
|
|
|
$(QUIET)$(call silent_on_success,installing dependencies $(INFER_PKG_OPAMLOCK) opam package,\
|
|
|
|
OPAMSWITCH=$(OPAMSWITCH); \
|
|
|
|
$(OPAM) pin add --yes --no-action -k git $(INFER_PKG_OPAMLOCK) .#HEAD; \
|
|
|
|
$(OPAM) install --deps-only --yes $(INFER_PKG_OPAMLOCK))
|
|
|
|
$(QUIET)$(call silent_on_success,generating opam.lock,\
|
|
|
|
$(OPAM) lock --pkg $(INFER_PKG_OPAMLOCK) > opam.lock)
|
|
|
|
|
[make] s/ocamlbuild/jbuilder/g
Summary:
Use jbuilder to build infer instead of ocamlbuild. This is mainly to get faster builds:
```
times in 10ms, ±differences measured in speedups, 4 cores
| | ocb total | jb | ±total | ocb user | jb | ±user | ocb cpu | jb | ±cpu | ocb sys | jb | ±sys |
|-----------------------------------+-----------+------+--------+----------+------+-------+---------+-----+------+---------+------+------|
| byte from scratch | 6428 | 2456 | 2.62 | 7743 | 6662 | 1.16 | 138 | 331 | 2.40 | 1184 | 1477 | 0.80 |
| native from scratch | 9841 | 4289 | 2.29 | 9530 | 8834 | 1.08 | 110 | 245 | 2.23 | 1373 | 1712 | 0.80 |
| byte after native | 29578 | 1602 | 18.46 | 4514 | 4640 | 0.97 | 170 | 325 | 1.91 | 543 | 576 | 0.94 |
| change infer.ml byte | 344 | 282 | 1.22 | 292 | 215 | 1.36 | 96 | 99 | 1.03 | 040 | 066 | 0.61 |
| change infer.ml native | 837 | 223 | 3.75 | 789 | 174 | 4.53 | 98 | 99 | 1.01 | 036 | 47 | 0.77 |
| change Config.ml byte | 451 | 339 | 1.33 | 382 | 336 | 1.14 | 97 | 122 | 1.26 | 056 | 80 | 0.70 |
| change Config.ml native | 4024 | 1760 | 2.29 | 4585 | 4225 | 1.09 | 127 | 276 | 2.17 | 559 | 644 | 0.87 |
| change cFrontend_config.ml byte | 348 | 643 | 0.54 | 297 | 330 | 0.90 | 96 | 67 | 0.70 | 038 | 102 | 0.37 |
| change cFrontend_config.ml native | 1480 | 584 | 2.53 | 1435 | 906 | 1.58 | 106 | 185 | 1.75 | 136 | 178 | 0.76 |
#+TBLFM: $4=$2/$3;f2::$7=$5/$6;f2::$10=$9/$8;f2::$13=$11/$12;f2
50 cores
| | ocb total | jb | ±total | ocb user | jb | ±user | ocb cpu | jb | ±cpu | ocb sys | jb | ±sys |
|---------------------+-----------+------+--------+----------+------+-------+---------+----+------+---------+------+------|
| byte from scratch | 9114 | 2061 | 4.42 | 9334 | 5133 | 1.82 | | | 0/0 | 2566 | 1726 | 1.49 |
| native from scratch | 13481 | 3967 | 3.40 | 12291 | 7608 | 1.62 | | | 0/0 | 3003 | 2100 | 1.43 |
| byte after native | 3467 | 1476 | 2.35 | 5067 | 3912 | 1.30 | | | 0/0 | 971 | 801 | 1.21 |
#+TBLFM: $4=$2/$3;f2::$7=$5/$6;f2::$10=$9/$8;f2::$13=$11/$12;f2
```
Menu:
1. Write a jbuild file, autogenerated from jbuild.in because we need to fill in
some information at build-time (really, at configure time, but TODO), such as
whether or not clang is enabled.
2. Nuke lots of stuff from infer/src/Makefile that is now in the jbuild file
3. The jbuild file lives in infer/src/ so it can see all the sources. If we put it somewhere else, eg, infer/, then `jbuilder` scans too many files (all irrelevant) and takes 2.5s to start instead of .8s. Adding irrelevant directories to jbuild-ignore does not help.
4. jbuilder does not support subdirectories, so resort to listing all the
source files in the generated jbuild (only source directories need to be
manually listed in jbuild.in though). Still, the generated .merlin is wrong
and makes merlin find source files in _build, so manually tune it to get
good merlin support. We also lose some of merlin for unit tests as it
cannot see their build artefacts anymore.
5. checkCopyright gets its own jbuild because it's standalone. Also, remove
some deprecation warnings in checkCopyright due to the new version of Core from
a while ago.
6. Drop less-used Makefile features (they had regressed anyway) such as
building individual modules. Also, building mod_dep.pdf now takes all the
source files available so they better build (before, it would only take the
source files from the config, eg with or without clang) (that's pretty minor).
7. The toplevel is now built as a custom toplevel because that was easier. It
should soon be even easier: https://github.com/janestreet/jbuilder/issues/210
8. Move BUILTINS.mli to BUILTINS.ml because jbuilder is not happy about
interface files without implementations.
In particular, I did not try to migrate too much of the Makefile logic to jbuilder,
more can be done in the future.
Reviewed By: jberdine
Differential Revision: D5573661
fbshipit-source-id: 4ca6d8f
7 years ago
|
|
|
# This is a magical version number that doesn't reinstall the world when added on top of what we
|
|
|
|
# have in opam.lock. To upgrade this version number, manually try to install several utop versions
|
|
|
|
# until you find one that doesn't recompile the world. TODO(t20828442): get rid of magic
|
|
|
|
OPAM_DEV_DEPS = ocp-indent merlin tuareg utop.2.0.0
|
|
|
|
|
|
|
|
.PHONY: devsetup
|
|
|
|
devsetup: Makefile.autoconf
|
|
|
|
$(QUIET)[ $(OPAM) != "no" ] || (echo 'No `opam` found, aborting setup.' >&2; exit 1)
|
|
|
|
$(QUIET)$(call silent_on_success,installing $(OPAM_DEV_DEPS),\
|
|
|
|
OPAMSWITCH=$(OPAMSWITCH); $(OPAM) install --yes --no-checksum user-setup $(OPAM_DEV_DEPS))
|
|
|
|
$(QUIET)echo '$(TERM_INFO)*** Running `opam config setup -a`$(TERM_RESET)' >&2
|
|
|
|
$(QUIET)OPAMSWITCH=$(OPAMSWITCH); $(OPAM) config --yes setup -a
|
|
|
|
$(QUIET)echo '$(TERM_INFO)*** Running `opam user-setup`$(TERM_RESET)' >&2
|
|
|
|
$(QUIET)OPAMSWITCH=$(OPAMSWITCH); OPAMYES=1; $(OPAM) user-setup install
|
|
|
|
$(QUIET)if [ "$(PLATFORM)" = "Darwin" ] && ! $$(parallel -h | grep -q GNU); then \
|
|
|
|
echo '$(TERM_INFO)*** Installing GNU parallel$(TERM_RESET)' >&2; \
|
|
|
|
brew install parallel; \
|
|
|
|
fi
|
|
|
|
$(QUIET)if [ ! -d "$$HOME"/.parallel ]; then mkdir "$$HOME"/.parallel; fi
|
|
|
|
$(QUIET)touch "$$HOME"/.parallel/will-cite
|
|
|
|
# expand all occurrences of "~" in PATH and MANPATH
|
|
|
|
$(QUIET)infer_repo_is_in_path=$$(echo $${PATH//\~/$$HOME} | grep -q "$(ABSOLUTE_ROOT_DIR)"/infer/bin; echo $$?); \
|
|
|
|
infer_repo_is_in_manpath=$$(echo $${MANPATH//\~/$$HOME} | grep -q "$(ABSOLUTE_ROOT_DIR)"/infer/man; echo $$?); \
|
|
|
|
if [ "$$infer_repo_is_in_path" != "0" ] || [ "$$infer_repo_is_in_manpath" != "0" ]; then \
|
|
|
|
shell_config_file="<could not auto-detect, please fill in yourself>"; \
|
|
|
|
if [ $$(basename "$(ORIG_SHELL)") = "bash" ]; then \
|
|
|
|
if [ "$(PLATFORM)" = "Linux" ]; then \
|
|
|
|
shell_config_file="$$HOME"/.bashrc; \
|
|
|
|
else \
|
|
|
|
shell_config_file="$$HOME"/.bash_profile; \
|
|
|
|
fi; \
|
|
|
|
elif [ $$(basename "$(ORIG_SHELL)") = "zsh" ]; then \
|
|
|
|
shell_config_file="$$HOME"/.zshrc; \
|
|
|
|
fi; \
|
|
|
|
echo >&2; \
|
|
|
|
echo '$(TERM_INFO)*** NOTE: `infer` is not in your PATH or MANPATH. If you are hacking on infer, you may$(TERM_RESET)' >&2; \
|
|
|
|
echo '$(TERM_INFO)*** NOTE: want to make infer executables and manuals available in your terminal. Type$(TERM_RESET)' >&2; \
|
|
|
|
echo '$(TERM_INFO)*** NOTE: the following commands to configure the current terminal and record the$(TERM_RESET)' >&2; \
|
|
|
|
printf '$(TERM_INFO)*** NOTE: changes in your shell configuration file (%s):$(TERM_RESET)\n' "$$shell_config_file">&2; \
|
|
|
|
echo >&2; \
|
|
|
|
if [ "$$infer_repo_is_in_path" != "0" ]; then \
|
|
|
|
printf '$(TERM_INFO) export PATH="%s/infer/bin":$$PATH$(TERM_RESET)\n' "$(ABSOLUTE_ROOT_DIR)" >&2; \
|
|
|
|
fi; \
|
|
|
|
if [ "$$infer_repo_is_in_manpath" != "0" ]; then \
|
|
|
|
printf '$(TERM_INFO) export MANPATH="%s/infer/man":$$MANPATH$(TERM_RESET)\n' "$(ABSOLUTE_ROOT_DIR)" >&2; \
|
|
|
|
fi; \
|
|
|
|
if [ "$$infer_repo_is_in_path" != "0" ]; then \
|
|
|
|
printf "$(TERM_INFO) echo 'export PATH=\"%s/infer/bin\":\$$PATH' >> \"$$shell_config_file\"$(TERM_RESET)\n" "$(ABSOLUTE_ROOT_DIR)" >&2; \
|
|
|
|
fi; \
|
|
|
|
if [ "$$infer_repo_is_in_manpath" != "0" ]; then \
|
|
|
|
printf "$(TERM_INFO) echo 'export MANPATH=\"%s/infer/man\":\$$MANPATH' >> \"$$shell_config_file\"$(TERM_RESET)\n" "$(ABSOLUTE_ROOT_DIR)" >&2; \
|
|
|
|
fi; \
|
|
|
|
fi
|
|
|
|
$(QUIET)PATH=$(ORIG_SHELL_PATH); if [ "$$(ocamlc -where 2>/dev/null)" != "$$($(OCAMLC) -where)" ]; then \
|
|
|
|
echo >&2; \
|
|
|
|
echo '$(TERM_INFO)*** NOTE: The current shell is not set up for the right opam switch.$(TERM_RESET)' >&2; \
|
|
|
|
echo '$(TERM_INFO)*** NOTE: Please run:$(TERM_RESET)' >&2; \
|
|
|
|
echo >&2; \
|
|
|
|
echo '$(TERM_INFO) eval $$(opam config env)$(TERM_RESET)' >&2; \
|
|
|
|
fi
|
|
|
|
|
|
|
|
# print any variable for Makefile debugging
|
|
|
|
print-%:
|
|
|
|
$(QUIET)echo '$*=$($*)'
|
|
|
|
|
|
|
|
# print list of targets
|
|
|
|
.PHONY: show-targets
|
|
|
|
show-targets:
|
|
|
|
$(QUIET)$(MAKE) -pqrR . | grep --only-matching -e '^[a-zA-Z0-9][^ ]*:' | cut -d ':' -f 1 | sort
|