It's convenient to use Makefile to manage your project, this is obvious for me. However, sometimes I want to execute shell in Makefile. Then here is an example like this:
GCC = gcc
G++ = g++
RM = rm
BINS = bmp2raw
all: $(BINS)
%:%.c
$(GCC) -o $@ -g $<
convert:
for i in $(shell ls *.bmp);do (./bmp2raw $$i $${i%.*}); done
clean:
$(RM) $(BINS)
This is a Makefile to manage a project converting .bmp file to .raw file using C. Besides it can also convert all the .bmp files in the current directory to .raw files without changing the name of the files (just the extension). Therefore, typing
#make convert
will get the fruit. :)