RM = rm FIND = find COPY = cp LN = ln CONDA = conda CONDA_ENV_FILE = environment.yml CONDA_ENV_NAME = csi702 PY = python PY_SETUP = setup.py JUPYTER = jupyter JUPYTERLAB_EXTENSIONS = jupyterlab_vim \ jupyterlab_templates \ @jupyterlab/git \ @jupyterlab/github \ @mflevine/jupyterlab_html \ @jupyter-widgets/jupyterlab-manager \ jupyter-matplotlib \ @ryantam626/jupyterlab_code_formatter \ jupyterlab-python-file JUPYTERLAB_SERVEREXTENSION = jupyterlab_templates \ jupyterlab_git \ jupyterlab_code_formatter R = Rscript define makefile_help @echo 'Makefile for CSI 702 virtual machine ' @echo ' ' @echo 'Usage: ' @echo ' make all Install all dependencies ' @echo ' make clean Clean up conda packages ' @echo ' make help display this message ' @echo ' make env create conda venv and install deps ' @echo ' ' endef define conda_cleanup bash -lc "$(CONDA) clean -y -a" sudo bash -lc "conda clean -y --packages" endef define install_python_deps bash -lc " \ $(CONDA) activate $(CONDA_ENV_NAME) && \ $(PY) -m nb_pdf_template.install --minted \ " endef define install_r_deps bash -lc "$(CONDA) activate $(CONDA_ENV_NAME) && \ $(R) -e \"install.packages('remotes', repos = 'https://cran.rstudio.com')\" \ -e \"remotes::install_deps()\"" endef define update_conda_env bash -lc "$(CONDA) env update --file $(CONDA_ENV_FILE)" endef define launch_jupyter_lab bash -lc " \ $(CONDA) activate $(CONDA_ENV_NAME) && \ $(JUPYTER) lab --ip='0.0.0.0' \ " endef define install_jupyterlab_extensions bash -lc " \ $(CONDA) activate $(CONDA_ENV_NAME) && \ $(JUPYTER) labextension install $(1) \ " endef define install_serverextension bash -lc " \ $(CONDA) activate $(CONDA_ENV_NAME) && \ $(JUPYTER) serverextension enable --py $(1) \ " endef all : env pydeps rdeps labextensions serverextensions help : $(call makefile_help) clean : $(call conda_cleanup) env : $(call update_conda_env) lab : $(call launch_jupyter_lab) labextensions : $(foreach extension,$(JUPYTERLAB_EXTENSIONS),$(call install_jupyterlab_extensions,--no-build $(extension));) bash -lc "$(CONDA) activate $(CONDA_ENV_NAME) && $(JUPYTER) lab build" pydeps : $(call install_python_deps) rdeps : $(call install_r_deps) serverextensions : $(foreach serverextension,$(JUPYTERLAB_SERVEREXTENSION),$(call install_serverextension,$(serverextension));) .PHONY : all clean env help lab labextensions pydeps rdeps serverextensions $(DIRS)