tags:

views:

301

answers:

2

I'm using GCC on Windows7 (using the TDM's build). I installed MSYS to be able to execute make and compile using makefiles. However, it is tedious to every time start up the MSYS bash shell, navigate to the directory of the project and run make.

What I want is to automate this process. I prefer to have a batch file in Windows, or something similar, from which I then invoke the MSYS bash. It should navigate to the directory the batch file resides in and call "make".

Is this possible? Can I send commands to MSYS bash from cmd (like navigation / invoking make)? Or can I let the MSYS bash run a "bash script", which sets the commands to be executed much like batch scripts?

Thank you.

PS: this is something similar as this question: http://stackoverflow.com/questions/2546757/executing-msys-from-cmd-exe-with-arguments

+2  A: 

Not an MSYS expert, but does something like this work for you:

rem Call this something like compile-project.bat
c:
cd \src\project
bash -c "make"
spong
Yes it does! Thanks a bunch :)
Daevius
A: 

You don't have to use bash to execute make, or any of the other MSYS programs. If you put the MSYS bin directory on your path, you can execute them from a Windows command shell. Alternatively, the bash shell has an enormously powerful scripting language built in. But I'm not clear if that's what you are asking about - you should clarify your question with an actual example of what you want to do, spelling out the steps you want automated.

My own setup is to have a Windows Explorer context menu called "Bash here" which opens a bash shell in the directory I select. This is done via the following registry entries:

[HKEY_CLASSES_ROOT\Directory\shell\mybash]
@="Bash Here"

[HKEY_CLASSES_ROOT\Directory\shell\mybash\command]
@="cmd /c c:\\bash.cmd %1"

And the following bash.cmd file in c:\:

@echo off
title bash
cd %1%
bash

Note that the MSYS bin directory is on my path. And of course, any registry hacking is at your own risk.

anon