$OpenBSD: patch-Makefile,v 1.8 2021/01/09 12:16:01 ajacoutot Exp $

Index: Makefile
--- Makefile.orig
+++ Makefile
@@ -21,7 +21,6 @@ endif
 
 # Where to install things:
 
-PREFIX=/usr/local
 
 
 # Program:
@@ -38,16 +37,12 @@ DATA_PREFIX=$(PREFIX)/share/tuxpaint-config/
 # Docs and man page:
 
 DOC_PREFIX=$(PREFIX)/share/doc/tuxpaint-config/
-MAN_PREFIX=$(PREFIX)/share/man/
+MAN_PREFIX=$(PREFIX)/man/
 
 
 # Tux Paint's 'System-wide' Config file:
 
-ifeq ($(PREFIX),/usr)
-  CONFDIR=/etc/tuxpaint
-else
-  CONFDIR=$(PREFIX)/etc/tuxpaint
-endif
+CONFDIR=${SYSCONFDIR}/tuxpaint
 
 
 # Icons and launchers:
@@ -61,7 +56,7 @@ KDE_ICON_PREFIX=$(shell kde-config --install icon --ex
 
 # Locale files
 
-LOCALE_PREFIX=${DESTDIR}$(PREFIX)/share/locale/
+LOCALE_PREFIX=$(PREFIX)/share/locale/
 # LOCALE_PREFIX=/usr/share/locale/
 
 
@@ -80,7 +75,6 @@ FLTK_LIBS=`fltk-config --ldflags`
 PAPER_LIB=-lpaper
 
 # Default CFLAGS:
-CFLAGS=-O2 -Wall
 
 # The entire set of CFLAGS:
 ALL_CFLAGS=$(CFLAGS) $(FLTK_CFLAGS) -DDATA_PREFIX=\"$(DATA_PREFIX)\" \
@@ -92,11 +86,6 @@ ALL_CFLAGS=$(CFLAGS) $(FLTK_CFLAGS) -DDATA_PREFIX=\"$(
 # "make" with no arguments builds the program and man page from sources:
 
 all:	tuxpaint-config translations
-	@echo
-	@echo "Done compiling."
-	@echo "Now (probably as 'root' superuser), run 'make install'"
-	@echo "to install Tux Paint Configuration Tool."
-	@echo
 
 releaseclean:
 	@echo
@@ -179,16 +168,9 @@ install-win32:
 # (depending on the *PREFIX variables at the top, you probably need
 # to do this as superuser ("root"))
 
-install:	install-bin install-data install-man install-doc \
-		install-gnome install-kde install-kde-icons \
+install:	install-bin install-man install-doc \
+		install-gnome \
 		install-icon install-gettext
-	@echo
-	@echo "All done! Now (preferably NOT as 'root' superuser),"
-	@echo "you can type the command 'tuxpaint-config' to run the"
-	@echo "configuration tool!"
-	@echo
-	@echo "Enjoy!"
-	@echo
 
 
 # "make clean" deletes the program, the compiled objects and the
@@ -267,24 +249,15 @@ install-kde-icons:
 # and the 24-color 32x32 XPM (for other Window managers):
 
 install-icon:
-	@echo
-	@echo "...Installing launcher icon graphics..."
-	@install -d ${DESTDIR}$(ICON_PREFIX)
-	@cp data/images/icon.png ${DESTDIR}$(ICON_PREFIX)tuxpaint-config.png
-	@chmod 644 ${DESTDIR}$(ICON_PREFIX)tuxpaint-config.png
-	@install -d ${DESTDIR}$(X11_ICON_PREFIX)
-	@cp data/images/icon32x32.xpm ${DESTDIR}$(X11_ICON_PREFIX)tuxpaint-config.xpm
-	@chmod 644 ${DESTDIR}$(X11_ICON_PREFIX)tuxpaint-config.xpm
+	${BSD_INSTALL_DATA_DIR} $(ICON_PREFIX)
+	${BSD_INSTALL_DATA} data/images/icon.png $(ICON_PREFIX)tuxpaint-config.png
+	${BSD_INSTALL_DATA} data/images/icon32x32.xpm $(ICON_PREFIX)tuxpaint-config.xpm
 
 
 # Install the program:
 
 install-bin:
-	@echo
-	@echo "...Installing program itself..."
-	@install -d ${DESTDIR}${BIN_PREFIX}
-	@cp tuxpaint-config ${DESTDIR}$(BIN_PREFIX)
-	@chmod a+rx,g-w,o-w ${DESTDIR}$(BIN_PREFIX)/tuxpaint-config$(EXE_EXT)
+	${BSD_INSTALL_PROGRAM} tuxpaint-config $(BIN_PREFIX)
 
 
 # Install the data (sound, graphics, fonts):
@@ -300,31 +273,15 @@ install-data:
 # Install the text documentation:
 
 install-doc:
-	@echo
-	@echo "...Installing documentation..."
-	@echo "(English)"
-	@install -d ${DESTDIR}$(DOC_PREFIX)
-	@install -d ${DESTDIR}$(DOC_PREFIX)/html
-	@cp docs/AUTHORS.txt ${DESTDIR}$(DOC_PREFIX)
-	@cp docs/CHANGES.txt ${DESTDIR}$(DOC_PREFIX)
-	@cp docs/COPYING.txt ${DESTDIR}$(DOC_PREFIX)
-	@cp docs/README.txt ${DESTDIR}$(DOC_PREFIX)
-	@cp docs/html/README.html ${DESTDIR}$(DOC_PREFIX)/html
-	@cp docs/TODO.txt ${DESTDIR}$(DOC_PREFIX)
-	@echo "(...Setting permissions)"
-	@chmod -R a+rx,g-w,o-w ${DESTDIR}$(DOC_PREFIX)
+	${BSD_INSTALL_DATA_DIR} $(DOC_PREFIX)
+	${BSD_INSTALL_DATA} docs/README.txt $(DOC_PREFIX)
 
 
 # Install the man page:
 
 install-man:
-	@echo "...Installing man pages..."
-	# man1 directory...
-	@install -d ${DESTDIR}$(MAN_PREFIX)/man1/
-	# tuxpaint-config.1
-	@cp src/tuxpaint-config.1 ${DESTDIR}$(MAN_PREFIX)/man1/
-	@gzip -9f ${DESTDIR}$(MAN_PREFIX)/man1/tuxpaint-config.1
-	@chmod a+rx,g-w,o-w ${DESTDIR}$(MAN_PREFIX)/man1/tuxpaint-config.1.gz
+	${BSD_INSTALL_MAN_DIR} $(MAN_PREFIX)/man1/
+	${BSD_INSTALL_MAN} src/tuxpaint-config.1 $(MAN_PREFIX)/man1/
 
 
 # Build the program!
@@ -332,22 +289,22 @@ install-man:
 tuxpaint-config:	obj/tuxpaint-config.o obj/tuxpaint-config2.o	\
 			obj/defaults.o $(ARCH_LIBS)
 	@echo Linking
-	$(CXX) $(ALL_CFLAGS) -o tuxpaint-config obj/tuxpaint-config.o 	\
+	$(CXX) $(ALL_CFLAGS) -liconv -lintl -o tuxpaint-config obj/tuxpaint-config.o 	\
 			obj/tuxpaint-config2.o obj/defaults.o $(ARCH_LIBS) \
 			$(FLTK_LIBS) $(ARCH_LINKS) $(PAPER_LIB)
 
 
 # Build the object for the program!
 
-obj/tuxpaint-config.o:	src/tuxpaint-config.cxx src/version.h src/about.h
+obj/tuxpaint-config.o:	src/tuxpaint-config.cxx obj src/version.h src/about.h
 	@echo Compiling tuxpaint-config.cxx
 	$(CXX) $(ALL_CFLAGS) -c src/tuxpaint-config.cxx -o obj/tuxpaint-config.o
 
-obj/tuxpaint-config2.o:	src/tuxpaint-config2.cxx src/version.h src/about.h
+obj/tuxpaint-config2.o:	src/tuxpaint-config2.cxx obj src/version.h src/about.h
 	@echo Compiling tuxpaint-config2.cxx
 	$(CXX) $(ALL_CFLAGS) -c src/tuxpaint-config2.cxx -o obj/tuxpaint-config2.o
 
-obj/defaults.o:	src/defaults.cxx
+obj/defaults.o:	src/defaults.cxx obj
 	@echo Compiling defaults.cxx
 	$(CXX) $(ALL_CFLAGS) -c src/defaults.cxx -o obj/defaults.o
 
