# Makefile for a generic version of the logo # Last edited on 2010-03-07 17:48:13 by stolfilocal # This file is designed to be included by Makefiles in # the subdirectory of a apecific version of the logo. ###################################################################### # For sub-make - caller must define # ${PREFIX} = prefix for all file names (e.g. "ic-logo") # ${VARSIZES} = list of pairs {VAR}:{SIZE}:{BGCOLOR} # where {VAR} is an image variant, {SIZE} is a width in pixels, # and {BGCOLOR} is a background color value in hexadecimal RGB, # e.g. "fancy:0800:FFFFFF plain:0800:000000 plain:0400:8FFFFF". # ${ACTIONS} = which actions to perform (clean, build-eps, show-eps, etc.) ifneq "/${PREFIX}" "/" ifneq "/${VARSIZES}" "/" ifneq "/${ACTIONS}" "/" # Actions to perform for each variant: ACTIONS_SINGLE := ${addsuffix -single,${ACTIONS}} .PHONY: all all: @-echo "ACTIONS_SINGLE = ${ACTIONS_SINGLE}" for vs in ${VARSIZES} ; do \ ${MAKE} PREFIX=${PREFIX} VARSIZE=$$vs ${ACTIONS_SINGLE} dummy ; \ done # Dummy action # This is useful because "make" with no action makes "all" # and this leads to infinite recursion, with disastrous results. dummy: @-echo "++++++++++++++++++++++++++++++++++++++++++++++++++" ###################################################################### # For sub-make - caller must define also ${VAR} ${SIZE} VARSIZE := ifneq "/${VARSIZE}" "/" ARG_FIELDS := ${subst :, ,${VARSIZE}} VAR := ${word 1,${ARG_FIELDS}} SIZE := ${word 2,${ARG_FIELDS}} BGCOLOR := ${word 3,${ARG_FIELDS}} .PHONY: clean-single build-eps-single show-eps-single PNG_FILE := ${PREFIX}-${VAR}.png TEMP_PNG_FILE := /tmp/${PREFIX}-${VAR}.png EPS_FILE := ${PREFIX}-${VAR}-${SIZE}.eps # PSVIEW := ghostview PSVIEW := gv debug-single: @-echo "PREFIX := ${PREFIX}" @-echo "VAR := ${VAR}" @-echo "SIZE := ${SIZE}" build-eps-single: ${EPS_FILE} ${EPS_FILE}: ${PNG_FILE} convert \ -size ${SIZE}x${SIZE} xc:'#${BGCOLOR}00' \ \( ${PNG_FILE} -resize '${SIZE}x' \) \ -compose SrcOver \ -composite ${TEMP_PNG_FILE} -display ${TEMP_PNG_FILE} convert \ ${TEMP_PNG_FILE} \ PPM:- \ | pamdepth 255 \ | pnmtopsx \ -rle \ -noturn \ -scale '0.25' \ > ${EPS_FILE} rm ${TEMP_PNG_FILE} ls -l ${EPS_FILE} show-eps-single: ${EPS_FILE} -${PSVIEW} ${EPS_FILE} JPG_FILE := ${PREFIX}-${VAR}-${SIZE}.jpg build-jpg-single: ${JPG_FILE} ${JPG_FILE}: ${PNG_FILE} convert \ -page +0+0 \( ${PNG_FILE} -resize '${SIZE}x' \) \ -size ${SIZE}x${SIZE} xc:'#FFFFFF00' \ -quality 98 \ -flatten ${JPG_FILE} ls -l ${JPG_FILE} show-jpg-single: ${JPG_FILE} -display ${JPG_FILE} clean-single: /bin/rm -f '${EPS_FILE}' '${JPG_FILE}' '${TEMP_PNG_FILE}' endif # End ${VARSIZE} section ###################################################################### endif endif endif # End section ${PREFIX} ${VARSIZES} ${ACTIONS} ######################################################################