Hi everyone long time vim/neovim user, currently for my latex I have in ~/.config/nvim/after/ftplugin.lua the following line:

vim.opt_local.makeprg="pdflatex -output-format pdf -output-directory /tmp %"

I am now working in a latex project that has a makefile, is it possible to create something in the lines of:

if ! makefile_exists then
  vim.opt_local.makeprg="pdflatex -output-format pdf -output-directory /tmp %"
end