icon: Construct .exe files to hold windows icons for file associations
authorKeith Packard <keithp@keithp.com>
Wed, 18 Jun 2014 09:15:04 +0000 (02:15 -0700)
committerKeith Packard <keithp@keithp.com>
Wed, 18 Jun 2014 21:18:38 +0000 (14:18 -0700)
It appears that creating an executable with an icon resource is the
only way to display icons for files. Fortunately, that's not all that
hard.

Signed-off-by: Keith Packard <keithp@keithp.com>
Makefile.am
icon/.gitignore
icon/Makefile.am
icon/altus-metrum.rc [new file with mode: 0644]
icon/micro-peak.rc [new file with mode: 0644]
icon/telegps.rc [new file with mode: 0644]
icon/windows-stub.c [new file with mode: 0644]

index 15d2c82..2f8a5ee 100644 (file)
@@ -18,6 +18,7 @@ fat:
        cd libaltos && $(MAKE) all
        cd altoslib && $(MAKE) all
        cd altosuilib && $(MAKE) all
+       cd icon && $(MAKE) fat
        cd altosui && $(MAKE) fat
        cd micropeak && $(MAKE) fat
        cd telegps && $(MAKE) fat
index e89555d..40cf2f3 100644 (file)
@@ -4,3 +4,4 @@ telegps-*.png
 *.ico
 *.icns
 *.build
+*.exe
index b1c00f4..61a1691 100644 (file)
@@ -34,7 +34,7 @@ res:
 all-local: $(ICO_FILES) $(ICNS_FILES)
 
 clean-local:
-       $(RM) altus-metrum-*.png telegps-*.png micropeak-*.png *.build *.ico *.icns
+       $(RM) altus-metrum-*.png telegps-*.png micropeak-*.png *.build *.ico *.icns *.o *.exe
 
 $(AM_FILES): altusmetrum.build
 
@@ -71,3 +71,20 @@ TeleGPS.icns: $(MAC_TG_FILES)
 
 MicroPeak.icns: $(MAC_MP_FILES)
        png2icns $@ $(MAC_MP_FILES)
+
+MINGCC32=i686-w64-mingw32-gcc
+MINGWINDRES=i686-w64-mingw32-windres
+
+SUFFIXES=.rc .exe
+
+fat: all micro-peak.exe altus-metrum.exe telegps.exe
+
+altus-metrum.o: altus-metrum.ico
+micro-peak.o: micro-peak.ico
+telegps.o: telegps.ico
+
+.rc.o:
+       $(MINGWINDRES) $*.rc $@
+
+.o.exe:
+       $(MINGCC32) -o $@ windows-stub.c $*.o
diff --git a/icon/altus-metrum.rc b/icon/altus-metrum.rc
new file mode 100644 (file)
index 0000000..bbd0360
--- /dev/null
@@ -0,0 +1 @@
+101    ICON    "altus-metrum.ico"
diff --git a/icon/micro-peak.rc b/icon/micro-peak.rc
new file mode 100644 (file)
index 0000000..4efe777
--- /dev/null
@@ -0,0 +1 @@
+101    ICON    "micro-peak.ico"
diff --git a/icon/telegps.rc b/icon/telegps.rc
new file mode 100644 (file)
index 0000000..7f5957f
--- /dev/null
@@ -0,0 +1 @@
+101    ICON    "telegps.ico"
diff --git a/icon/windows-stub.c b/icon/windows-stub.c
new file mode 100644 (file)
index 0000000..8df3e0a
--- /dev/null
@@ -0,0 +1,2 @@
+__stdcall
+WinMain(int a, int b, int c, int d) { return 0; }