Add -o option to specify executable name

This commit is contained in:
Wilson Snyder 2010-01-30 09:42:44 -05:00
parent c49e0ac5c8
commit 7fd6ddc25b
5 changed files with 15 additions and 3 deletions

View File

@ -232,6 +232,7 @@ descriptions in the next sections for more information.
-O0 Disable optimizations
-O3 High performance optimizations
-O<optimization-letter> Selectable optimizations
-o <executable> Name of final executable
--output-split <bytes> Split .cpp files into pieces
--output-split-cfuncs <statements> Split .ccp functions
--pins-bv <bits> Specify types for top level ports
@ -564,6 +565,11 @@ disables an optimization, an upper case letter enables it. This is
intended for debugging use only; see the source code for version-dependent
mappings of optimizations to -O letters.
=item -o <executable>
Specify the name for the final executable built if using --exe. Defaults
to the --prefix if not specified.
=item --output-split I<bytes>
Enables splitting the output .cpp/.sp files into multiple outputs. When a

View File

@ -119,7 +119,7 @@ public:
of.puts("\n");
if (v3Global.opt.exe()) {
of.puts("default: "+v3Global.opt.prefix()+"\n");
of.puts("default: "+v3Global.opt.exeName()+"\n");
} else {
of.puts("default: "+v3Global.opt.prefix()+"__ALL.a\n");
}
@ -205,7 +205,7 @@ public:
}
of.puts("\n### Link rules... (from --exe)\n");
of.puts(v3Global.opt.prefix()+": $(VK_USER_OBJS) $(VK_GLOBAL_OBJS) $(VM_PREFIX)__ALL.a\n");
of.puts(v3Global.opt.exeName()+": $(VK_USER_OBJS) $(VK_GLOBAL_OBJS) $(VM_PREFIX)__ALL.a\n");
of.puts("\t$(LINK) $(LDFLAGS) $^ $(LOADLIBES) $(LDLIBS) -o $@ $(LIBS) $(SC_LIBS) 2>&1 | c++filt\n");
of.puts("\n");
}

View File

@ -750,6 +750,9 @@ void V3Options::parseOptsList(FileLine* fl, int argc, char** argv) {
shift; m_makeDir = argv[i];
addIncDir (string (m_makeDir)); // Need to find generated files there too
}
else if ( !strcmp (sw, "-o") && (i+1)<argc ) {
shift; m_exeName = argv[i];
}
else if ( !strncmp (sw, "-U", 2)) {
V3PreShell::undef (string (sw+strlen("-U")));
}

View File

@ -138,6 +138,7 @@ class V3Options {
int m_compLimitParens; // compiler selection options
string m_bin; // main switch: --bin {binary}
string m_exeName; // main switch: -o {name}
string m_flags; // main switch: -f {name}
string m_makeDir; // main switch: -Mdir
string m_modPrefix; // main switch: --mod-prefix
@ -251,6 +252,7 @@ class V3Options {
int compLimitBlocks() const { return m_compLimitBlocks; }
int compLimitParens() const { return m_compLimitParens; }
string exeName() const { return m_exeName!="" ? m_exeName : prefix(); }
string makeDir() const { return m_makeDir; }
string modPrefix() const { return m_modPrefix; }
string pipeFilter() const { return m_pipeFilter; }

View File

@ -537,10 +537,11 @@ sub execute {
if ($param{vlt}
#&& (!$param{needs_v4} || -r "$ENV{VERILATOR_ROOT}/src/V3Gate.cpp")
) {
$param{executable} ||= "$self->{obj_dir}/$param{VM_PREFIX}";
$self->_run(logfile=>"$self->{obj_dir}/vlt_sim.log",
cmd=>[($run_env
.($opt_gdbsim ? "gdbrun ":"")
."$self->{obj_dir}/$param{VM_PREFIX}"),
.$param{executable}),
@{$param{all_run_flags}},
],
%param,