--- Makefile.orig	Tue Jul 31 15:20:30 2001
+++ Makefile	Tue Jul 31 15:29:30 2001
@@ -38,7 +38,7 @@
 #	-O3   - optimize (it seems that -O3 also help to find out some errors);
 #	-g    - produce debugging information.
 #
-CFLAGS=		-Wall -O2 -g
+#CFLAGS=		-Wall -O2 -g
 
 #
 # DSTBINDIR - where to install binaries
@@ -63,7 +63,7 @@
 #
 # DSTSHAREDIR - where to install examples, etc.
 #
-DSTSHAREDIR=	/usr/local/share/ipa
+DSTSHAREDIR=	/usr/local/share/examples/ipa
 
 #
 # IP6FW (FreeBSD only)
@@ -204,10 +204,10 @@
 	@${ECHO}
 .else
 	@${ECHO} ">> Installing binaries, manual pages and miscellaneous files"
-	${INSTALL} -c -g wheel -o root -m 0555 ipa ipastat ${DSTBINDIR}
+	${BSD_INSTALL_PROGRAM} ipa ipastat ${DSTBINDIR}
 	${CHMOD} u+s ${DSTBINDIR}/ipastat
-	${INSTALL} -c -g wheel -o root -m 0444 man/ipa.5 man/ipa.conf.5 ${DSTMANDIR}/man5
-	${INSTALL} -c -g wheel -o root -m 0444 man/ipa.8 man/ipastat.8 ${DSTMANDIR}/man8
+	${BSD_INSTALL_MAN} man/ipa.5 man/ipa.conf.5 ${DSTMANDIR}/man5
+	${BSD_INSTALL_MAN} man/ipa.8 man/ipastat.8 ${DSTMANDIR}/man8
 .if !exists(${DSTMANDIR}/ru_SU.KOI8-R/man5)
 	${INSTALL} -d -m 0555 ${DSTMANDIR}/ru_SU.KOI8-R/man5
 .endif
@@ -216,13 +216,22 @@
 .endif
 .if !exists(${DSTMANDIR}/ru_RU.KOI8-R)
 	${LN} -s ${DSTMANDIR}/ru_SU.KOI8-R ${DSTMANDIR}/ru_RU.KOI8-R
+.else
+.if !exists(${DSTMANDIR}/ru_RU.KOI8-R/man5)
+	${INSTALL} -d -m 0555 ${DSTMANDIR}/ru_RU.KOI8-R/man5
+.endif
+.if !exists(${DSTMANDIR}/ru_RU.KOI8-R/man8)
+	${INSTALL} -d -m 0555 ${DSTMANDIR}/ru_RU.KOI8-R/man8
+.endif
+.endif
+	${BSD_INSTALL_MAN} man/ru_RU.KOI8-R/ipa.5 man/ru_RU.KOI8-R/ipa.conf.5 ${DSTMANDIR}/ru_RU.KOI8-R/man5
+	${BSD_INSTALL_MAN} man/ru_RU.KOI8-R/ipa.8 man/ru_RU.KOI8-R/ipastat.8 ${DSTMANDIR}/ru_RU.KOI8-R/man8
+.if !defined(NOPORTDOCS)
+	${INSTALL} -d -m 0555 ${DSTSHAREDIR}
+	${BSD_INSTALL_DATA} examples/* ${DSTSHAREDIR}
 .endif
-	${INSTALL} -c -g wheel -o root -m 0444 man/ru_RU.KOI8-R/ipa.5 man/ru_RU.KOI8-R/ipa.conf.5 ${DSTMANDIR}/ru_RU.KOI8-R/man5
-	${INSTALL} -c -g wheel -o root -m 0444 man/ru_RU.KOI8-R/ipa.8 man/ru_RU.KOI8-R/ipastat.8 ${DSTMANDIR}/ru_RU.KOI8-R/man8
-	${INSTALL} -d -m 0555 ${DSTSHAREDIR}/examples
-	${INSTALL} -c -g wheel -o root -m 0444 examples/* ${DSTSHAREDIR}/examples
 .if exists(${DSTRCDIR})
-	${INSTALL} -c -g wheel -o root -m 0500 etc/ipa.sh.sample ${DSTRCDIR}
+	${BSD_INSTALL_DATA} etc/ipa.sh.sample ${DSTRCDIR}
 .else
 	@${ECHO}
 	@${ECHO} ">> Can't find directory ${DSTRCDIR}, skip installing of ipa.sh.sample"
@@ -230,7 +239,7 @@
 	@${ECHO}
 .endif
 .if exists(${DSTETCDIR})
-	${INSTALL} -c -g wheel -o root -m 0400 etc/ipa.conf.default ${DSTETCDIR}
+	${BSD_INSTALL_DATA} etc/ipa.conf.default ${DSTETCDIR}
 .else
 	@${ECHO}
 	@${ECHO} ">> Can't find directory ${DSTETCDIR}, skip installing of ipa.conf.default"
