Created
October 6, 2012 04:43
-
-
Save CapnKernel/3843897 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CONVERT=echo convert | |
CONVERT_FLAGS=-resize 60% -quality 80 | |
# Get a list of all .jpg and .JPG files, except for ones with '-resize' in the name | |
IN_FILES:=$(shell find -iname '*.jpg' | grep -v -- "-resize") | |
$(info IN_FILES=$(IN_FILES)) | |
# From that list, generate a list of output filenames. | |
# We do this in two lines, one for .jpg, and one for .JPG | |
OUT_FILES_tmp:=$(patsubst %.jpg,%-resize.jpg,$(IN_FILES)) | |
OUT_FILES:=$(patsubst %.JPG,%-resize.JPG,$(OUT_FILES_tmp)) | |
$(info OUT_FILES=$(OUT_FILES)) | |
all: $(OUT_FILES) | |
%-resize.jpg: %.jpg | |
$(CONVERT) $(CONVERT_FLAGS) $< $@ | |
%-resize.JPG: %.JPG | |
$(CONVERT) $(CONVERT_FLAGS) $< $@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
foo.o: foo.c
gcc -o foo.o -c foo.c