-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
73 lines (51 loc) · 1.87 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# Copyright (C) 2020 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
# The top directory where environment will be created.
TOP_DIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST))))
# A pip `requirements.txt` file.
# https://pip.pypa.io/en/stable/reference/pip_install/#requirements-file-format
REQUIREMENTS_FILE := requirements.txt
# A conda `environment.yml` file.
# https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html
ENVIRONMENT_FILE := environment.yml
include third_party/make-env/conda.mk
# Create a version.py file
VERSION_PY = sphinx_verilog_domain/version.py
$(VERSION_PY):
@echo "__version__ = '$$(git describe | sed -e's/v\([0-9]\+\)\.\([0-9]\+\)-\([0-9]\+\)-g[0-9a-f]\+/\1.\2.post\3/')'" > $@
.PHONY: $(VERSION_PY)
version:
@if $$(git rev-parse --is-shallow-repository); then git fetch --unshallow; fi
git fetch origin --tags
@$(MAKE) $(VERSION_PY)
@cat $(VERSION_PY)
version-clean:
rm -f $(VERSION_PY)
.PHONY: version-clean
clean:: version-clean
# Build the package locally
# -------------------------------------
build: $(VERSION_PY) | $(CONDA_ENV_PYTHON)
$(IN_CONDA_ENV) python setup.py sdist bdist_wheel && twine check dist/*
build-clean:
rm -rf env/downloads/conda-pkgs
rm -rf build dist *.egg-info
find -name *.pyc -delete
find -name __pycache__ -delete
.PHONY: build build-clean
clean:: build-clean
# Upload the package to PyPi
# -------------------------------------
#PYPI_TEST = --repository-url https://test.pypi.org/legacy/
#PYPI_TEST = --repository testpypi
upload-test: build | $(CONDA_ENV_PYTHON)
$(IN_CONDA_ENV) twine upload ${PYPI_TEST} dist/*
.PHONY: upload-test
upload: build | $(CONDA_ENV_PYTHON)
$(IN_CONDA_ENV) twine upload --verbose dist/*
.PHONY: upload