forked from github/verilator
Internals: Factor out making a make cmd string in Verilator.cpp. No functional change intended. (#2453)
This commit is contained in:
parent
271fa5fe3c
commit
2fd23458ce
@ -584,20 +584,15 @@ static void verilate(const string& argString) {
|
||||
FileLine::deleteAllRemaining();
|
||||
}
|
||||
|
||||
static void execBuildJob() {
|
||||
UASSERT(v3Global.opt.build(), "--build is not specified.");
|
||||
UASSERT(v3Global.opt.gmake(), "--build requires GNU Make.");
|
||||
UASSERT(!v3Global.opt.cmake(), "--build cannot use CMake.");
|
||||
UINFO(1, "Start Build\n");
|
||||
|
||||
static string buildMakeCmd(const string& makefile, const string& target) {
|
||||
const V3StringList& makeFlags = v3Global.opt.makeFlags();
|
||||
const int jobs = v3Global.opt.buildJobs();
|
||||
UASSERT(jobs >= 0, "-j option parser in V3Options.cpp filters out negative value");
|
||||
|
||||
std::stringstream cmd;
|
||||
std::ostringstream cmd;
|
||||
cmd << v3Global.opt.getenvMAKE();
|
||||
cmd << " -C " << v3Global.opt.makeDir();
|
||||
cmd << " -f " << v3Global.opt.prefix() << ".mk";
|
||||
cmd << " -f " << makefile;
|
||||
if (jobs == 0) {
|
||||
cmd << " -j";
|
||||
} else if (jobs > 1) {
|
||||
@ -606,8 +601,18 @@ static void execBuildJob() {
|
||||
for (V3StringList::const_iterator it = makeFlags.begin(); it != makeFlags.end(); ++it) {
|
||||
cmd << ' ' << *it;
|
||||
}
|
||||
if (!target.empty()) { cmd << ' ' << target; }
|
||||
|
||||
const std::string cmdStr = cmd.str();
|
||||
return cmd.str();
|
||||
}
|
||||
|
||||
static void execBuildJob() {
|
||||
UASSERT(v3Global.opt.build(), "--build is not specified.");
|
||||
UASSERT(v3Global.opt.gmake(), "--build requires GNU Make.");
|
||||
UASSERT(!v3Global.opt.cmake(), "--build cannot use CMake.");
|
||||
UINFO(1, "Start Build\n");
|
||||
|
||||
const string cmdStr = buildMakeCmd(v3Global.opt.prefix() + ".mk", "");
|
||||
const int exit_code = V3Os::system(cmdStr);
|
||||
if (exit_code != 0) {
|
||||
v3error(cmdStr << " exitted with " << exit_code << std::endl);
|
||||
|
Loading…
Reference in New Issue
Block a user