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 15d2c82da0c1263f4a6cc68e120b08efd090b086..2f8a5ee182d1e63c5e5da951cacf73f3a702c636 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 e89555dee5d4001ebeb60d607bc2e4f0b59da69c..40cf2f3e2824186a4a2682092e654ec903d7a227 100644 (file)
@@ -4,3 +4,4 @@ telegps-*.png
 *.ico
 *.icns
 *.build
+*.exe
index b1c00f4b4e50415ee3b466d431f1ef8f6a05226e..61a169141d6127cb1eaafa7a56e81dc37903df22 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; }