comparison Makefile @ 126:d851f4f89fb4

Improve Makefile deployment mechanism. * Makefile: Introduce checks for required tools and especially the Jekyll version. Explain the deployment in detail. * README.md: Remove verbose section about deployment to the Makefile. Update documentation. Remove advertising section.
author Kai T. Ohlhus <k.ohlhus@gmail.com>
date Fri, 09 Dec 2016 15:18:41 +0100
parents bfdbe4eb3128
children 839113398e6f
comparison
equal deleted inserted replaced
125:d79176062baa 126:d851f4f89fb4
6 6
7 CVS_RSH=ssh 7 CVS_RSH=ssh
8 8
9 export CVS_RSH 9 export CVS_RSH
10 10
11 all: deploy 11 CHECK_GEM := $(shell command -v gem 2> /dev/null)
12 CHECK_JEKYLL := $(shell command -v jekyll 2> /dev/null)
13 CHECK_JEKYLL_VERSION = $(shell jekyll --version | grep ^jekyll | sed 's/^.* //g')
12 14
13 deploy: | $(SAVANNAH_DIR) 15 deploy: | $(SAVANNAH_DIR) check_prerequisites
16 #
17 # Build static website into the subdirectory `_site` using Jekyll
18 #
14 jekyll build 19 jekyll build
20 #
21 # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
22 # DANGAROUS STEP, ommitted by default.
23 #
24 # Remove all previous files in the target directory, but no directories at
25 # all or CVS related stuff. This is due to a limitation of CVS, see
26 #
27 # https://web.archive.org/web/20140629054602/http://ximbiot.com/cvs/manual/cvs-1.11.23/cvs_7.html#SEC69
28 #
29 # For some introduction to CVS, see https://savannah.nongnu.org/projects/cvs
30 # or http://www.cs.umb.edu/~srevilak/cvs.html.
31 #
32 # find $(SAVANNAH_DIR) -type f -not -path "*/CVS/*" -exec rm -f '{}' \;
33 #
34 # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
35 #
36 # Copy the content of that directory `_site` into the checked out
37 # Savannah CVS (see make target $(SAVANNAH_DIR)).
38 #
15 cp -a _site/. $(SAVANNAH_DIR) 39 cp -a _site/. $(SAVANNAH_DIR)
40 #
41 # Add all potential new directories to CVS
42 #
16 cd $(SAVANNAH_DIR) && find . -type d -not -name "CVS" -exec cvs add '{}' \; 43 cd $(SAVANNAH_DIR) && find . -type d -not -name "CVS" -exec cvs add '{}' \;
44 #
45 # Add all potential new files to CVS (the following command taken from
46 # http://stackoverflow.com/questions/5071/how-to-add-cvs-directories-recursively
47 # proved to be fast)
48 #
17 cd $(SAVANNAH_DIR) && find . -type f | grep -v CVS | xargs cvs add 49 cd $(SAVANNAH_DIR) && find . -type f | grep -v CVS | xargs cvs add
50 #
51 # Commit the chages to get online.
52 #
18 cd $(SAVANNAH_DIR) && cvs commit 53 cd $(SAVANNAH_DIR) && cvs commit
54 #
55 # Now everything should be visible to the world.
56 #
57
58 check_prerequisites:
59 ifndef CHECK_GEM
60 $(error "Command `gem` is not available please install rubygems")
61 endif
62 ifndef CHECK_JEKYLL
63 $(error "Command `jekyll` is not available. ${CHECK_JEKYLL_VERSION} Try `gem install jekyll`")
64 endif
65 ifneq "3.3" "$(word 1, $(sort 3.3 $(CHECK_JEKYLL_VERSION)))"
66 $(error "Detected Jekyll version ${CHECK_JEKYLL_VERSION} (>= 3.3 required).")
67 endif
68 @echo "All prerequisites fulfilled."
19 69
20 $(SAVANNAH_DIR): 70 $(SAVANNAH_DIR):
21 cd .. \ 71 cd .. \
22 && cvs -z3 -d:ext:$(USRNAME)@cvs.savannah.gnu.org:/web/octave checkout -P octave 72 && cvs -z3 -d:ext:$(USRNAME)@cvs.savannah.gnu.org:/web/octave checkout -P octave
73
74 .DEFAULT_GOAL :=