$OpenBSD: patch-Makefile,v 1.3 2012/05/24 08:23:02 landry Exp $
- only use gtk-2 through pkg-config
- dont use -Werror/-O2
- fix version detection
- install binaries under bin as puzzle-$i
- generate desktop files/install icons
--- Makefile.orig	Wed May 23 02:35:49 2012
+++ Makefile	Wed May 23 17:33:42 2012
@@ -11,10 +11,9 @@ CC := $(TOOLPATH)$(CC)
 # building with GTK 1.2, or you can set it to `pkg-config gtk+-2.0'
 # if you want to enforce 2.0. The default is to try 2.0 and fall back
 # to 1.2 if it isn't found.
-GTK_CONFIG = sh -c 'pkg-config gtk+-2.0 $$0 2>/dev/null || gtk-config $$0'
+GTK_CONFIG = pkg-config gtk+-2.0
 
-CFLAGS := -O2 -Wall -Werror -ansi -pedantic -g -I./ -Iicons/ `$(GTK_CONFIG) \
-		--cflags` $(CFLAGS)
+CFLAGS += -Wall -ansi -pedantic -g -I./ -Iicons/ `$(GTK_CONFIG) --cflags`
 XLIBS = `$(GTK_CONFIG) --libs` -lm
 ULIBS = -lm#
 INSTALL=install
@@ -670,9 +669,9 @@ GAMES += twiddle
 GAMES += unequal
 GAMES += untangle
 version.o: version.c version2.def
-	$(CC) $(COMPAT) $(XFLAGS) $(CFLAGS) `cat version2.def` -c version.c
+	$(CC) $(COMPAT) $(XFLAGS) $(CFLAGS) `cat version.def` -c version.c
 version2.def: FORCE
-	if test -z "$(VER)" && test -f manifest && md5sum -c manifest; then \
+	if test -z "$(VER)" && test -f manifest && md5 -c manifest; then \
 		cat version.def > version2.def.new; \
 	elif test -z "$(VER)" && test -d .svn && svnversion . >/dev/null 2>&1; then \
 		echo "-DREVISION=`svnversion .`" >version2.def.new; \
@@ -686,9 +685,19 @@ version2.def: FORCE
 	fi
 .PHONY: FORCE
 install:
+	for d in 16 32 48; do \
+		$(INSTALL_DATA) -d $(DESTDIR)/$(prefix)/share/icons/hicolor/$${d}x$${d}/apps/ ; \
+	done; \
+	$(INSTALL_DATA) -d $(DESTDIR)/$(prefix)/share/applications/; \
+	$(INSTALL_DATA) -d $(DESTDIR)/$(prefix)/share/doc/puzzles/; \
+	$(INSTALL_DATA) puzzles.txt $(DESTDIR)/$(prefix)/share/doc/puzzles/; \
 	for i in $(GAMES); do \
-		$(INSTALL_PROGRAM) -m 755 $$i $(DESTDIR)$(gamesdir)/$$i \
-		|| exit 1; \
+		$(INSTALL_PROGRAM) -m 755 $$i $(DESTDIR)$(bindir)/puzzle-$$i ;\
+		ui=`echo $$i | perl -n -e 'print ucfirst'` ;\
+		echo "[Desktop Entry]\nVersion=1.0\nName=$$ui\nComment=$$ui puzzle\nExec=puzzle-$$i\nIcon=puzzle-$$i\nType=Application\nCategories=Game;LogicGame;" > $(DESTDIR)/$(prefix)/share/applications/puzzle-$$i.desktop;\
+		for d in 16 32 48; do \
+			$(INSTALL_DATA) icons/$$i-$${d}d24.png $(DESTDIR)/$(prefix)/share/icons/hicolor/$${d}x$${d}/apps/puzzle-$$i.png ;\
+		done \
 	done
 
 clean:
