Beyond Makefiles: GNU make is For More Than Just Compiling - page 2
make and LaTex
Another possible use is to check a Perl script (or Apache config file, or...) for syntax errors:
all: checkperl checkperl: myscript.pl perl -Mstrict -wc $<This uses the 'strict' module to check your script, with warnings turned on. However, with this version, you'd have to edit the makefile to add a new dependency every time you add a new Perl file. To check all Perl files in that directory, you can use xargs:
checkperl: *.pl ls $? | xargs -L1 perl -Mstrict -wcThe implicit variable $? concatenates the names of all the source files (here everything ending .pl) with a space between them. The command then runs ls to pass these names into xargs, which then runs the perl checking command on each. (Note the -L1 option; without this, the command will run only on the first file.)
Other possibilities include emailing changed files to yourself for an informal backup. The variable $? lists only the files which have changed since the last time the target was generated, separated by a space. Remember that if you use a phony target (as with checkperl above), this will always list all files.
make is far more versatile and productive than you might have thought from only encountering it when building the odd piece of software from source. It's well worth experimenting with for any repetitive file-processing task you find yourself doing. Check out the GNU make manual for extensive further information, in particular the sections on variables and implicit rules.
Sponsored by BlackBerry
BlackBerry® Enterprise Server Express enables businesses of any size to quickly and easily get started with the BlackBerry solution. It provides advanced BlackBerry smartphone features with no additional software or user license fees, and works with any Internet-enabled BlackBerry data plan or a BlackBerry enterprise data plan. Download now!