Page 1 of 1

Dependencies for resource files

Posted: Thu Nov 19, 2009 4:36 pm
by ironhead
As part of my own makefiles for my project, I build dependencies for my resource files (*.rc) via the following in my Makefile:

Code: Select all

$(TARGET).o.d: $(TARGET).rc
    g++ -E -xc-header -DRC_INVOKED -MM -MF $@ -MT $(TARGET).o
What would the best approach be to implement this in my CodeLite project?

Re: Dependencies for resource files

Posted: Thu Nov 19, 2009 4:53 pm
by eranif
You can add your own makefile rules to the generated makefile via the 'custom makefile steps' tab in the project settings

For example:
to generate .o.d file, add:
Dependencies: $(TARGET).o.d

in the rule actions:

Code: Select all

$(TARGET).o.d: $(TARGET).rc
    g++ -E -xc-header -DRC_INVOKED -MM -MF $@ -MT $(TARGET).o
However, codelite does not know what is TARGET, so you will need to set the real name here

Instead of 'g++' use $(CompilerName) to see the complete line of how codelite compile files, have a look at 'Settings -> Build Settings -> gnu g++ -> File Types'
It is something like:

Code: Select all

$(CompilerName) $(SourceSwitch) "$(FileFullPath)" $(CmpOptions) $(ObjectSwitch)$(IntermediateDirectory)/$(FileName)$(ObjectSuffix) $(IncludePath)
play with it and it will work eventually

Eran

Re: Dependencies for resource files

Posted: Thu Nov 19, 2009 5:11 pm
by ironhead
Can I have multiple Custom makefile steps?

I currently have the Dependencies as:

Code: Select all

../svnversion.h
With the Rule action being:

Code: Select all

../svnversion.h:
	svn info --revision HEAD | findstr Revision > svnversion.tmp &
	for /f "tokens=1,2" %%i in (svnversion.tmp) do echo #define SVN_VERSION %%j > ..\svnversion.h &
	for /f "tokens=1,2" %%i in (svnversion.tmp) do echo #define SVN_VERSION_STR "%%j" >> ..\svnversion.h &
	del /q svnversion.tmp
How do I define a second dependency?

Re: Dependencies for resource files

Posted: Thu Nov 19, 2009 5:13 pm
by jfouche
eranif wrote:play with it and it will work eventually
:D

Re: Dependencies for resource files

Posted: Thu Nov 19, 2009 5:27 pm
by eranif
Yes, add another dependency, and at the 'Rule' section, add the makefile rule for it
Eran

Re: Dependencies for resource files

Posted: Thu Nov 19, 2009 5:39 pm
by ironhead
Sorry, brain lapse on my part, just needed to add a space between the dependencies and have them all on the one line.

Re: Dependencies for resource files

Posted: Fri Nov 20, 2009 2:46 am
by ironhead
I'm getting there.... I now have:

Dependencies:

Code: Select all

$(IntermediateDirectory)/emergeDesktop.rc$(DependSuffix)
Rule action:

Code: Select all

$(IntermediateDirectory)/emergeDesktop.rc$(DependSuffix): emergeDesktop.rc
	$(CompilerName) -E -xc-header -DRC_INVOKED -MT$(IntermediateDirectory)/emergeDesktop.rc$(ObjectSuffix) -MF$(IntermediateDirectory)/emergeDesktop.rc$(DependSuffix) -MM emergeDesktop.rc
I tried using absolute paths with:

Code: Select all

... -MM $(ProjectPath)/emergeDesktop.rc
But it resulted in mixed path slashes. Is it possible to call some routine to convert $(ProjectPath) to unix format within the Windows version of CodeLite?

Additionally, is it possible to extend the 'clean' rule to remove emergeDesktop.rc$(DependSuffix)?

Thank you for all the help!

Chris

Re: Dependencies for resource files

Posted: Fri Nov 20, 2009 9:46 am
by eranif
ironhead wrote:But it resulted in mixed path slashes. Is it possible to call some routine to convert $(ProjectPath) to unix format within the Windows version of CodeLite?
No
ironhead wrote:Additionally, is it possible to extend the 'clean' rule to remove emergeDesktop.rc$(DependSuffix)?
You can not extend the clean rule. Sorry

Eran