env: use make-env and add conda environment

Signed-off-by: Alessandro Comodi <acomodi@antmicro.com>
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 1f4991f..f03746d 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -25,12 +25,11 @@
       run: |
         sed -i -e's/- python/- python=${{ matrix.python-version }}/' environment.yml
         cat environment.yml
-        # FIXME: #65 - Replace with `make-env`
-        ./prepareenv.sh
+        make env
 
     - name: Test
       run: |
-        TOXENV="$(echo py${{ matrix.python-version }} | sed -e's/\.//g')" .github/test.sh
+        TOXENV="$(echo py${{ matrix.python-version }} | sed -e's/\.//g')" make test-py
 
     - name: Upload test results
       uses: actions/upload-artifact@v2
diff --git a/MANIFEST.in b/MANIFEST.in
index cb0dfbe..cee3d1d 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,7 +1,9 @@
 exclude .readthedocs.yml
+exclude .gitmodules
 exclude environment.yml
 exclude tox.ini
 exclude *.swp
+exclude Makefile
 prune conf
 prune third_party
 
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..8df6859
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,30 @@
+# Copyright (C) 2021  The Symbiflow Authors.
+#
+# Use of this source code is governed by a ISC-style
+# license that can be found in the LICENSE file or at
+# https://opensource.org/licenses/ISC
+#
+# SPDX-License-Identifier: ISC
+
+SHELL=bash
+
+TOP_DIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST))))
+REQUIREMENTS_FILE ?= requirements.txt
+ENVIRONMENT_FILE ?= environment.yml
+
+TOXPYTHON ?=
+
+V2X_PYTHON_SRCS = $(shell find v2x -name "*py")
+
+include third_party/make-env/conda.mk
+
+env:: | $(CONDA_ENV_PYTHON)
+
+format: $(V2X_PYTHON_SRCS)
+	$(IN_CONDA_ENV) yapf -i ${V2X_PYTHON_SRCS} setup.py
+
+test-py:
+	$(IN_CONDA_ENV) TOXENV=$(TOXPYTHON) tox
+
+.PHONY: env build test-py
+
diff --git a/environment.yml b/environment.yml
index 336dad0..179c311 100644
--- a/environment.yml
+++ b/environment.yml
@@ -1,9 +1,18 @@
-name: yosys-env
+# Copyright (C) 2021  The SymbiFlow Authors.
+#
+# Use of this source code is governed by a ISC-style
+# license that can be found in the LICENSE file or at
+# https://opensource.org/licenses/ISC
+#
+# SPDX-License-Identifier:ISC
+
+name: symbiflow-v2x
 channels:
-  - symbiflow
+  - defaults
+  - litex-hub
 dependencies:
+  - litex-hub::symbiflow-yosys
   - python
-  - symbiflow-yosys
   - pip
   - pip:
     - -r requirements.txt
diff --git a/requirements.txt b/requirements.txt
index 88e8857..588f807 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -11,3 +11,4 @@
 pytest-runner
 readme_renderer
 tox
+yapf==0.24.0
diff --git a/tox.ini b/tox.ini
index 6f791c1..42c879a 100644
--- a/tox.ini
+++ b/tox.ini
@@ -18,7 +18,7 @@
     python setup.py check -m -r -s
     flake8 setup.py v2x
     pytest --doctest-modules -vv v2x --junitxml=junit/{basepython}-test-results.xml
-    pytest -vv
+    pytest -vv tests
 [flake8]
 exclude = .tox,*.egg,build,data
 select = E,W,F