aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaj Tuomi <kaj.tuomi@siru.fi>2019-05-27 11:31:50 +0300
committerKaj Tuomi <kaj.tuomi@siru.fi>2019-05-27 11:31:50 +0300
commit90d070d2948bcccc8fc89d5ac147e078c77d9691 (patch)
treec6f60b2d7f5eadbd77762d910b38782429b186e3
parent29b898cf76283c0068864279ed611468dccd9aa9 (diff)
downloadyosys-90d070d2948bcccc8fc89d5ac147e078c77d9691.tar.gz
yosys-90d070d2948bcccc8fc89d5ac147e078c77d9691.tar.bz2
yosys-90d070d2948bcccc8fc89d5ac147e078c77d9691.zip
Guard all Python-api related items.
-rw-r--r--Makefile6
1 files changed, 6 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 9eafb2de8..db60e8288 100644
--- a/Makefile
+++ b/Makefile
@@ -21,12 +21,14 @@ ENABLE_PROTOBUF := 0
# python wrappers
ENABLE_PYOSYS := 0
+ifeq ($(ENABLE_PYOSYS),1)
PYTHON_VERSION_TESTCODE := "import sys;t='{v[0]}.{v[1]}'.format(v=list(sys.version_info[:2]));print(t)"
PYTHON_EXECUTABLE := $(shell if python3 -c ""; then echo "python3"; else echo "python"; fi)
PYTHON_VERSION := $(shell $(PYTHON_EXECUTABLE) -c ""$(PYTHON_VERSION_TESTCODE)"")
PYTHON_MAJOR_VERSION := $(shell echo $(PYTHON_VERSION) | cut -f1 -d.)
PYTHON_PREFIX := $(shell $(PYTHON_EXECUTABLE)-config --prefix)
PYTHON_DESTDIR := $(PYTHON_PREFIX)/lib/python$(PYTHON_VERSION)/site-packages
+endif
# other configuration flags
ENABLE_GCOV := 0
@@ -314,11 +316,13 @@ CXXFLAGS += $(shell $(PYTHON_EXECUTABLE)-config --includes) -DWITH_PYTHON
endif
endif
+ifeq ($(ENABLE_PYOSYS),1)
PY_WRAPPER_FILE = kernel/python_wrappers
OBJS += $(PY_WRAPPER_FILE).o
PY_GEN_SCRIPT= py_wrap_generator
PY_WRAP_INCLUDES := $(shell python$(PYTHON_VERSION) -c "from misc import $(PY_GEN_SCRIPT); $(PY_GEN_SCRIPT).print_includes()")
endif
+endif
ifeq ($(ENABLE_READLINE),1)
CXXFLAGS += -DYOSYS_ENABLE_READLINE
@@ -577,9 +581,11 @@ endif
$(Q) mkdir -p $(dir $@)
$(P) cat $< | grep -E -v "#[ ]*(include|error)" | $(LD) -x c++ -o $@ -E -P -
+ifeq ($(ENABLE_PYOSYS),1)
$(PY_WRAPPER_FILE).cc: misc/$(PY_GEN_SCRIPT).py $(PY_WRAP_INCLUDES)
$(Q) mkdir -p $(dir $@)
$(P) python$(PYTHON_VERSION) -c "from misc import $(PY_GEN_SCRIPT); $(PY_GEN_SCRIPT).gen_wrappers(\"$(PY_WRAPPER_FILE).cc\")"
+endif
%.o: %.cpp
$(Q) mkdir -p $(dir $@)