sdcc makefile生成优化 (#377)
* sdcc makefile生成优化 1.隐藏删除文件的错误提示 2.支持生成目标文件输出目录 * 修复删不了文件 * 确保能删除编译文件同时不提示任何错误 * 更正clean脚本错误(%1 2>&1)应为(%1 2>%1) 指定生成目标文件输出目录支持跨盘,跨平台(理论) * 预防配置项为相对路径 * clean 目标与>%1中间添加空格,避免错误
This commit is contained in:
parent
c6c7d92e1c
commit
697bdca255
|
@ -195,7 +195,7 @@ void SDCCProjectCompiler::writeMakeIncludes(QFile &file)
|
|||
void SDCCProjectCompiler::writeMakeClean(QFile &file)
|
||||
{
|
||||
writeln(file, "clean: clean-custom");
|
||||
writeln(file, QString("\t-$(RM) $(CLEANOBJ) > %1 2>&1").arg(NULL_FILE));
|
||||
writeln(file, QString("\t@-$(RM) $(CLEANOBJ) >%1 2>%1||:").arg(NULL_FILE));
|
||||
writeln(file);
|
||||
}
|
||||
|
||||
|
@ -256,6 +256,7 @@ void SDCCProjectCompiler::writeMakeObjFilesRules(QFile &file)
|
|||
writeln(file, objStr);
|
||||
|
||||
// Write custom build command
|
||||
|
||||
if (unit->overrideBuildCmd() && !unit->buildCmd().isEmpty()) {
|
||||
QString BuildCmd = unit->buildCmd();
|
||||
BuildCmd.replace("<CRTAB>", "\n\t");
|
||||
|
@ -263,8 +264,16 @@ void SDCCProjectCompiler::writeMakeObjFilesRules(QFile &file)
|
|||
// Or roll our own
|
||||
} else {
|
||||
if (fileType==FileType::CSource) {
|
||||
writeln(file, "\t$(CC) $(CFLAGS) -c " + escapeArgumentForMakefileRecipe(shortFileName, false));
|
||||
}
|
||||
if(mProject->options().folderForObjFiles.isEmpty()) {
|
||||
writeln(file, "\t$(CC) $(CFLAGS) -c " + escapeArgumentForMakefileRecipe(shortFileName, false));
|
||||
}else{
|
||||
QString fullObjDir = includeTrailingPathDelimiter(mProject->options().folderForObjFiles);
|
||||
QString relativeObjDir = extractRelativePath(mProject->directory(),fullObjDir);
|
||||
QString objfile=extractRelativePath(generateAbsolutePath(mProject->directory(),relativeObjDir),unit->fileName());
|
||||
writeln(file, "\tpushd "+ localizePath(relativeObjDir)+" &&$(CC) $(CFLAGS) -c " + localizePath(objfile));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue