$OpenBSD: patch-Makefile,v 1.1.1.1 2007/01/15 16:39:40 ajacoutot Exp $
--- Makefile.orig	Thu Oct 19 09:41:49 2006
+++ Makefile	Sat Jan 13 13:56:39 2007
@@ -18,7 +18,6 @@ VER_DATE=`date +"%Y-%m-%d"`
 
 # Where to install things:
 
-PREFIX=/usr/local
 
 
 # Root directory to place files when creating packages.
@@ -40,16 +39,12 @@ DATA_PREFIX=$(PKG_ROOT)$(PREFIX)/share/t
 # Docs and man page:
 
 DOC_PREFIX=$(PKG_ROOT)$(PREFIX)/share/doc/tuxpaint
-MAN_PREFIX=$(PKG_ROOT)$(PREFIX)/share/man
+MAN_PREFIX=$(PKG_ROOT)$(PREFIX)/man
 
 
 # 'System-wide' Config file:
 
-ifeq ($(PREFIX),/usr)
-  CONFDIR=$(PKG_ROOT)/etc/tuxpaint
-else
-  CONFDIR=$(PKG_ROOT)$(PREFIX)/etc/tuxpaint
-endif
+CONFDIR=${SYSCONFDIR}/tuxpaint
 
 
 # Commands useful to other arch's (e.g., BeOS)
@@ -97,7 +92,8 @@ SDL_CFLAGS=$(shell sdl-config --cflags)
 # The entire set of CFLAGS:
 
 #-ffast-math
-CFLAGS=-O2 -W -Wall -fno-common -ffloat-store \
+CFLAGS+=-I${LOCALBASE}/include -I${LOCALBASE}/include/libpng \
+	-W -Wall -fno-common -ffloat-store \
 	-Wcast-align -Wredundant-decls \
 	-Wbad-function-cast -Wwrite-strings \
 	-Waggregate-return \
@@ -119,19 +115,6 @@ MOUSE_CFLAGS=-Isrc/$(MOUSEDIR) -D$(CURSO
 # "make" with no arguments builds the program and man page from sources:
 
 all:	tuxpaint translations
-	@echo
-	@echo "--------------------------------------------------------------"
-	@echo
-	@echo "Done compiling."
-	@echo
-	@echo "Now run 'make install' with any options you ran 'make' with."
-	@echo "to install Tux Paint."
-	@echo
-	@echo "You may need superuser ('root') priveleges, depending on"
-	@echo "where you're installing."
-	@echo "(Depending on your system, you either need to 'su' first,"
-	@echo "or run 'sudo make install'.)"
-	@echo
 
 releaseclean:
 	@echo
@@ -222,24 +205,7 @@ nokia770:
 install:	install-bin install-data install-man install-doc \
 		install-icon install-gettext install-importscript \
 		install-default-config install-example-stamps \
-		install-example-starters \
-		install-gnome install-kde install-kde-icons
-	@echo
-	@echo "--------------------------------------------------------------"
-	@echo
-	@echo "All done! Now (preferably NOT as 'root' superuser),"
-	@echo "you can type the command 'tuxpaint' to run the program!!!"
-	@echo
-	@echo "For more information, see the 'tuxpaint' man page,"
-	@echo "run 'tuxpaint --usage' or see $(DOC_PREFIX)/README.txt"
-	@echo
-	@echo "Visit Tux Paint's home page for more information, updates"
-	@echo "and to learn how you can help out!"
-	@echo
-	@echo "  http://www.newbreedsoftware.com/tuxpaint/"
-	@echo
-	@echo "Enjoy!"
-	@echo
+		install-example-starters
 
 
 # Installs the various parts for the MinGW/MSYS development/testing environment.
@@ -470,9 +436,8 @@ uninstall:
 install-default-config:
 	@echo
 	@echo "...Installing default config file..."
-	@install -d $(CONFDIR)
-	@cp src/tuxpaint.conf $(CONFDIR)
-	@chmod 644 $(CONFDIR)/tuxpaint.conf
+	${BSD_INSTALL_DATA_DIR} $(PKG_ROOT)$(PREFIX)/share/examples/tuxpaint
+	${BSD_INSTALL_DATA} src/tuxpaint.conf $(PKG_ROOT)$(PREFIX)/share/examples/tuxpaint
 
 
 # Install example stamps
@@ -480,7 +445,7 @@ install-default-config:
 install-example-stamps:
 	@echo
 	@echo "...Installing example stamps..."
-	@install -d $(DATA_PREFIX)/stamps
+	${BSD_INSTALL_DATA_DIR} $(DATA_PREFIX)/stamps
 	@cp -R stamps/* $(DATA_PREFIX)/stamps
 	@chmod -R a+rX,g-w,o-w $(DATA_PREFIX)/stamps
 
@@ -490,7 +455,7 @@ install-example-stamps:
 install-example-starters:
 	@echo
 	@echo "...Installing example starter images..."
-	@install -d $(DATA_PREFIX)/starters
+	${BSD_INSTALL_DATA_DIR} $(DATA_PREFIX)/starters
 	@cp -R starters/* $(DATA_PREFIX)/starters
 	@chmod -R a+rX,g-w,o-w $(DATA_PREFIX)/starters
 
@@ -587,12 +552,9 @@ install-kde-icons:
 install-icon:
 	@echo
 	@echo "...Installing launcher icon graphics..."
-	@install -d $(ICON_PREFIX)
-	@cp data/images/icon.png $(ICON_PREFIX)/tuxpaint.png
-	@chmod 644 $(ICON_PREFIX)/tuxpaint.png
-	@install -d $(X11_ICON_PREFIX)
-	@cp data/images/icon32x32.xpm $(X11_ICON_PREFIX)/tuxpaint.xpm
-	@chmod 644 $(X11_ICON_PREFIX)/tuxpaint.xpm
+	${BSD_INSTALL_DATA_DIR} $(ICON_PREFIX)
+	${BSD_INSTALL_DATA} data/images/icon.png $(ICON_PREFIX)/tuxpaint.png
+	${BSD_INSTALL_DATA} data/images/icon32x32.xpm $(ICON_PREFIX)/tuxpaint.xpm
 
 
 # Install the program:
@@ -600,9 +562,7 @@ install-icon:
 install-bin:
 	@echo
 	@echo "...Installing program itself..."
-	@install -d $(BIN_PREFIX)
-	@cp tuxpaint $(BIN_PREFIX)
-	@chmod a+rx,g-w,o-w $(BIN_PREFIX)/tuxpaint$(EXE_EXT)
+	${BSD_INSTALL_PROGRAM} tuxpaint $(BIN_PREFIX)
 
 # Install the required Windows DLLs into the 'bdist' directory
 
@@ -627,8 +587,7 @@ install-dlls:
 install-importscript:
 	@echo
 	@echo "...Installing 'tuxpaint-import' script..."
-	@cp src/tuxpaint-import.sh $(BIN_PREFIX)/tuxpaint-import
-	@chmod a+rx,g-w,o-w $(BIN_PREFIX)/tuxpaint-import
+	${BSD_INSTALL_SCRIPT} src/tuxpaint-import.sh $(BIN_PREFIX)/tuxpaint-import
 
 
 # Install the data (sound, graphics, fonts):
@@ -636,12 +595,14 @@ install-importscript:
 install-data:
 	@echo
 	@echo "...Installing data files..."
-	@install -d $(DATA_PREFIX)
+	${BSD_INSTALL_DATA_DIR} $(DATA_PREFIX)
 	@cp -R data/* $(DATA_PREFIX)
 	@chmod -R a+rX,g-w,o-w $(DATA_PREFIX)
+	${BSD_INSTALL_DATA_DIR} $(PREFIX)/share/appplications
+	${BSD_INSTALL_DATA} src/tuxpaint.desktop $(PREFIX)/share/appplications
 	@echo
 	@echo "...Installing fonts..."
-	@install -d $(DATA_PREFIX)/fonts/locale
+	${BSD_INSTALL_DATA_DIR} $(DATA_PREFIX)/fonts/locale
 	@cp -R fonts/locale/* $(DATA_PREFIX)/fonts/locale
 	@chmod -R a+rX,g-w,o-w $(DATA_PREFIX)/fonts/locale
 
@@ -992,9 +953,12 @@ install-gettext:
 install-doc:
 	@echo
 	@echo "...Installing documentation..."
-	@install -d $(DOC_PREFIX)
-	@cp -R docs/* $(DOC_PREFIX)
-	@chmod a=rX,g=rX,u=rwX $(DOC_PREFIX)
+	${BSD_INSTALL_DATA_DIR} $(DOC_PREFIX)
+	${BSD_INSTALL_DATA} docs/ADVANCED-STAMPS-HOWTO.txt $(DOC_PREFIX)
+	${BSD_INSTALL_DATA} docs/EXTENDING.txt $(DOC_PREFIX)
+	${BSD_INSTALL_DATA} docs/FAQ.txt $(DOC_PREFIX)
+	${BSD_INSTALL_DATA} docs/OPTIONS.txt $(DOC_PREFIX)
+	${BSD_INSTALL_DATA} docs/README.txt $(DOC_PREFIX)
 
 
 # Install the man page:
@@ -1003,21 +967,11 @@ install-man:
 	@echo
 	@echo "...Installing man pages..."
 	@# man1 directory...
-	@install -d $(MAN_PREFIX)/man1
+	${BSD_INSTALL_MAN_DIR} $(MAN_PREFIX)/man1
 	@# tuxpaint.1
-	@cp src/manpage/tuxpaint.1 $(MAN_PREFIX)/man1
-	@gzip -f $(MAN_PREFIX)/man1/tuxpaint.1
-	@chmod a+rx,g-w,o-w $(MAN_PREFIX)/man1/tuxpaint.1.gz
-	@# pl/man1 directory...
-	@install -d $(MAN_PREFIX)/pl/man1/
-	@# tuxpaint-pl.1
-	@cp src/manpage/tuxpaint-pl.1 $(MAN_PREFIX)/pl/man1/tuxpaint.1
-	@gzip -f $(MAN_PREFIX)/pl/man1/tuxpaint.1
-	@chmod a+rx,g-w,o-w $(MAN_PREFIX)/pl/man1/tuxpaint.1.gz
+	${BSD_INSTALL_MAN} src/manpage/tuxpaint.1 $(MAN_PREFIX)/man1
 	@# tuxpaint-import.1
-	@cp src/manpage/tuxpaint-import.1 $(MAN_PREFIX)/man1/
-	@gzip -f $(MAN_PREFIX)/man1/tuxpaint-import.1
-	@chmod a+rx,g-w,o-w $(MAN_PREFIX)/man1/tuxpaint-import.1.gz
+	${BSD_INSTALL_MAN} src/manpage/tuxpaint-import.1 $(MAN_PREFIX)/man1
 
 
 
@@ -1034,7 +988,7 @@ tuxpaint:	obj/tuxpaint.o obj/i18n.o obj/
 		$^ \
 		$(HQXX_O) \
 		$(SDL_LIBS) \
-		-lm $(ARCH_LINKS)
+		-lm $(ARCH_LINKS) -liconv -lintl
 	@$(RSRC_CMD)
 	@$(MIMESET_CMD)
 
