1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-10 01:48:00 +00:00
putty-source/icons/Makefile
Simon Tatham 450a995f05 Use NetPBM .pam as an intermediate format in the icon makefile.
mkicon.py now outputs .pam by hand, rather than using ImageMagick to
go straight to .png. For most purposes the main makefile then uses
ImageMagick anyway, to convert those .pams straight to the .pngs that
the rest of the scripts were expecting. But one script that doesn't do
that is macicon.py, which builds the MacOS .icns file by directly
reading those .pam files back in.

This allows the 'make icns' target in the icons directory to build
from a clean checkout on vanilla MacOS, without requiring a user to
install ImageMagick or any other non-core Python image handling
module.

(I could probably take this change at least a little bit further. I
don't see any reason why icon.pl - generating the Windows .ico files -
couldn't read the .pam files directly, about as easily as macicon.py
did, if anyone had a use case for building the Windows icons in the
presence of Python and Perl but in the absence of ImageMagick. But the
.png files are directly useful outputs for Unix, so _some_ PNG-writing
will have to remain here.)
2016-03-23 06:58:56 +00:00

112 lines
3.9 KiB
Makefile

# Makefile for the PuTTY icon suite.
ICONS = putty puttycfg puttygen pscp pageant pterm ptermcfg puttyins
SIZES = 16 32 48 128
MODE = # override to -it on command line for opaque testing
PAMS = $(foreach I,$(ICONS),$(foreach S,$(SIZES),$(I)-$(S).pam))
MONOPAMS = $(foreach I,$(ICONS),$(foreach S,$(SIZES),$(I)-$(S)-mono.pam))
TRUEPAMS = $(foreach I,$(ICONS),$(foreach S,$(SIZES),$(I)-$(S)-true.pam))
PNGS = $(patsubst %.pam,%.png,$(PAMS))
MONOPNGS = $(patsubst %.pam,%.png,$(MONOPAMS))
TRUEPNGS = $(patsubst %.pam,%.png,$(TRUEPAMS))
ICOS = putty.ico puttygen.ico pscp.ico pageant.ico pageants.ico puttycfg.ico \
puttyins.ico
ICNS = PuTTY.icns
CICONS = xpmputty.c xpmpucfg.c xpmpterm.c xpmptcfg.c
base: icos cicons
all: pngs monopngs base icns # truepngs currently disabled by default
pngs: $(PNGS)
monopngs: $(MONOPNGS)
truepngs: $(TRUEPNGS)
icos: $(ICOS)
icns: $(ICNS)
cicons: $(CICONS)
install: icos cicons
cp $(ICOS) ../windows
cp $(CICONS) ../unix
$(PAMS): %.pam: mkicon.py
./mkicon.py $(MODE) $(join $(subst -, ,$(basename $@)),_icon) $@
$(PNGS) $(MONOPNGS) $(TRUEPNGS): %.png: %.pam
convert $< $@
$(MONOPAMS): %.pam: mkicon.py
./mkicon.py -2 $(MODE) $(join $(subst -, ,$(subst -mono,,$(basename $@))),_icon) $@
$(TRUEPAMS): %.pam: mkicon.py
./mkicon.py -T $(MODE) $(join $(subst -, ,$(subst -true,,$(basename $@))),_icon) $@
putty.ico: putty-16.png putty-32.png putty-48.png \
putty-16-mono.png putty-32-mono.png putty-48-mono.png
./icon.pl -4 $(filter-out %-mono.png, $^) -1 $(filter %-mono.png, $^) > $@
puttycfg.ico: puttycfg-16.png puttycfg-32.png puttycfg-48.png \
puttycfg-16-mono.png puttycfg-32-mono.png puttycfg-48-mono.png
./icon.pl -4 $(filter-out %-mono.png, $^) -1 $(filter %-mono.png, $^) > $@
puttygen.ico: puttygen-16.png puttygen-32.png puttygen-48.png \
puttygen-16-mono.png puttygen-32-mono.png puttygen-48-mono.png
./icon.pl -4 $(filter-out %-mono.png, $^) -1 $(filter %-mono.png, $^) > $@
pageant.ico: pageant-16.png pageant-32.png pageant-48.png \
pageant-16-mono.png pageant-32-mono.png pageant-48-mono.png
./icon.pl -4 $(filter-out %-mono.png, $^) -1 $(filter %-mono.png, $^) > $@
pageants.ico: pageant-16.png pageant-16-mono.png
./icon.pl -4 $(filter-out %-mono.png, $^) -1 $(filter %-mono.png, $^) > $@
pscp.ico: pscp-16.png pscp-32.png pscp-48.png \
pscp-16-mono.png pscp-32-mono.png pscp-48-mono.png
./icon.pl -4 $(filter-out %-mono.png, $^) -1 $(filter %-mono.png, $^) > $@
# Because the installer icon makes heavy use of brown when drawing
# the cardboard box, it's worth having 8-bit versions of it in
# addition to the 4- and 1-bit ones.
puttyins.ico: puttyins-16.png puttyins-32.png puttyins-48.png \
puttyins-16-mono.png puttyins-32-mono.png \
puttyins-48-mono.png \
puttyins-16-true.png puttyins-32-true.png \
puttyins-48-true.png
./icon.pl -8 $(filter %-true.png, $^) \
-4 $(filter-out %-true.png, $(filter-out %-mono.png, $^)) \
-1 $(filter %-mono.png, $^) > $@
# Icon for the website. (This isn't linked into "make all".)
website.ico: putty-16.png
./icon.pl -4 $^ >$@
xpmputty.c: putty-16.png putty-32.png putty-48.png
./cicon.pl main_icon $^ > $@
xpmpucfg.c: puttycfg-16.png puttycfg-32.png puttycfg-48.png
./cicon.pl cfg_icon $^ > $@
xpmpterm.c: pterm-16.png pterm-32.png pterm-48.png
./cicon.pl main_icon $^ > $@
xpmptcfg.c: ptermcfg-16.png ptermcfg-32.png ptermcfg-48.png
./cicon.pl cfg_icon $^ > $@
PuTTY.icns: putty-16-mono.pam putty-16.pam \
putty-32-mono.pam putty-32.pam \
putty-48-mono.pam putty-48.pam \
putty-128.pam
./macicon.py mono:putty-16-mono.pam colour:putty-16.pam \
mono:putty-32-mono.pam colour:putty-32.pam \
mono:putty-48-mono.pam colour:putty-48.pam \
colour:putty-128.pam \
output:$@
clean:
rm -f *.pam *.png *.ico *.icns *.c