@@ -550,7 +550,12 @@ compile <- function(quiet = TRUE,
550550 stanc_built_options <- c(stanc_built_options , paste0(" --" , option_name , " =" , " '" , stanc_options [[i ]], " '" ))
551551 }
552552 }
553- stancflags_val <- paste0(" STANCFLAGS += " , stancflags_val , paste0(" " , stanc_built_options , collapse = " " ))
553+ make_local_stancflags <- get_make_variable(" STANCFLAGS" )
554+ stancflags_val <- paste0(
555+ " STANCFLAGS += " ,
556+ stancflags_val ,
557+ paste0(c(" " , stanc_built_options , make_local_stancflags ), collapse = " " )
558+ )
554559 withr :: with_path(
555560 c(
556561 toolchain_PATH_env_var(),
@@ -769,7 +774,12 @@ check_syntax <- function(pedantic = FALSE,
769774 ),
770775 run_log <- wsl_compatible_run(
771776 command = stanc_cmd(),
772- args = c(wsl_safe_path(self $ stan_file()), stanc_built_options , stancflags_val ),
777+ args = c(
778+ wsl_safe_path(self $ stan_file()),
779+ stanc_built_options ,
780+ stancflags_val ,
781+ get_make_variable(" STANCFLAGS" )
782+ ),
773783 wd = cmdstan_path(),
774784 echo = is_verbose_mode(),
775785 echo_cmd = is_verbose_mode(),
@@ -909,8 +919,12 @@ format <- function(overwrite_file = FALSE,
909919 ),
910920 run_log <- wsl_compatible_run(
911921 command = stanc_cmd(),
912- args = c(wsl_safe_path(self $ stan_file()), stanc_built_options ,
913- stancflags_val ),
922+ args = c(
923+ wsl_safe_path(self $ stan_file()),
924+ stanc_built_options ,
925+ stancflags_val ,
926+ get_make_variable(" STANCFLAGS" )
927+ ),
914928 wd = cmdstan_path(),
915929 echo = is_verbose_mode(),
916930 echo_cmd = is_verbose_mode(),
0 commit comments