diff options
author | Andrew Cady <d@jerkface.net> | 2023-09-02 12:39:26 -0400 |
---|---|---|
committer | Andrew Cady <d@jerkface.net> | 2023-11-12 09:31:58 -0500 |
commit | 2716a8b95ab1b68932bcaa816bae2cf12b56bb17 (patch) | |
tree | fa590b6a056736b16cb61e1124fa00ebdb6aa77f | |
parent | f88cbb76415413db81575fb382a1768819e8a8fd (diff) |
make deploy target
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Makefile | 26 |
2 files changed, 23 insertions, 4 deletions
@@ -2,3 +2,4 @@ | |||
2 | stack.yaml.lock | 2 | stack.yaml.lock |
3 | cosmic-countdown.cabal | 3 | cosmic-countdown.cabal |
4 | bin | 4 | bin |
5 | deploy-target.url | ||
@@ -1,17 +1,21 @@ | |||
1 | stack_path != which stack | 1 | stack_path != which stack |
2 | 2 | ||
3 | binout = ./bin/countdown | ||
4 | |||
3 | all: $(if $(stack_path),,install-stack) | 5 | all: $(if $(stack_path),,install-stack) |
4 | stack build | 6 | stack build |
5 | ln -sfT $$(stack path --local-install-root)/bin ./bin | 7 | ln -sfT $$(stack path --local-install-root)/bin ./bin |
6 | 8 | ||
7 | .PHONY: all run install install-dev-tools | 9 | .PHONY: all run install install-dev-tools deploy |
8 | |||
9 | run: all | ||
10 | ./bin/countdown | ||
11 | 10 | ||
12 | install: | 11 | install: |
13 | stack install | 12 | stack install |
14 | 13 | ||
14 | $(binout): install | ||
15 | |||
16 | run: all | ||
17 | $(binout) | ||
18 | |||
15 | install-dev-tools: | 19 | install-dev-tools: |
16 | stack install apply-refact hlint stylish-haskell hasktags hoogle | 20 | stack install apply-refact hlint stylish-haskell hasktags hoogle |
17 | 21 | ||
@@ -32,5 +36,19 @@ endif | |||
32 | endif | 36 | endif |
33 | endif | 37 | endif |
34 | 38 | ||
39 | define prompt_user | ||
40 | @bash -c \ | ||
41 | 'read -p $(1) && printf "%s\n" "$${REPLY}" > "$$1"' \ | ||
42 | bash \ | ||
43 | "$@" | ||
44 | endef | ||
45 | |||
46 | deploy-target.url: | ||
47 | $(call prompt_user, "Enter deploy target rsync URL: ") | ||
48 | |||
49 | deploy: $(binout) deploy-target.url | ||
50 | @read target < deploy-target.url && set -x && \ | ||
51 | rsync -i4zaP $(binout) "$$target" | ||
52 | |||
35 | %.html: %.md | 53 | %.html: %.md |
36 | pandoc -f markdown -t html -o $@ $^ | 54 | pandoc -f markdown -t html -o $@ $^ |