Added libyosys.so build

This commit is contained in:
Clifford Wolf 2015-08-04 13:22:49 +02:00
parent c63e5ed7ec
commit 31b555ae72
3 changed files with 24 additions and 3 deletions

1
.gitignore vendored
View File

@ -25,3 +25,4 @@
/yosys-win32-mxebin-*
/yosys-win32-vcxsrc-*
/yosysjs-*
/libyosys.so

View File

@ -24,6 +24,7 @@ TARGET_BINDIR := $(DESTDIR)/bin
TARGET_DATDIR := $(DESTDIR)/share/yosys
EXE =
LIB =
OBJS =
GENFILES =
EXTRA_OBJS =
@ -55,6 +56,7 @@ ifeq (Darwin,$(findstring Darwin,$(shell uname)))
else
LDFLAGS += -rdynamic
LDLIBS += -lrt
LIB = .so
endif
YOSYS_VER := 0.5+$(shell test -d .git && { git log --author=clifford@clifford.at --oneline c3c9fbfb8c678.. | wc -l; })
@ -105,6 +107,7 @@ CXXFLAGS += $(EMCCFLAGS)
LDFLAGS += $(EMCCFLAGS)
LDLIBS =
EXE = .js
LIB =
TARGETS := $(filter-out yosys-config,$(TARGETS))
EXTRA_TARGETS += yosysjs-$(YOSYS_VER).zip
@ -131,11 +134,16 @@ LDLIBS := $(filter-out -lrt,$(LDLIBS))
ABCMKARGS += ARCHFLAGS="-DSIZEOF_VOID_P=4 -DSIZEOF_LONG=4 -DSIZEOF_INT=4 -DWIN32_NO_DLL -x c++ -fpermissive -w"
ABCMKARGS += LIBS="lib/x86/pthreadVC2.lib -s" READLINE=0 CC="$(CXX)" CXX="$(CXX)"
EXE = .exe
LIB =
else ifneq ($(CONFIG),none)
$(error Invalid CONFIG setting '$(CONFIG)'. Valid values: clang, gcc, gcc-4.6, emcc, none)
endif
ifneq ($(LIB),)
TARGETS += libyosys$(LIB)
endif
ifeq ($(ENABLE_READLINE),1)
CXXFLAGS += -DYOSYS_ENABLE_READLINE
LDLIBS += -lreadline
@ -286,7 +294,12 @@ yosys.js: $(filter-out yosysjs-$(YOSYS_VER).zip,$(EXTRA_TARGETS))
endif
yosys$(EXE): $(OBJS)
$(P) $(CXX) -o yosys$(EXE) $(LDFLAGS) $(OBJS) $(LDLIBS)
$(P) $(CXX) -o yosys$(EXE) $(LDFLAGS) $^ $(LDLIBS)
ifneq ($(LIB),)
libyosys$(LIB): $(filter-out kernel/driver.o,$(OBJS))
$(P) $(CXX) -o libyosys$(LIB) -shared -Wl,-soname,libyosys$(LIB) $(LDFLAGS) $^ $(LDLIBS)
endif
%.o: %.cc
$(P) $(CXX) -o $@ -c $(CXXFLAGS) $<
@ -363,10 +376,17 @@ install: $(TARGETS) $(EXTRA_TARGETS)
$(INSTALL_SUDO) install $(TARGETS) $(DESTDIR)/bin/
$(INSTALL_SUDO) mkdir -p $(DESTDIR)/share/yosys
$(INSTALL_SUDO) cp -r share/. $(DESTDIR)/share/yosys/.
ifneq ($(LIB),)
$(INSTALL_SUDO) cp libyosys$(LIB) $(DESTDIR)/lib/
$(INSTALL_SUDO) ldconfig
endif
uninstall:
$(INSTALL_SUDO) rm -vf $(addprefix $(DESTDIR)/bin/,$(notdir $(TARGETS)))
$(INSTALL_SUDO) rm -rvf $(DESTDIR)/share/yosys/
ifneq ($(LIB),)
$(INSTALL_SUDO) rm -vf $(DESTDIR)/lib/libyosys$(LIB)
endif
update-manual: $(TARGETS) $(EXTRA_TARGETS)
cd manual && ../yosys -p 'help -write-tex-command-reference-manual'

View File

@ -1,6 +1,6 @@
// clang -o example -std=c++11 -I/usr/include/tcl8.5 -I include/ example.cc objs/*.o -lstdc++ -lm -lrt -lreadline -lffi -ldl -ltcl8.5
// yosys-config --exec --cxx -o example --cxxflags --ldflags example.cc -lyosys -lstdc++
#include <yosys.h>
#include <kernel/yosys.h>
int main()
{