blob: 96291cc3d9b6caf889f828bbcaa2cf75de082ac1 [file] [log] [blame] [edit]
# Minimal makefile for Sphinx documentation
#
SHELL = /bin/bash
MAKEDIR := $(dir $(lastword $(MAKEFILE_LIST)))
# You can set these variables from the command line.
EXP_OPEN := $$((
EXP_CLOSE := ))
CPU_CORES := $(shell nproc)
CPU_CORES_2 := $(shell echo $(EXP_OPEN) $(CPU_CORES) * 2 $(EXP_CLOSE))
SPHINXOPTS = -j $(CPU_CORES_2)
SPHINXBUILD = [ -e env/bin/activate ] && source env/bin/activate; sphinx-build
SPHINXAUTOBUILD = [ -e env/bin/activate ] && source env/bin/activate; sphinx-autobuild
SPHINXPROJ = SkywaterPDK
SOURCEDIR = .
BUILDDIR = _build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
# Vim makes a '4913' file for file system checking. Seriously.
livehtml:
@$(SPHINXAUTOBUILD) \
-b html \
--delay 5 \
\
--ignore \*.swp \
--ignore \*~ \
--ignore env \
--ignore _build \
--ignore .git \
--ignore */4913 \
\
$(SPHINXOPTS) \
"$(SOURCEDIR)" \
"$(BUILDDIR)/html"
.PHONY: help livehtml Makefile
# Conda environment to make it easy to get all the dependencies required (like Yosys and stuff).
env/Miniconda3-latest-Linux-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
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 requirements
.PHONY: env
# PIP requirements in the environment...
requirements.txt:
@true
env/.requirements.txt: requirements.txt
source env/bin/activate; pip install -r requirements.txt
touch -r requirements.txt env/.requirements.txt
requirements: env/.requirements.txt
@true
.PHONY: requirements
# Generate the rules/periphery-rules.rst from CSV files in rules/periphery/
$(wildcard rules/periphery/*):
true
rules/periphery-rules.rst: $(wildcard rules/periphery/*)
source env/bin/activate; cd rules/periphery; ./periphery-split-csv.py > /dev/null
# Various automated fixups that can be run
fixup:
# Make sure it is SkyWater
find ../ -type f -name \*.rst -exec sed -i 's/Skywater/SkyWater/gi' \{\} \+
# Strip trailing space
find ../ -type f -name \*.rst -exec sed -i 's/ \+$$//' \{\} \+
# Make sure all library names have the :lib: role.
find ../ -type f -name \*.rst -exec sed -i -e'/:name:.*/!s/\(:lib:\)\?`\?\(sky130_[a-z0-9]\+_[a-z0-9]\+\(_[a-z0-9]\+\)\?\)`\?\(\s\|$$\)/:lib:`\2`\4/g' \{\} \+
.PHONY: fixup
echo:
@echo '$(SPHINXBUILD) -M XXXX "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)'
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)