mirror of https://github.com/YosysHQ/yosys.git
Added ENABLE_LIBYOSYS Makefile option
This commit is contained in:
parent
c7fd3fbb68
commit
4e4b156e13
23
Makefile
23
Makefile
|
@ -12,6 +12,7 @@ ENABLE_PLUGINS := 1
|
||||||
ENABLE_READLINE := 1
|
ENABLE_READLINE := 1
|
||||||
ENABLE_VERIFIC := 0
|
ENABLE_VERIFIC := 0
|
||||||
ENABLE_COVER := 1
|
ENABLE_COVER := 1
|
||||||
|
ENABLE_LIBYOSYS := 0
|
||||||
|
|
||||||
# other configuration flags
|
# other configuration flags
|
||||||
ENABLE_GPROF := 0
|
ENABLE_GPROF := 0
|
||||||
|
@ -24,7 +25,6 @@ TARGET_BINDIR := $(DESTDIR)/bin
|
||||||
TARGET_DATDIR := $(DESTDIR)/share/yosys
|
TARGET_DATDIR := $(DESTDIR)/share/yosys
|
||||||
|
|
||||||
EXE =
|
EXE =
|
||||||
LIB =
|
|
||||||
OBJS =
|
OBJS =
|
||||||
GENFILES =
|
GENFILES =
|
||||||
EXTRA_OBJS =
|
EXTRA_OBJS =
|
||||||
|
@ -56,7 +56,6 @@ ifeq (Darwin,$(findstring Darwin,$(shell uname)))
|
||||||
else
|
else
|
||||||
LDFLAGS += -rdynamic
|
LDFLAGS += -rdynamic
|
||||||
LDLIBS += -lrt
|
LDLIBS += -lrt
|
||||||
LIB = .so
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
YOSYS_VER := 0.5+$(shell test -d .git && { git log --author=clifford@clifford.at --oneline c3c9fbfb8c678.. | wc -l; })
|
YOSYS_VER := 0.5+$(shell test -d .git && { git log --author=clifford@clifford.at --oneline c3c9fbfb8c678.. | wc -l; })
|
||||||
|
@ -107,7 +106,6 @@ CXXFLAGS += $(EMCCFLAGS)
|
||||||
LDFLAGS += $(EMCCFLAGS)
|
LDFLAGS += $(EMCCFLAGS)
|
||||||
LDLIBS =
|
LDLIBS =
|
||||||
EXE = .js
|
EXE = .js
|
||||||
LIB =
|
|
||||||
|
|
||||||
TARGETS := $(filter-out yosys-config,$(TARGETS))
|
TARGETS := $(filter-out yosys-config,$(TARGETS))
|
||||||
EXTRA_TARGETS += yosysjs-$(YOSYS_VER).zip
|
EXTRA_TARGETS += yosysjs-$(YOSYS_VER).zip
|
||||||
|
@ -134,14 +132,13 @@ 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 += 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)"
|
ABCMKARGS += LIBS="lib/x86/pthreadVC2.lib -s" READLINE=0 CC="$(CXX)" CXX="$(CXX)"
|
||||||
EXE = .exe
|
EXE = .exe
|
||||||
LIB =
|
|
||||||
|
|
||||||
else ifneq ($(CONFIG),none)
|
else ifneq ($(CONFIG),none)
|
||||||
$(error Invalid CONFIG setting '$(CONFIG)'. Valid values: clang, gcc, gcc-4.6, emcc, none)
|
$(error Invalid CONFIG setting '$(CONFIG)'. Valid values: clang, gcc, gcc-4.6, emcc, none)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq ($(LIB),)
|
ifeq ($(ENABLE_LIBYOSYS),1)
|
||||||
TARGETS += libyosys$(LIB)
|
TARGETS += libyosys.so
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(ENABLE_READLINE),1)
|
ifeq ($(ENABLE_READLINE),1)
|
||||||
|
@ -296,10 +293,8 @@ endif
|
||||||
yosys$(EXE): $(OBJS)
|
yosys$(EXE): $(OBJS)
|
||||||
$(P) $(CXX) -o yosys$(EXE) $(LDFLAGS) $^ $(LDLIBS)
|
$(P) $(CXX) -o yosys$(EXE) $(LDFLAGS) $^ $(LDLIBS)
|
||||||
|
|
||||||
ifneq ($(LIB),)
|
libyosys.so: $(filter-out kernel/driver.o,$(OBJS))
|
||||||
libyosys$(LIB): $(filter-out kernel/driver.o,$(OBJS))
|
$(P) $(CXX) -o libyosys.so -shared -Wl,-soname,libyosys.so $(LDFLAGS) $^ $(LDLIBS)
|
||||||
$(P) $(CXX) -o libyosys$(LIB) -shared -Wl,-soname,libyosys$(LIB) $(LDFLAGS) $^ $(LDLIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
%.o: %.cc
|
%.o: %.cc
|
||||||
$(P) $(CXX) -o $@ -c $(CXXFLAGS) $<
|
$(P) $(CXX) -o $@ -c $(CXXFLAGS) $<
|
||||||
|
@ -376,16 +371,16 @@ install: $(TARGETS) $(EXTRA_TARGETS)
|
||||||
$(INSTALL_SUDO) install $(TARGETS) $(DESTDIR)/bin/
|
$(INSTALL_SUDO) install $(TARGETS) $(DESTDIR)/bin/
|
||||||
$(INSTALL_SUDO) mkdir -p $(DESTDIR)/share/yosys
|
$(INSTALL_SUDO) mkdir -p $(DESTDIR)/share/yosys
|
||||||
$(INSTALL_SUDO) cp -r share/. $(DESTDIR)/share/yosys/.
|
$(INSTALL_SUDO) cp -r share/. $(DESTDIR)/share/yosys/.
|
||||||
ifneq ($(LIB),)
|
ifeq ($(ENABLE_LIBYOSYS),1)
|
||||||
$(INSTALL_SUDO) cp libyosys$(LIB) $(DESTDIR)/lib/
|
$(INSTALL_SUDO) cp libyosys.so $(DESTDIR)/lib/
|
||||||
$(INSTALL_SUDO) ldconfig
|
$(INSTALL_SUDO) ldconfig
|
||||||
endif
|
endif
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
$(INSTALL_SUDO) rm -vf $(addprefix $(DESTDIR)/bin/,$(notdir $(TARGETS)))
|
$(INSTALL_SUDO) rm -vf $(addprefix $(DESTDIR)/bin/,$(notdir $(TARGETS)))
|
||||||
$(INSTALL_SUDO) rm -rvf $(DESTDIR)/share/yosys/
|
$(INSTALL_SUDO) rm -rvf $(DESTDIR)/share/yosys/
|
||||||
ifneq ($(LIB),)
|
ifeq ($(ENABLE_LIBYOSYS),1)
|
||||||
$(INSTALL_SUDO) rm -vf $(DESTDIR)/lib/libyosys$(LIB)
|
$(INSTALL_SUDO) rm -vf $(DESTDIR)/lib/libyosys.so
|
||||||
endif
|
endif
|
||||||
|
|
||||||
update-manual: $(TARGETS) $(EXTRA_TARGETS)
|
update-manual: $(TARGETS) $(EXTRA_TARGETS)
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
// Note: Set ENABLE_LIBYOSYS=1 in Makefile or Makefile.conf to build libyosys.so
|
||||||
// yosys-config --exec --cxx -o example --cxxflags --ldflags example.cc -lyosys -lstdc++
|
// yosys-config --exec --cxx -o example --cxxflags --ldflags example.cc -lyosys -lstdc++
|
||||||
|
|
||||||
#include <kernel/yosys.h>
|
#include <kernel/yosys.h>
|
||||||
|
|
Loading…
Reference in New Issue