Browse Source

comments, and change how --verbose prints

feature/dependency-graph
Martin Dørum 4 years ago
parent
commit
862cb6baf0
2 changed files with 8 additions and 2 deletions
  1. 1
    1
      src/sys.cc
  2. 7
    1
      src/toolchain.cc

+ 1
- 1
src/sys.cc View File

@@ -53,7 +53,7 @@ void execute(std::vector<const char *> &args, std::string *output) {
if (global::verbose) {
for (size_t i = 0; i < args.size(); ++i) {
if (i == 0) {
fprintf(stderr, "%s", args[i]);
fprintf(stderr, " %s", args[i]);
} else {
fprintf(stderr, " %s", args[i]);
}

+ 7
- 1
src/toolchain.cc View File

@@ -111,6 +111,7 @@ void pkgFlags(const std::vector<std::string> &pkgs, std::vector<std::string> &fl
argv.push_back(pkg.c_str());
}

// Execute $(PKG_CONFIG) --cflags $(PKGS)
std::string output;
sys::execute(argv, &output);
parseWhitespaceSeparated(output, flags);
@@ -124,6 +125,7 @@ void pkgLDLibs(const std::vector<std::string> &pkgs, std::vector<std::string> &f
argv.push_back(pkg.c_str());
}

// Execute $(PKG_CONFIG) --libs $(PKGS)
std::string output;
sys::execute(argv, &output);
parseWhitespaceSeparated(output, flags);
@@ -144,8 +146,9 @@ void getDependencies(
}

argv.push_back("-MM");
argv.push_back("-c");
argv.push_back(sourcePath.c_str());

// Execute $(CC) $(flags) -MM $<
std::string output;
sys::execute(argv, &output);

@@ -165,6 +168,7 @@ void compile(
std::string destDir = outDir + "/" + srcDir;
std::string destPath = destDir + "/" + name + ".o";

// Ensure the output directory actually exists
sys::mkdirp(outDir);

std::vector<const char *> argv;
@@ -177,6 +181,8 @@ void compile(
argv.push_back(destPath.c_str());
argv.push_back("-c");
argv.push_back(sourcePath.c_str());

// Execute $(CC) $(flags) -o $@ -c $<
sys::execute(argv, nullptr);
}


Loading…
Cancel
Save