Clue on how to change tmp dir for generated bat files

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

Clue on how to change tmp dir for generated bat files

Post by jfouche »

Hi,

For my own need, I want to change the directory where is created the batch file which launch the compilation of a project. This batch is created in %TEMP% directory.
I didn't find where this file is created. Any clue would be helpfull.

For information, I think I will add -Dvariable=value in codelite command line. This way, we can override the codelite usual way.
For me, I will create a variable codelite.tmp.dir, which will be used to create the batch file. If this variable doesn't exist, I'll let CodeLite use it's current way of generating it's batch.

I suppose nobody will need this change (except those, like me, who's company policy has change, and doesn't let application to create batch file in %TEMP% dir), but I can share it.
Let me know
Jérémie
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Clue on how to change tmp dir for generated bat files

Post by eranif »

jfouche wrote:For my own need, I want to change the directory where is created the batch file which launch the compilation of a project. This batch is created in %TEMP% directory.
I didn't find where this file is created. Any clue would be helpfull.
I am not sure to which batch file you are referring. IIRC, the only batch file generated by codelite is done when the project is using a custom makefile + there are some post/pre build commands. Is this the case?

Can you please paste here some example of how your build looks like?

If all you need is to add a -D<name>=<value> to the compilation line you can define the standard makefile environment variables CXX/CC like this:

Code: Select all

CXX=g++ -Dvariable=value
CC=g++ -Dvariable=value
Eran
Make sure you have read the HOW TO POST thread
jfouche
CodeLite Guru
Posts: 351
Joined: Mon Oct 20, 2008 7:26 pm
Genuine User: Yes
IDE Question: C++
Location: France
Contact:

Re: Clue on how to change tmp dir for generated bat files

Post by jfouche »

Hello Eran,

Open the CodeLite workspace, and select the Windows release configuration. Hit "F7".
Open your %TEMP% dir and look at the generated batches (it contains "cd plugin && mingw32-make ..."). In my company, they are not generated due to the new security policy, and I can't use CodeLite to compile anymore :(

About the -Dname=value, I was thinking about variables during codelite run :
codelite.exe -Dcodelite.tmp.dir=d:\my_dir
Jérémie
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Clue on how to change tmp dir for generated bat files

Post by eranif »

jfouche wrote:Open the CodeLite workspace, and select the Windows release configuration. Hit "F7".
Open your %TEMP% dir and look at the generated batches (it contains "cd plugin && mingw32-make ..."). In my company, they are not generated due to the new security policy, and I can't use CodeLite to compile anymore
Its not codelite who does that... its mingw32-make.exe ...

I experminted with it a bit and my first guess was correct: mingw32-make.exe is using the TMP environment variable to determine the location of the temp folder.

So what I did was:

Settings -> Environment variables
Added:

Code: Select all

TMP=C:\MyTempFolder
NOTICE that I defined TMP without 'E' ( I tried TEMP=... and it did not work )

and all the auto generated .bat files were generated in the new folder


Eran
Make sure you have read the HOW TO POST thread
jfouche
CodeLite Guru
Posts: 351
Joined: Mon Oct 20, 2008 7:26 pm
Genuine User: Yes
IDE Question: C++
Location: France
Contact:

Re: Clue on how to change tmp dir for generated bat files

Post by jfouche »

Back at home, I checked the content of the batch :
@echo off
cd "Plugin" && mingw32-make.exe -f "plugin_sdk.mk" ../PCH/precompiled_header_release.h.gch && mingw32-make.exe -f "plugin_sdk.mk" && mingw32-make.exe -f "plugin_sdk.mk" PostBuild
I'm surprised that mingw32-make created one like this.

I'll try your suggestion tomorow at work, but I'm not very optimistic about this. I tried to modify the TMP and TEMP variable in a DOS console before launching CodeLite, the policy is smart enough to block the creation of the batch...
Jérémie
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Clue on how to change tmp dir for generated bat files

Post by eranif »

codelite generates Makefile and simply runs it using mingw32-make.exe without any intermediate batch files.

The below line (note that it slightly differs from what you posted) is taken from codelite's Makefile:
@cd "Plugin" && $(MAKE) -f "plugin_sdk.mk" ../PCH/precompiled_header_release.h.gch && $(MAKE) -f "plugin_sdk.mk" && $(MAKE) -f "plugin_sdk.mk" PostBuild
I suspect that mingw32-make replaces $(MAKE) with the actual invocation command of make and generates a helper batch file to execute it (its a reasonable way for executing chain commands using the && operator)

Eran
Make sure you have read the HOW TO POST thread
jfouche
CodeLite Guru
Posts: 351
Joined: Mon Oct 20, 2008 7:26 pm
Genuine User: Yes
IDE Question: C++
Location: France
Contact:

Re: Clue on how to change tmp dir for generated bat files

Post by jfouche »

Well, you're right, as usual ;)
I had a look to mingw32-make source and it uses directly the tmpfile() function.
I'm probably lost... :cry:
Jérémie
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Clue on how to change tmp dir for generated bat files

Post by eranif »

jfouche wrote:Well, you're right, as usual ;)
I had a look to mingw32-make source and it uses directly the tmpfile() function.
I'm probably lost... :cry:
Not really, simply define TMP environment variable in codelite's environment settings and it will work...

Code: Select all

TMP=d:\my_dir
it will work ( I tried that )

Eran
Make sure you have read the HOW TO POST thread
jfouche
CodeLite Guru
Posts: 351
Joined: Mon Oct 20, 2008 7:26 pm
Genuine User: Yes
IDE Question: C++
Location: France
Contact:

Re: Clue on how to change tmp dir for generated bat files

Post by jfouche »

I hope it will work in my company, but
jfouche wrote:I'll try your suggestion tomorow at work, but I'm not very optimistic about this. I tried to modify the TMP and TEMP variable in a DOS console before launching CodeLite, but the policy is smart enough to block the creation of the batch...
I'll tell you tomorow. But as it's not CL fault, I can't complain here ;)

Thanks a lot for your time
Jérémie
jfouche
CodeLite Guru
Posts: 351
Joined: Mon Oct 20, 2008 7:26 pm
Genuine User: Yes
IDE Question: C++
Location: France
Contact:

Re: Clue on how to change tmp dir for generated bat files

Post by jfouche »

Eran,

You're great. That works :)
Thanks a lot for this simple solution. You have to know that VisualStudio doesn't work anymore also (if the project has pre / post steps).
One more point to CodeLite
Jérémie
Post Reply