2015-07-19 09:50:54 +00:00
|
|
|
#
|
|
|
|
# usage:
|
|
|
|
# make system=foo
|
|
|
|
# make systems='foo bar'
|
2015-09-26 22:22:50 +00:00
|
|
|
# make eval get=tv.wu.config.time.timeZone [filter=json]
|
2015-07-19 09:50:54 +00:00
|
|
|
#
|
|
|
|
|
2015-07-11 14:55:22 +00:00
|
|
|
.ONESHELL:
|
|
|
|
.SHELLFLAGS := -eufc
|
2015-07-19 09:50:54 +00:00
|
|
|
|
|
|
|
ifdef systems
|
|
|
|
$(systems):
|
2015-09-26 22:22:50 +00:00
|
|
|
@
|
2015-07-19 09:50:54 +00:00
|
|
|
parallel \
|
|
|
|
--line-buffer \
|
|
|
|
-j0 \
|
|
|
|
--no-notice \
|
|
|
|
--tagstring {} \
|
2015-09-26 22:22:50 +00:00
|
|
|
-q make -s systems= system={} ::: $(systems)
|
2015-07-19 09:50:54 +00:00
|
|
|
else ifdef system
|
2015-09-26 22:22:50 +00:00
|
|
|
.PHONY: deploy infest
|
|
|
|
deploy infest:;@
|
|
|
|
export get=$$LOGNAME.${system}.config.krebs.build.scripts.$@
|
|
|
|
export filter=json
|
|
|
|
make -s eval | sh
|
2015-09-18 01:04:39 +00:00
|
|
|
|
2015-07-22 23:04:51 +00:00
|
|
|
.PHONY: eval
|
|
|
|
eval:
|
2015-07-24 15:34:08 +00:00
|
|
|
@
|
2015-07-28 19:03:49 +00:00
|
|
|
ifeq ($(filter),json)
|
2015-08-05 13:24:50 +00:00
|
|
|
extraArgs='--json --strict'
|
2015-07-28 19:03:49 +00:00
|
|
|
filter() { jq -r .; }
|
|
|
|
else
|
|
|
|
filter() { cat; }
|
|
|
|
endif
|
2015-07-24 15:34:08 +00:00
|
|
|
NIX_PATH=stockholm=$$PWD:$$NIX_PATH \
|
|
|
|
nix-instantiate \
|
2015-07-28 19:03:49 +00:00
|
|
|
$${extraArgs-} \
|
2015-07-22 23:04:51 +00:00
|
|
|
--eval \
|
|
|
|
-A "$$get" \
|
2015-07-24 15:34:08 +00:00
|
|
|
'<stockholm>' \
|
|
|
|
--argstr user-name "$$LOGNAME" \
|
2015-09-26 22:22:50 +00:00
|
|
|
--argstr host-name "$$HOSTNAME" \
|
2015-07-28 19:03:49 +00:00
|
|
|
| filter
|
2015-07-19 09:50:54 +00:00
|
|
|
else
|
|
|
|
$(error unbound variable: system[s])
|
2015-07-11 14:55:22 +00:00
|
|
|
endif
|