R Studio "Build Book" for bookmark fail if Makefile exists

Minimal Working Example

  1. Download official bookdown-demo from GitHub - rstudio/bookdown-demo: A minimal book example using bookdown. For example, run git clone git@github.com:rstudio/bookdown-demo.git
  2. Create Makefile inside bookdown-demo with
all:
  @echo "Hello R user"
  1. Open R Studio and the bookdown-demo project.
  2. Click on "Build Book" from the "Build" tab.

Observed Result

R Studio call Make.

Expected Result/Output

R Studio will build the book.

Question

  • What is the target that R Studio is passing to Make?
  • How can I disable R Studio from call Make?

This is a feature of bookdown actually. When use inside RStudio, the build Book button with use the site: bookdown::bookdown_site function that is in the index.yaml to know which function to run.

bookdown::bookdown_site() will do the following to render a book project:

  • use _render.R to build the book if this file exists in the book project
  • use Makefile by calling make if a Makefile exists in the book project
  • call render_book("index.Rmd", ...) otherwise.

That is why you Makefile is executed. bookdown assumes that if there is one in the book project it is to build the book.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.