@@ -123,8 +123,8 @@ ifneq ($(shell :; command -v brew),)
123123BREW_PREFIX := $(shell brew --prefix) /opt
124124$(info $$BREW_PREFIX is [${BREW_PREFIX}])
125125ifeq ($(ENABLE_PYOSYS ) ,1)
126- CXXFLAGS += -I$(BREW_PREFIX ) /boost/include/boost
127- LINKFLAGS += -L$(BREW_PREFIX ) /boost/lib
126+ CXXFLAGS += -I$(BREW_PREFIX ) /boost/include
127+ LINKFLAGS += -L$(BREW_PREFIX ) /boost/lib -L $( BREW_PREFIX ) /boost-python3/lib
128128endif
129129CXXFLAGS += -I$(BREW_PREFIX ) /readline/include
130130LINKFLAGS += -L$(BREW_PREFIX ) /readline/lib
@@ -153,7 +153,14 @@ ifeq ($(OS), Haiku)
153153CXXFLAGS += -D_DEFAULT_SOURCE
154154endif
155155
156- YOSYS_VER := 0.50+0
156+ YOSYS_VER := 0.51+0
157+ YOSYS_MAJOR := $(shell echo $(YOSYS_VER ) | cut -d'.' -f1)
158+ YOSYS_MINOR := $(shell echo $(YOSYS_VER ) | cut -d'.' -f2 | cut -d'+' -f1)
159+ YOSYS_COMMIT := $(shell echo $(YOSYS_VER ) | cut -d'+' -f2)
160+ CXXFLAGS += -DYOSYS_VER=\\"$(YOSYS_VER ) \\" \
161+ -DYOSYS_MAJOR=$(YOSYS_MAJOR ) \
162+ -DYOSYS_MINOR=$(YOSYS_MINOR ) \
163+ -DYOSYS_COMMIT=$(YOSYS_COMMIT )
157164
158165# Note: We arrange for .gitcommit to contain the (short) commit hash in
159166# tarballs generated with git-archive(1) using .gitattributes. The git repo
@@ -169,7 +176,7 @@ endif
169176OBJS = kernel/version_$(GIT_REV ) .o
170177
171178bumpversion :
172- sed -i " /^YOSYS_VER := / s/+[0-9][0-9]*$$ /+` git log --oneline b5170e1 .. | wc -l` /;" Makefile
179+ sed -i " /^YOSYS_VER := / s/+[0-9][0-9]*$$ /+` git log --oneline c4b5190 .. | wc -l` /;" Makefile
173180
174181ABCMKARGS = CC="$(CXX ) " CXX="$(CXX ) " ABC_USE_LIBSTDCXX=1 ABC_USE_NAMESPACE=abc VERBOSE=$(Q )
175182
@@ -330,8 +337,13 @@ TARGETS += libyosys.so
330337endif
331338
332339ifeq ($(ENABLE_PYOSYS ) ,1)
340+ # python-config --ldflags includes -l and -L, but LINKFLAGS is only -L
341+ LINKFLAGS += $(filter-out -l% ,$(shell $(PYTHON_CONFIG ) --ldflags) )
342+ LIBS += $(shell $(PYTHON_CONFIG ) --libs)
343+ CXXFLAGS += $(shell $(PYTHON_CONFIG ) --includes) -DWITH_PYTHON
344+
333345# Detect name of boost_python library. Some distros use boost_python-py<version>, other boost_python<version>, some only use the major version number, some a concatenation of major and minor version numbers
334- CHECK_BOOST_PYTHON = (echo "int main(int argc, char ** argv) {return 0;}" | $(CXX ) -xc -o /dev/null $(shell $(PYTHON_CONFIG ) --ldflags ) -l$(1 ) - > /dev/null 2>&1 && echo "-l$(1 ) ")
346+ CHECK_BOOST_PYTHON = (echo "int main(int argc, char ** argv) {return 0;}" | $(CXX ) -xc -o /dev/null $(LINKFLAGS ) $(LIBS ) -l$(1 ) - > /dev/null 2>&1 && echo "-l$(1 ) ")
335347BOOST_PYTHON_LIB ?= $(shell \
336348 $(call CHECK_BOOST_PYTHON,boost_python-py$(subst .,,$(PYTHON_VERSION ) ) ) || \
337349 $(call CHECK_BOOST_PYTHON,boost_python-py$(PYTHON_MAJOR_VERSION ) ) || \
@@ -343,11 +355,7 @@ ifeq ($(BOOST_PYTHON_LIB),)
343355$(error BOOST_PYTHON_LIB could not be detected. Please define manually)
344356endif
345357
346- LIBS += $(shell $(PYTHON_CONFIG ) --libs) $(BOOST_PYTHON_LIB ) -lboost_system -lboost_filesystem
347- # python-config --ldflags includes LIBS for some reason
348- LINKFLAGS += $(filter-out -l% ,$(shell $(PYTHON_CONFIG ) --ldflags) )
349- CXXFLAGS += $(shell $(PYTHON_CONFIG ) --includes) -DWITH_PYTHON
350-
358+ LIBS += $(BOOST_PYTHON_LIB ) -lboost_system -lboost_filesystem
351359PY_WRAPPER_FILE = kernel/python_wrappers
352360OBJS += $(PY_WRAPPER_FILE ) .o
353361PY_GEN_SCRIPT = py_wrap_generator
@@ -651,6 +659,9 @@ OBJS += libs/fst/fastlz.o
651659OBJS += libs/fst/lz4.o
652660endif
653661
662+ techlibs/% _pm.h : passes/pmgen/pmgen.py techlibs/% .pmg
663+ $(P ) mkdir -p $(dir $@ ) && $(PYTHON_EXECUTABLE ) $< -o $@ -p $(notdir $* ) $(filter-out $< ,$^ )
664+
654665ifneq ($(SMALL ) ,1)
655666
656667OBJS += libs/subcircuit/subcircuit.o
@@ -775,6 +786,15 @@ check-git-abc:
775786 elif [ -f " $( YOSYS_SRC) /abc/.gitcommit" ] && ! grep -q ' \$$Format:%[hH]\$$' " $( YOSYS_SRC) /abc/.gitcommit" ; then \
776787 echo " 'abc' comes from a tarball. Continuing." ; \
777788 exit 0; \
789+ elif git -C " $( YOSYS_SRC) " submodule status abc 2> /dev/null | grep -q ' ^+' ; then \
790+ echo " 'abc' submodule does not match expected commit." ; \
791+ echo " Run 'git submodule update' to check out the correct version." ; \
792+ echo " Note: If testing a different version of abc, call 'git commit abc' in the Yosys source directory to update the expected commit." ; \
793+ exit 1; \
794+ elif git -C " $( YOSYS_SRC) " submodule status abc 2> /dev/null | grep -q ' ^U' ; then \
795+ echo " 'abc' submodule has merge conflicts." ; \
796+ echo " Please resolve merge conflicts before continuing." ; \
797+ exit 1; \
778798 elif [ -f " $( YOSYS_SRC) /abc/.gitcommit" ] && grep -q ' \$$Format:%[hH]\$$' " $( YOSYS_SRC) /abc/.gitcommit" ; then \
779799 echo " Error: 'abc' is not configured as a git submodule." ; \
780800 echo " To resolve this:" ; \
@@ -997,6 +1017,18 @@ docs/source/cell/word_add.rst: $(TARGETS) $(EXTRA_TARGETS)
9971017docs/source/generated/cells.json : docs/source/generated $(TARGETS ) $(EXTRA_TARGETS )
9981018 $(Q ) ./$(PROGRAM_PREFIX ) yosys -p ' help -dump-cells-json $@'
9991019
1020+ docs/source/generated/% .cc : backends/% .cc
1021+ $(Q ) mkdir -p $(@D )
1022+ $(Q ) cp $< $@
1023+
1024+ # diff returns exit code 1 if the files are different, but it's not an error
1025+ docs/source/generated/functional/rosette.diff : backends/functional/smtlib.cc backends/functional/smtlib_rosette.cc
1026+ $(Q ) mkdir -p $(@D )
1027+ $(Q ) diff -U 20 $^ > $@ || exit 0
1028+
1029+ PHONY : docs/gen/functional_ir
1030+ docs/gen/functional_ir : docs/source/generated/functional/smtlib.cc docs/source/generated/functional/rosette.diff
1031+
10001032PHONY : docs/gen docs/usage docs/reqs
10011033docs/gen : $(TARGETS )
10021034 $(Q ) $(MAKE ) -C docs gen
@@ -1032,7 +1064,7 @@ docs/reqs:
10321064 $(Q ) $(MAKE ) -C docs reqs
10331065
10341066.PHONY : docs/prep
1035- docs/prep : docs/source/cmd/abc.rst docs/source/generated/cells.json docs/gen docs/usage
1067+ docs/prep : docs/source/cmd/abc.rst docs/source/generated/cells.json docs/gen docs/usage docs/gen/functional_ir
10361068
10371069DOC_TARGET ?= html
10381070docs : docs/prep
@@ -1053,6 +1085,7 @@ clean:
10531085 rm -rf vloghtb/Makefile vloghtb/refdat vloghtb/rtl vloghtb/scripts vloghtb/spec vloghtb/check_yosys vloghtb/vloghammer_tb.tar.bz2 vloghtb/temp vloghtb/log_test_*
10541086 rm -f tests/svinterfaces/* .log_stdout tests/svinterfaces/* .log_stderr tests/svinterfaces/dut_result.txt tests/svinterfaces/reference_result.txt tests/svinterfaces/a.out tests/svinterfaces/* _syn.v tests/svinterfaces/* .diff
10551087 rm -f tests/tools/cmp_tbdata
1088+ rm -f $(addsuffix /run-test.mk,$(MK_TEST_DIRS ) )
10561089 -$(MAKE ) -C docs clean
10571090 rm -rf docs/source/cmd docs/util/__pycache__
10581091
0 commit comments