mirror of https://github.com/YosysHQ/yosys.git
Added version info to yosys command and added -V option
This commit is contained in:
parent
1af1cebb64
commit
485e870bcd
|
@ -15,3 +15,4 @@
|
||||||
/yosys-config
|
/yosys-config
|
||||||
/yosys-filterlib
|
/yosys-filterlib
|
||||||
/yosys-svgviewer
|
/yosys-svgviewer
|
||||||
|
/kernel/version_*.cc
|
||||||
|
|
8
Makefile
8
Makefile
|
@ -20,6 +20,10 @@ LDFLAGS = -rdynamic
|
||||||
LDLIBS = -lstdc++ -lreadline -lm -ldl
|
LDLIBS = -lstdc++ -lreadline -lm -ldl
|
||||||
QMAKE = qmake-qt4
|
QMAKE = qmake-qt4
|
||||||
|
|
||||||
|
YOSYS_VER := 0.0.x
|
||||||
|
GIT_REV := $(shell git rev-parse --short HEAD || echo UNKOWN)
|
||||||
|
OBJS = kernel/version_$(GIT_REV).o
|
||||||
|
|
||||||
-include Makefile.conf
|
-include Makefile.conf
|
||||||
|
|
||||||
ifeq ($(CONFIG),clang-debug)
|
ifeq ($(CONFIG),clang-debug)
|
||||||
|
@ -76,6 +80,9 @@ top-all: $(TARGETS) $(EXTRA_TARGETS)
|
||||||
yosys: $(OBJS)
|
yosys: $(OBJS)
|
||||||
$(CXX) -o yosys $(LDFLAGS) $(OBJS) $(LDLIBS)
|
$(CXX) -o yosys $(LDFLAGS) $(OBJS) $(LDLIBS)
|
||||||
|
|
||||||
|
kernel/version_$(GIT_REV).cc:
|
||||||
|
echo "extern const char *yosys_version_str; const char *yosys_version_str=\"Yosys $(YOSYS_VER) (git sha1 $(GIT_REV))\";" > kernel/version_$(GIT_REV).cc
|
||||||
|
|
||||||
yosys-config: yosys-config.in
|
yosys-config: yosys-config.in
|
||||||
sed 's,@CXX@,$(CXX),; s,@CXXFLAGS@,$(CXXFLAGS),; s,@LDFLAGS@,$(LDFLAGS),; s,@LDLIBS@,$(LDLIBS),;' < yosys-config.in > yosys-config
|
sed 's,@CXX@,$(CXX),; s,@CXXFLAGS@,$(CXXFLAGS),; s,@LDFLAGS@,$(LDFLAGS),; s,@LDLIBS@,$(LDLIBS),;' < yosys-config.in > yosys-config
|
||||||
chmod +x yosys-config
|
chmod +x yosys-config
|
||||||
|
@ -105,6 +112,7 @@ manual:
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(OBJS) $(GENFILES) $(TARGETS)
|
rm -f $(OBJS) $(GENFILES) $(TARGETS)
|
||||||
|
rm -f kernel/version_*.o kernel/version_*.cc
|
||||||
rm -f libs/*/*.d frontends/*/*.d passes/*/*.d backends/*/*.d kernel/*.d
|
rm -f libs/*/*.d frontends/*/*.d passes/*/*.d backends/*/*.d kernel/*.d
|
||||||
cd manual && rm -f *.aux *.bbl *.blg *.idx *.log *.out *.pdf *.toc
|
cd manual && rm -f *.aux *.bbl *.blg *.idx *.log *.out *.pdf *.toc
|
||||||
test ! -f libs/svgviewer/Makefile || make -C libs/svgviewer distclean
|
test ! -f libs/svgviewer/Makefile || make -C libs/svgviewer distclean
|
||||||
|
|
|
@ -31,6 +31,9 @@
|
||||||
#include "kernel/register.h"
|
#include "kernel/register.h"
|
||||||
#include "kernel/log.h"
|
#include "kernel/log.h"
|
||||||
|
|
||||||
|
// from kernel/version_*.o (cc source generated from Makefile)
|
||||||
|
extern const char *yosys_version_str;
|
||||||
|
|
||||||
bool fgetline(FILE *f, std::string &buffer)
|
bool fgetline(FILE *f, std::string &buffer)
|
||||||
{
|
{
|
||||||
buffer = "";
|
buffer = "";
|
||||||
|
@ -438,10 +441,13 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
int opt;
|
int opt;
|
||||||
while ((opt = getopt(argc, argv, "Sm:f:b:o:p:l:qts:c:")) != -1)
|
while ((opt = getopt(argc, argv, "VSm:f:b:o:p:l:qts:c:")) != -1)
|
||||||
{
|
{
|
||||||
switch (opt)
|
switch (opt)
|
||||||
{
|
{
|
||||||
|
case 'V':
|
||||||
|
printf("%s\n", yosys_version_str);
|
||||||
|
exit(0);
|
||||||
case 'S':
|
case 'S':
|
||||||
backend_command = "verilog -noattr";
|
backend_command = "verilog -noattr";
|
||||||
passes_commands.push_back("hierarchy");
|
passes_commands.push_back("hierarchy");
|
||||||
|
@ -494,7 +500,7 @@ int main(int argc, char **argv)
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
fprintf(stderr, "Usage: %s [-S] [-q] [-t] [-l logfile] [-o <outfile>] [-f <frontend>] [{-s|-c} <scriptfile>]\n", argv[0]);
|
fprintf(stderr, "Usage: %s [-V] [-S] [-q] [-t] [-l logfile] [-o <outfile>] [-f <frontend>] [{-s|-c} <scriptfile>]\n", argv[0]);
|
||||||
fprintf(stderr, " %*s[-p <pass> [-p ..]] [-b <backend>] [-m <module_file>] [<infile> [..]]\n", int(strlen(argv[0])+1), "");
|
fprintf(stderr, " %*s[-p <pass> [-p ..]] [-b <backend>] [-m <module_file>] [<infile> [..]]\n", int(strlen(argv[0])+1), "");
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
fprintf(stderr, " -q\n");
|
fprintf(stderr, " -q\n");
|
||||||
|
@ -527,6 +533,9 @@ int main(int argc, char **argv)
|
||||||
fprintf(stderr, " -m module_file\n");
|
fprintf(stderr, " -m module_file\n");
|
||||||
fprintf(stderr, " load the specified module (aka plugin)\n");
|
fprintf(stderr, " load the specified module (aka plugin)\n");
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
|
fprintf(stderr, " -V\n");
|
||||||
|
fprintf(stderr, " print version information and exit\n");
|
||||||
|
fprintf(stderr, "\n");
|
||||||
fprintf(stderr, "The option -S is an alias for the following options that perform a simple\n");
|
fprintf(stderr, "The option -S is an alias for the following options that perform a simple\n");
|
||||||
fprintf(stderr, "transformation of the input to a gate-level netlist. This can be helpful when\n");
|
fprintf(stderr, "transformation of the input to a gate-level netlist. This can be helpful when\n");
|
||||||
fprintf(stderr, "e.g. using yosys as a pre-processor for a tool that can't understand full verilog.\n");
|
fprintf(stderr, "e.g. using yosys as a pre-processor for a tool that can't understand full verilog.\n");
|
||||||
|
@ -569,6 +578,8 @@ int main(int argc, char **argv)
|
||||||
log(" | |\n");
|
log(" | |\n");
|
||||||
log(" \\-----------------------------------------------------------------------------/\n");
|
log(" \\-----------------------------------------------------------------------------/\n");
|
||||||
log("\n");
|
log("\n");
|
||||||
|
log(" %s\n", yosys_version_str);
|
||||||
|
log("\n");
|
||||||
|
|
||||||
Pass::init_register();
|
Pass::init_register();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue