Merge pull request #41 from daniellimws/docs-portability Allow docs/Makefile to be portable
diff --git a/docs/Makefile b/docs/Makefile index 64f9ba2..2bff6bc 100644 --- a/docs/Makefile +++ b/docs/Makefile
@@ -1,6 +1,7 @@ # Minimal makefile for Sphinx documentation # +SHELL = /bin/bash MAKEDIR := $(dir $(lastword $(MAKEFILE_LIST))) # You can set these variables from the command line. @@ -10,6 +11,21 @@ SPHINXPROJ = SymbiFlowV2X SOURCEDIR = . BUILDDIR = _build +OSFLAG = +UNAME_S := $(shell uname -s) +ifneq (, $(findstring Linux, $(UNAME_S))) + OSFLAG := Linux +endif +ifeq ($(UNAME_S), Darwin) + OSFLAG := MacOSX +endif +ifneq (, $(findstring Cygwin, $(UNAME_S))) + OSFLAG := Linux +endif +ifneq (, $(findstring MINGW, $(UNAME_S))) + OSFLAG := Linux +endif + # Put it first so that "make" without argument is like "make help". help: @@ -21,15 +37,15 @@ .PHONY: help livehtml Makefile -env/Miniconda3-latest-Linux-x86_64.sh: +env/Miniconda3-latest-$(OSFLAG)-x86_64.sh: mkdir env - wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O env/Miniconda3-latest-Linux-x86_64.sh - chmod a+x env/Miniconda3-latest-Linux-x86_64.sh + wget https://repo.anaconda.com/miniconda/Miniconda3-latest-$(OSFLAG)-x86_64.sh -O env/Miniconda3-latest-$(OSFLAG)-x86_64.sh + chmod a+x env/Miniconda3-latest-$(OSFLAG)-x86_64.sh env: rm -rf env - make env/Miniconda3-latest-Linux-x86_64.sh - ./env/Miniconda3-latest-Linux-x86_64.sh -p $(PWD)/env -b -f + make env/Miniconda3-latest-$(OSFLAG)-x86_64.sh + ./env/Miniconda3-latest-$(OSFLAG)-x86_64.sh -p $(PWD)/env -b -f source env/bin/activate; conda config --system --add envs_dirs $(PWD)/env/envs source env/bin/activate; conda config --system --add pkgs_dirs $(PWD)/env/pkgs source env/bin/activate; conda env update --name base --file ./environment.yml