Page 1 of 1

debug 2 Codelite instances unnecessary rebuild step

Posted: Fri Jul 25, 2014 6:56 am
by slorents
Hello!

Debug 2 instances of same application (2 different workspaces):
- common sources
- common intermediate directory (Debug)
- different output exec files (in different directories)

Change a source file, rebuild 1 project - ok.
Rebuild 2 project - ok.

After that I would expect that no rebuild needed while I am not change the source files... but F7 in 1 project start rebuild output file (exec).
In addition after rebuild 1 project, F7 in 2 project also start rebuild. So to start debugging 2 projects I always need 2 unnecessary rebuilds :(

Problem is in Makefile rule:

Code: Select all

$(OutputFile): $(IntermediateDirectory)/.d $(Objects) 
	@$(MakeDirCommand) $(@D)
	@echo "" > $(IntermediateDirectory)/.d
	@echo $(Objects0)  > $(ObjectsFileList)
	@echo $(Objects1) >> $(ObjectsFileList)
	$(LinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions)
This command create new ".d" file, that enforce OutputFile rebuild:

Code: Select all

@echo "" > $(IntermediateDirectory)/.d

Is there option in Codelite to disable this command in Makefile?

PS. Clang, Codelite 6.1

Re: debug 2 Codelite instances unnecessary rebuild step

Posted: Fri Jul 25, 2014 8:00 am
by eranif
Can you upload a zip file with a minimal workspaces that sermons traces the problem?
Thanks,
Eran

Re: debug 2 Codelite instances unnecessary rebuild step

Posted: Fri Jul 25, 2014 11:38 am
by slorents
I changed makefile.
Before:

Code: Select all

@echo "" > $(IntermediateDirectory)/.d
After:

Code: Select all

@test -e $(IntermediateDirectory)/.d || echo "" > $(IntermediateDirectory)/.d
It work under linux.

builder_gnumake.cpp: 1022

Code: Select all

void
BuilderGnuMake::CreateTargets(const wxString& type, BuildConfigPtr bldConf, wxString& text, const wxString& projName)
{
    bool markRebuilt(true);
    text << wxT("\t@$(MakeDirCommand) $(@D)\n");
    text << wxT("\t@test -e $(IntermediateDirectory)/.d || echo \"\" > $(IntermediateDirectory)/.d\n");   // *************** Changed line

Re: debug 2 Codelite instances unnecessary rebuild step

Posted: Fri Jul 25, 2014 12:12 pm
by slorents
Here is example.
Under windows (mingw) the problem is bigger, F7 always rebuild exec even with one project.

Re: debug 2 Codelite instances unnecessary rebuild step

Posted: Fri Jul 25, 2014 12:20 pm
by slorents
Another option is to move "bad" line to another rule. I think it is more clear => better.

Code: Select all

$(OutputFile): $(IntermediateDirectory)/.d $(Objects) 
	@$(MakeDirCommand) $(@D)
	@echo $(Objects0)  > $(ObjectsFileList)
	$(LinkerName) $(OutputSwitch)$(OutputFile) @$(ObjectsFileList) $(LibPath) $(Libs) $(LinkOptions)

$(IntermediateDirectory)/.d:
	@$(MakeDirCommand) "./Debug"
	@echo "" > $(IntermediateDirectory)/.d
Add line builder_gnumake.cpp: 595

Code: Select all

void BuilderGnuMake::CreateMakeDirsTarget(BuildConfigPtr bldConf, const wxString& targetName, wxString& text)
{
    text << wxT("\n");
    text << targetName << wxT(":\n");
    text << wxT("\t") << GetMakeDirCmd(bldConf) << wxT("\n");
    text << wxT("\t@echo \"\" > $(IntermediateDirectory)/.d\n");  //*************** Add line
}
Remove line builder_gnumake.cpp: 1022

Code: Select all

void
BuilderGnuMake::CreateTargets(const wxString& type, BuildConfigPtr bldConf, wxString& text, const wxString& projName)
{
    bool markRebuilt(true);
    text << wxT("\t@$(MakeDirCommand) $(@D)\n");
    //text << wxT("\t@echo \"\" > $(IntermediateDirectory)/.d\n");   //************** Remove line