Page 1 of 1

Clearing with Custom Build [SOLVED]

Posted: Sun Feb 08, 2015 9:50 am
by member7
Hi, I'm very exited about codelite 7!
I migrated my old codelite project to codelite 7.0 and set it up such that I can build it with mingw 4.9.2. I can build my project just fine now but cleaning removes the entire configured build folder where the previous version only removed object and depend files.

I want to setup codelite such that it removes only objects and depends when cleaning. I don't know how to do that, my guess is I need to make a custom build. I've tried to make a custom build which calls the same command codelite does but it won't build.

Output View without Custom Build:
C:\Windows\system32\cmd.exe /C "C:/mingw-4.9.2/bin/mingw32-make.exe -j2 SHELL=cmd.exe -e -f Makefile"
"----------Building project:[ project - Debug ]----------"
mingw32-make.exe[1]: Entering directory 'C:/Workspace/project'
C:/mingw-4.9.2/bin/g++.exe -o ./Debug/project @"project.txt" -L.
mingw32-make.exe[1]: Leaving directory 'C:/Workspace/project'
0 errors, 0 warnings
When using Custom Build:
MESSAGE: Entering directory `C:\Workspace'
C:\Windows\system32\cmd.exe /C "C:/mingw-4.9.2/bin/mingw32-make.exe -j2 SHELL=cmd.exe -e -f Makefile"
----------Building project:[ project - Debug ]----------
"----------Building project:[ project - Debug ]----------"
mingw32-make.exe[1]: Entering directory 'C:/Workspace/project'
C:/mingw-4.9.2/bin/g++.exe -o ./Debug/project @"project.txt" -L.
mingw32-make.exe[1]: *** [Debug/project] Error 1
project.mk:78: recipe for target 'Debug/project' failed
mingw32-make.exe[1]: Leaving directory 'C:/Workspace/project'
mingw32-make.exe: *** [All] Error 2
Makefile:4: recipe for target 'All' failed
1 errors, 0 warnings
I want to have codelite use the default Makefile when building but use my Makefile from the old codelite version for cleaning. What is going wrong in my setup above? I appreciate any insight.
I'm using Codelite 7.0 on Windows 7 with MinGW 4.9.2

Re: Clearing with Custom Build

Posted: Sun Feb 08, 2015 10:19 am
by eranif
The file "Makefile" is auto generated. Don't use that.
I want to setup codelite such that it removes only objects and depends when cleaning
Can you explain why? what is wrong with cleaning the build folder?

The reason the clean was changed is simple: on very large projects, cleaning each file can take up to minutes while removing the folder is much faster


Eran

Re: Clearing with Custom Build

Posted: Sun Feb 08, 2015 11:43 am
by member7
Can you explain why?
I keep a few bigger files inside the build folders. Maybe I fell into bad practice out of convenience.

I noticed the Makefile is auto generated and made a copy with a slight adjustment such that it refers to the autogenerated projekt.mk for building and my custom clean_project.mk for cleaning. But the outcome is the same.
.PHONY: clean All

All:
@echo "----------Building project:[ project - Debug ]----------"
@cd "project" && $(MAKE) -f "project.mk"
clean:
@echo "----------Cleaning project:[ project - Debug ]----------"
@cd "project" && $(MAKE) -f "clean_project.mk" clean

Re: Clearing with Custom Build

Posted: Sun Feb 08, 2015 11:52 am
by eranif
I will take a long shot here and I will guess that the problem is within your compiler (4.9.2)
What happens when you run the custom build from the command line? My guess is that you will get a dialog box with an error message

Right click on the file's tab label and select 'Open Shell at file path' then perform codelite steps:
1. cd C:\Workspace
2. Run the build command:

Code: Select all

C:\Windows\system32\cmd.exe /C "C:/mingw-4.9.2/bin/mingw32-make.exe -j2 SHELL=cmd.exe -e -f Makefile"
Eran

Re: Clearing with Custom Build

Posted: Sun Feb 08, 2015 12:02 pm
by member7
Indeed an error dialog box "The program can't start because libwinpthread-1.dll is missing from your computer."
C:\Workspace>C:\Windows\system32\cmd.exe /C "C:/mingw-4.9.2/bin/mingw32-make.exe -j2 SHELL=cmd.exe -e -f Makefile"
"----------Building project:[ project - Debug ]----------"
mingw32-make.exe[1]: Entering directory 'C:/Workspace/project'
C:/mingw-4.9.2/bin/g++.exe -o ./Debug/project @"project.txt" -L.
project.mk:78: recipe for target 'Debug/project' failed
mingw32-make.exe[1]: *** [Debug/project] Error 1
mingw32-make.exe[1]: Leaving directory 'C:/Workspace/project'
Makefile:4: recipe for target 'All' failed
mingw32-make.exe: *** [All] Error 2

Re: Clearing with Custom Build

Posted: Sun Feb 08, 2015 12:10 pm
by eranif
This is a bug in the compiler...it assumes that you have added its 'bin' folder into the PATH environment variable
You don't see this error when using standard build because codelite's adds the 'bin' folder of the compiler into the PATH environment variable during the build time (in the bin folder of your compiler, you will find the missing DLL: libwinpthread-1.dl)

However, when using custom build, this is not done - because codelite has no idea how are you going to build your workspace

You can workaround this by adding it to the PATH environment variable like this:

settings->environment variables

Code: Select all

PATH=C:\mingw-4.9.2\bin;$PATH
Eran

Re: Clearing with Custom Build

Posted: Sun Feb 08, 2015 1:05 pm
by member7
Adding it to the PATH environment worked like a charm. Thank you, Eran!