Next: Preprocess Env Vars, Previous: Project Readme, Up: Build Tools [Index]
Although running the command org-babel-tangle
(‘C-c C-v t’) from within Emacs
will install everything, it would be nice to have a simple Makefile that is
downloaded with this file that could be invoked to do the same thing without
starting Emacs and Org-mode and keying in the org-babel-tangle
command. This
little Makefile should be stored on GitHub along with the Template.org
file.
When the source is extracted to a directory, then running this Makefile’s
default rule as simply make
will extract the preprocess.el
script, which
updates ‘DEV’ and then extracts the full Makefile. Because this file is
tangled along with the full Makefile, it simply gets tacked onto the end of the
big Makefile as an additional rule. Now, running make
runs the default rule
from the main Makefile, which is to extract everything, then export to TEXI,
INFO, HTML, and PDF forms.
It is assumed that an Emacs server is running, and that the $EDITOR environment
variable is set to use emacsclient
.
boot: $(EDITOR) -u --eval \ "(with-current-buffer (car (find-file-noselect \"./*.org\" nil nil t)) \ (goto-char (point-min)) \ (re-search-forward \"^#[+]name:preprocess.el$$\") \ (org-babel-tangle (quote (4))) \ (save-buffer) \ (kill-buffer))" \ --eval \ "(let ((rsrcdir \"resources\") \ (subdirs (list \"tools\" \"images\"))) \ (mkdir rsrcdir t) \ (dolist (subdir subdirs) (mkdir (concat rsrcdir \"/\" subdir) t)))" ./resources/tools/preprocess.el