NPSOL_LIBS=
CXX_STD = CXX14

# Developer's Note: As of R 3.5.3 and Rtools35.exe you must set the following flags
#  CXX14 = $(BINPREF)g++ $(M_ARCH)
#  CXX14STD = -std=gnu++14
#  CXX14FLAGS = -Wa,-mbig-obj -g0 -O2
# in R/R-$VERSION/etc/i386/Makeconf and R/R-$VERSION/etc/x64/Makeconf
# I'm not sure that the -g0 is even needed, so maybe just 
#  CXX14FLAGS = -Wa,-mbig-obj -O2

PKG_LIBS=$(FLIBS) $(BLAS_LIBS) $(LAPACK_LIBS) $(NPSOL_LIBS)
# Uncomment the next line to link to OpenBLAS:
# PKG_LIBS=$(FLIBS) $(NPSOL_LIBS) -L"C:/path/to/OpenBLAS/lib" -l:libopenblas.a $(LAPACK_LIBS)

# Uncomment the following two lines to try parallel
# PKG_LIBS=$(FLIBS) $(BLAS_LIBS) $(LAPACK_LIBS) $(NPSOL_LIBS) $(SHLIB_OPENMP_CXXFLAGS)
# PKG_CXXFLAGS=$(SHLIB_OPENMP_CXXFLAGS)

# Uncomment one of the following lines to turn on all debugging output in the backend
# PKG_CFLAGS=-DDEBUGMX                     # DEBUGMX gives Setup, cleanup, and per-iteration details
# PKG_CFLAGS=-DDEBUGMX -DDEBUGMX_ALGEBRA   # DEBUGMX_ALGEBRA gives per-compute calculation output (be careful with FIML)
# PKG_CFLAGS=-DDEBUGMX -DDEBUGMX_ALGEBRA -DDEBUGMX_MATRIX # turn on algebra and matrix debugging
# PKG_CFLAGS=-DDEBUGMX_ROWS                # DEBUGMX_ROWS gives per-row output for selected FIML rows
# PKG_CFLAGS=-DDEBUGMX -DDEBUGMX_ALGEBRA -DDEBUGMX_MATRIX -DDEBUGMX_ROWS # Debug setup, etc., Algebras, etc., Matrix, and Rows
# PKG_CFLAGS=-DVERBOSEMX                   # VERBOSEMX gives minimal per-iteration details and a few other notes

#BGEN_DEBUG += -D DEBUG=1

COMMON_FLAGS=-I. -Iinclude \
-Iinclude/zstd-1.1.0 \
-Iinclude/zstd-1.1.0/common \
-Iinclude/zstd-1.1.0/compress \
-Iinclude/zstd-1.1.0/decompress \
-D SQLITE_ENABLE_COLUMN_METADATA \
-D SQLITE_ENABLE_STAT4 \
-D SQLITE_MAX_EXPR_DEPTH=10000 \
-D SQLITE_USE_URI=1 \
$(BGEN_DEBUG)

ifeq "$(WIN)" "64"
PKG_CFLAGS += 
else
PKG_CFLAGS += -DEIGEN_DONT_VECTORIZE -DEIGEN_DISABLE_UNALIGNED_ARRAY_ASSERT
endif

PKG_CXXFLAGS=$(OPENMP_CXXFLAGS) $(COMPILER_CXXFLAGS) $(ARCH_SPECIFIC_COMPILER_FLAGS) $(PKG_CFLAGS) $(COMMON_FLAGS) -DSTRICT_R_HEADERS
# Uncomment the next line to compile with OpenBLAS:
# PKG_CXXFLAGS=$(OPENMP_CXXFLAGS) $(COMPILER_CXXFLAGS) $(ARCH_SPECIFIC_COMPILER_FLAGS) -D EIGEN_USE_BLAS -I"C:/path/to/OpenBLAS/include" $(PKG_CFLAGS) $(COMMON_FLAGS) 
PKG_CFLAGS += $(COMMON_FLAGS) -DSTRICT_R_HEADERS
# Uncomment this line too, if debugging
# PKG_CXXFLAGS=$(OPENMP_CXXFLAGS) $(COMPILER_CXXFLAGS) $(ARCH_SPECIFIC_COMPILER_FLAGS) $(PKG_CFLAGS) -UNDEBUG
