First off I would like to say that I am new to sublime text editor and I love it. I have no experience with JSON, however it does not seem difficult at all.
I am trying to write a build system that will call a bash script that will move a makefile into the directory that I am working and call that makefile, which will compile my c code with avr-gcc and then flash it to a connected microcontroller using avrdude.
I realize that sublime text 2 can only have one "cmd" object so I tried calling everything on one line from a terminal emulator and it worked exactly how I intended it to. The call was:
checkAVRmakefile.sh $PWD; make PROJECTNAME+=hello install
my script is in a directory on my $PATH environment variable and I pass it the directory that I am working in so it checks there for the makefile and if it isn't there it copies it from the directory that I have where I keep all of my makefiles. Then I call make and pass it the name I with the project to be called and the install flashes the avr microcontroller.
What I do with sublime is this:
{
"shell":true,
"cmd":[ "checkAVRmakefile.sh", "$file_path", ";" ,"make","PROJECTNAME+=$file_base_name","install"],
}
This only runs the bash script which puts the makefile in the directory but does not run make.
Does anyone see where I went wrong?
Any help is appreciated. I also asked a question similar to this on the sublime forums but no one has answered. Also I am on Ubuntu and am using ST2.
I found what my problem was. It was a combination of my bash script not handling spaces in my directory names and me not using the shell:true object corectly in the build system. So what works now is:
{
"shell":true,
"cmd":["check.sh $file_path && make PROJECTNAME+=$file_base_name install"]
}
It seems that with the shell:true object I don't need every input in the cmd list to be in quotes, just one long string.
(thanks to u/Scoo_ from reddit for suggesting the fix) Hope this helps some one else out
EDIT (17-3-2014): I have uploaded the files that I use for building my AVR projects to my git hub: https://github.com/Jesse-Millwood/AVR-Stuffs.git
So I've got this other installation of Python on my machine that I need for various purposes and I need to run a .bat or .cmd in my terminal to setup my environment variables before I use that flavor of Python. This needs to be done because otherwise it imports other modules of the same name from my default c:\Python27 python installation. I dug around the internet a bit and this is what I was able to come up with to get it to run from Sublime Text 2 when I hit ctrl+B (build).
I hope someone finds this useful. This is a custom buildfile that runs out of Sublime using my other flavor. You can create a new buildfile in Sublime by selecting Tools>Build System>New Build System and paste this into it with whatever mods you need.
{
"shell":true,
"cmd": ["C:\\GIT\\Folder1\\Folder1\\thebatch.cmd", "&;",
"python", "-u", "$file"],
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"working_dir": "C:\\GIT\\GBmapper\\AWSInterfaces\\DEM_Processing"
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With