bool DirectCommands::IsObjectOutdated(ProjectBuildTarget* target, const pfDetails& pfd, wxString* errorStr) { // If the source file does not exist, then do not compile. time_t timeSrc; depsTimeStamp(pfd.source_file_absolute_native.mb_str(), &timeSrc); if (!timeSrc) { if (errorStr) *errorStr = _("WARNING: Can't read file's timestamp: ") + pfd.source_file_absolute_native; if (wxFileExists(pfd.source_file_absolute_native)) { return true; } return false; } // If the object file does not exist, then it must be built. In this case // there is no need to scan the source file for headers. time_t timeObj; Compiler* compiler = target ? CompilerFactory::GetCompiler(target->GetCompilerID()) : m_pCompiler; wxString ObjectAbs = (target->GetUseFlatObjects())?pfd.object_file_flat_absolute_native:pfd.object_file_absolute_native; depsTimeStamp(ObjectAbs.mb_str(), &timeObj); if(compiler->GetParentID().Matches(_T("lcy"))) { wxString ramld = pfd.source_file_native; if(ramld.Contains(_T(".ld"))) { depsTimeStamp(ramld.mb_str(), &timeObj); time_t ramldstamp = m_pCompilerPlugin->GetRamLDTimestamp(); if(timeObj > ramldstamp) m_pCompilerPlugin->SetRamLDTimestamp(timeObj); return (timeObj > ramldstamp ); } } if (!timeObj) return true; // If the source file is newer than the object file, then the object file // must be built. In this case there is no need to scan the source file // for headers. if (timeSrc > timeObj) return true; // Scan the source file for headers. Result is NULL if the file does // not exist. If one of the descendent header files is newer than the // object file, then the object file must be built. depsRef ref = depsScanForHeaders(pfd.source_file_absolute_native.mb_str()); if (ref) { time_t timeNewest; (void) depsGetNewest(ref, &timeNewest); return (timeNewest > timeObj); } // object file is up to date with source file return false; }
bool DirectCommands::IsObjectOutdated(ProjectBuildTarget* target, const pfDetails& pfd, wxString* errorStr) const { // If the source file does not exist, then do not compile. time_t timeSrc; depsTimeStamp(pfd.source_file_absolute_native.mb_str(), &timeSrc); if (!timeSrc) { if (errorStr) *errorStr = _("WARNING: Can't read file's timestamp: ") + pfd.source_file_absolute_native; if (wxFileExists(pfd.source_file_absolute_native)) return true; // fall-back: Its better to compile in that case return false; } // If the object file does not exist, then it must be built. In this case // there is no need to scan the source file for headers. time_t timeObj; Compiler* compiler = target ? CompilerFactory::GetCompiler(target->GetCompilerID()) : m_pCompiler; if (!compiler) return false; wxString ObjectAbs = (compiler->GetSwitches().UseFlatObjects) ? pfd.object_file_flat_absolute_native : pfd.object_file_absolute_native; depsTimeStamp(ObjectAbs.mb_str(), &timeObj); if (!timeObj) return true; // fall-back: Its better to compile in that case // If the source file is newer than the object file, then the object file // must be built. In this case there is no need to scan the source file // for headers. if (timeSrc > timeObj) return true; // Do the check for includes only, if not disabled by the user, e.g. in case of non C/C++ compilers if ( Manager::Get()->GetConfigManager(_T("compiler"))->ReadBool(_T("/skip_include_deps"), false) ) return false; // Scan the source file for headers. Result is NULL if the file does // not exist. If one of the descendent header files is newer than the // object file, then the object file must be built. depsRef ref = depsScanForHeaders(pfd.source_file_absolute_native.mb_str()); if (ref) { time_t timeNewest; (void) depsGetNewest(ref, &timeNewest); return (timeNewest > timeObj); } // object file is up to date with source file and does not depend on #includes return false; }