changeset 195:829457be9eea

Build system changes to support (in a big kludgy manner) icon and version information resource generation for Win32 binaries.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 17 Nov 2010 04:09:41 +0200
parents 0751e0fb7ba9
children edd5ce3e5399
files Makefile.gen Makefile.w32 nnchat.c
diffstat 3 files changed, 17 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile.gen	Wed Nov 17 04:08:51 2010 +0200
+++ b/Makefile.gen	Wed Nov 17 04:09:41 2010 +0200
@@ -1,3 +1,5 @@
+NN_VERSION=0.8.3
+
 #CFLAGS+=-g -W -Wall -O2 -DTH_NO_DEFAULTS
 CFLAGS+=-g -W -Wall -DTH_NO_DEFAULTS
 COMP=$(CC) $(CFLAGS)
@@ -18,8 +20,8 @@
 $(OBJPATH)%.o: %.c %.h
 	$(COMP) -c -o $@ $<
 
-$(NNCHAT_BIN): nnchat.c $(OBJPATH)libnnchat.o $(OBJPATH)th_util.o $(OBJPATH)th_string.o $(OBJPATH)th_args.o $(OBJPATH)th_config.o
-	$(COMP) -o $@ $+ $(LDFLAGS)
+$(NNCHAT_BIN): nnchat.c $(OBJPATH)libnnchat.o $(OBJPATH)th_util.o $(OBJPATH)th_string.o $(OBJPATH)th_args.o $(OBJPATH)th_config.o $(EXTRAOBJS)
+	$(COMP) -o $@ $+ $(LDFLAGS) -DNN_VERSION=\"$(NN_VERSION)\"
 
 #
 # Special targets
--- a/Makefile.w32	Wed Nov 17 04:08:51 2010 +0200
+++ b/Makefile.w32	Wed Nov 17 04:09:41 2010 +0200
@@ -1,9 +1,10 @@
 #
 # For win32 version cross-compilation with MinGW suite @ Linux
 #
+SDL=y
 
 # Set PATH to include MinGW cross compiler path FIRST!
-PATH=/usr/local/i386-mingw32/bin:/usr/bin:/bin
+PATH=/usr/local/i386-mingw32/bin:/usr/bin:/bin:/usr/local/bin
 
 # C-compiler, flags and linker flags
 CC=gcc
@@ -25,8 +26,18 @@
 BINPATH=./win32/
 #BINPATH=/misc/wine_c/
 NONBUILD=$(OBJPATH)
+EXTRAOBJS= resource.o
+ICON=resource.ico
 
 include Makefile.gen
 
 $(OBJPATH):
 	mkdir $@
+
+comma:= ,
+
+resource.rc: resource.rc.in $(ICON)
+	sed -e "s/@VERSION@/$(NN_VERSION)/g;s/@VERSION_COM@/$(subst .,$(comma),$(NN_VERSION))/g;s/@ICON@/$(ICON)/g;s#@EXE@#$(notdir $(NNCHAT_BIN))#g" < $< > $@
+
+resource.o: resource.rc
+	i386-mingw32-windres $< -O coff -o $@
--- a/nnchat.c	Wed Nov 17 04:08:51 2010 +0200
+++ b/nnchat.c	Wed Nov 17 04:09:41 2010 +0200
@@ -894,7 +894,7 @@
     memset(histBuf, 0, sizeof(histBuf));
     
     /* Initialize */
-    th_init("NNChat", "Newbie Nudes chat client", "0.8.3",
+    th_init("NNChat", "Newbie Nudes chat client", NN_VERSION,
         "Written and designed by Anonymous Finnish Guy (C) 2008-2010",
         "This software is freeware, use and distribute as you wish.");
     th_verbosityLevel = 0;