From 4d4117c998db8f58a436ec9ea9c930bce85febef Mon Sep 17 00:00:00 2001 From: Benedikt Tutzer Date: Fri, 22 Jun 2018 11:15:03 +0200 Subject: added ENABLE_PYTHON option in build environment --- Makefile | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 11803ec0a..e8fcf933b 100644 --- a/Makefile +++ b/Makefile @@ -14,9 +14,13 @@ ENABLE_READLINE := 1 ENABLE_EDITLINE := 0 ENABLE_VERIFIC := 0 ENABLE_COVER := 1 -ENABLE_LIBYOSYS := 0 +ENABLE_LIBYOSYS := 1 ENABLE_PROTOBUF := 0 +# python wrappers +ENABLE_PYTHON := 1 +PYTHON_VERSION := 3.5 + # other configuration flags ENABLE_GPROF := 0 ENABLE_DEBUG := 0 @@ -228,6 +232,11 @@ ifeq ($(ENABLE_LIBYOSYS),1) TARGETS += libyosys.so endif +ifeq ($(ENABLE_PYTHON),1) +LDLIBS += -lpython$(PYTHON_VERSION)m -lboost_python-py$(subst .,,$(PYTHON_VERSION)) -lboost_system +CXXFLAGS += -I/usr/include/python$(PYTHON_VERSION) -fPIC -D WITH_PYTHON +endif + ifeq ($(ENABLE_READLINE),1) CXXFLAGS += -DYOSYS_ENABLE_READLINE ifeq ($(OS), FreeBSD) -- cgit v1.2.3 From a27fa1833e6dadf02645a12febb78853b5786151 Mon Sep 17 00:00:00 2001 From: Benedikt Tutzer Date: Mon, 25 Jun 2018 17:08:29 +0200 Subject: added wrappers for Design, Modules, Cells and Wires --- Makefile | 1 + 1 file changed, 1 insertion(+) (limited to 'Makefile') diff --git a/Makefile b/Makefile index e8fcf933b..09cf18497 100644 --- a/Makefile +++ b/Makefile @@ -235,6 +235,7 @@ endif ifeq ($(ENABLE_PYTHON),1) LDLIBS += -lpython$(PYTHON_VERSION)m -lboost_python-py$(subst .,,$(PYTHON_VERSION)) -lboost_system CXXFLAGS += -I/usr/include/python$(PYTHON_VERSION) -fPIC -D WITH_PYTHON +OBJS += kernel/python_wrappers.o endif ifeq ($(ENABLE_READLINE),1) -- cgit v1.2.3 From b57dafce6819516d529cc0077b95cb3293a5dc06 Mon Sep 17 00:00:00 2001 From: Benedikt Tutzer Date: Wed, 1 Aug 2018 08:04:08 +0200 Subject: removed unused library and already present compiler flag --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 09cf18497..ca17c4476 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ ENABLE_PROTOBUF := 0 # python wrappers ENABLE_PYTHON := 1 -PYTHON_VERSION := 3.5 +PYTHON_VERSION := 3.6 # other configuration flags ENABLE_GPROF := 0 @@ -233,8 +233,8 @@ TARGETS += libyosys.so endif ifeq ($(ENABLE_PYTHON),1) -LDLIBS += -lpython$(PYTHON_VERSION)m -lboost_python-py$(subst .,,$(PYTHON_VERSION)) -lboost_system -CXXFLAGS += -I/usr/include/python$(PYTHON_VERSION) -fPIC -D WITH_PYTHON +LDLIBS += -lpython$(PYTHON_VERSION)m -lboost_python-py$(subst .,,$(PYTHON_VERSION)) +CXXFLAGS += -I/usr/include/python$(PYTHON_VERSION) -D WITH_PYTHON OBJS += kernel/python_wrappers.o endif -- cgit v1.2.3 From bf7b73acfc2b5e46206e5688b8a6e8d9b0d60d8f Mon Sep 17 00:00:00 2001 From: Benedikt Tutzer Date: Mon, 13 Aug 2018 15:18:46 +0200 Subject: Added Wrappers for: -IdString -Const -CaseRule -SwitchRule -SyncRule -Process -SigChunk -SigBit -SigSpec With all their member functions as well as the remaining member functions for Cell, Wire, Module and Design and static functions of rtlil.h --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index ca17c4476..691f43798 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ ENABLE_PROTOBUF := 0 # python wrappers ENABLE_PYTHON := 1 -PYTHON_VERSION := 3.6 +PYTHON_VERSION := 3.5 # other configuration flags ENABLE_GPROF := 0 @@ -233,7 +233,7 @@ TARGETS += libyosys.so endif ifeq ($(ENABLE_PYTHON),1) -LDLIBS += -lpython$(PYTHON_VERSION)m -lboost_python-py$(subst .,,$(PYTHON_VERSION)) +LDLIBS += -lpython$(PYTHON_VERSION)m -lboost_python-py$(subst .,,$(PYTHON_VERSION)) -lboost_system CXXFLAGS += -I/usr/include/python$(PYTHON_VERSION) -D WITH_PYTHON OBJS += kernel/python_wrappers.o endif -- cgit v1.2.3 From d79a2808cf2446fa21d91a6141f6fbe2318c03ec Mon Sep 17 00:00:00 2001 From: Benedikt Tutzer Date: Thu, 16 Aug 2018 16:00:11 +0200 Subject: Python Passes can now be added with the -m option or with the plugin command. There are still issues when run in shell mode, but they can be used just fine in a python script --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 691f43798..6466bddf2 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ PYTHON_VERSION := 3.5 # other configuration flags ENABLE_GPROF := 0 -ENABLE_DEBUG := 0 +ENABLE_DEBUG := 1 ENABLE_NDEBUG := 0 LINK_CURSES := 0 LINK_TERMCAP := 0 -- cgit v1.2.3 From 6f8abc11435abae7d3632a891bfa216da4c27acc Mon Sep 17 00:00:00 2001 From: Benedikt Tutzer Date: Wed, 19 Sep 2018 10:32:34 +0200 Subject: Exposed generator script to make-process --- Makefile | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 6466bddf2..e1d66e566 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ PYTHON_VERSION := 3.5 # other configuration flags ENABLE_GPROF := 0 -ENABLE_DEBUG := 1 +ENABLE_DEBUG := 0 ENABLE_NDEBUG := 0 LINK_CURSES := 0 LINK_TERMCAP := 0 @@ -65,8 +65,8 @@ all: top-all YOSYS_SRC := $(dir $(firstword $(MAKEFILE_LIST))) VPATH := $(YOSYS_SRC) -CXXFLAGS := $(CXXFLAGS) -Wall -Wextra -ggdb -I. -I"$(YOSYS_SRC)" -MD -D_YOSYS_ -fPIC -I$(PREFIX)/include -LDFLAGS := $(LDFLAGS) -L$(LIBDIR) +CXXFLAGS := $(CXXFLAGS) -Wall -Wextra -ggdb -I. -I"$(YOSYS_SRC)" -MD -D_YOSYS_ -fPIC -I$(PREFIX)/include -ferror-limit=0 +LDFLAGS := $(LDFLAGS) -L$(LIBDIR) -ferror-limit=0 LDLIBS := $(LDLIBS) -lstdc++ -lm PLUGIN_LDFLAGS := @@ -235,7 +235,10 @@ endif ifeq ($(ENABLE_PYTHON),1) LDLIBS += -lpython$(PYTHON_VERSION)m -lboost_python-py$(subst .,,$(PYTHON_VERSION)) -lboost_system CXXFLAGS += -I/usr/include/python$(PYTHON_VERSION) -D WITH_PYTHON -OBJS += kernel/python_wrappers.o +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 "import $(PY_GEN_SCRIPT); $(PY_GEN_SCRIPT).print_includes()") endif ifeq ($(ENABLE_READLINE),1) @@ -474,6 +477,14 @@ libyosys.so: $(filter-out kernel/driver.o,$(OBJS)) $(Q) mkdir -p $(dir $@) $(P) $(CXX) -o $@ -c $(CPPFLAGS) $(CXXFLAGS) $< +%.pyh: %.h + $(Q) mkdir -p $(dir $@) + $(P) cat $< | grep -E -v "#[ ]*(include|error)" | $(LD) -x c++ -o $@ -E -P $(CPPFLAGS) $(CXXFLAGS) -Qunused-arguments - + +$(PY_WRAPPER_FILE).cc: $(PY_GEN_SCRIPT).py $(PY_WRAP_INCLUDES) + $(Q) mkdir -p $(dir $@) + $(P) python$(PYTHON_VERSION) -c "import $(PY_GEN_SCRIPT); $(PY_GEN_SCRIPT).gen_wrappers(\"$(PY_WRAPPER_FILE).cc\")" + %.o: %.cpp $(Q) mkdir -p $(dir $@) $(P) $(CXX) -o $@ -c $(CPPFLAGS) $(CXXFLAGS) $< @@ -610,8 +621,9 @@ manual: $(TARGETS) $(EXTRA_TARGETS) clean: rm -rf share + rm -rf kernel/*.pyh if test -d manual; then cd manual && sh clean.sh; fi - rm -f $(OBJS) $(GENFILES) $(TARGETS) $(EXTRA_TARGETS) $(EXTRA_OBJS) + rm -f $(OBJS) $(GENFILES) $(TARGETS) $(EXTRA_TARGETS) $(EXTRA_OBJS) $(PY_WRAP_INCLUDES) $(PY_WRAPPER_FILE).cc rm -f kernel/version_*.o kernel/version_*.cc abc/abc-[0-9a-f]* abc/libabc-[0-9a-f]*.a rm -f libs/*/*.d frontends/*/*.d passes/*/*.d backends/*/*.d kernel/*.d techlibs/*/*.d rm -rf tests/asicworld/*.out tests/asicworld/*.log -- cgit v1.2.3 From 7ca9fa64f7438cc4238b9245defd72a242da0fe7 Mon Sep 17 00:00:00 2001 From: Benedikt Tutzer Date: Tue, 11 Dec 2018 08:42:57 +0100 Subject: Added python-api to install --- Makefile | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'Makefile') diff --git a/Makefile b/Makefile index e1d66e566..c1943758a 100644 --- a/Makefile +++ b/Makefile @@ -20,6 +20,7 @@ ENABLE_PROTOBUF := 0 # python wrappers ENABLE_PYTHON := 1 PYTHON_VERSION := 3.5 +PYTHON_DESTDIR := /usr/local/lib/python$(PYTHON_VERSION)/dist-packages # other configuration flags ENABLE_GPROF := 0 @@ -602,6 +603,11 @@ ifeq ($(ENABLE_LIBYOSYS),1) $(INSTALL_SUDO) cp libyosys.so $(DESTDIR)$(LIBDIR) $(INSTALL_SUDO) $(STRIP) -S $(DESTDIR)$(LIBDIR)/libyosys.so $(INSTALL_SUDO) ldconfig +ifeq ($(ENABLE_PYTHON),1) + $(INSTALL_SUDO) mkdir -p $(PYTHON_DESTDIR)/libyosys + $(INSTALL_SUDO) cp libyosys.so $(PYTHON_DESTDIR)/libyosys + $(INSTALL_SUDO) cp __init__.py $(PYTHON_DESTDIR)/libyosys +endif endif uninstall: @@ -609,6 +615,11 @@ uninstall: $(INSTALL_SUDO) rm -rvf $(DESTDIR)$(DATDIR) ifeq ($(ENABLE_LIBYOSYS),1) $(INSTALL_SUDO) rm -vf $(DESTDIR)$(LIBDIR)/libyosys.so +ifeq ($(ENABLE_PYTHON),1) + $(INSTALL_SUDO) rm -vf $(PYTHON_DESTDIR)/libyosys/libyosys.so + $(INSTALL_SUDO) rm -vf $(PYTHON_DESTDIR)/libyosys/__init__.py + $(INSTALL_SUDO) rmdir $(PYTHON_DESTDIR)/libyosys +endif endif update-manual: $(TARGETS) $(EXTRA_TARGETS) -- cgit v1.2.3 From b9288b216dce110ad11eb0615a6a911a9fcae05b Mon Sep 17 00:00:00 2001 From: Benedikt Tutzer Date: Fri, 21 Dec 2018 14:08:23 +0100 Subject: Make can now install Python libraries to system path --- Makefile | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index c1943758a..de1e2c404 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ ENABLE_LIBYOSYS := 1 ENABLE_PROTOBUF := 0 # python wrappers -ENABLE_PYTHON := 1 +ENABLE_PYOSYS := 1 PYTHON_VERSION := 3.5 PYTHON_DESTDIR := /usr/local/lib/python$(PYTHON_VERSION)/dist-packages @@ -233,7 +233,7 @@ ifeq ($(ENABLE_LIBYOSYS),1) TARGETS += libyosys.so endif -ifeq ($(ENABLE_PYTHON),1) +ifeq ($(ENABLE_PYOSYS),1) LDLIBS += -lpython$(PYTHON_VERSION)m -lboost_python-py$(subst .,,$(PYTHON_VERSION)) -lboost_system CXXFLAGS += -I/usr/include/python$(PYTHON_VERSION) -D WITH_PYTHON PY_WRAPPER_FILE = kernel/python_wrappers @@ -603,10 +603,10 @@ ifeq ($(ENABLE_LIBYOSYS),1) $(INSTALL_SUDO) cp libyosys.so $(DESTDIR)$(LIBDIR) $(INSTALL_SUDO) $(STRIP) -S $(DESTDIR)$(LIBDIR)/libyosys.so $(INSTALL_SUDO) ldconfig -ifeq ($(ENABLE_PYTHON),1) - $(INSTALL_SUDO) mkdir -p $(PYTHON_DESTDIR)/libyosys - $(INSTALL_SUDO) cp libyosys.so $(PYTHON_DESTDIR)/libyosys - $(INSTALL_SUDO) cp __init__.py $(PYTHON_DESTDIR)/libyosys +ifeq ($(ENABLE_PYOSYS),1) + $(INSTALL_SUDO) mkdir -p $(PYTHON_DESTDIR)/pyosys + $(INSTALL_SUDO) cp libyosys.so $(PYTHON_DESTDIR)/pyosys + $(INSTALL_SUDO) cp __init__.py $(PYTHON_DESTDIR)/pyosys endif endif @@ -615,10 +615,10 @@ uninstall: $(INSTALL_SUDO) rm -rvf $(DESTDIR)$(DATDIR) ifeq ($(ENABLE_LIBYOSYS),1) $(INSTALL_SUDO) rm -vf $(DESTDIR)$(LIBDIR)/libyosys.so -ifeq ($(ENABLE_PYTHON),1) - $(INSTALL_SUDO) rm -vf $(PYTHON_DESTDIR)/libyosys/libyosys.so - $(INSTALL_SUDO) rm -vf $(PYTHON_DESTDIR)/libyosys/__init__.py - $(INSTALL_SUDO) rmdir $(PYTHON_DESTDIR)/libyosys +ifeq ($(ENABLE_PYOSYS),1) + $(INSTALL_SUDO) rm -vf $(PYTHON_DESTDIR)/pyosys/libyosys.so + $(INSTALL_SUDO) rm -vf $(PYTHON_DESTDIR)/pyosys/__init__.py + $(INSTALL_SUDO) rmdir $(PYTHON_DESTDIR)/pyosys endif endif -- cgit v1.2.3 From adfd8d463dcc222843eebe2186bc274228d06acc Mon Sep 17 00:00:00 2001 From: Benedikt Tutzer Date: Wed, 3 Apr 2019 11:17:50 +0200 Subject: Autodetect highest installed python version --- Makefile | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 80b12c826..6f7448843 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,9 @@ ENABLE_PROTOBUF := 0 # python wrappers ENABLE_PYOSYS := 1 -PYTHON_VERSION := 3.5 +PYTHON_VERSION_TESTCODE := "import sys;t='{v[0]}.{v[1]}'.format(v=list(sys.version_info[:2]));print(t)" +PYTHON_VERSION := $(shell if python3 -c ""; then python3 -c ""$(PYTHON_VERSION_TESTCODE)""; else python -c ""$(PYTHON_VERSION_TESTCODE)""; fi) +PYTHON_MAJOR_VERSION := $(shell echo $(PYTHON_VERSION) | cut -f1 -d.) PYTHON_DESTDIR := /usr/local/lib/python$(PYTHON_VERSION)/dist-packages # other configuration flags @@ -267,7 +269,11 @@ TARGETS += libyosys.so endif ifeq ($(ENABLE_PYOSYS),1) -LDLIBS += -lpython$(PYTHON_VERSION)m -lboost_python-py$(subst .,,$(PYTHON_VERSION)) -lboost_system + ifeq ($(PYTHON_MAJOR_VERSION),3) + LDLIBS += -lpython$(PYTHON_VERSION)m -lboost_python-py$(subst .,,$(PYTHON_VERSION)) -lboost_system + else + LDLIBS += -lpython$(PYTHON_VERSION) -lboost_python-py$(subst .,,$(PYTHON_VERSION)) -lboost_system + endif CXXFLAGS += -I/usr/include/python$(PYTHON_VERSION) -D WITH_PYTHON PY_WRAPPER_FILE = kernel/python_wrappers OBJS += $(PY_WRAPPER_FILE).o -- cgit v1.2.3 From fd7fb1377d4d30d692c78eb55173198339fea17d Mon Sep 17 00:00:00 2001 From: Benedikt Tutzer Date: Wed, 3 Apr 2019 13:21:40 +0200 Subject: Added cross-platform support for plugin-paths --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 6f7448843..618e4b603 100644 --- a/Makefile +++ b/Makefile @@ -270,9 +270,9 @@ endif ifeq ($(ENABLE_PYOSYS),1) ifeq ($(PYTHON_MAJOR_VERSION),3) - LDLIBS += -lpython$(PYTHON_VERSION)m -lboost_python-py$(subst .,,$(PYTHON_VERSION)) -lboost_system + LDLIBS += -lpython$(PYTHON_VERSION)m -lboost_python-py$(subst .,,$(PYTHON_VERSION)) -lboost_system -lstdc++fs else - LDLIBS += -lpython$(PYTHON_VERSION) -lboost_python-py$(subst .,,$(PYTHON_VERSION)) -lboost_system + LDLIBS += -lpython$(PYTHON_VERSION) -lboost_python-py$(subst .,,$(PYTHON_VERSION)) -lboost_system -lstdc++fs endif CXXFLAGS += -I/usr/include/python$(PYTHON_VERSION) -D WITH_PYTHON PY_WRAPPER_FILE = kernel/python_wrappers -- cgit v1.2.3 From c5a8dceff85c766c229d331c342e866dcef9af5f Mon Sep 17 00:00:00 2001 From: Benedikt Tutzer Date: Wed, 3 Apr 2019 15:13:58 +0200 Subject: Preprocessing does not need all the flags --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 618e4b603..7f37fe6aa 100644 --- a/Makefile +++ b/Makefile @@ -532,7 +532,7 @@ libyosys.so: $(filter-out kernel/driver.o,$(OBJS)) %.pyh: %.h $(Q) mkdir -p $(dir $@) - $(P) cat $< | grep -E -v "#[ ]*(include|error)" | $(LD) -x c++ -o $@ -E -P $(CPPFLAGS) $(CXXFLAGS) -Qunused-arguments - + $(P) cat $< | grep -E -v "#[ ]*(include|error)" | $(LD) -x c++ -o $@ -E -P -Qunused-arguments - $(PY_WRAPPER_FILE).cc: $(PY_GEN_SCRIPT).py $(PY_WRAP_INCLUDES) $(Q) mkdir -p $(dir $@) -- cgit v1.2.3 From d330f4e009874b24bc656a04ea1a650897f641ba Mon Sep 17 00:00:00 2001 From: Benedikt Tutzer Date: Wed, 3 Apr 2019 15:34:31 +0200 Subject: Even less options for the preprocessor --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 7f37fe6aa..06d020e68 100644 --- a/Makefile +++ b/Makefile @@ -532,7 +532,7 @@ libyosys.so: $(filter-out kernel/driver.o,$(OBJS)) %.pyh: %.h $(Q) mkdir -p $(dir $@) - $(P) cat $< | grep -E -v "#[ ]*(include|error)" | $(LD) -x c++ -o $@ -E -P -Qunused-arguments - + $(P) cat $< | grep -E -v "#[ ]*(include|error)" | $(LD) -x c++ -o $@ -E -P - $(PY_WRAPPER_FILE).cc: $(PY_GEN_SCRIPT).py $(PY_WRAP_INCLUDES) $(Q) mkdir -p $(dir $@) -- cgit v1.2.3 From c3486c42709f0d1cfaca1fc24c86e0211f35996d Mon Sep 17 00:00:00 2001 From: Benedikt Tutzer Date: Wed, 3 Apr 2019 16:19:47 +0200 Subject: Removed compiler flags that are clang specific --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 06d020e68..119afc594 100644 --- a/Makefile +++ b/Makefile @@ -71,8 +71,8 @@ all: top-all YOSYS_SRC := $(dir $(firstword $(MAKEFILE_LIST))) VPATH := $(YOSYS_SRC) -CXXFLAGS := $(CXXFLAGS) -Wall -Wextra -ggdb -I. -I"$(YOSYS_SRC)" -MD -D_YOSYS_ -fPIC -I$(PREFIX)/include -ferror-limit=0 -LDFLAGS := $(LDFLAGS) -L$(LIBDIR) -ferror-limit=0 +CXXFLAGS := $(CXXFLAGS) -Wall -Wextra -ggdb -I. -I"$(YOSYS_SRC)" -MD -D_YOSYS_ -fPIC -I$(PREFIX)/include +LDFLAGS := $(LDFLAGS) -L$(LIBDIR) LDLIBS := $(LDLIBS) -lstdc++ -lm PLUGIN_LDFLAGS := -- cgit v1.2.3 From e64b3f107411c150bbc773fc72b915bc60813c52 Mon Sep 17 00:00:00 2001 From: Benedikt Tutzer Date: Thu, 4 Apr 2019 09:24:50 +0200 Subject: Changed filesystem dependency to boost instead of experimental std library --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 119afc594..2038801e6 100644 --- a/Makefile +++ b/Makefile @@ -270,9 +270,9 @@ endif ifeq ($(ENABLE_PYOSYS),1) ifeq ($(PYTHON_MAJOR_VERSION),3) - LDLIBS += -lpython$(PYTHON_VERSION)m -lboost_python-py$(subst .,,$(PYTHON_VERSION)) -lboost_system -lstdc++fs + LDLIBS += -lpython$(PYTHON_VERSION)m -lboost_python-py$(subst .,,$(PYTHON_VERSION)) -lboost_system -lboost_filesystem -lstdc++fs else - LDLIBS += -lpython$(PYTHON_VERSION) -lboost_python-py$(subst .,,$(PYTHON_VERSION)) -lboost_system -lstdc++fs + LDLIBS += -lpython$(PYTHON_VERSION) -lboost_python-py$(subst .,,$(PYTHON_VERSION)) -lboost_system -lboost_filesystem -lstdc++fs endif CXXFLAGS += -I/usr/include/python$(PYTHON_VERSION) -D WITH_PYTHON PY_WRAPPER_FILE = kernel/python_wrappers -- cgit v1.2.3 From 574dfb2ef9b31ff1396e48cb37b5f59996c5db24 Mon Sep 17 00:00:00 2001 From: Benedikt Tutzer Date: Thu, 4 Apr 2019 09:51:14 +0200 Subject: Removed link to experimental filesystem library --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 2038801e6..9f81c3417 100644 --- a/Makefile +++ b/Makefile @@ -270,9 +270,9 @@ endif ifeq ($(ENABLE_PYOSYS),1) ifeq ($(PYTHON_MAJOR_VERSION),3) - LDLIBS += -lpython$(PYTHON_VERSION)m -lboost_python-py$(subst .,,$(PYTHON_VERSION)) -lboost_system -lboost_filesystem -lstdc++fs + LDLIBS += -lpython$(PYTHON_VERSION)m -lboost_python-py$(subst .,,$(PYTHON_VERSION)) -lboost_system -lboost_filesystem else - LDLIBS += -lpython$(PYTHON_VERSION) -lboost_python-py$(subst .,,$(PYTHON_VERSION)) -lboost_system -lboost_filesystem -lstdc++fs + LDLIBS += -lpython$(PYTHON_VERSION) -lboost_python-py$(subst .,,$(PYTHON_VERSION)) -lboost_system -lboost_filesystem endif CXXFLAGS += -I/usr/include/python$(PYTHON_VERSION) -D WITH_PYTHON PY_WRAPPER_FILE = kernel/python_wrappers -- cgit v1.2.3 From cc270ea81bc7209e9e1673e6c3dbd5db6d3ceee8 Mon Sep 17 00:00:00 2001 From: Benedikt Tutzer Date: Fri, 5 Apr 2019 11:56:01 +0200 Subject: Autodetect Python paths and boost python libraries for different distributions --- Makefile | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 9f81c3417..c6c56b604 100644 --- a/Makefile +++ b/Makefile @@ -22,9 +22,10 @@ ENABLE_PROTOBUF := 0 # python wrappers ENABLE_PYOSYS := 1 PYTHON_VERSION_TESTCODE := "import sys;t='{v[0]}.{v[1]}'.format(v=list(sys.version_info[:2]));print(t)" -PYTHON_VERSION := $(shell if python3 -c ""; then python3 -c ""$(PYTHON_VERSION_TESTCODE)""; else python -c ""$(PYTHON_VERSION_TESTCODE)""; fi) +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_DESTDIR := /usr/local/lib/python$(PYTHON_VERSION)/dist-packages +PYTHON_DESTDIR := `$(PYTHON_EXECUTABLE)-config --prefix`/lib/python$(PYTHON_VERSION)/dist-packages # other configuration flags ENABLE_GCOV := 0 @@ -269,12 +270,27 @@ TARGETS += libyosys.so endif ifeq ($(ENABLE_PYOSYS),1) - ifeq ($(PYTHON_MAJOR_VERSION),3) - LDLIBS += -lpython$(PYTHON_VERSION)m -lboost_python-py$(subst .,,$(PYTHON_VERSION)) -lboost_system -lboost_filesystem - else - LDLIBS += -lpython$(PYTHON_VERSION) -lboost_python-py$(subst .,,$(PYTHON_VERSION)) -lboost_system -lboost_filesystem - endif -CXXFLAGS += -I/usr/include/python$(PYTHON_VERSION) -D WITH_PYTHON + +#Detect name of boost_python library. Some distros usbe boost_python-py, other boost_python, some only use the major version number, some a concatenation of major and minor version numbers +BOOST_PYTHON_LIB ?= $(shell \ + if echo "int main(int argc, char ** argv) {return 0;}" | $(CXX) -xc -o /dev/null `$(PYTHON_EXECUTABLE)-config --libs` -lboost_python-py$(subst .,,$(PYTHON_VERSION)) -; then echo "-lboost_python-py$(subst .,,$(PYTHON_VERSION))"; else \ + if echo "int main(int argc, char ** argv) {return 0;}" | $(CXX) -xc -o /dev/null `$(PYTHON_EXECUTABLE)-config --libs` -lboost_python-py$(subst .,,$(PYTHON_MAJOR_VERSION)) -; then echo "-lboost_python-py$(subst .,,$(PYTHON_MAJOR_VERSION))"; else \ + if echo "int main(int argc, char ** argv) {return 0;}" | $(CXX) -xc -o /dev/null `$(PYTHON_EXECUTABLE)-config --libs` -lboost_python$(subst .,,$(PYTHON_VERSION)) -; then echo "-lboost_python$(subst .,,$(PYTHON_VERSION))"; else \ + if echo "int main(int argc, char ** argv) {return 0;}" | $(CXX) -xc -o /dev/null `$(PYTHON_EXECUTABLE)-config --libs` -lboost_python$(subst .,,$(PYTHON_MAJOR_VERSION)) -; then echo "-lboost_python$(subst .,,$(PYTHON_MAJOR_VERSION))"; else \ + echo ""; fi; fi; fi; fi;) + +ifeq ($(BOOST_PYTHON_LIB),) +$(error BOOST_PYTHON_LIB could not be detected. Please define manualy) +endif + +ifeq ($(PYTHON_MAJOR_VERSION),3) +LDLIBS += `$(PYTHON_EXECUTABLE)-config --libs` $(BOOST_PYTHON_LIB) -lboost_system -lboost_filesystem +CXXFLAGS += `$(PYTHON_EXECUTABLE)-config --includes` -D WITH_PYTHON +else +LDLIBS += `$(PYTHON_EXECUTABLE)-config --libs` $(BOOST_PYTHON_LIB) -lboost_system -lboost_filesystem +CXXFLAGS += `$(PYTHON_EXECUTABLE)-config --includes` -D WITH_PYTHON +endif + PY_WRAPPER_FILE = kernel/python_wrappers OBJS += $(PY_WRAPPER_FILE).o PY_GEN_SCRIPT= py_wrap_generator -- cgit v1.2.3 From e19981ab6111765baa5b2ab7a16c92278130fd8b Mon Sep 17 00:00:00 2001 From: Benedikt Tutzer Date: Sun, 7 Apr 2019 10:11:35 +0200 Subject: Suppress error from the compiler run during libboost-python* detection --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index c6c56b604..993cbb7e5 100644 --- a/Makefile +++ b/Makefile @@ -273,10 +273,10 @@ ifeq ($(ENABLE_PYOSYS),1) #Detect name of boost_python library. Some distros usbe boost_python-py, other boost_python, some only use the major version number, some a concatenation of major and minor version numbers BOOST_PYTHON_LIB ?= $(shell \ - if echo "int main(int argc, char ** argv) {return 0;}" | $(CXX) -xc -o /dev/null `$(PYTHON_EXECUTABLE)-config --libs` -lboost_python-py$(subst .,,$(PYTHON_VERSION)) -; then echo "-lboost_python-py$(subst .,,$(PYTHON_VERSION))"; else \ - if echo "int main(int argc, char ** argv) {return 0;}" | $(CXX) -xc -o /dev/null `$(PYTHON_EXECUTABLE)-config --libs` -lboost_python-py$(subst .,,$(PYTHON_MAJOR_VERSION)) -; then echo "-lboost_python-py$(subst .,,$(PYTHON_MAJOR_VERSION))"; else \ - if echo "int main(int argc, char ** argv) {return 0;}" | $(CXX) -xc -o /dev/null `$(PYTHON_EXECUTABLE)-config --libs` -lboost_python$(subst .,,$(PYTHON_VERSION)) -; then echo "-lboost_python$(subst .,,$(PYTHON_VERSION))"; else \ - if echo "int main(int argc, char ** argv) {return 0;}" | $(CXX) -xc -o /dev/null `$(PYTHON_EXECUTABLE)-config --libs` -lboost_python$(subst .,,$(PYTHON_MAJOR_VERSION)) -; then echo "-lboost_python$(subst .,,$(PYTHON_MAJOR_VERSION))"; else \ + if echo "int main(int argc, char ** argv) {return 0;}" | $(CXX) -xc -o /dev/null `$(PYTHON_EXECUTABLE)-config --libs` -lboost_python-py$(subst .,,$(PYTHON_VERSION)) - > /dev/null 2>&1; then echo "-lboost_python-py$(subst .,,$(PYTHON_VERSION))"; else \ + if echo "int main(int argc, char ** argv) {return 0;}" | $(CXX) -xc -o /dev/null `$(PYTHON_EXECUTABLE)-config --libs` -lboost_python-py$(subst .,,$(PYTHON_MAJOR_VERSION)) - > /dev/null 2>&1; then echo "-lboost_python-py$(subst .,,$(PYTHON_MAJOR_VERSION))"; else \ + if echo "int main(int argc, char ** argv) {return 0;}" | $(CXX) -xc -o /dev/null `$(PYTHON_EXECUTABLE)-config --libs` -lboost_python$(subst .,,$(PYTHON_VERSION)) - > /dev/null 2>&1; then echo "-lboost_python$(subst .,,$(PYTHON_VERSION))"; else \ + if echo "int main(int argc, char ** argv) {return 0;}" | $(CXX) -xc -o /dev/null `$(PYTHON_EXECUTABLE)-config --libs` -lboost_python$(subst .,,$(PYTHON_MAJOR_VERSION)) - > /dev/null 2>&1; then echo "-lboost_python$(subst .,,$(PYTHON_MAJOR_VERSION))"; else \ echo ""; fi; fi; fi; fi;) ifeq ($(BOOST_PYTHON_LIB),) -- cgit v1.2.3