Page 1 of 1

make doesn't work quite right

Posted: Mon Oct 15, 2012 8:58 pm
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.

Re: make doesn't work quite right

Posted: Mon Oct 15, 2012 10:38 pm
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

Re: make doesn't work quite right

Posted: Tue Oct 16, 2012 10:49 am
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.

Re: make doesn't work quite right

Posted: Tue Oct 16, 2012 1:54 pm
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.

Re: make doesn't work quite right

Posted: Tue Oct 16, 2012 4:48 pm
by Jarod42
You can open myproject.mk to see the generated makefile and see the defined variables.

So, I think you want $(OutputFile)

Re: make doesn't work quite right

Posted: Tue Oct 16, 2012 7:12 pm
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.