# Makefile for the Gallery images on the Sketch homepage # # All the gallery files are generated from pairs of sk-files and readme # files. The rendering process involves relatively large intermediate # PPM files which are not automatically removed. You may want to do that # by hand occasionally. # Directory where the .sk and .readme files can be found SRCDIR = src # # Tools Configuration # # program to convert .sk files to ppm SK2PPM = sk2ppm # program to convert ppm to jpeg CJPEG = cjpeg # program to scale a ppm file PNMSCALE = pnmscale # The Gallery images. These are the basenames of the .sk and .readme # files in $(SRCDIR). They're grouped by artist with MISC as the catch # all. APASCUAL = coco nana portrait SimcaSP moniteur Affiche4 Distribution Simca8 WOJTKIEWICZ = bathead fruitscene kapelusznica HARA = trem01 raposa TATANE = avion cartes compo helicoptere photo pomme vache BIDDIER = southern_bell southern_cop smile_n_jack under_da_sea THILBRICHT = waratah STOVICEK = stay_with_us anna04 MISC = bsddaemon penguin sun # list of all drawing basenames to process DRAWINGS = $(APASCUAL) $(WOJTKIEWICZ) $(HARA) $(TATANE) $(BIDDIER) \ $(THILBRICHT) $(STOVICEK) $(MISC) # list of all the tarfiles TARFILES = $(DRAWINGS:%=%.tar.gz) # list of all the jpg images IMAGES = $(DRAWINGS:%=%.jpg) # Resolution of the rendered .sk files in ppi FULL_RESOLUTION = 144 # number of gradient steps when rendering GRADIENT_STEPS = 100 # Command to scale the rendered PPM file to a more suitable size for the # full image FULL_SCALE = $(PNMSCALE) 0.4 # scale factor for the preview thumbnail PREVIEW_FACTOR = -height 150 # cjpeg options for the full-scale images LARGE_JPEG_OPTS = -quality 80 # Some images need some special options or extra processing. To # facilitate this, the makefile uses variables with the form # _sk2ppmopt and _previewfilter. is the # basename of the sk-file being processed. # # The *_sk2ppmopt variables control the rendering of sk-files to ppm. # Normally, the bounding box of an image determines the region of the # drawing that is rendered. If the *_sk2ppmopt variable's value is page, # then the page is used as the region. # # The *_previewfilter are an additional filtering step for the generated # previews. Their value should be a command that accepts a PPM file on # stdin and writes a PPM file to stdout. The command should end in a # pipe symbol. The output is the input to the cjpeg program which writes # the preview image. coco_sk2ppmopt = page moniteur_previewfilter = pnmcrop -black | coco_previewfilter = pnmcrop -black | bathead_previewfilter = pnmcrop -black | # the intermediate ppm files should not be removed automatically because # they're relatively expensive to create. .PRECIOUS: %.ppm all: $(IMAGES) $(TARFILES) %.jpg: %.ppm $(PNMSCALE) $(PREVIEW_FACTOR) $< | $($*_previewfilter) \ $(CJPEG) > small$@ \ || rm -f small$@ $(FULL_SCALE) $< | $(CJPEG) $(LARGE_JPEG_OPTS) > $@ || rm -f $@ %.ppm: $(SRCDIR)/%.sk $(SK2PPM) --resolution=$(FULL_RESOLUTION) \ --gradient-steps=$(GRADIENT_STEPS) \ $(shell if [ "$($*_sk2ppmopt)" == "page" ]; \ then echo ''; else echo '--bbox'; fi) \ $< $@ %.tar.gz: $(SRCDIR)/%.sk $(SRCDIR)/%.readme tar cvzf $@ $^ clean: rm -f $(IMAGES) $(IMAGES:%=small%) $(TARFILES) clobber: clean rm -f *.ppm