CXX_STD = CXX17
# zlib (bundled with R) lets the core read gzip/zlib-compressed chunks.
PKG_CPPFLAGS = -I../inst/include -DLSTAR_HAVE_ZLIB
# OpenMP: the streaming kernels (csc_col_mean_var, stream_col_stats, ...) are OpenMP-parallel; without
# these flags the #pragma omp directives are no-ops and the R build runs serial regardless of n_threads.
PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS)
# std::filesystem is in libstdc++/libc++ on the supported C++17 toolchains (gcc >= 9.1, clang);
# no -lstdc++fs needed. zlib via -lz (R links it too); OpenMP link flag must match the compile flag
# (SHLIB_OPENMP_CXXFLAGS in both PKG_CXXFLAGS and PKG_LIBS, per Writing R Extensions 1.2.1.1).
PKG_LIBS = -lz $(SHLIB_OPENMP_CXXFLAGS)

# Strip debug symbols from the built shared object. The -O3 C++ accelerator (with the header-only core +
# nlohmann/json) carries ~11MB of debug info; stripping keeps the installed package small (the CRAN
# "installed size" NOTE). `strip -S` removes only debug symbols and works on both GNU and BSD/macOS;
# guarded so it's a harmless no-op where strip is absent (e.g. Windows).
strippedLib: $(SHLIB)
	if command -v strip >/dev/null 2>&1; then strip -S $(SHLIB) 2>/dev/null || true; fi
.PHONY: strippedLib
all: $(SHLIB) strippedLib
