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.
Solid state disks (SSDs) made a splash in consumer technology, and now the technology has its eyes on the enterprise storage market. Download this eBook to see what SSDs can do for your infrastructure and review the pros and cons of this potentially game-changing storage technology.
- 1Linux Top 3: GNOME 3.12 and New Betas for Ubuntu 14.04 and OpenMandriva Lx 2014.0
- 2Linux Top 3: Linus Lashes out, Linux 3.14 Gets PIE and Ubuntu One is Done.
- 3Linux Top 3: Ubuntu 14.04, Debian Gives Squeeze More Life and Red Hat Goes Atomic
- 4Linux Top 3: CoreOS, Oracle Enterprise Linux 7 and Ubuntu 14.10
- 5Linux Top 3: Debian Dumps SPARC, Ubuntu Takes Over Linux 3.13 and the Core Infrastructure Initiative