-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathMakefile.instance
20 lines (17 loc) · 973 Bytes
/
Makefile.instance
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
define instance_arg_present
ifeq ($(findstring instance=, $(strip $(filter-out --%,$(MAKEFLAGS)))), instance=)
showmenu := false
newinstance := ${instance}
else
showmenu := true
newinstance := ""
endif
endef
.PHONY: instance # Create a duplicate instance with its own .env_{DOCKER_CONTEXT}_{INSTANCE} config file
instance: check-in-subshell
$(eval $(instance_arg_present))
@unset INSTANCE; unset instance; MAKE_INSTANCE_SOURCE_RCFILE=${MAKE_INSTANCE_SOURCE_RCFILE} DOCKER_CONTEXT=${DOCKER_CONTEXT} ENV_FILE=${ENV_FILE} showmenu=${showmenu} newinstance=${newinstance} call=instance ${BIN}/instance
.PHONY: switch # Switch to the given INSTANCE and enter a new subshell for it
switch: check-in-subshell
$(eval $(instance_arg_present))
@unset INSTANCE; unset instance; MAKE_INSTANCE_SOURCE_RCFILE=${MAKE_INSTANCE_SOURCE_RCFILE} DOCKER_CONTEXT=${DOCKER_CONTEXT} ENV_FILE=${ENV_FILE} showmenu=${showmenu} newinstance=${newinstance} call=switch ${BIN}/instance