forked from thundercore/thunder-box
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GNUmakefile
50 lines (45 loc) · 1.78 KB
/
GNUmakefile
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
CONDA := $(HOME)/miniconda3/bin/conda
TOP_DIR := $(patsubst %/,%,$(dir $(realpath $(lastword $(MAKEFILE_LIST)))))
CONDA_ENV_DIR := $(TOP_DIR)/conda-env
# This can be used to customized local builds.
-include $(TOP_DIR)/Local.mk
PATH := $(CONDA_ENV_DIR)/bin:$(TOP_DIR)/node_modules/.bin:$(PATH)
export PATH
PREFERRED_INTERACTIVE_SHELL ?= bash
PS1_NAME ?= 'thunder-box'
MAKE_SHELL_PS1 ?= '$(PS1_NAME) $$ '
.PHONY: shell
ifeq ($(PREFERRED_INTERACTIVE_SHELL),bash)
shell:
@INIT_FILE=$(shell mktemp); \
printf '[ -e $$HOME/.bashrc ] && source $$HOME/.bashrc\n' > $$INIT_FILE; \
printf '[ -e Local.env ] && source Local.env\n' >> $$INIT_FILE; \
printf 'PS1='"$(MAKE_SHELL_PS1) "'\n' >> $$INIT_FILE; \
$(PREFERRED_INTERACTIVE_SHELL) --init-file $$INIT_FILE || true
else ifeq ($(PREFERRED_INTERACTIVE_SHELL),fish)
shell:
@INIT_FILE=$(shell mktemp); \
printf 'if functions -q fish_right_prompt\n' > $$INIT_FILE; \
printf ' functions -c fish_right_prompt __fish_right_prompt_original\n' >> $$INIT_FILE; \
printf ' functions -e fish_right_prompt\n' >> $$INIT_FILE; \
printf 'else\n' >> $$INIT_FILE; \
printf ' function __fish_right_prompt_original\n' >> $$INIT_FILE; \
printf ' end\n' >> $$INIT_FILE; \
printf 'end\n' >> $$INIT_FILE; \
printf 'function fish_right_prompt\n' >> $$INIT_FILE; \
printf ' echo -n "($(PS1_NAME)) "\n' >> $$INIT_FILE; \
printf ' __fish_right_prompt_original\n' >> $$INIT_FILE; \
printf 'end\n' >> $$INIT_FILE; \
$(PREFERRED_INTERACTIVE_SHELL) --init-command="source $$INIT_FILE" || true
else
shell:
@$(PREFERRED_INTERACTIVE_SHELL) || true
endif
.PHONY: conda-env
conda-env:
if [ ! -d $(CONDA_ENV_DIR) ]; then \
$(CONDA) env create -f environment.yml -p $(CONDA_ENV_DIR); \
else \
$(CONDA) env update -f environment.yml -p $(CONDA_ENV_DIR); \
fi
yarn install