make

make is the quintessential project building utility, now mostly buried inside fancy GUIs or replaced by trendier (and bloated) stuff such as ant. Since I use it so little that I tend to forget the basics, here are a couple of snippets:

Batch Conversion of Files in Two Steps:

# this assumes you have PNG files in the current directory
JPGS = $(shell ls *.png | sed 's/\(.*\.\)png/\1jpg/' | xargs echo)

%.jpeg: %.png
        /sw/bin/mogrify -format jpeg -resize 720x180! -quality 92 -sharpen 1 $<

%.jpg: %.jpeg
        mv $< `echo $< | sed 's/\(.*\.\)jpeg/\1jpg/'`

all: $(JPGS)