forked from kindrobot/resume
64 lines
2.4 KiB
Makefile
64 lines
2.4 KiB
Makefile
# resume
|
|
# adapated from {init,build,deploy}.sh
|
|
|
|
# A Make rule looks like this:
|
|
#
|
|
# TARGET : PREREQUISITE...
|
|
# BUILD COMMANDS...
|
|
#
|
|
# To the left of the colon is the TARGET, and to the right are its
|
|
# PREREQUISITES. Make builds a DAG of targets and prerequisites before doing
|
|
# anything, so the order doesn't matter, /except/ that the first rule is run if
|
|
# you just type "make" at the prompt. Prerequisites are optional and are built
|
|
# in order from left to right before the target is built.
|
|
#
|
|
# Under the target/prerequisite line is a series of BUILD COMMANDS, executed by
|
|
# the shell to build the target. Each command is executed in its own shell, and
|
|
# if any command fails, Make immediately stops execution and exits (unless you
|
|
# tell it not to...). Build commands are also optional; you can just have a
|
|
# target/prereq line to tell make what depends on what. (Also there's like,
|
|
# "automatic rules" and all sorts of other things that complicate the picture a
|
|
# bit.... but the basic idea is just that.)
|
|
#
|
|
# Oh, by the way, the build commands have to be indented with a TAB character
|
|
# for ... Reasons.
|
|
|
|
# .PHONY is a "special target" that means its prerequisites don't correspond to
|
|
# any files. It's good to mark phony targets /just in case/ your project
|
|
# somehow gets a file named, say, "init" or "deploy" --- then these rules might
|
|
# not work right.
|
|
.PHONY : init build deploy
|
|
|
|
init:
|
|
# Note that these are /basically/ the same commands as in init.sh.
|
|
npm install
|
|
git clone git@tildegit.org:kindrobot/resume -b pages resume-pages
|
|
git submodule update --init
|
|
# I had to put the npm install here on the same line as the cd to keep
|
|
# it all in the same shell. You could also add a backslash at the end
|
|
# of the line to escape the newline and keep it all in one shell, too.
|
|
cd jsonresume-theme-kindrobot && npm install
|
|
|
|
# Build depends on init.
|
|
build: init
|
|
node yamlToJson.js > resume.json
|
|
mkdir -p public
|
|
cp index.html photo.jpg resume.yml resume.json public
|
|
npx resume export public/resume.html --theme $theme
|
|
# Here's some backslash-escaped newlines!
|
|
if [[ -z $flag || $flag != "--no-pdf" ]]; then \
|
|
npx resume export public/resume.pdf --theme $theme \
|
|
fi
|
|
rm resume.json
|
|
|
|
# Deploy depends on build (and init!)
|
|
deploy: build init
|
|
cp public/* resume-pages
|
|
cd resume-pages && \
|
|
git add . ;\
|
|
git commit -m "Updates from $(hostname) on $(date)" ;\
|
|
git push
|
|
|
|
## This is a very naive Makefile. It should work though! I'm going to keep
|
|
## improving it as I go :)
|