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 create the resource directories ’tools’,
’images’, and ’source’, and then preprocesses ‘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.
The Makefile can also run ’git’ to update the repository, including pushing the changes to Github. This should be called after initially installing a new repository.
Running ‘make all’ does both.
It is assumed that an Emacs server is running, and that the ‘$EMACS_TERMSERVER’
environment variable is set to use emacsclient --socket-name=termserver
.
TERMSERVER := $(EMACS_TERMSERVER) --socket-name=termserver --suppress-output boot: @$(TERMSERVER) \ --eval \ "(let ((rsrcdir \"resources\") \ (subdirs (list \"tools\" \"images\" \"source\"))) \ (mkdir rsrcdir t) \ (dolist (subdir subdirs) (mkdir (concat rsrcdir \"/\" subdir) t)))" \ --eval \ "(with-current-buffer \ (car (find-file-noselect \"./*.org\" nil nil t)) \ (save-excursion \ (goto-char (point-min)) \ (let ((re-search-str \"\\(?::tangle\\|load-file \\(?:[\\]*\\)?[\\\"]\\)\s*\\(.*?/\\[dD\\]ev\\)/\") \ (dev (getenv \"DEV\"))) \ (while \ (re-search-forward re-search-str nil t) \ (replace-match dev t nil nil 1))) \ (save-buffer) \ (org-babel-tangle)))" git: git add . && git commit -m "After running boot-template Makefile" && git push origin master all: boot git