$NetBSD: patch-aa,v 1.9 2016/03/19 17:21:48 nros Exp $
* add prefix to install dirs and set correct man, info and doc dirs.
* don't run checkdir since the test dir is missing
* define the correct configuration dir
* use BSD_INSTALL* to get the right permissions
--- Makefile.orig	2015-11-19 15:02:58.000000000 +0000
+++ Makefile
@@ -27,11 +27,11 @@ DESTDIR?=/usr/local
 BINARY_NAME=latex2rtf$(EXE_SUFFIX)
 
 # Location of binary, man, info, and support files - adapt as needed
-BINDIR=/bin
-MANDIR=/share/$(PKGMANDIR)/man1
-INFODIR=/share/info
-SUPPORTDIR=/share/latex2rtf
-CFGDIR=/share/latex2rtf/cfg
+BINDIR=$(PREFIX)/bin
+MANDIR=$(PREFIX)/$(PKGMANDIR)/man1
+INFODIR=$(PREFIX)/$(PKGINFODIR)
+SUPPORTDIR=$(PREFIX)/share/doc/latex2rtf
+CFGDIR=$(PREFIX)/share/latex2rtf/cfg
 
 #Uncomment next 5 lines for Windows
 #BINDIR=
@@ -145,16 +145,16 @@ OBJS=fonts.o direct.o encodings.o comman
 	mygetopt.o styles.o preparse.o vertical.o fields.o \
 	labels.o biblio.o auxfile.o	acronyms.o
 
-all : checkdir latex2rtf    # Windows: remove "checkdir"
+all : latex2rtf    # Windows: remove "checkdir"
 
 latex2rtf: $(OBJS) $(HDRS)
 	$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS)	$(LIBS) -o $(BINARY_NAME)
 
 cfg.o: Makefile cfg.c
-	$(CC) $(CFLAGS) -DCFGDIR=\"$(DESTDIR)$(CFGDIR)\" -c cfg.c -o cfg.o
+	$(CC) $(CFLAGS) -DCFGDIR=\"$(CFGDIR)\" -c cfg.c -o cfg.o
 
 main.o: Makefile main.c
-	$(CC) $(CFLAGS) -DCFGDIR=\"$(DESTDIR)$(CFGDIR)\" -c main.c -o main.o
+	$(CC) $(CFLAGS) -DCFGDIR=\"$(CFGDIR)\" -c main.c -o main.o
 
 check test: latex2rtf
 	cd test && $(MAKE) clean
@@ -213,14 +213,14 @@ install: latex2rtf doc/latex2rtf.1 $(CFG
 	$(MKDIR) $(DESTDIR)$(BINDIR)
 	$(MKDIR) $(DESTDIR)$(MANDIR)
 	$(MKDIR) $(DESTDIR)$(CFGDIR)
-	cp -p scripts/latex2png  $(DESTDIR)$(BINDIR)
-	cp -p doc/latex2rtf.1    $(DESTDIR)$(MANDIR)
-	cp -p doc/latex2png.1    $(DESTDIR)$(MANDIR)
-	cp -p $(CFGS)            $(DESTDIR)$(CFGDIR)
-	cp -p doc/latex2rtf.html $(DESTDIR)$(SUPPORTDIR)
-	cp -p doc/latex2rtf.pdf  $(DESTDIR)$(SUPPORTDIR)
-	cp -p doc/latex2rtf.txt  $(DESTDIR)$(SUPPORTDIR)
-	cp -p $(BINARY_NAME)     $(DESTDIR)$(BINDIR)
+	$(MKDIR) $(DESTDIR)$(SUPPORTDIR)
+	$(BSD_INSTALL_SCRIPT) scripts/latex2png  $(DESTDIR)$(BINDIR)
+	$(BSD_INSTALL_MAN) doc/latex2rtf.1 $(DESTDIR)$(MANDIR)
+	$(BSD_INSTALL_MAN) doc/latex2png.1 $(DESTDIR)$(MANDIR)
+	$(BSD_INSTALL_DATA) $(CFGS)  $(DESTDIR)$(CFGDIR)
+	$(BSD_INSTALL_DATA) doc/latex2rtf.html $(DESTDIR)$(SUPPORTDIR)
+	$(BSD_INSTALL_DATA) doc/latex2rtf.txt  $(DESTDIR)$(SUPPORTDIR)
+	$(BSD_INSTALL_PROGRAM) $(BINARY_NAME)     $(DESTDIR)$(BINDIR)
 	@echo "******************************************************************"
 	@echo "*** latex2rtf successfully installed as \"$(BINARY_NAME)\""
 	@echo "*** in directory \"$(DESTDIR)$(BINDIR)\""
@@ -228,7 +228,7 @@ install: latex2rtf doc/latex2rtf.1 $(CFG
 	@echo "*** \"make install-info\" will install TeXInfo files "
 	@echo "***"
 	@echo "*** latex2rtf was compiled to search for its configuration files in"
-	@echo "***           \"$(DESTDIR)$(CFGDIR)\" "
+	@echo "***           \"$(CFGDIR)\" "
 	@echo "***"
 	@echo "*** If the configuration files are moved then either"
 	@echo "***   1) set the environment variable RTFPATH to this new location, or"
