-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathMakefile
More file actions
62 lines (47 loc) · 1.79 KB
/
Makefile
File metadata and controls
62 lines (47 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
.PHONY: update-outputs run interactive clean
# Tools
DOCKER := docker
DOCKER_RUN_OPTS :=
# Use this for Podman
#DOCKER := podman
#DOCKER_RUN_OPTS := --userns=keep-id --security-opt label=disable
# Use this for Finch
#DOCKER := finch
#DOCKER_RUN_OPTS := --platform=amd64
# Name of the container we'll generate the tutorial outputs with
container := ghcr.io/spack/tutorial:latest@sha256:978cbf0a169644b3bc06f30a397770ee935b1836aa742f7996b4d74d7a4e4721
# Sections to build
sections := environments
# Allow users to override variables (e.g. DOCKER := sudo docker)
-include Make.user
run_targets := $(addprefix run-,$(sections))
# Entrypoint
update-outputs: run
echo "Filtering raw outputs though col"
for raw in raw/*/*.out; do \
out=$$(echo $$raw | sed 's.raw/..'); \
cat $$raw | perl -pe 's/\x1b]0;.+?\x07//g' | perl -pe 's/\x1b\[\d+F\x1b\[J//g' | perl -pe 's/\033\[([01];)?\d+m//g' | col -bp | sed '/^==> Waiting for/d' > $$out; \
done
local: local-scripting
local-scripting: local-dev scripting.sh
#local-cache: local-dev cache.sh
local-dev: local-packaging dev.sh
local-packaging: local-stacks packaging.sh
local-stacks: local-environments stacks.sh
# local-config: local-environments config.sh # coming soon^TM
local-environments: local-basics environments.sh
local-basics: basics.sh init_spack.sh defs.sh
local-%: %.sh init_spack.sh defs.sh
$(CURDIR)/$(@:local-%=%).sh
run:
$(DOCKER) run $(DOCKER_RUN_OPTS) --rm -t \
--mount type=bind,source=$(CURDIR),target=/project -w /project \
${container} "make local"
interactive:
$(DOCKER) run $(DOCKER_RUN_OPTS) --rm -it \
--mount type=bind,source=$(CURDIR),target=/project -w /project \
${container}
$(addprefix clean-,$(sections)):
rm -f $(@:clean-%=run-%) $(wildcard raw/$(@:clean-%=%)/*.out)
clean:
rm -f $(run_targets) $(wildcard raw/*/*.out)