Dependencies for resource files

General questions regarding the usage of CodeLite
ironhead
CodeLite Enthusiast
Posts: 22
Joined: Mon Mar 30, 2009 3:15 pm
Contact:

Dependencies for resource files

Post by ironhead » Thu Nov 19, 2009 4:36 pm

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?

User avatar
eranif
CodeLite Plugin
Posts: 5942
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Dependencies for resource files

Post by eranif » Thu Nov 19, 2009 4:53 pm

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
Make sure you have read the HOW TO POST thread

ironhead
CodeLite Enthusiast
Posts: 22
Joined: Mon Mar 30, 2009 3:15 pm
Contact:

Re: Dependencies for resource files

Post by ironhead » Thu Nov 19, 2009 5:11 pm

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?

jfouche
CodeLite Guru
Posts: 351
Joined: Mon Oct 20, 2008 7:26 pm
Genuine User: Yes
IDE Question: C++
Location: France
Contact:

Re: Dependencies for resource files

Post by jfouche » Thu Nov 19, 2009 5:13 pm

eranif wrote:play with it and it will work eventually
:D
Jérémie

User avatar
eranif
CodeLite Plugin
Posts: 5942
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Dependencies for resource files

Post by eranif » Thu Nov 19, 2009 5:27 pm

Yes, add another dependency, and at the 'Rule' section, add the makefile rule for it
Eran
Make sure you have read the HOW TO POST thread

ironhead
CodeLite Enthusiast
Posts: 22
Joined: Mon Mar 30, 2009 3:15 pm
Contact:

Re: Dependencies for resource files

Post by ironhead » Thu Nov 19, 2009 5:39 pm

Sorry, brain lapse on my part, just needed to add a space between the dependencies and have them all on the one line.

ironhead
CodeLite Enthusiast
Posts: 22
Joined: Mon Mar 30, 2009 3:15 pm
Contact:

Re: Dependencies for resource files

Post by ironhead » Fri Nov 20, 2009 2:46 am

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

User avatar
eranif
CodeLite Plugin
Posts: 5942
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Dependencies for resource files

Post by eranif » Fri Nov 20, 2009 9:46 am

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
Make sure you have read the HOW TO POST thread

Post Reply