Resolved merge conflict of sky130/Makefile.in
diff --git a/README.md b/README.md
index 89f929f..e5d34ae 100644
--- a/README.md
+++ b/README.md
@@ -58,7 +58,7 @@
 the need to declare an install target or run "make install".  However, it is
 recommended to declare a target location and install there, using
 
-    ./configure --enable-[PDK_name]-pdk=[path] --with-[PDK_name]-local-path=[path]
+    ./configure --prefix=[/opt/pdks] --enable-[PDK_name]-pdk=[path]
 
 followed by "make" and "make install".
 
diff --git a/common/staging_install.py b/common/staging_install.py
index 52dad2e..be8d9e3 100755
--- a/common/staging_install.py
+++ b/common/staging_install.py
@@ -1,29 +1,54 @@
 #!/usr/bin/env python3
-#
-# staging_install.py
-#
-# This file copies the staging area created by foundry_install.py
-# into the target directory area, changing paths to match the target,
-# and creating symbolic links where requested and allowed.
-#
-# Options:
-#    -link_from <type>	Make symbolic links to vendor files from target
-#			Types are: "none", "source", or a PDK name.
-#			Default "none" (copy all files from source)
-#    -ef_format		Use efabless naming (libs.ref/techLEF),
-#			otherwise use generic naming (libs.tech/lef)
-#
-#    -staging <path>	Path to staging top level directory
-#    -target <path>	Path to target top level directory
-#    -local <path>	For distributed installs, this is the local
-#			path to target top level directory.
-#    -source <path>     Path to original source top level directory,
-#                       if link_from is "source".  This option may
-#                       be called multiple times if there are multiple
-#                       sources.
-#    -variable <name>	Specify a variable name that is used for the
-#			target path.  This variable name must be enforced
-#			in setup scripts like .magicrc
+
+"""
+staging_install.py [options...]
+
+This file copies the staging area created by foundry_install.py
+into the target directory area, changing paths to match the target,
+and creating symbolic links where requested and allowed.
+
+Options:
+  -staging <path>    Path to staging top level directory that the files
+                     will be installed from.
+
+  -target <path>     Final install path in system file system.
+
+                     Normally, '$(prefix)/pdks/<unique pdk name>'.
+
+                     If -local is not given, this will be the top level
+                     directory location the files are installed too.
+
+  -local <path>      Actual file system location to write the files too.
+                     The result can then be packaged and distributed.
+
+                     For usage with things like package managers and other
+                     administrator installation tooling.  The resulting
+                     files still need to be installed at '-target' on the
+                     final system.
+
+                     Think 'DESTDIR', see
+                     https://www.gnu.org/prep/standards/html_node/DESTDIR.html
+
+  -source <path>     Path to original source top level directory, if
+                     link_from is "source".  This option may be called
+                     multiple times if there are multiple sources.
+
+  -variable <name>   Specify a variable name that is used for the
+                     target path.  This variable name must be enforced
+                     in setup scripts like .magicrc
+
+Less common options:
+  -link_from <type>  Make symbolic links to vendor files from target.
+
+                     Types are: "none", "source", or a PDK name.
+
+                     Default "none" (copy all files from source)
+
+  -ef_format         Use efabless naming (libs.ref/techLEF),
+                     otherwise use generic naming (libs.tech/lef)
+
+If <target> is unspecified then <name> is used for the target.
+"""
 
 import re
 import os
@@ -38,20 +63,6 @@
 # in Python 3.8 and up ONLY using "dirs_exist_ok=True".
 from distutils.dir_util import copy_tree
 
-def usage():
-    print("staging_install.py [options...]")
-    print("   -link_from <name> Make symbolic links from target to <name>")
-    print("                     where <name> can be 'source' or a PDK name.")
-    print("                     Default behavior is to copy all files.")
-    print("   -copy             Copy files from source to target (default)")
-    print("   -ef_format        Use efabless naming conventions for local directories")
-    print("")
-    print("   -staging <path>   Path to top of staging directory tree")
-    print("   -target <path>    Path to top of target directory tree")
-    print("   -local <path>	Local path to top of target directory tree for distributed install")
-    print("")
-    print(" If <target> is unspecified then <name> is used for the target.")
-
 def makeuserwritable(filepath):
     if os.path.exists(filepath):
         st = os.stat(filepath)
@@ -225,7 +236,7 @@
 
     if len(sys.argv) == 1:
         print("No options given to staging_install.py.")
-        usage()
+        print(__doc__)
         sys.exit(0)
 
     optionlist = []
diff --git a/scripts/configure b/scripts/configure
index 80d66e5..aed9348 100755
--- a/scripts/configure
+++ b/scripts/configure
@@ -585,7 +585,6 @@
 PACKAGE_BUGREPORT='github.com/RTimothyEdwards/open_pdks'
 PACKAGE_URL=''
 
-ac_default_prefix=/usr/share
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
 EF_STYLE
@@ -662,8 +661,6 @@
 ac_user_opts='
 enable_option_checking
 enable_sky130_pdk
-with_sky130_dist_path
-with_sky130_local_path
 with_sky130_link_targets
 enable_klayout
 enable_magic
@@ -1362,11 +1359,6 @@
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
-  --with-sky130-dist-path=/path/to/install/sky130
-                          "staging location to install the PDK for
-                          distribution (optional)"
-  --with-sky130-local-path=/path/to/install/sky130
-                          "run-time location of the PDK"
   --with-sky130-link-targets=none|source
                           "make symbolic links to existing files
                           [default=none]"
@@ -1933,7 +1925,7 @@
 if ${am_cv_python_version+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  am_cv_python_version=`$PYTHON -c "import sys; sys.stdout.write(sys.version[:3])"`
+  am_cv_python_version=`$PYTHON -c "import sys; print('%u.%u' % sys.version_info[:2])"`
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_python_version" >&5
 $as_echo "$am_cv_python_version" >&6; }
@@ -2205,7 +2197,7 @@
 
 
         SKY130_SOURCE_PATH=""
-        SKY130_LOCAL_PATH="/usr/share/pdk"
+        SKY130_LOCAL_PATH="${datadir}/pdk"
         SKY130_DIST_PATH=""
         SKY130_LINK_TARGETS="none"
         SKY130_AUTO="0"
@@ -2270,50 +2262,6 @@
 $as_echo "$as_me: PDK 'sky130' will be downloaded automatically during make." >&6;}
 	    fi
 
-            # --with-pdk-dist-path=PDK_DIST_PATH
-
-# Check whether --with-sky130-dist-path was given.
-if test "${with_sky130_dist_path+set}" = set; then :
-  withval=$with_sky130_dist_path; SKY130_DIST_PATH=$withval
-
-fi
-
-
-            # "Require" this argument
-            { $as_echo "$as_me:${as_lineno-$LINENO}: Checking whether distribution path is specified for 'sky130'" >&5
-$as_echo "$as_me: Checking whether distribution path is specified for 'sky130'" >&6;}
-            if test "x$SKY130_DIST_PATH" == "x" ; then
-                { $as_echo "$as_me:${as_lineno-$LINENO}: Option --with-sky130-dist-path=<path> not specified.  Local install only." >&5
-$as_echo "$as_me: Option --with-sky130-dist-path=<path> not specified.  Local install only." >&6;}
-                SKY130_DIST_PATH=""
-            else
-                SKY130_DIST_PATH=`realpath $SKY130_DIST_PATH`
-            fi
-
-            # --with-pdk-local-path=PDK_LOCAL_PATH
-
-# Check whether --with-sky130-local-path was given.
-if test "${with_sky130_local_path+set}" = set; then :
-  withval=$with_sky130_local_path; SKY130_LOCAL_PATH=$withval
-
-fi
-
-
-            # Require this argument
-            { $as_echo "$as_me:${as_lineno-$LINENO}: Checking whether local path is specified for 'sky130'" >&5
-$as_echo "$as_me: Checking whether local path is specified for 'sky130'" >&6;}
-            if test "x$SKY130_LOCAL_PATH" == "x" ; then
-                as_fn_error $? "Option --with-sky130-local-path=<path> not specified!" "$LINENO" 5
-                SKY130_LOCAL_PATH=""
-            else
-            	{ $as_echo "$as_me:${as_lineno-$LINENO}: Install path for 'sky130' is $SKY130_LOCAL_PATH" >&5
-$as_echo "$as_me: Install path for 'sky130' is $SKY130_LOCAL_PATH" >&6;}
-		# If dist-path is specified then do not try to expand local-path
-		if test "$SKY130_DIST_PATH" == "" ; then
-		    SKY130_LOCAL_PATH=`realpath $SKY130_LOCAL_PATH`
-		fi
-            fi
-
             # --with-pdk-link-targets=PDK_LINK_TARGETS
 
 # Check whether --with-sky130-link-targets was given.
diff --git a/scripts/configure.ac b/scripts/configure.ac
index 972bd37..5fdc3ef 100755
--- a/scripts/configure.ac
+++ b/scripts/configure.ac
@@ -1,6 +1,6 @@
 AC_INIT([open_pdks], [1.0], [github.com/RTimothyEdwards/open_pdks])
 
-AC_PREFIX_DEFAULT(/usr/share)
+AC_CONFIG_MACRO_DIR(m4)
 
 ## REQUIRES: https://www.gnu.org/software/autoconf-archive/ax_python_module.html#ax_python_module
 AM_PATH_PYTHON([3.4])
@@ -36,8 +36,6 @@
         m4_define([pdkvar], [m4_normalize(m4_esyscmd(echo pdk | tr "a-z-" "A-Z_"))])
 
         pdkvar[]_SOURCE_PATH=""
-        pdkvar[]_LOCAL_PATH="/usr/share/[pdk]"
-        pdkvar[]_DIST_PATH=""
         pdkvar[]_LINK_TARGETS="none"
         pdkvar[]_AUTO="0"
 
@@ -55,7 +53,6 @@
             ], [
             ]
         )
-	    # # Require this argument
 
         if @<:@ "$[]pdkvar[]_SOURCE_PATH" != "" @:>@; then
             pdkvar[]_SOURCE_PATH=`realpath $[]pdkvar[]_SOURCE_PATH`
@@ -76,40 +73,6 @@
 		AC_MSG_NOTICE([PDK 'pdk' will be downloaded automatically during make.])
 	    fi
 
-            # --with-pdk-dist-path=PDK_DIST_PATH
-            AC_ARG_WITH(pdk-dist-path,
-                [AS_HELP_STRING([--with-pdk-dist-path=/path/to/install/pdk], "staging location to install the PDK for distribution (optional)")],
-                [pdkvar[]_DIST_PATH=$withval]
-            )
-
-            # "Require" this argument
-            AC_MSG_NOTICE([Checking whether distribution path is specified for 'pdk'])
-            if test "x$[]pdkvar[]_DIST_PATH" == "x" ; then
-                AC_MSG_NOTICE([Option --with-pdk-dist-path=<path> not specified.  Local install only.])
-                pdkvar[]_DIST_PATH=""
-            else
-                pdkvar[]_DIST_PATH=`realpath $[]pdkvar[]_DIST_PATH`
-            fi
-
-            # --with-pdk-local-path=PDK_LOCAL_PATH
-            AC_ARG_WITH(pdk-local-path,
-                [AS_HELP_STRING([--with-pdk-local-path=/path/to/install/pdk], "run-time location of the PDK")],
-                [pdkvar[]_LOCAL_PATH=$withval]
-            )
-
-            # Require this argument
-            AC_MSG_NOTICE([Checking whether local path is specified for 'pdk'])
-            if test "x$[]pdkvar[]_LOCAL_PATH" == "x" ; then
-                AC_MSG_ERROR([Option --with-pdk-local-path=<path> not specified!])
-                pdkvar[]_LOCAL_PATH=""
-            else
-            	AC_MSG_NOTICE([Install path for 'pdk' is $[]pdkvar[]_LOCAL_PATH])
-		# If dist-path is specified then do not try to expand local-path
-		if test "$[]pdkvar[]_DIST_PATH" == "" ; then
-		    pdkvar[]_LOCAL_PATH=`realpath $[]pdkvar[]_LOCAL_PATH`
-		fi
-            fi
-
             # --with-pdk-link-targets=PDK_LINK_TARGETS
             AC_ARG_WITH(pdk-link-targets,
                 [AS_HELP_STRING([--with-pdk-link-targets=none|source], "make symbolic links to existing files @<:@default=none@:>@")],
@@ -120,8 +83,6 @@
         fi
 
         AC_SUBST(pdkvar[]_SOURCE_PATH)
-        AC_SUBST(pdkvar[]_LOCAL_PATH)
-        AC_SUBST(pdkvar[]_DIST_PATH)
         AC_SUBST(pdkvar[]_LINK_TARGETS)
     ])
 ])
diff --git a/scripts/m4/ax_python_module.m4 b/scripts/m4/ax_python_module.m4
new file mode 100644
index 0000000..f0f873d
--- /dev/null
+++ b/scripts/m4/ax_python_module.m4
@@ -0,0 +1,56 @@
+# ===========================================================================
+#     https://www.gnu.org/software/autoconf-archive/ax_python_module.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_PYTHON_MODULE(modname[, fatal, python])
+#
+# DESCRIPTION
+#
+#   Checks for Python module.
+#
+#   If fatal is non-empty then absence of a module will trigger an error.
+#   The third parameter can either be "python" for Python 2 or "python3" for
+#   Python 3; defaults to Python 3.
+#
+# LICENSE
+#
+#   Copyright (c) 2008 Andrew Collier
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved. This file is offered as-is, without any
+#   warranty.
+
+#serial 9
+
+AU_ALIAS([AC_PYTHON_MODULE], [AX_PYTHON_MODULE])
+AC_DEFUN([AX_PYTHON_MODULE],[
+    if test -z $PYTHON;
+    then
+        if test -z "$3";
+        then
+            PYTHON="python3"
+        else
+            PYTHON="$3"
+        fi
+    fi
+    PYTHON_NAME=`basename $PYTHON`
+    AC_MSG_CHECKING($PYTHON_NAME module: $1)
+    $PYTHON -c "import $1" 2>/dev/null
+    if test $? -eq 0;
+    then
+        AC_MSG_RESULT(yes)
+        eval AS_TR_CPP(HAVE_PYMOD_$1)=yes
+    else
+        AC_MSG_RESULT(no)
+        eval AS_TR_CPP(HAVE_PYMOD_$1)=no
+        #
+        if test -n "$2"
+        then
+            AC_MSG_ERROR(failed to find required module $1)
+            exit 1
+        fi
+    fi
+])
diff --git a/sky130/Makefile.in b/sky130/Makefile.in
index 883b80e..6576f3c 100644
--- a/sky130/Makefile.in
+++ b/sky130/Makefile.in
@@ -21,18 +21,6 @@
 #		downloaded and installed to <repo root>/pdks.
 #		If explicitly disabled, sky130 is skipped over entirely.
 #
-#	--with-sky130-local-path=<path>
-#		where <path> is the run-time location of the installed PDK
-#		files generated by open_pdks.  This option is mandatory and
-#		has no default.
-#
-#	--with-sky130-dist-path=<path>
-#		where <path> is the install-time location of the installed
-#		PDK files generated by open_pdks, with the expectation that
-#		<path> is something like a git repository that is then
-#		distributed across a system.  If this option is not specified,
-#		then files are installed to the local path.
-#
 #	--with-sky130-link-targets=<value>
 #		where <value> is one of "none" or "source".  If set to "source",
 #		then where possible, the installed files are symbolic links
@@ -129,15 +117,10 @@
 #	SKYWATER_PATH: points to vendor sources
 #	EF_STYLE: 1 for efabless style, 0 otherwise
 #	LINK_TARGETS: link back to source or link to 1st PDK when possible
-#	DIST_PATH: install location for distributed install
-#	LOCAL_PATH: install location for local install or runtime location
-#		    for distributed install
 #
 # Run "make" to stage the PDK for tool setup and vendor libraries
 #
-# Run "make install" to install all staged files.  The installation is
-# either local or distributed, depending on whether --with-sky130-dist-path
-# has been set when running configure.
+# Run "make install" to install all staged files.
 #
 # Run "make clean" to remove all staging files.
 #
@@ -156,6 +139,10 @@
 MV = mv
 SED = @SED@
 
+prefix = @prefix@
+datarootdir = @datarootdir@
+datadir = @datadir@
+
 # Use git revision if this is a cloned repo;  otherwise get the revision
 # from the VERSION file in the directory above.
 GITREV = $(shell git describe --long)
@@ -184,6 +171,8 @@
 
 STAGING_PATH = $(shell pwd)/build
 
+SHARED_PDKS_PATH = $(datadir)/pdks
+
 # If LINK_TARGETS is set to "none", then files are copied
 # from the SkyWater sources to the target.  If set to "source",
 # symbolic links are made in the target directories pointing
@@ -227,24 +216,18 @@
 # Once updated in git, the git project can be distributed to all hosts.
 #
 ifeq (${EF_STYLE}, 1)
-    LOCAL_PATH = @SKY130_LOCAL_PATH@
     CONFIG_DIR = .ef-config
     REV_DIR = ${REVISION}
 else
-    # LOCAL_PATH = /usr/local/share/vlsi/SkyWater
-    LOCAL_PATH = @SKY130_LOCAL_PATH@
     CONFIG_DIR = .config
     REV_DIR = .
 endif
 
-# DIST_PATH = ~/gits/ef-skywater-${TECH}
-DIST_PATH = @SKY130_DIST_PATH@
-
 # EF process nodes created from the master sources
 SKY130A = sky130A
 
 ifeq (${LINK_TARGETS}, ${SKY130A})
-    DIST_LINK_TARGETS = ${LOCAL_PATH}/${LINK_TARGETS}
+    DIST_LINK_TARGETS = ${SHARED_PDKS_PATH}/${LINK_TARGETS}
 else
     DIST_LINK_TARGETS = ${LINK_TARGETS}
 endif
@@ -391,13 +374,17 @@
 # The following script in the ../common directory does most of the work of
 # copying or linking the foundry vendor files to the target directory.
 STAGE = set -f ; ../common/foundry_install.py ${EF_FORMAT}
+ifneq ($(DESTDIR), )
+INSTALL = ../common/staging_install.py -local $(DESTDIR)
+else
 INSTALL = ../common/staging_install.py ${EF_FORMAT}
+endif
 
 # The script(s) below are used for custom changes to the vendor PDK files
 ADDPROP = ../common/insert_property.py ${EF_FORMAT}
 
 # List the EDA tools to install local setup files for
-TOOLS =
+TOOLS = 
 
 # KLAYOUT_DISABLED = 0 | 1
 KLAYOUT_DISABLED = @KLAYOUT_DISABLED@
@@ -1133,56 +1120,23 @@
 			options=custom/scripts/gds_import_setup.tcl \
 		-library digital sky130_osu_sc_18t_ls 2>&1 | tee -a ${SKY130A}_make.log
 
-install:
-	if test "x${DIST_PATH}" == "x" ; then \
-	    ${MAKE} install-local ; \
-	else \
-	    ${MAKE} install-dist; \
-	fi
+install: install-a
 
-install-local: install-local-a
-
-install-local-a:
+install-a:
 	echo "Starting SKY130 PDK migration on "`date` > ${SKY130A}_install.log
-	${INSTALL} -source ${STAGING_PATH}/${SKY130A} \
-		-target ${LOCAL_PATH}/${SKY130A} \
+	${INSTALL} \
+		-source ${STAGING_PATH}/${SKY130A} \
+		-target ${SHARED_PDKS_PATH}/${SKY130A} \
 		-variable PDKPATH \
 		-link_from ${LINK_TARGETS} 2>&1 | tee -a ${SKY130A}_install.log
 	echo "Ended SKY130 PDK migration on "`date` >> ${SKY130A}_install.log
 
-install-dist: install-dist-a
+uninstall: uninstall-a
 
-install-dist-a:
-	echo "Starting SKY130 PDK migration on "`date` > ${SKY130A}_install.log
-	${INSTALL} -source ${STAGING_PATH}/${SKY130A} \
-		-target ${DIST_PATH}/${SKY130A} \
-		-variable PDKPATH \
-		-local ${LOCAL_PATH}/${SKY130A} \
-		-link_from ${DIST_LINK_TARGETS} 2>&1 | tee -a ${SKY130A}_install.log
-	echo "Ended SKY130 PDK migration on "`date` >> ${SKY130A}_install.log
-
-uninstall:
-	if test "x${DIST_PATH}" == "x" ; then \
-	    ${MAKE} uninstall-local ; \
-	else \
-	    ${MAKE} uninstall-dist; \
-	fi
-
-uninstall-local: uninstall-local-a
-
-uninstall-local-a:
-	echo "Uninstalling SKY130 PDK from ${LOCAL_PATH}"
-	if test "x${LOCAL_PATH}" != "x" ; then \
-		${RM} -rf ${LOCAL_PATH}/${SKY130A} ; \
-	fi
-	echo "Finished SKY130 PDK uninstall"
-
-uninstall-dist: uninstall-dist-a
-
-uninstall-dist-a:
-	echo "Uninstalling SKY130 PDK from ${DIST_PATH}"
-	if test "x${DIST_PATH}" != "x" ; then \
-		${RM} -rf ${DIST_PATH}/${SKY130A} ; \
+uninstall-a:
+	echo "Uninstalling SKY130 PDK from ${SHARED_PDKS_PATH}"
+	if test "x${SHARED_PDKS_PATH}" != "x" ; then \
+		${RM} -rf ${SHARED_PDKS_PATH}/${SKY130A} ; \
 	fi
 	echo "Finished SKY130 PDK uninstall"
 
@@ -1199,4 +1153,32 @@
 	# Legacy name
 	${RM} ${SKY130A}_migrate.log
 
+# Old aliases for compatibility
+# -------------------------------------------------------------------------------------
+install-dist:
+	$(warning "'make install-dist' has been replaced with 'make install'")
+	make install
+install-local:
+	$(warning "'make install-local' has been replaced with 'make install'")
+	make install
 
+uninstall-dist:
+	$(warning "'make uninstall-dist' has been replaced with 'make uninstall'")
+	make uninstall
+uninstall-local:
+	$(warning "'make uninstall-local' has been replaced with 'make uninstall'")
+	make uninstall
+
+install-dist-a:
+	$(warning "'make install-dist-a' has been replaced with 'make install'")
+	make install
+install-local-a:
+	$(warning "'make install-local-a' has been replaced with 'make install'")
+	make install
+
+uninstall-dist-a:
+	$(warning "'make uninstall-dist-a' has been replaced with 'make uninstall'")
+	make uninstall
+uninstall-local-a:
+	$(warning "'make uninstall-local-a' has been replaced with 'make uninstall'")
+	make uninstall