move morphle stuff out of top level Makefile
diff --git a/Makefile b/Makefile
index 488e814..fc48b11 100644
--- a/Makefile
+++ b/Makefile
@@ -1,20 +1,3 @@
-# SPDX-FileCopyrightText: Copyright 2020 eFabless
-# 
-# SPDX-License-Identifier: Apache-2.0
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-# 
-#     https://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
 # cannot commit files larger than 100 MB to GitHub 
 FILE_SIZE_LIMIT_MB = 100
 LARGE_FILES := $(shell find ./gds -type f -name "*.gds")
@@ -25,6 +8,7 @@
 ARCHIVES := $(shell find . -type f -name "*.gz")
 ARCHIVE_SOURCES := $(basename $(ARCHIVES))
 
+
 # PDK setup configs
 THREADS ?= $(shell nproc)
 STD_CELL_LIBRARY ?= sky130_fd_sc_hd
@@ -55,36 +39,6 @@
 verify:
 	echo "verify"
 
-.PHONY: init_block_flat
-init_block_flat:
-	@echo
-	@echo "       clearing user_projec_example"
-	@echo
-	rm -fR openlane/user_proj_example/*
-	@echo
-	@echo "       overwritting user_proj_example with 16x16 block"
-	@echo
-	cp ol_templates/config_block.tcl openlane/user_proj_example/config.tcl
-	cp ol_templates/pin_order.cfg openlane/user_proj_example/pin_order.cfg
-
-.PHONY: init_block_cells
-init_block_cells:
-	@echo
-	@echo "       clearing user_projec_example"
-	@echo
-	rm -fR openlane/user_proj_example/*
-	@echo
-	@echo "       overwritting user_proj_example with 16x16 block using black box cells"
-	@echo
-	cp ol_templates/config_block2.tcl openlane/user_proj_example/config.tcl
-	cp ol_templates/pdn.tcl openlane/user_proj_example/pdn.tcl
-	cp ol_templates/pin_order.cfg openlane/user_proj_example/pin_order.cfg
-
-.PHONY: help
-help:
-	@echo "      available commands (do 'make <command>')"
-	@echo
-	@awk '/^.PHONY/{print "    " $$2}' Makefile
 
 
 $(LARGE_FILES_GZ): %.gz: %
@@ -108,6 +62,38 @@
 uncompress: $(ARCHIVE_SOURCES)
 	@echo "All files are uncompressed!"
 
+
+# LVS
+NETGEN_SETUP=$(PDK_ROOT)/sky130A/libs.tech/netgen/sky130A_setup.tcl
+
+BLOCKS = $(shell cd openlane && find * -maxdepth 0 -type d)
+LVS_BLOCKS = $(foreach block, $(BLOCKS), lvs-$(block))
+$(LVS_BLOCKS): lvs-% : ./mag/%.mag ./verilog/gl/%.v ./spi/lvs/%.spice
+	echo "Extracting $*"
+	mkdir -p ./mag/tmp
+	echo "load $* -dereference;\
+		extract no all;\
+		extract do local;\
+		extract;\
+		ext2spice lvs;\
+		ext2spice;\
+		feedback save extract_$*.log;\
+		exit;" > ./mag/extract_$*.tcl
+	cd mag && MAGTYPE=maglef magic -rcfile ${PDK_ROOT}/sky130A/libs.tech/magic/current/sky130A.magicrc -noc -dnull extract_$*.tcl
+	mv ./mag/$*.spice ./spi/lvs
+	mv -f ./mag/extract_$*.{tcl,log} ./mag/*.ext ./mag/tmp
+	####
+	mkdir -p ./spi/lvs/tmp
+	sh ./spi/lvs/run_lvs.sh ./verilog/gl/$*.v ./spi/lvs/$*.spice $*
+	mv -f ./spi/lvs/*{.out,.json,.log} ./spi/lvs/tmp
+	
+
+.PHONY: help
+help:
+	@$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$'
+
+		
+###########################################################################
 .PHONY: pdk
 pdk: skywater-pdk skywater-library open_pdks build-pdk
 
diff --git a/README.md b/README.md
index a314dd5..0682358 100644
--- a/README.md
+++ b/README.md
@@ -35,13 +35,13 @@
 
     export PDK_ROOT=<path where the various PDK projects will be placed>
 
-If the supplied *user_proj_example* is still present in the openlane subdirectory, then this will patch it to use Morphle Logic verilog files instead by replacing only the *config.tcl* file:
+If the supplied *user_proj_example* is still present in the openlane subdirectory, then this will patch it to use Morphle Logic verilog files instead by replacing everything in that subdirectory with new versions of the needed files:
 
-    make copy_config_block
+    cd ol_templates
+    make init_block_flat
+    cd ..
 
-If you need a reminder of the possible targets for *make* just do:
-
-    make help
+In the *ol_templates* subdirectory, you can "make help" to see other options. One such is "make init_block_cells" which will copy the files needed so that *user_proj_example* will be built using the yellow cells as block boxes instead of doing the whole circuit at once. This will require having previously generated the ycell files.
 
 If the various PDK packages have been installed with the correct versions then this step can be skipped:
 
@@ -58,9 +58,11 @@
 
     make openlane
 
-Be sure that you have the latest version of the *magic* tool, otherwise you will get some very hard to understand errors.
+If the project is going to be built using the yellow cells as black boxes, then they have to be generated first:
 
-The first actual step is to generate all the files for the example project:
+    make morphle_ycell
+
+The next step (which is the first non optional one) is to generate all the files for the example project:
 
     make user_proj_example
 
@@ -70,6 +72,7 @@
     make user_project_wrapper
 
 Now we have the *gds/user_project_wrapper.gds* file that the main script needs.
+Be sure that you have the latest version of the *magic* tool, otherwise you will get some very hard to understand errors.
 
     cd ..
     make ship
diff --git a/ol_templates/Makefile b/ol_templates/Makefile
new file mode 100644
index 0000000..a4be0f0
--- /dev/null
+++ b/ol_templates/Makefile
@@ -0,0 +1,50 @@
+# SPDX-FileCopyrightText: Copyright 2020 Jecel Mattos de Assumpcao Jr
+# 
+# SPDX-License-Identifier: Apache-2.0
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+#     https://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+
+.PHONY: init_block_flat
+init_block_flat:
+	@echo
+	@echo "       clearing user_projec_example"
+	@echo
+	rm -fR ../openlane/user_proj_example/*
+	@echo
+	@echo "       overwritting user_proj_example with 16x16 block"
+	@echo
+	cp config_block.tcl ../openlane/user_proj_example/config.tcl
+	cp pin_order.cfg ../openlane/user_proj_example/pin_order.cfg
+
+.PHONY: init_block_cells
+init_block_cells:
+	@echo
+	@echo "       clearing user_projec_example"
+	@echo
+	rm -fR ../openlane/user_proj_example/*
+	@echo
+	@echo "       overwritting user_proj_example with 16x16 block using black box cells"
+	@echo
+	cp config_block2.tcl ../openlane/user_proj_example/config.tcl
+	cp pdn.tcl ../openlane/user_proj_example/pdn.tcl
+	cp pin_order.cfg ../openlane/user_proj_example/pin_order.cfg
+
+.PHONY: help
+help:
+	@echo "      available commands (do 'make <command>')"
+	@echo
+	@awk '/^.PHONY/{print "    " $$2}' Makefile
+
+