Writes a string into a depfile, escaping some special characters following the Makefile rules.
| 1299 | |
| 1300 | // Writes a string into a depfile, escaping some special characters following the Makefile rules. |
| 1301 | static void writeEscapedDepString(std::ofstream& file, const std::string& str) |
| 1302 | { |
| 1303 | for (char c : str) { |
| 1304 | switch (c) { |
| 1305 | case ' ': |
| 1306 | case ':': |
| 1307 | case '#': |
| 1308 | case '[': |
| 1309 | case ']': |
| 1310 | case '\\': |
| 1311 | file << '\\'; |
| 1312 | break; |
| 1313 | case '$': |
| 1314 | file << '$'; |
| 1315 | break; |
| 1316 | } |
| 1317 | file << c; |
| 1318 | } |
| 1319 | } |
| 1320 | |
| 1321 | // Writes a depfile similar to gcc -MMD foo.c |
| 1322 | bool writeDepFile(std::string depfile, std::vector<std::string>& binaryFiles, const std::vector<std::string>& sources) |