Skip to content

Commit

Permalink
Allow docs/Makefile to be portable
Browse files Browse the repository at this point in the history
Currently docs/Makefile downloads Conda but only the Linux version.
This commit allows it to detect the operating system and download the
corresponding Conda installer.

Additionally, `make` uses the sh shell which does not support the `source`
command. This causes the commands that use `source` to fail on some
systems that do not have the sh shell linked to something else (say dash).

Signed-off-by: Daniel Lim Wee Soong <weesoong.lim@gmail.com>
  • Loading branch information
daniellimws committed Apr 16, 2020
1 parent 1e800d5 commit 8b575e6
Showing 1 changed file with 25 additions and 10 deletions.
35 changes: 25 additions & 10 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,26 @@ MAKEDIR := $(dir $(lastword $(MAKEFILE_LIST)))

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = [ -e env/bin/activate ] && source env/bin/activate; sphinx-build
SPHINXAUTOBUILD = [ -e env/bin/activate ] && source env/bin/activate; sphinx-autobuild
SPHINXBUILD = [ -e env/bin/activate ] && . env/bin/activate; sphinx-build
SPHINXAUTOBUILD = [ -e env/bin/activate ] && . env/bin/activate; sphinx-autobuild
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:
Expand All @@ -21,18 +36,18 @@ livehtml:
.PHONY: help livehtml Makefile


env/Miniconda3-latest-Linux-x86_64.sh:
env/Miniconda3:
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
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
make env/Miniconda3
./env/Miniconda3-latest-$(OSFLAG)-x86_64.sh -p $(PWD)/env -b -f
. env/bin/activate; conda config --system --add envs_dirs $(PWD)/env/envs
. env/bin/activate; conda config --system --add pkgs_dirs $(PWD)/env/pkgs
. env/bin/activate; conda env update --name base --file ./environment.yml

.PHONY: env

Expand Down

0 comments on commit 8b575e6

Please sign in to comment.