make doesn't work quite right

General questions regarding the usage of CodeLite
HJarausch
CodeLite Veteran
Posts: 98
Joined: Thu Feb 18, 2010 10:54 pm
Genuine User: Yes
IDE Question: C++
Contact:

make doesn't work quite right

Post by HJarausch »

Hi,

I have a long standing problem with CodeLite.
Given a project, say P, with a single source file P.cpp and build it sucessfully. This generates a P.exe in the debug folder.
Now, introduce an error in P.cpp. The build phase fails but when I try to run the project, it does run because it invokes the old executable.
How can I achieve that running a project fails if the the executable is older than any object or source file?

Many thanks for a hint,
Helmut.
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: make doesn't work quite right

Post by eranif »

You can add a pre-build step that deletes the old binary before compilation starts.
From "project settings -> pre/post build commands -> Pre Build"
Eran
Make sure you have read the HOW TO POST thread
HJarausch
CodeLite Veteran
Posts: 98
Joined: Thu Feb 18, 2010 10:54 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: make doesn't work quite right

Post by HJarausch »

eranif wrote:You can add a pre-build step that deletes the old binary before compilation starts.
From "project settings -> pre/post build commands -> Pre Build"
Eran
Many thanks Eran.
The ideal solution would be two different post-build steps, one if make succeeds and one if it fails.
In my case make fails so I'd remove the binary only in this case. Otherwise, the linkage phase has to be rerun any time one wants to run the binary.

Thanks,
Helmut.
HJarausch
CodeLite Veteran
Posts: 98
Joined: Thu Feb 18, 2010 10:54 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: make doesn't work quite right

Post by HJarausch »

eranif wrote:You can add a pre-build step that deletes the old binary before compilation starts.
From "project settings -> pre/post build commands -> Pre Build"
Eran
I have problems doing so,

under Linux, I've added the following command line first as Pre Build, next as Post Build
/bin/echo "$(CurrentFileFullPath)/HJ" > /tmp/LOG

In both cases, $(CurrentFileFullPath) evaluated to the null string.
What can I find out the full name of the executable?

This is with 4.1.5770

Thanks,
Helmut.
User avatar
Jarod42
CodeLite Expert
Posts: 240
Joined: Wed Sep 30, 2009 5:54 pm
Genuine User: Yes
IDE Question: C++
Location: France
Contact:

Re: make doesn't work quite right

Post by Jarod42 »

You can open myproject.mk to see the generated makefile and see the defined variables.

So, I think you want $(OutputFile)
HJarausch
CodeLite Veteran
Posts: 98
Joined: Thu Feb 18, 2010 10:54 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: make doesn't work quite right

Post by HJarausch »

Jarod42 wrote:You can open myproject.mk to see the generated makefile and see the defined variables.

So, I think you want $(OutputFile)
Many thanks. Now I can use the Pre Build action
rm "$(ProjectPath)/$(OutputFile)"

although this isn't optimal, as noted before.
Helmut.
Post Reply