[Makefiles] Use custom CC in ocamlopt only when configure flag is set

Summary: Introduce `--enable-ocamlopt-custom-cc` configure flag (disabled by default). Normally it doesn't have to be set. However, when cross-compiling infer itself for another platform it may have to be set.

Reviewed By: jberdine

Differential Revision: D3995032

fbshipit-source-id: ce2fd72
master
Andrzej Kotulski 8 years ago committed by Facebook Github Bot
parent f677c3ab3d
commit 61f532d2f8

@ -20,6 +20,7 @@ CLANG_PREFIX = @CLANG_PREFIX@
CPP = @CPP@ CPP = @CPP@
CXX = @CXX@ CXX = @CXX@
CXXFLAGS = @CXXFLAGS@ CXXFLAGS = @CXXFLAGS@
ENABLE_OCAMLOPT_CUSTOM_CC = @ENABLE_OCAMLOPT_CUSTOM_CC@
ENABLE_OCAML_ANNOT = @ENABLE_OCAML_ANNOT@ ENABLE_OCAML_ANNOT = @ENABLE_OCAML_ANNOT@
ENABLE_OCAML_BINANNOT = @ENABLE_OCAML_BINANNOT@ ENABLE_OCAML_BINANNOT = @ENABLE_OCAML_BINANNOT@
exec_prefix = @exec_prefix@ exec_prefix = @exec_prefix@

@ -102,6 +102,12 @@ AS_IF([test "x$enable_c_analyzers" = "xyes"], [
AC_CHECK_TOOL([CMAKE], [cmake], [no]) AC_CHECK_TOOL([CMAKE], [cmake], [no])
AC_ASSERT_PROG([cmake], [$CMAKE]) AC_ASSERT_PROG([cmake], [$CMAKE])
]) ])
AC_ARG_ENABLE(ocamlopt-custom-cc,
AS_HELP_STRING([--enable-ocamlopt-custom-cc], [use CC in ocamlopt invocations]),
,
enable_ocamlopt_custom_cc=no)
ENABLE_OCAMLOPT_CUSTOM_CC=$enable_ocamlopt_custom_cc
AC_SUBST([ENABLE_OCAMLOPT_CUSTOM_CC])
]) ])
# end if($enable_c_analyzers) # end if($enable_c_analyzers)

@ -22,8 +22,6 @@ OCAML_FATAL_WARNINGS = +5+6+8+10+11+12+18+19+20+23+26+29+27+32+33+34+35+37+38+39
OCAMLBUILD_OPTIONS = \ OCAMLBUILD_OPTIONS = \
-r \ -r \
-lflags -cc,$(CC) \
-cflags -cc,$(CC) \
-cflags -g -lflags -g \ -cflags -g -lflags -g \
-cflags -short-paths \ -cflags -short-paths \
-cflags -safe-string \ -cflags -safe-string \
@ -42,6 +40,10 @@ ifeq ($(ENABLE_OCAML_BINANNOT),yes)
OCAMLBUILD_OPTIONS += -cflags -bin-annot OCAMLBUILD_OPTIONS += -cflags -bin-annot
endif endif
ifeq ($(ENABLE_OCAMLOPT_CUSTOM_CC),yes)
OCAMLBUILD_OPTIONS += -lflags -cc,$(CC) -cflags -cc,$(CC)
endif
ifneq (,$(findstring s,$(MAKEFLAGS))) ifneq (,$(findstring s,$(MAKEFLAGS)))
OCAMLBUILD_OPTIONS += -quiet OCAMLBUILD_OPTIONS += -quiet
endif endif

Loading…
Cancel
Save