# Copyright (c) 2015-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD+Patents license found in the
# LICENSE file in the root directory of this source tree.

CXX          = @CXX@
CXXCPP       = @CXXCPP@
# TODO: Investigate the LAPACKE wrapper for LAPACK, which defines the correct
#   type for FORTRAN integers.
CPPFLAGS     = -DFINTEGER=int @CPPFLAGS@
CXXFLAGS     = -fPIC @OPENMP_CXXFLAGS@ -m64 -Wno-sign-compare @CXXFLAGS@
CPUFLAGS     = -msse4 -mpopcnt
LDFLAGS      = @OPENMP_LDFLAGS@ @LDFLAGS@
LIBS         = @BLAS_LIBS@ @LAPACK_LIBS@ @LIBS@
PYTHONCFLAGS = @PYTHON_CFLAGS@ -I@NUMPY_INCLUDE@

NVCC         = @NVCC@
NVCCLDFLAGS  = @NVCC_LDFLAGS@
NVCCLIBS     = @NVCC_LIBS@
CUDAROOT     = @CUDA_PREFIX@
CUDACFLAGS   = @NVCC_CPPFLAGS@
NVCCFLAGS    = -I $(CUDAROOT)/targets/x86_64-linux/include/ \
-Xcompiler -fPIC \
-Xcudafe --diag_suppress=unrecognized_attribute \
-gencode arch=compute_35,code="compute_35" \
-gencode arch=compute_52,code="compute_52" \
-gencode arch=compute_60,code="compute_60" \
-gencode arch=compute_61,code="compute_61" \
-lineinfo \
-ccbin $(CXX) -DFAISS_USE_FLOAT16

OS = $(shell uname -s)

SHAREDEXT   = so
SHAREDFLAGS = -shared

ifeq ($(OS),Darwin)
	SHAREDEXT   = dylib
	SHAREDFLAGS = -dynamiclib -undefined dynamic_lookup
endif

MKDIR_P      = @MKDIR_P@
PYTHON       = @PYTHON@
SWIG         = @SWIG@

prefix      ?= @prefix@
exec_prefix ?= @exec_prefix@
libdir       = @libdir@
includedir   = @includedir@
