Merge pull request #135 from riking/patch-1

Add 'make submodules' to download standard cell libraries
diff --git a/README.rst b/README.rst
index 9a17ca2..1f53be5 100644
--- a/README.rst
+++ b/README.rst
@@ -111,6 +111,16 @@
 
 We are excited to see additions to this documentation around using this design kit with new tools and design flows. Please see the `Contributing file <docs/contributing.rst>`_ for information on how to do this.
 
+To download or update to the 'latest' version of all standard cell libraries, and to regenerate the liberty files, clone this repository and run the following commands.
+
+```bash
+# Expect a large download! ~7GB at time of writing.
+SUBMODULE_VERSION=latest make submodules -j3 || make submodules -j1
+
+# Regenerate liberty files
+make timing
+```
+
 Support
 =======
 
diff --git a/README.src.rst b/README.src.rst
index fb600e3..253c304 100644
--- a/README.src.rst
+++ b/README.src.rst
@@ -93,6 +93,16 @@
 
 We are excited to see additions to this documentation around using this design kit with new tools and design flows. Please see the `Contributing file <docs/contributing.rst>`_ for information on how to do this.
 
+To download or update to the 'latest' version of all standard cell libraries, and to regenerate the liberty files, clone this repository and run the following commands.
+
+```bash
+# Expect a large download! ~7GB at time of writing.
+SUBMODULE_VERSION=latest make submodules -j3 || make submodules -j1
+
+# Regenerate liberty files
+make timing
+```
+
 Support
 =======
 
diff --git a/scripts/make/git.mk b/scripts/make/git.mk
index a058758..e1a862e 100644
--- a/scripts/make/git.mk
+++ b/scripts/make/git.mk
@@ -15,6 +15,25 @@
 FULL_VERSION := $(shell git describe --long)
 TAG_VERSION  := $(firstword $(subst -, ,$(FULL_VERSION)))
 
+SUBMODULE_VERSION ?= latest
+
 ifeq (,$(FULL_VERSION))
 $(error "Version value could not be determined. Make sure you fetch the tags.")
 endif
+
+submodules: libraries/sky130_fd_sc_hd/$(SUBMODULE_VERSION)/.git libraries/sky130_fd_sc_hdll/$(SUBMODULE_VERSION)/.git libraries/sky130_fd_sc_hs/$(SUBMODULE_VERSION)/.git libraries/sky130_fd_sc_ms/$(SUBMODULE_VERSION)/.git libraries/sky130_fd_sc_ls/$(SUBMODULE_VERSION)/.git
+
+libraries/sky130_fd_sc_hd/%/.git: .gitmodules
+	git submodule update --init $(@D)
+
+libraries/sky130_fd_sc_hdll/%/.git: .gitmodules
+	git submodule update --init $(@D)
+
+libraries/sky130_fd_sc_hs/%/.git: .gitmodules
+	git submodule update --init $(@D)
+
+libraries/sky130_fd_sc_ms/%/.git: .gitmodules
+	git submodule update --init $(@D)
+
+libraries/sky130_fd_sc_ls/%/.git: .gitmodules
+	git submodule update --init $(@D)