static const char* addCurrentDirToSourceFile(const char* filename, const char* modFilename) { // Do nothing if modFilename is NULL if (modFilename == NULL) { return filename; } // Do nothing if the filename is already absolute if (filename[0] == '/') { return filename; } // Do nothing if the current module's directory is "./" const char* modDir = getDirectory(modFilename); if (strcmp(modDir, ".") == 0) { return filename; } // If the file is a .c or .o... if (isCSource(filename) || isObjFile(filename)) { // ...and it isn't already an absolute path, add the module directory return astr(modDir, "/", filename); } // If the file is a .h, add the module's directory to the -I path if (isCHeader(filename)) { for_vector(const char, dir, incDirs) { if (dir == modDir) { // we've already added this -I directory, so don't do it again return filename; } } addIncInfo(modDir); return filename; } // otherwise, leave it as-is return filename; }
static void handleIncDir(ArgumentState* arg_state, char* arg_unused) { addIncInfo(incFilename); }
static void handleIncDir(const ArgumentDescription* desc, const char* arg_unused) { addIncInfo(incFilename); }