Rename ‘bootstrap.*’ -> ‘build.*’

This commit is contained in:
Tom Willemse 2023-07-25 22:48:29 -07:00
parent 862d4827f0
commit ca1020b4d0
4 changed files with 12 additions and 12 deletions

2
.gitignore vendored
View file

@ -4,7 +4,7 @@
# Built files # Built files
/public /public
/posts/index.org /posts/index.org
/bootstrap.mk /build.mk
# Added automatically by `eldev init'. # Added automatically by `eldev init'.
/.eldev /.eldev

View file

@ -1,7 +1,7 @@
%.mk: bootstrap.org %.mk: build.org
eldev emacs -quick -batch \ eldev emacs -quick -batch \
-eval "(package-initialize)" \ -eval "(package-initialize)" \
-load ob-tangle \ -load ob-tangle \
-eval "(org-babel-tangle-file \"$<\" \"$(PWD)/$@\" \"makefile\")" -eval "(org-babel-tangle-file \"$<\" \"$(PWD)/$@\" \"makefile\")"
include bootstrap.mk include build.mk

View file

@ -1,15 +1,15 @@
#+title: ryuslash's website's bootstrap #+title: ryuslash's website's build's files
#+subtitle: Literate configuration of how to build this site #+subtitle: Literate configuration of how to build this site
#+options: num:nil prop:t #+options: num:nil prop:t
I'm a big fan of [[file:literate-programming.org][Literate Programming]], so I figured I'd make the builds for my website a literate configuration file as well. I'm a big fan of [[file:literate-programming.org][Literate Programming]], so I figured I'd make the builds for my website a literate configuration file as well.
First I need to bootstrap the bootstrap. This is the smallest make file that I can think to make to enable me to build the rest out. This make file is duplicated in both this file and the source code repository since I don't know of a way not to. First I need to build the build files. This is the smallest make file that I can think to make to enable me to build the rest out. This make file is duplicated in both this file and the source code repository since I don't know of a way not to.
First I specify that any =.mk= file should depend on /this/ file ({{{input-file}}}) and that it is generated by running =org-babel-tangle-file= on it. The =$<= is the first dependency and =$@= is the current target file (whatever =.mk= file we're generating). First I specify that any =.mk= file should depend on /this/ file ({{{input-file}}}) and that it is generated by running =org-babel-tangle-file= on it. The =$<= is the first dependency and =$@= is the current target file (whatever =.mk= file we're generating).
#+begin_src makefile :tangle no #+begin_src makefile :tangle no
%.mk: bootstrap.org %.mk: build.org
eldev emacs -quick -batch \ eldev emacs -quick -batch \
-eval "(package-initialize)" \ -eval "(package-initialize)" \
-load ob-tangle \ -load ob-tangle \
@ -19,17 +19,17 @@ First I specify that any =.mk= file should depend on /this/ file ({{{input-file}
After that it's just a matter of including the file I want. After that it's just a matter of including the file I want.
#+begin_src makefile :tangle no #+begin_src makefile :tangle no
include bootstrap.mk include build.mk
#+end_src #+end_src
GNU Make (I don't know about other makes) will see if there is a recipe to make the file it wants to include and will try and run it before trying to include the file. This combined with our =%.mk= target ensures that make will always try to recreate the =bootstrap.mk= file when ={{{input-file}}}= is updated. GNU Make (I don't know about other makes) will see if there is a recipe to make the file it wants to include and will try and run it before trying to include the file. This combined with our =%.mk= target ensures that make will always try to recreate the =build.mk= file when ={{{input-file}}}= is updated.
* Makefile * Makefile
:PROPERTIES: :PROPERTIES:
:header-args:makefile: :tangle bootstrap.mk :header-args:makefile: :tangle build.mk
:END: :END:
This is the actual make file that builds and deploys my site. It's all put into the =bootstrap.mk= file and executed from there. The =%.mk= pattern rule thankfully doesn't get recognized as a make target, so the first target define in the included file is assumed to be the default target. This is the actual make file that builds and deploys my site. It's all put into the =build.mk= file and executed from there. The =%.mk= pattern rule thankfully doesn't get recognized as a make target, so the first target define in the included file is assumed to be the default target.
First off I specify the =help= target. This target parses the make files and extracts targets that include some comment on what they do. This target should come first so that it automatically becomes the default target. This way when I run just ~make~ I can see which targets I have available. I got this awesome trick from [[https://victoria.dev/][Victoria Drake]]s article [[https://victoria.dev/blog/how-to-create-a-self-documenting-makefile/][How to create a self-documenting Makefile]]. First off I specify the =help= target. This target parses the make files and extracts targets that include some comment on what they do. This target should come first so that it automatically becomes the default target. This way when I run just ~make~ I can see which targets I have available. I got this awesome trick from [[https://victoria.dev/][Victoria Drake]]s article [[https://victoria.dev/blog/how-to-create-a-self-documenting-makefile/][How to create a self-documenting Makefile]].
@ -87,7 +87,7 @@ clean: ## Remove all of the build files
@rm -rvf *.elc @rm -rvf *.elc
@rm -rvf public @rm -rvf public
@rm -rvf .org-timestamps @rm -rvf .org-timestamps
@rm -rvf posts/index.org bootstrap.mk @rm -rvf posts/index.org build.mk
#+end_src #+end_src
The =serve= target is a convenience target for when I'm writing or making modifications to the build and publish processes. It just starts a simple =php= web server in the =public/= directory so that I can easily load it in my browser. The =serve= target is a convenience target for when I'm writing or making modifications to the build and publish processes. It just starts a simple =php= web server in the =public/= directory so that I can easily load it in my browser.

View file

@ -29,7 +29,7 @@ The first topic I pay any attention to of course has to be [[file:emacs.org][Ema
* My literate configuration * My literate configuration
Every so often I get really drawn to remaking my entire configuration into a [[file:literate-programming.org][Literate Programming]] style. See my [[file:config/rincewind.org][latest attempt]] and also my [[file:bootstrap.org][literate build files]] for this website. Every so often I get really drawn to remaking my entire configuration into a [[file:literate-programming.org][Literate Programming]] style. See my [[file:config/rincewind.org][latest attempt]] and also my [[file:build.org][literate build files]] for this website.
* Topics * Topics