I am trying to add this code to my makefile in the PreBuild Command section of the Project Settings
$(info Executing Pre Build commands …)
$(info ${TIVA_ROOT})
ifndef TIVA_ROOT
$(error You must specify the path to TivaWare in the TIVA_ROOT environment variable)
endif
ROOT=$(TIVA_ROOT)
$(info Done)
Simple enough! Unfortunately however, CodeLite insists in adding a TAB in front of each line, which means that my conditional statement does not work: as I understand it, tabs should not be used in front of conditionals. Is there any way around this?
I would use a custom makefile altogether, but in that case, how can I access all of the CodeLite specific variables (project path, project name, etc) that are created for me in the .mk that CodeLite autogenerates?
Thanks for any suggestions,
Fed
PreBuild/PostBuild steps and conditionals
-
- CodeLite Curious
- Posts: 4
- Joined: Sun Jan 31, 2016 2:36 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
- eranif
- CodeLite Plugin
- Posts: 6375
- Joined: Wed Feb 06, 2008 9:29 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: PreBuild/PostBuild steps and conditionals
The Pre/Post build page is meant for a "one line per command"
This is why TAB is placed infront of each line
This is why TAB is placed infront of each line
All CodeLite variables are translated into Makefile variables, if you look at the top of the PROJECT.mk file you will see the complete list. Here is an example of a sample makefile:federix wrote:I would use a custom makefile altogether, but in that case, how can I access all of the CodeLite specific variables (project path, project name, etc) that are created for me in the .mk that CodeLite autogenerates?
Code: Select all
ProjectName :=Frame
ConfigurationName :=Debug
WorkspacePath := "/home/eran/Desktop/wxCTest"
ProjectPath := "/home/eran/Desktop/wxCTest/Frame"
IntermediateDirectory :=./Debug
OutDir := $(IntermediateDirectory)
CurrentFileName :=
CurrentFilePath :=
CurrentFileFullPath :=
User :=Eran Ifrah
Date :=31/01/16
CodeLitePath :="/home/eran/.codelite"
LinkerName :=/usr/bin/g++
SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC
ObjectSuffix :=.o
DependSuffix :=.o.d
PreprocessSuffix :=.i
DebugSwitch :=-g
IncludeSwitch :=-I
LibrarySwitch :=-l
OutputSwitch :=-o
LibraryPathSwitch :=-L
PreprocessorSwitch :=-D
SourceSwitch :=-c
OutputFile :=$(IntermediateDirectory)/$(ProjectName)
Preprocessors :=
ObjectSwitch :=-o
ArchiveOutputSwitch :=
PreprocessOnlySwitch :=-E
ObjectsFileList :="Frame.txt"
PCHCompileFlags :=
MakeDirCommand :=mkdir -p
LinkOptions := $(shell wx-config --libs --debug)
IncludePath := $(IncludeSwitch). $(IncludeSwitch).
IncludePCH :=
RcIncludePath :=
Libs :=
ArLibs :=
LibPath := $(LibraryPathSwitch).
Make sure you have read the HOW TO POST thread
-
- CodeLite Curious
- Posts: 4
- Joined: Sun Jan 31, 2016 2:36 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: PreBuild/PostBuild steps and conditionals
Thanks, I was aware of that! However, my question was whether there is any way around it. From your answer, unfortunately, I gather that there is noteranif wrote:The Pre/Post build page is meant for a "one line per command"
This is why TAB is placed infront of each line
Thanks, I was aware of that too! In this case, my question was how to get those same variables if I want to use a custom makefile, rather than the one you have shown here, which is auto-generated. As far as I could see, CodeLite will not generate that file if you use custom makefiles, so do you happen to know whether I can get those variable declarations somewhere somehow in that case?eranif wrote:All CodeLite variables are translated into Makefile variables, if you look at the top of the PROJECT.mk file you will see the complete list. Here is an example of a sample makefile:federix wrote:I would use a custom makefile altogether, but in that case, how can I access all of the CodeLite specific variables (project path, project name, etc) that are created for me in the .mk that CodeLite autogenerates?
Code: Select all
ProjectName :=Frame ConfigurationName :=Debug WorkspacePath := "/home/eran/Desktop/wxCTest" ProjectPath := "/home/eran/Desktop/wxCTest/Frame" IntermediateDirectory :=./Debug OutDir := $(IntermediateDirectory) CurrentFileName := CurrentFilePath := CurrentFileFullPath := User :=Eran Ifrah Date :=31/01/16 CodeLitePath :="/home/eran/.codelite" LinkerName :=/usr/bin/g++ SharedObjectLinkerName :=/usr/bin/g++ -shared -fPIC ObjectSuffix :=.o DependSuffix :=.o.d PreprocessSuffix :=.i DebugSwitch :=-g IncludeSwitch :=-I LibrarySwitch :=-l OutputSwitch :=-o LibraryPathSwitch :=-L PreprocessorSwitch :=-D SourceSwitch :=-c OutputFile :=$(IntermediateDirectory)/$(ProjectName) Preprocessors := ObjectSwitch :=-o ArchiveOutputSwitch := PreprocessOnlySwitch :=-E ObjectsFileList :="Frame.txt" PCHCompileFlags := MakeDirCommand :=mkdir -p LinkOptions := $(shell wx-config --libs --debug) IncludePath := $(IncludeSwitch). $(IncludeSwitch). IncludePCH := RcIncludePath := Libs := ArLibs := LibPath := $(LibraryPathSwitch).
- eranif
- CodeLite Plugin
- Posts: 6375
- Joined: Wed Feb 06, 2008 9:29 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: PreBuild/PostBuild steps and conditionals
No, you can't get those variables when using a custom makefile.
You can submit a feature request with the following proposal:
Export workspace variables before build starts as an environment variables
Unless you have a different proposal
Thanks
Eran
You can submit a feature request with the following proposal:
Export workspace variables before build starts as an environment variables
Unless you have a different proposal
Thanks
Eran
Make sure you have read the HOW TO POST thread
-
- CodeLite Curious
- Posts: 4
- Joined: Sun Jan 31, 2016 2:36 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: PreBuild/PostBuild steps and conditionals
Of course, thank you! Another suggestion could be to properly de-indent conditionals when adding pre- and post-build customisations...
-
- CodeLite Curious
- Posts: 4
- Joined: Sun Jan 31, 2016 2:36 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: PreBuild/PostBuild steps and conditionals
By the way, if you don't mind directing me to the parts of the CodeLite code where my two proposed changes could be implemented, I don't mind having a go at it!
- eranif
- CodeLite Plugin
- Posts: 6375
- Joined: Wed Feb 06, 2008 9:29 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: PreBuild/PostBuild steps and conditionals
The bits that needs updated is at:
A more accurate location:
custombuildrequest.cpp:221
As you can see on that line, CodeLite allocates
EnvSetter object (this object applies the environment when allocated and restores it to what it was when it destroyed)
It accepts an "override map" where you can set additional environment variables
Eran
Code: Select all
CustomBuildRequest::Process(IManager* manager)
custombuildrequest.cpp:221
As you can see on that line, CodeLite allocates
EnvSetter object (this object applies the environment when allocated and restores it to what it was when it destroyed)
It accepts an "override map" where you can set additional environment variables
Eran
Make sure you have read the HOW TO POST thread