TARGET_DATDIR := $(DESTDIR)/share/yosys
EXE =
+LIB =
OBJS =
GENFILES =
EXTRA_OBJS =
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; })
LDFLAGS += $(EMCCFLAGS)
LDLIBS =
EXE = .js
+LIB =
TARGETS := $(filter-out yosys-config,$(TARGETS))
EXTRA_TARGETS += yosysjs-$(YOSYS_VER).zip
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
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) $<
$(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'