From 82c23fe8b28e5280fae35cc2dd369e2d7bdcd4e9 Mon Sep 17 00:00:00 2001 From: cedounet <134267244+cedounet@users.noreply.github.com> Date: Mon, 7 Aug 2023 15:41:39 +0100 Subject: [PATCH] Fix bundle re-run (#165) * Use standard practices for website build - Declare your dependencies - Do not rebuild unless dependencies changed - Cleanup after yourself - Document your targets - COMMANDS in upper case and variables/rules in lowercase * Prevent bundle install to re-run Split it into two separate targets one for installing env and one for actually reworking the html. * Fix typo in makefile comment Co-authored-by: Hendrik Kleinwaechter --------- Co-authored-by: Hendrik Kleinwaechter --- book/makefile | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/book/makefile b/book/makefile index 0bb2e63..d205d62 100644 --- a/book/makefile +++ b/book/makefile @@ -37,7 +37,7 @@ website_src := $(src_all) website.cfg website_assets := $(wildcard ../website/assets/*) ruby_src := ../website/modify_build.rb $(website_assets) -ruby_src += ../website/Gemfile ../website/Gemfile.lock +ruby_pkg := ../website/Gemfile ../website/Gemfile.lock tgt_figures := $(patsubst %.tex, %.png,$(src_figures)) @@ -250,9 +250,17 @@ $(website_dir)/book.html: $(website_src) html: $(website_dir)/book.html cp $< $(website_dir)/index.html +# Because packages will be installed in hard to predict places use a file as +# marker.. +../website/_bundle_install_done: $(ruby_pkg) + - rm ../website/$@ + cd ../website && bundle install + touch ../website/$@ + +# TODO: this will run every single time, but is so fast we don't really care .PHONY: website -website: html $(ruby_src) - cd ../website && bundle install && ruby modify_build.rb +website: html ../website/_bundle_install_done $(ruby_src) + cd ../website && ruby modify_build.rb # Debug Stuff from now on .PHONY: show_tools_version