aboutsummaryrefslogtreecommitdiff
path: root/icons/Makefile
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2021-03-29 18:23:11 +0100
committerSimon Tatham <anakin@pobox.com>2021-03-29 19:02:23 +0100
commitcc7f5503dc8f4ddf468e080a73028c83d1196e83 (patch)
tree10e17f66ff5a417f8ce9cf23d0f926380c2a6957 /icons/Makefile
parent72b28b5e71b05e7775d14b1e3e2e00b82af4d87a (diff)
downloadpuzzles-cc7f5503dc8f4ddf468e080a73028c83d1196e83.zip
puzzles-cc7f5503dc8f4ddf468e080a73028c83d1196e83.tar.gz
puzzles-cc7f5503dc8f4ddf468e080a73028c83d1196e83.tar.bz2
puzzles-cc7f5503dc8f4ddf468e080a73028c83d1196e83.tar.xz
Migrate to a CMake-based build system.
This completely removes the old system of mkfiles.pl + Recipe + .R files that I used to manage the various per-platform makefiles and other build scripts in this code base. In its place is a CMakeLists.txt setup, which is still able to compile for Linux, Windows, MacOS, NestedVM and Emscripten. The main reason for doing this is because mkfiles.pl was a horrible pile of unmaintainable cruft. It was hard to keep up to date (e.g. didn't reliably support the latest Visual Studio project files); it was so specific to me that nobody else could maintain it (or was even interested in trying, and who can blame them?), and it wasn't even easy to _use_ if you weren't me. And it didn't even produce very good makefiles. In fact I've been wanting to hurl mkfiles.pl in the bin for years, but was blocked by CMake not quite being able to support my clang-cl based system for cross-compiling for Windows on Linux. But CMake 3.20 was released this month and fixes the last bug in that area (it had to do with preprocessing of .rc files), so now I'm unblocked! CMake is not perfect, but it's better at mkfiles.pl's job than mkfiles.pl was, and it has the great advantage that lots of other people already know about it. Other advantages of the CMake system: - Easier to build with. At least for the big three platforms, it's possible to write down a list of build commands that's actually the same everywhere ("cmake ." followed by "cmake --build ."). There's endless scope for making your end-user cmake commands more fancy than that, for various advantages, but very few people _have_ to. - Less effort required to add a new puzzle. You just add a puzzle() statement to the top-level CMakeLists.txt, instead of needing to remember eight separate fiddly things to put in the .R file. (Look at the reduction in CHECKLST.txt!) - The 'unfinished' subdirectory is now _built_ unconditionally, even if the things in it don't go into the 'make install' target. So they won't bit-rot in future. - Unix build: unified the old icons makefile with the main build, so that each puzzle builds without an icon, runs to build its icon, then relinks with it. - Windows build: far easier to switch back and forth between debug and release than with the old makefiles. - MacOS build: CMake has its own .dmg generator, which is surely better thought out than my ten-line bodge. - net reduction in the number of lines of code in the code base. In fact, that's still true _even_ if you don't count the deletion of mkfiles.pl itself - that script didn't even have the virtue of allowing everything else to be done exceptionally concisely.
Diffstat (limited to 'icons/Makefile')
-rw-r--r--icons/Makefile162
1 files changed, 0 insertions, 162 deletions
diff --git a/icons/Makefile b/icons/Makefile
deleted file mode 100644
index 6465806..0000000
--- a/icons/Makefile
+++ /dev/null
@@ -1,162 +0,0 @@
-# Makefile for Puzzles icons.
-
-PUZZLES = blackbox bridges cube dominosa fifteen filling flip flood \
- galaxies guess inertia keen lightup loopy magnets map mines \
- net netslide palisade pattern pearl pegs range rect \
- samegame signpost singles sixteen slant solo tents towers \
- twiddle tracks undead unequal unruly untangle
-
-BASE = $(patsubst %,%-base.png,$(PUZZLES))
-WEB = $(patsubst %,%-web.png,$(PUZZLES))
-
-IBASE = $(patsubst %,%-ibase.png,$(PUZZLES))
-IBASE4 = $(patsubst %,%-ibase4.png,$(PUZZLES))
-P96D24 = $(patsubst %,%-96d24.png,$(PUZZLES))
-P96D8 = $(patsubst %,%-96d8.png,$(PUZZLES))
-P96D4 = $(patsubst %,%-96d4.png,$(PUZZLES))
-P48D24 = $(patsubst %,%-48d24.png,$(PUZZLES))
-P48D8 = $(patsubst %,%-48d8.png,$(PUZZLES))
-P48D4 = $(patsubst %,%-48d4.png,$(PUZZLES))
-P32D24 = $(patsubst %,%-32d24.png,$(PUZZLES))
-P32D8 = $(patsubst %,%-32d8.png,$(PUZZLES))
-P32D4 = $(patsubst %,%-32d4.png,$(PUZZLES))
-P16D24 = $(patsubst %,%-16d24.png,$(PUZZLES))
-P16D8 = $(patsubst %,%-16d8.png,$(PUZZLES))
-P16D4 = $(patsubst %,%-16d4.png,$(PUZZLES))
-ICONS = $(patsubst %,%.ico,$(PUZZLES))
-CICONS = $(patsubst %,%-icon.c,$(PUZZLES))
-RC = $(patsubst %,%.rc,$(PUZZLES))
-
-BIN = ../
-PIC = ./
-
-# Work around newer ImageMagick unilaterally distorting colours when
-# converting to PNG.
-CSP = -set colorspace RGB
-
-base: $(BASE)
-web: $(WEB)
-pngicons: $(P96D24) $(P48D24) $(P32D24) $(P16D24)
-winicons: $(ICONS) $(RC)
-gtkicons: $(CICONS)
-all: base web pngicons winicons gtkicons
-
-# Build the base puzzle screenshots from which all the other images
-# are derived. Some of them involve showing a move animation
-# part-way through.
-fifteen-base.png : override REDO=0.3
-flip-base.png : override REDO=0.3
-netslide-base.png : override REDO=0.3
-sixteen-base.png : override REDO=0.3
-twiddle-base.png : override REDO=0.3
-$(BASE): %-base.png: $(BIN)% $(PIC)%.sav
- $(PIC)screenshot.sh $(BIN)$* $(PIC)$*.sav $@ $(REDO)
-
-# Build the screenshots for the web, by scaling the original base
-# images to a uniform size.
-$(WEB): %-web.png: %-base.png
- $(PIC)square.pl 150 5 $^ $@
-
-# Build the base _icon_ images, by careful cropping of the base
-# images: icons are very small so it's often necessary to zoom in
-# on a smaller portion of the screenshot.
-blackbox-ibase.png : override CROP=352x352 144x144+0+208
-bridges-ibase.png : override CROP=264x264 107x107+157+157
-dominosa-ibase.png : override CROP=304x272 152x152+152+0
-fifteen-ibase.png : override CROP=240x240 120x120+0+120
-filling-ibase.png : override CROP=256x256 133x133+14+78
-flip-ibase.png : override CROP=288x288 145x145+120+72
-galaxies-ibase.png : override CROP=288x288 165x165+0+0
-guess-ibase.png : override CROP=263x420 178x178+75+17
-inertia-ibase.png : override CROP=321x321 128x128+193+0
-keen-ibase.png : override CROP=288x288 96x96+24+120
-lightup-ibase.png : override CROP=256x256 112x112+144+0
-loopy-ibase.png : override CROP=257x257 113x113+0+0
-magnets-ibase.png : override CROP=264x232 96x96+36+100
-mines-ibase.png : override CROP=240x240 110x110+130+130
-net-ibase.png : override CROP=193x193 113x113+0+80
-netslide-ibase.png : override CROP=289x289 144x144+0+0
-palisade-ibase.png : override CROP=288x288 192x192+0+0
-pattern-ibase.png : override CROP=384x384 223x223+0+0
-pearl-ibase.png : override CROP=216x216 94x94+108+15
-pegs-ibase.png : override CROP=263x263 147x147+116+0
-range-ibase.png : override CROP=256x256 98x98+111+15
-rect-ibase.png : override CROP=205x205 115x115+90+0
-signpost-ibase.png : override CROP=240x240 98x98+23+23
-singles-ibase.png : override CROP=224x224 98x98+15+15
-sixteen-ibase.png : override CROP=288x288 144x144+144+144
-slant-ibase.png : override CROP=321x321 160x160+160+160
-solo-ibase.png : override CROP=481x481 145x145+24+24
-tents-ibase.png : override CROP=320x320 165x165+142+0
-towers-ibase.png : override CROP=300x300 102x102+151+6
-tracks-ibase.png : override CROP=246x246 118x118+6+6
-twiddle-ibase.png : override CROP=192x192 102x102+69+21
-undead-ibase.png : override CROP=416x480 192x192+16+80
-unequal-ibase.png : override CROP=208x208 104x104+104+104
-untangle-ibase.png : override CROP=320x320 164x164+3+116
-$(IBASE): %-ibase.png: %-base.png
- $(PIC)crop.sh $^ $@ $(CROP)
-
-# Convert the full-size icon images to 4-bit colour, because that
-# seems to work better than reducing it in 24 bits and then
-# dithering.
-$(IBASE4): %-ibase4.png: %-ibase.png
- convert -colors 16 +dither $(CSP) -map $(PIC)win16pal.xpm $^ $@
-
-# Build the 24-bit PNGs for the icons, at four sizes.
-$(P96D24): %-96d24.png: %-ibase.png
- $(PIC)square.pl 96 4 $^ $@
-$(P48D24): %-48d24.png: %-ibase.png
- $(PIC)square.pl 48 4 $^ $@
-$(P32D24): %-32d24.png: %-ibase.png
- $(PIC)square.pl 32 2 $^ $@
-$(P16D24): %-16d24.png: %-ibase.png
- $(PIC)square.pl 16 1 $^ $@
-
-# The 8-bit icon PNGs are just custom-paletted quantisations of the
-# 24-bit ones.
-$(P96D8) $(P48D8) $(P32D8) $(P16D8): %d8.png: %d24.png
- convert -colors 256 $^ $@
-
-# But the depth-4 images work better if we re-shrink from the
-# ibase4 versions of the images, and then normalise the colours
-# again afterwards. (They're still not very good, but my hope is
-# that on most modern Windows machines this won't matter too
-# much...)
-$(P96D4): %-96d4.png: %-ibase4.png
- $(PIC)square.pl 96 1 $^ $@-tmp2.png
- convert -colors 16 $(CSP) -map $(PIC)win16pal.xpm $@-tmp2.png $@
- rm -f $@-tmp2.png
-$(P48D4): %-48d4.png: %-ibase4.png
- $(PIC)square.pl 48 1 $^ $@-tmp2.png
- convert -colors 16 $(CSP) -map $(PIC)win16pal.xpm $@-tmp2.png $@
- rm -f $@-tmp2.png
-$(P32D4): %-32d4.png: %-ibase.png
- $(PIC)square.pl 32 1 $^ $@-tmp2.png
- convert -colors 16 $(CSP) -map $(PIC)win16pal.xpm $@-tmp2.png $@
- rm -f $@-tmp2.png
-$(P16D4): %-16d4.png: %-ibase.png
- $(PIC)square.pl 16 1 $^ $@-tmp2.png
- convert -colors 16 $(CSP) -map $(PIC)win16pal.xpm $@-tmp2.png $@
- rm -f $@-tmp2.png
-
-# Build the actual Windows icons themselves, by feeding all those
-# PNGs to my icon builder script.
-$(ICONS): %.ico: %-48d24.png %-48d8.png %-48d4.png \
- %-32d24.png %-32d8.png %-32d4.png \
- %-16d24.png %-16d8.png %-16d4.png
- $(PIC)icon.pl -24 $*-48d24.png $*-32d24.png $*-16d24.png \
- -8 $*-48d8.png $*-32d8.png $*-16d8.png \
- -4 $*-48d4.png $*-32d4.png $*-16d4.png > $@
-
-# Build the .RC files which bind the icons into the applications.
-$(RC): %.rc:
- echo '#include "puzzles.rc2"' > $@
- echo '200 ICON "$*.ico"' >> $@
-
-# Build the GTK icon source files.
-$(CICONS): %-icon.c: %-16d24.png %-32d24.png %-48d24.png %-96d24.png
- $(PIC)cicon.pl $^ > $@
-
-clean:
- rm -f *.png *.ico *.rc *-icon.c