Page 1 of 1
Clue on how to change tmp dir for generated bat files
Posted: Wed Oct 09, 2013 3:14 pm
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
Re: Clue on how to change tmp dir for generated bat files
Posted: Wed Oct 09, 2013 3:31 pm
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
Re: Clue on how to change tmp dir for generated bat files
Posted: Wed Oct 09, 2013 7:42 pm
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
Re: Clue on how to change tmp dir for generated bat files
Posted: Wed Oct 09, 2013 9:26 pm
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:
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
Re: Clue on how to change tmp dir for generated bat files
Posted: Wed Oct 09, 2013 9:46 pm
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...
Re: Clue on how to change tmp dir for generated bat files
Posted: Wed Oct 09, 2013 9:53 pm
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
Re: Clue on how to change tmp dir for generated bat files
Posted: Thu Oct 10, 2013 12:03 am
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...
Re: Clue on how to change tmp dir for generated bat files
Posted: Thu Oct 10, 2013 12:18 am
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...
Not really, simply define TMP environment variable in codelite's environment settings and it will work...
it will work ( I tried that )
Eran
Re: Clue on how to change tmp dir for generated bat files
Posted: Thu Oct 10, 2013 1:07 am
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
Re: Clue on how to change tmp dir for generated bat files
Posted: Thu Oct 10, 2013 1:47 pm
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