When developing in C language, if you make a Makefile, you want to make it automatically and execute it.
There seem to be various ways to monitor file changes, but if you have a Ruby environment, you can use guard-shell
to make it so easy.
I have put a set of sample files in here.
--It is assumed that the environment where Ruby and Rubygems can be installed and executed is in place. --Please prepare the source code and Makefile for making. If you just want to move it, please download the above sample.
$ gem install guard
$ gem install guard-shell
Move to the directory where you want to monitor the file, and then execute the following command to generate a file with a sample named Guardfile
.
$ guard init
Edit the Guardfile as follows. Change the part surrounded by `` to your favorite command.
Guardfile
guard :shell do
watch(/(.*)\.c/) {|m| `make && ./#{File.basename(m[0], ".c")}` }
end
Just hit the following command.
$ guard
When you want to modify the monitoring target or the execution command, you can modify the Guardfile and it will be reloaded automatically, so it is convenient that you do not have to end the guard
command in the middle.
-I tried using Guard-Kuroneko Diary
Recommended Posts