CXX_STD = CXX17
PKG_CPPFLAGS=-I./piqp/include -DR_LANG -DPIQP_STD_FILESYSTEM

all: .r_patched

# Apply R-specific patches to the vendored PIQP sources (skipped if already applied)
.r_patched: r_patches/piqp.patch
	cd piqp && (patch -p1 -R -s -f --dry-run < ../r_patches/piqp.patch > /dev/null 2>&1 || patch -p1 -s < ../r_patches/piqp.patch)
	touch .r_patched

# R CMD build runs 'make clean' here after installing for vignettes. Remove
# the marker so it does not end up in the tarball (R-devel no longer runs the
# top-level 'cleanup' script during build when it is listed in .Rbuildignore).
clean:
	@rm -f .r_patched $(OBJECTS) $(SHLIB)
