binutils: Make manpage handling generic to ease maintenance
authorJohn Marino <draco@marino.st>
Sun, 12 Feb 2012 17:35:45 +0000 (18:35 +0100)
committerJohn Marino <draco@marino.st>
Sun, 12 Feb 2012 21:00:21 +0000 (22:00 +0100)
DragonFly has two sets of binutils with one designated as primary and the
other is the backup.  In the recent past, every time these designation
were switched or a new binutils was brought in, around 30 makefiles had
to be manually and tediously updated in at least 3 places per file.

This commit implements common variables that will make future primary
designation changes not require changes to individual makefiles, but
rather limit the update to a couple of commons ones.

36 files changed:
gnu/usr.bin/Makefile
gnu/usr.bin/Makefile.buo [new file with mode: 0644]
gnu/usr.bin/binutils221/Makefile.inc
gnu/usr.bin/binutils221/Makefile.inc1 [new file with mode: 0644]
gnu/usr.bin/binutils221/addr2line/Makefile
gnu/usr.bin/binutils221/ar/Makefile
gnu/usr.bin/binutils221/as/Makefile.inc0
gnu/usr.bin/binutils221/cxxfilt/Makefile
gnu/usr.bin/binutils221/elfedit/Makefile
gnu/usr.bin/binutils221/gprof/Makefile
gnu/usr.bin/binutils221/ld/Makefile
gnu/usr.bin/binutils221/nm/Makefile
gnu/usr.bin/binutils221/objcopy/Makefile
gnu/usr.bin/binutils221/objdump/Makefile
gnu/usr.bin/binutils221/ranlib/Makefile
gnu/usr.bin/binutils221/readelf/Makefile
gnu/usr.bin/binutils221/size/Makefile
gnu/usr.bin/binutils221/strings/Makefile
gnu/usr.bin/binutils221/strip/Makefile
gnu/usr.bin/binutils222/Makefile.inc
gnu/usr.bin/binutils222/Makefile.inc1 [new file with mode: 0644]
gnu/usr.bin/binutils222/addr2line/Makefile
gnu/usr.bin/binutils222/ar/Makefile
gnu/usr.bin/binutils222/as/Makefile.inc0
gnu/usr.bin/binutils222/cxxfilt/Makefile
gnu/usr.bin/binutils222/elfedit/Makefile
gnu/usr.bin/binutils222/gprof/Makefile
gnu/usr.bin/binutils222/ld/Makefile
gnu/usr.bin/binutils222/nm/Makefile
gnu/usr.bin/binutils222/objcopy/Makefile
gnu/usr.bin/binutils222/objdump/Makefile
gnu/usr.bin/binutils222/ranlib/Makefile
gnu/usr.bin/binutils222/readelf/Makefile
gnu/usr.bin/binutils222/size/Makefile
gnu/usr.bin/binutils222/strings/Makefile
gnu/usr.bin/binutils222/strip/Makefile

index a2229fa..76cd187 100644 (file)
@@ -1,5 +1,7 @@
 # $FreeBSD: src/gnu/usr.bin/Makefile,v 1.51 2000/01/16 00:11:34 obrien Exp $
 
+.include "Makefile.buo"
+
 SUBDIR= dialog diff grep groff man rcs texinfo
 
 .if !defined(NO_CVS)
@@ -10,18 +12,18 @@ SUBDIR+=cvs
 SUBDIR+=gdb
 .endif
 
-SUBDIR+= binutils222
+SUBDIR+= ${BU_PRIMARY}
 .if !defined(NO_BINUTILS221)
-SUBDIR+= binutils221
+SUBDIR+= ${BU_SECONDARY}
 .endif
 
 .if !defined(NO_GCC41)
 SUBDIR+= cc41
-.ORDER: binutils222 cc41
+.ORDER: ${BU_PRIMARY} cc41
 .endif
 
 SUBDIR+= cc44
-.ORDER: binutils222 cc44
+.ORDER: ${BU_PRIMARY} cc44
 
 # maximum parallelism
 #
diff --git a/gnu/usr.bin/Makefile.buo b/gnu/usr.bin/Makefile.buo
new file mode 100644 (file)
index 0000000..d1fac85
--- /dev/null
@@ -0,0 +1,23 @@
+# DragonFly maintains two sets of binutils.  The last time it was necessary to swap the primary and
+# backup status between them, 37 files had to be changed.  This makefile include aims to make that process
+# much simpler by having common variables located in one place to control the state.
+#
+# Additionally, with each new import or upgrade of binutils, dozens of Makefiles have to be individually
+# customized over the previous version.  Ideally in the future the Makefiles are generic and only have to be
+# copied over in most cases.
+
+BU_PRIMARY=    binutils222
+BU_BACKUP=     binutils221
+
+.if defined(BUVERSION)
+.if (${BUVERSION} == ${BU_PRIMARY})
+IS_PRIMARY=    1
+MANPAGEVER=    222
+.else
+.endif
+
+.if (${BUVERSION} == ${BU_BACKUP})
+MANPAGEVER=    221
+.else
+.endif
+.endif
index 09fc6b1..d947795 100644 (file)
@@ -1 +1 @@
-BINDIR?=       /usr/libexec/binutils221/elf
+BINDIR?=       /usr/libexec/${BUVERSION}/elf
diff --git a/gnu/usr.bin/binutils221/Makefile.inc1 b/gnu/usr.bin/binutils221/Makefile.inc1
new file mode 100644 (file)
index 0000000..b8e7378
--- /dev/null
@@ -0,0 +1,2 @@
+BUVERSION=     binutils221
+.include "../Makefile.buo"
index 94378e4..fe64d90 100644 (file)
@@ -1,15 +1,21 @@
+.include "../Makefile.inc1"
 .include "../Makefile.bu"
 
 .PATH: ${SRCDIR}/binutils ${SRCDIR}/binutils/doc
 
 PROG=  addr2line
 SRCS=  addr2line.c
-MAN=   addr2line221.1
+MFILE= addr2line${MANPAGEVER}.1
+MAN=   ${MFILE}
 WARNS= 2
 
-addr2line221.1: ${SRCDIR}/binutils/doc/addr2line.1
+${MFILE}: ${SRCDIR}/binutils/doc/addr2line.1
        cp ${.ALLSRC} ${.TARGET}
 
-CLEANFILES+=   addr2line221.1
+CLEANFILES+=   ${MFILE}
+
+.if defined(IS_PRIMARY)
+MLINKS+=       ${MFILE} addr2line.1
+.endif
 
 .include <bsd.prog.mk>
index f96681f..ceb2049 100644 (file)
@@ -1,15 +1,21 @@
+.include "../Makefile.inc1"
 .include "../Makefile.bu"
 
 .PATH: ${SRCDIR}/binutils ${SRCDIR}/binutils/doc
 
 PROG=  ar
 SRCS=  ar.c not-ranlib.c
-MAN=   ar221.1
+MFILE= ar${MANPAGEVER}.1
+MAN=   ${MFILE}
 NOSHARED?= yes
 
-ar221.1: ${SRCDIR}/binutils/doc/ar.1
+${MFILE}: ${SRCDIR}/binutils/doc/ar.1
        cp ${.ALLSRC} ${.TARGET}
 
-CLEANFILES+=   ar221.1
+CLEANFILES+=   ${MFILE}
+
+.if defined(IS_PRIMARY)
+MLINKS+=       ${MFILE} ar.1
+.endif
 
 .include <bsd.prog.mk>
index ff98bc4..963c7e1 100644 (file)
@@ -1,4 +1,5 @@
 .include "${.CURDIR}/../../Makefile.inc0"
+.include "${.CURDIR}/../../Makefile.inc1"
 
 RELTOP:= ../${RELTOP}
 .PATH: ${SRCDIR}/gas ${SRCDIR}/gas/config ${.CURDIR}/..
@@ -6,7 +7,8 @@ RELTOP:= ../${RELTOP}
 TARGET_OS?=    dragonfly
 
 PROG=  as
-MAN=   as221.1
+MFILE= as${MANPAGEVER}.1
+MAN=   ${MFILE}
 SRCS+= app.c                   \
        as.c                    \
        atof-generic.c          \
@@ -54,7 +56,11 @@ NOSHARED?=   yes
 DPADD+=        ${RELTOP}/libopcodes/libopcodes.a
 LDADD+=        ${RELTOP}/libopcodes/libopcodes.a
 
-as221.1: ${SRCDIR}/gas/doc/as.1
+${MFILE}: ${SRCDIR}/gas/doc/as.1
        cp ${.ALLSRC} ${.TARGET}
 
-CLEANFILES+=   as221.1
+CLEANFILES+=   ${MFILE}
+
+.if defined(IS_PRIMARY)
+MLINKS+=       ${MFILE} as.1
+.endif
index 3d709b1..6769f70 100644 (file)
@@ -1,15 +1,21 @@
+.include "../Makefile.inc1"
 .include "../Makefile.bu"
 
 .PATH: ${SRCDIR}/binutils
 
 PROG=  c++filt
 SRCS=   cxxfilt.c
-MAN=   c++filt221.1
+MFILE= c++filt${MANPAGEVER}.1
+MAN=   ${MFILE}
 WARNS= 1
 
-c++filt221.1: ${.CURDIR}/c++filt.1
+${MFILE}: ${.CURDIR}/c++filt.1
        cp ${.ALLSRC} ${.TARGET}
 
-CLEANFILES+=   c++filt221.1
+CLEANFILES+=   ${MFILE}
+
+.if defined(IS_PRIMARY)
+MLINKS+=       ${MFILE} c++filt.1
+.endif
 
 .include <bsd.prog.mk>
index b15b4cb..68e1661 100644 (file)
@@ -1,15 +1,21 @@
+.include "../Makefile.inc1"
 .include "../Makefile.bu"
 
 .PATH: ${SRCDIR}/binutils ${SRCDIR}/binutils/doc
 
 PROG=  elfedit
 SRCS=   elfedit.c elfcomm.c
-MAN=   elfedit221.1
+MFILE= elfedit${MANPAGEVER}.1
+MAN=   ${MFILE}
 WARNS= 1
 
-elfedit221.1: ${SRCDIR}/binutils/doc/elfedit.1
+${MFILE}: ${SRCDIR}/binutils/doc/elfedit.1
        cp ${.ALLSRC} ${.TARGET}
 
-CLEANFILES+=   elfedit221.1
+CLEANFILES+=   ${MFILE}
+
+.if defined(IS_PRIMARY)
+MLINKS+=       ${MFILE} elfedit.1
+.endif
 
 .include <bsd.prog.mk>
index 1bd9482..1130154 100644 (file)
@@ -1,3 +1,4 @@
+.include "../Makefile.inc1"
 .include "../Makefile.bu"
 
 .PATH: ${SRCDIR}/gprof
@@ -27,13 +28,14 @@ SRCS=   basic_blocks.c      \
        flat_bl.c       \
        bsd_callg_bl.c  \
        fsf_callg_bl.c
-MAN=   gprof221.1
+MFILE= gprof${MANPAGEVER}.1
+MAN=   ${MFILE}
 
 CFLAGS=        -DHAVE_CONFIG_H
 CFLAGS+=-I${.CURDIR} -I${.CURDIR}/../libbfd -I${.OBJDIR}/../libbfd
 CFLAGS+=-I${SRCDIR}/include -I${SRCDIR}/bfd
 
-gprof221.1: ${.CURDIR}/gprof.1
+${MFILE}: ${.CURDIR}/gprof.1
        cp ${.ALLSRC} ${.TARGET}
 
 flat_bl.c:
@@ -51,9 +53,13 @@ fsf_callg_bl.c:
        FUNCTION=`(echo fsf_callg_bl|sed -e 's,.*/,,g' -e 's/_bl//')`_blurb \
        FILE=fsf_callg_bl.m ${SRCDIR}/gprof/fsf_callg_bl.m
 
-CLEANFILES+=   gprof221.1     \
+CLEANFILES+=   ${MFILE}       \
                flat_bl.c      \
                bsd_callg_bl.c \
                fsf_callg_bl.c
 
+.if defined(IS_PRIMARY)
+MLINKS+=       ${MFILE} gprof.1
+.endif
+
 .include <bsd.prog.mk>
index 55bce0f..051b211 100644 (file)
@@ -1,11 +1,13 @@
 ELF_SCR_EXT=   x xbn xc xd xdc xdw xn xr xs xsc xsw xu xw
 
 .include "../Makefile.inc0"
+.include "../Makefile.inc1"
 
 .PATH: ${SRCDIR}/ld
 
 PROG=  ld.bfd
-MAN=   ld221.1
+MFILE= ld${MANPAGEVER}.1
+MAN=   ${MFILE}
 LIBEXEC_BINUTILS= ${BINDIR}/..
 SCRIPTDIR= ${LIBEXEC_BINUTILS}/ldscripts
 SRCS+= ldgram.y        \
@@ -35,8 +37,6 @@ NOSHARED?= yes
 CLEANDIRS+=    ldscripts tmpdir
 CLEANFILES+=   ldemul-list.h stringify.sed
 
-LINKS= ${BINDIR}/ld.bfd ${BINDIR}/ld
-
 EMXFR=
 EMLST=
 .for _e in ${EMS}
@@ -51,10 +51,14 @@ ldemul-list.h:
 stringify.sed:
        ${LN} -sf ${SRCDIR}/ld/emultempl/astring.sed ${.TARGET}
 
-ld221.1: ${SRCDIR}/ld/ld.1
+${MFILE}: ${SRCDIR}/ld/ld.1
        cp ${.ALLSRC} ${.TARGET}
 
-CLEANFILES+=   ld221.1
+CLEANFILES+=   ${MFILE}
+
+.if defined(IS_PRIMARY)
+MLINKS+=       ${MFILE} ld.1
+.endif
 
 afterinstall: install-ldscripts
 
index a41a7ba..07e425b 100644 (file)
@@ -1,14 +1,20 @@
+.include "../Makefile.inc1"
 .include "../Makefile.bu"
 
 .PATH: ${SRCDIR}/binutils ${SRCDIR}/binutils/doc
 
 PROG=  nm
-MAN=   nm221.1
+MFILE= nm${MANPAGEVER}.1
+MAN=   ${MFILE}
 WARNS= 2
 
-nm221.1: ${SRCDIR}/binutils/doc/nm.1
+${MFILE}: ${SRCDIR}/binutils/doc/nm.1
        cp ${.ALLSRC} ${.TARGET}
 
-CLEANFILES+=   nm221.1
+CLEANFILES+=   ${MFILE}
+
+.if defined(IS_PRIMARY)
+MLINKS+=       ${MFILE} nm.1
+.endif
 
 .include <bsd.prog.mk>
index 15c65ec..47e29cc 100644 (file)
@@ -1,15 +1,21 @@
+.include "../Makefile.inc1"
 .include "../Makefile.bu"
 
 .PATH: ${SRCDIR}/binutils ${SRCDIR}/binutils/doc
 
 PROG=  objcopy
 SRCS=  not-strip.c objcopy.c
-MAN=   objcopy221.1
+MFILE= objcopy${MANPAGEVER}.1
+MAN=   ${MFILE}
 WARNS= 1
 
-objcopy221.1: ${SRCDIR}/binutils/doc/objcopy.1
+${MFILE}: ${SRCDIR}/binutils/doc/objcopy.1
        cp ${.ALLSRC} ${.TARGET}
 
-CLEANFILES+=   objcopy221.1
+CLEANFILES+=   ${MFILE}
+
+.if defined(IS_PRIMARY)
+MLINKS+=       ${MFILE} objcopy.1
+.endif
 
 .include <bsd.prog.mk>
index f160930..29c89a4 100644 (file)
@@ -1,18 +1,24 @@
+.include "../Makefile.inc1"
 .include "../Makefile.bu"
 
 .PATH: ${SRCDIR}/binutils ${SRCDIR}/binutils/doc
 
 PROG=  objdump
 SRCS=  elfcomm.c objdump.c
-MAN=   objdump221.1
+MFILE= objdump${MANPAGEVER}.1
+MAN=   ${MFILE}
 WARNS= 1
 
 DPADD+=        ${.OBJDIR}/../libopcodes/libopcodes.a
 LDADD+=        ${.OBJDIR}/../libopcodes/libopcodes.a
 
-objdump221.1: ${SRCDIR}/binutils/doc/objdump.1
+${MFILE}: ${SRCDIR}/binutils/doc/objdump.1
        cp ${.ALLSRC} ${.TARGET}
 
-CLEANFILES+=   objdump221.1
+CLEANFILES+=   ${MFILE}
+
+.if defined(IS_PRIMARY)
+MLINKS+=       ${MFILE} objdump.1
+.endif
 
 .include <bsd.prog.mk>
index 5e0e26f..c93851b 100644 (file)
@@ -1,16 +1,22 @@
+.include "../Makefile.inc1"
 .include "../Makefile.bu"
 
 .PATH: ${SRCDIR}/binutils ${SRCDIR}/binutils/doc
 
 PROG=  ranlib
 SRCS=  ar.c is-ranlib.c
-MAN=   ranlib221.1
+MFILE= ranlib${MANPAGEVER}.1
+MAN=   ${MFILE}
 
 NOSHARED?= yes
 
-ranlib221.1: ${SRCDIR}/binutils/doc/ranlib.1
+${MFILE}: ${SRCDIR}/binutils/doc/ranlib.1
        cp ${.ALLSRC} ${.TARGET}
 
-CLEANFILES+=   ranlib221.1
+CLEANFILES+=   ${MFILE}
+
+.if defined(IS_PRIMARY)
+MLINKS+=       ${MFILE} ranlib.1
+.endif
 
 .include <bsd.prog.mk>
index 74d26b8..12dd662 100644 (file)
@@ -1,15 +1,21 @@
+.include "../Makefile.inc1"
 .include "../Makefile.bu"
 
 .PATH: ${SRCDIR}/binutils ${SRCDIR}/binutils/doc
 
 PROG=  readelf
 SRCS=  readelf.c unwind-ia64.c dwarf.c elfcomm.c
-MAN=   readelf221.1
+MFILE= readelf${MANPAGEVER}.1
+MAN=   ${MFILE}
 WARNS= 1
 
-readelf221.1: ${SRCDIR}/binutils/doc/readelf.1
+${MFILE}: ${SRCDIR}/binutils/doc/readelf.1
        cp ${.ALLSRC} ${.TARGET}
 
-CLEANFILES+=   readelf221.1
+CLEANFILES+=   ${MFILE}
+
+.if defined(IS_PRIMARY)
+MLINKS+=       ${MFILE} readelf.1
+.endif
 
 .include <bsd.prog.mk>
index c699d34..db9b51b 100644 (file)
@@ -1,14 +1,20 @@
+.include "../Makefile.inc1"
 .include "../Makefile.bu"
 
 .PATH: ${SRCDIR}/binutils ${SRCDIR}/binutils/doc
 
 PROG=  size
-MAN=   size221.1
+MFILE= size${MANPAGEVER}.1
+MAN=   ${MFILE}
 WARNS= 2
 
-size221.1: ${SRCDIR}/binutils/doc/size.1
+${MFILE}: ${SRCDIR}/binutils/doc/size.1
        cp ${.ALLSRC} ${.TARGET}
 
-CLEANFILES+=   size221.1
+CLEANFILES+=   ${MFILE}
+
+.if defined(IS_PRIMARY)
+MLINKS+=       ${MFILE} size.1
+.endif
 
 .include <bsd.prog.mk>
index 221b24b..09f68c2 100644 (file)
@@ -1,14 +1,20 @@
+.include "../Makefile.inc1"
 .include "../Makefile.bu"
 
 .PATH: ${SRCDIR}/binutils ${SRCDIR}/binutils/doc
 
 PROG=  strings
-MAN=   strings221.1
+MFILE= strings${MANPAGEVER}.1
+MAN=   ${MFILE}
 WARNS= 2
 
-strings221.1: ${SRCDIR}/binutils/doc/strings.1
+${MFILE}: ${SRCDIR}/binutils/doc/strings.1
        cp ${.ALLSRC} ${.TARGET}
 
-CLEANFILES+=   strings221.1
+CLEANFILES+=   ${MFILE}
+
+.if defined(IS_PRIMARY)
+MLINKS+=       ${MFILE} strings.1
+.endif
 
 .include <bsd.prog.mk>
index bf37e47..80496b1 100644 (file)
@@ -1,10 +1,12 @@
+.include "../Makefile.inc1"
 .include "../Makefile.bu"
 
 .PATH: ${SRCDIR}/binutils ${SRCDIR}/binutils/doc
 
 PROG=  strip
 SRCS=  objcopy.c is-strip.c
-MAN=   strip221.1
+MFILE= strip${MANPAGEVER}.1
+MAN=   ${MFILE}
 WARNS= 1
 
 CLEANFILES+=   maybe_stripped
@@ -19,10 +21,14 @@ maybe_stripped: strip
 .endif
 .endif
 
-strip221.1: ${SRCDIR}/binutils/doc/strip.1
+${MFILE}: ${SRCDIR}/binutils/doc/strip.1
        cp ${.ALLSRC} ${.TARGET}
 
-CLEANFILES+=   strip221.1
+CLEANFILES+=   ${MFILE}
+
+.if defined(IS_PRIMARY)
+MLINKS+=       ${MFILE} strip.1
+.endif
 
 realinstall:
        ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
index f1c1393..d947795 100644 (file)
@@ -1 +1 @@
-BINDIR?=       /usr/libexec/binutils222/elf
+BINDIR?=       /usr/libexec/${BUVERSION}/elf
diff --git a/gnu/usr.bin/binutils222/Makefile.inc1 b/gnu/usr.bin/binutils222/Makefile.inc1
new file mode 100644 (file)
index 0000000..5e6e644
--- /dev/null
@@ -0,0 +1,2 @@
+BUVERSION=     binutils222
+.include "../Makefile.buo"
index a6d8980..fe64d90 100644 (file)
@@ -1,16 +1,21 @@
+.include "../Makefile.inc1"
 .include "../Makefile.bu"
 
 .PATH: ${SRCDIR}/binutils ${SRCDIR}/binutils/doc
 
 PROG=  addr2line
 SRCS=  addr2line.c
-MAN=   addr2line222.1
-MLINKS+=addr2line222.1 addr2line.1
+MFILE= addr2line${MANPAGEVER}.1
+MAN=   ${MFILE}
 WARNS= 2
 
-addr2line222.1: ${SRCDIR}/binutils/doc/addr2line.1
+${MFILE}: ${SRCDIR}/binutils/doc/addr2line.1
        cp ${.ALLSRC} ${.TARGET}
 
-CLEANFILES+=   addr2line222.1
+CLEANFILES+=   ${MFILE}
+
+.if defined(IS_PRIMARY)
+MLINKS+=       ${MFILE} addr2line.1
+.endif
 
 .include <bsd.prog.mk>
index 1c622c0..ceb2049 100644 (file)
@@ -1,16 +1,21 @@
+.include "../Makefile.inc1"
 .include "../Makefile.bu"
 
 .PATH: ${SRCDIR}/binutils ${SRCDIR}/binutils/doc
 
 PROG=  ar
 SRCS=  ar.c not-ranlib.c
-MAN=   ar222.1
-MLINKS+=ar222.1 ar.1
+MFILE= ar${MANPAGEVER}.1
+MAN=   ${MFILE}
 NOSHARED?= yes
 
-ar222.1: ${SRCDIR}/binutils/doc/ar.1
+${MFILE}: ${SRCDIR}/binutils/doc/ar.1
        cp ${.ALLSRC} ${.TARGET}
 
-CLEANFILES+=   ar222.1
+CLEANFILES+=   ${MFILE}
+
+.if defined(IS_PRIMARY)
+MLINKS+=       ${MFILE} ar.1
+.endif
 
 .include <bsd.prog.mk>
index daa169d..963c7e1 100644 (file)
@@ -1,4 +1,5 @@
 .include "${.CURDIR}/../../Makefile.inc0"
+.include "${.CURDIR}/../../Makefile.inc1"
 
 RELTOP:= ../${RELTOP}
 .PATH: ${SRCDIR}/gas ${SRCDIR}/gas/config ${.CURDIR}/..
@@ -6,8 +7,8 @@ RELTOP:= ../${RELTOP}
 TARGET_OS?=    dragonfly
 
 PROG=  as
-MAN=   as222.1
-MLINKS+=as222.1 as.1
+MFILE= as${MANPAGEVER}.1
+MAN=   ${MFILE}
 SRCS+= app.c                   \
        as.c                    \
        atof-generic.c          \
@@ -55,7 +56,11 @@ NOSHARED?=   yes
 DPADD+=        ${RELTOP}/libopcodes/libopcodes.a
 LDADD+=        ${RELTOP}/libopcodes/libopcodes.a
 
-as222.1: ${SRCDIR}/gas/doc/as.1
+${MFILE}: ${SRCDIR}/gas/doc/as.1
        cp ${.ALLSRC} ${.TARGET}
 
-CLEANFILES+=   as222.1
+CLEANFILES+=   ${MFILE}
+
+.if defined(IS_PRIMARY)
+MLINKS+=       ${MFILE} as.1
+.endif
index c1d21e4..6769f70 100644 (file)
@@ -1,16 +1,21 @@
+.include "../Makefile.inc1"
 .include "../Makefile.bu"
 
 .PATH: ${SRCDIR}/binutils
 
 PROG=  c++filt
 SRCS=   cxxfilt.c
-MAN=   c++filt222.1
-MLINKS+=c++filt222.1 c++filt.1
+MFILE= c++filt${MANPAGEVER}.1
+MAN=   ${MFILE}
 WARNS= 1
 
-c++filt222.1: ${.CURDIR}/c++filt.1
+${MFILE}: ${.CURDIR}/c++filt.1
        cp ${.ALLSRC} ${.TARGET}
 
-CLEANFILES+=   c++filt222.1
+CLEANFILES+=   ${MFILE}
+
+.if defined(IS_PRIMARY)
+MLINKS+=       ${MFILE} c++filt.1
+.endif
 
 .include <bsd.prog.mk>
index cbefa39..68e1661 100644 (file)
@@ -1,16 +1,21 @@
+.include "../Makefile.inc1"
 .include "../Makefile.bu"
 
 .PATH: ${SRCDIR}/binutils ${SRCDIR}/binutils/doc
 
 PROG=  elfedit
 SRCS=   elfedit.c elfcomm.c
-MAN=   elfedit222.1
-MLINKS+=elfedit222.1 elfedit.1
+MFILE= elfedit${MANPAGEVER}.1
+MAN=   ${MFILE}
 WARNS= 1
 
-elfedit222.1: ${SRCDIR}/binutils/doc/elfedit.1
+${MFILE}: ${SRCDIR}/binutils/doc/elfedit.1
        cp ${.ALLSRC} ${.TARGET}
 
-CLEANFILES+=   elfedit222.1
+CLEANFILES+=   ${MFILE}
+
+.if defined(IS_PRIMARY)
+MLINKS+=       ${MFILE} elfedit.1
+.endif
 
 .include <bsd.prog.mk>
index d05b1f0..1130154 100644 (file)
@@ -1,3 +1,4 @@
+.include "../Makefile.inc1"
 .include "../Makefile.bu"
 
 .PATH: ${SRCDIR}/gprof
@@ -27,14 +28,14 @@ SRCS=   basic_blocks.c      \
        flat_bl.c       \
        bsd_callg_bl.c  \
        fsf_callg_bl.c
-MAN=   gprof222.1
-MLINKS+=gprof222.1 gprof.1
+MFILE= gprof${MANPAGEVER}.1
+MAN=   ${MFILE}
 
 CFLAGS=        -DHAVE_CONFIG_H
 CFLAGS+=-I${.CURDIR} -I${.CURDIR}/../libbfd -I${.OBJDIR}/../libbfd
 CFLAGS+=-I${SRCDIR}/include -I${SRCDIR}/bfd
 
-gprof222.1: ${.CURDIR}/gprof.1
+${MFILE}: ${.CURDIR}/gprof.1
        cp ${.ALLSRC} ${.TARGET}
 
 flat_bl.c:
@@ -52,9 +53,13 @@ fsf_callg_bl.c:
        FUNCTION=`(echo fsf_callg_bl|sed -e 's,.*/,,g' -e 's/_bl//')`_blurb \
        FILE=fsf_callg_bl.m ${SRCDIR}/gprof/fsf_callg_bl.m
 
-CLEANFILES+=   gprof222.1     \
+CLEANFILES+=   ${MFILE}       \
                flat_bl.c      \
                bsd_callg_bl.c \
                fsf_callg_bl.c
 
+.if defined(IS_PRIMARY)
+MLINKS+=       ${MFILE} gprof.1
+.endif
+
 .include <bsd.prog.mk>
index 59f93b8..051b211 100644 (file)
@@ -1,12 +1,13 @@
 ELF_SCR_EXT=   x xbn xc xd xdc xdw xn xr xs xsc xsw xu xw
 
 .include "../Makefile.inc0"
+.include "../Makefile.inc1"
 
 .PATH: ${SRCDIR}/ld
 
 PROG=  ld.bfd
-MAN=   ld222.1
-MLINKS+=ld222.1 ld.1
+MFILE= ld${MANPAGEVER}.1
+MAN=   ${MFILE}
 LIBEXEC_BINUTILS= ${BINDIR}/..
 SCRIPTDIR= ${LIBEXEC_BINUTILS}/ldscripts
 SRCS+= ldgram.y        \
@@ -36,8 +37,6 @@ NOSHARED?= yes
 CLEANDIRS+=    ldscripts tmpdir
 CLEANFILES+=   ldemul-list.h stringify.sed
 
-LINKS= ${BINDIR}/ld.bfd ${BINDIR}/ld
-
 EMXFR=
 EMLST=
 .for _e in ${EMS}
@@ -52,10 +51,14 @@ ldemul-list.h:
 stringify.sed:
        ${LN} -sf ${SRCDIR}/ld/emultempl/astring.sed ${.TARGET}
 
-ld222.1: ${SRCDIR}/ld/ld.1
+${MFILE}: ${SRCDIR}/ld/ld.1
        cp ${.ALLSRC} ${.TARGET}
 
-CLEANFILES+=   ld222.1
+CLEANFILES+=   ${MFILE}
+
+.if defined(IS_PRIMARY)
+MLINKS+=       ${MFILE} ld.1
+.endif
 
 afterinstall: install-ldscripts
 
index 9f43414..07e425b 100644 (file)
@@ -1,15 +1,20 @@
+.include "../Makefile.inc1"
 .include "../Makefile.bu"
 
 .PATH: ${SRCDIR}/binutils ${SRCDIR}/binutils/doc
 
 PROG=  nm
-MAN=   nm222.1
-MLINKS+=nm222.1 nm.1
+MFILE= nm${MANPAGEVER}.1
+MAN=   ${MFILE}
 WARNS= 2
 
-nm222.1: ${SRCDIR}/binutils/doc/nm.1
+${MFILE}: ${SRCDIR}/binutils/doc/nm.1
        cp ${.ALLSRC} ${.TARGET}
 
-CLEANFILES+=   nm222.1
+CLEANFILES+=   ${MFILE}
+
+.if defined(IS_PRIMARY)
+MLINKS+=       ${MFILE} nm.1
+.endif
 
 .include <bsd.prog.mk>
index a81fd99..47e29cc 100644 (file)
@@ -1,16 +1,21 @@
+.include "../Makefile.inc1"
 .include "../Makefile.bu"
 
 .PATH: ${SRCDIR}/binutils ${SRCDIR}/binutils/doc
 
 PROG=  objcopy
 SRCS=  not-strip.c objcopy.c
-MAN=   objcopy222.1
-MLINKS+=objcopy222.1 objcopy.1
+MFILE= objcopy${MANPAGEVER}.1
+MAN=   ${MFILE}
 WARNS= 1
 
-objcopy222.1: ${SRCDIR}/binutils/doc/objcopy.1
+${MFILE}: ${SRCDIR}/binutils/doc/objcopy.1
        cp ${.ALLSRC} ${.TARGET}
 
-CLEANFILES+=   objcopy222.1
+CLEANFILES+=   ${MFILE}
+
+.if defined(IS_PRIMARY)
+MLINKS+=       ${MFILE} objcopy.1
+.endif
 
 .include <bsd.prog.mk>
index 9524d3a..a2a003e 100644 (file)
@@ -1,11 +1,12 @@
+.include "../Makefile.inc1"
 .include "../Makefile.bu"
 
 .PATH: ${SRCDIR}/binutils ${SRCDIR}/binutils/doc
 
 PROG=  objdump
 SRCS=  elfcomm.c objdump.c
-MAN=   objdump222.1
-MLINKS+=objdump222.1 objdump.1
+MFILE= objdump${MANPAGEVER}.1
+MAN=   ${MFILE}
 WARNS= 1
 
 CFLAGS+= -DOBJDUMP_PRIVATE_VECTORS=""
@@ -13,9 +14,13 @@ CFLAGS+= -DOBJDUMP_PRIVATE_VECTORS=""
 DPADD+=        ${.OBJDIR}/../libopcodes/libopcodes.a
 LDADD+=        ${.OBJDIR}/../libopcodes/libopcodes.a
 
-objdump222.1: ${SRCDIR}/binutils/doc/objdump.1
+${MFILE}: ${SRCDIR}/binutils/doc/objdump.1
        cp ${.ALLSRC} ${.TARGET}
 
-CLEANFILES+=   objdump222.1
+CLEANFILES+=   ${MFILE}
+
+.if defined(IS_PRIMARY)
+MLINKS+=       ${MFILE} objdump.1
+.endif
 
 .include <bsd.prog.mk>
index 90cd25e..c93851b 100644 (file)
@@ -1,17 +1,22 @@
+.include "../Makefile.inc1"
 .include "../Makefile.bu"
 
 .PATH: ${SRCDIR}/binutils ${SRCDIR}/binutils/doc
 
 PROG=  ranlib
 SRCS=  ar.c is-ranlib.c
-MAN=   ranlib222.1
-MLINKS+=ranlib222.1 ranlib.1
+MFILE= ranlib${MANPAGEVER}.1
+MAN=   ${MFILE}
 
 NOSHARED?= yes
 
-ranlib222.1: ${SRCDIR}/binutils/doc/ranlib.1
+${MFILE}: ${SRCDIR}/binutils/doc/ranlib.1
        cp ${.ALLSRC} ${.TARGET}
 
-CLEANFILES+=   ranlib222.1
+CLEANFILES+=   ${MFILE}
+
+.if defined(IS_PRIMARY)
+MLINKS+=       ${MFILE} ranlib.1
+.endif
 
 .include <bsd.prog.mk>
index bc18e94..12dd662 100644 (file)
@@ -1,16 +1,21 @@
+.include "../Makefile.inc1"
 .include "../Makefile.bu"
 
 .PATH: ${SRCDIR}/binutils ${SRCDIR}/binutils/doc
 
 PROG=  readelf
 SRCS=  readelf.c unwind-ia64.c dwarf.c elfcomm.c
-MAN=   readelf222.1
-MLINKS+=readelf222.1 readelf.1
+MFILE= readelf${MANPAGEVER}.1
+MAN=   ${MFILE}
 WARNS= 1
 
-readelf222.1: ${SRCDIR}/binutils/doc/readelf.1
+${MFILE}: ${SRCDIR}/binutils/doc/readelf.1
        cp ${.ALLSRC} ${.TARGET}
 
-CLEANFILES+=   readelf222.1
+CLEANFILES+=   ${MFILE}
+
+.if defined(IS_PRIMARY)
+MLINKS+=       ${MFILE} readelf.1
+.endif
 
 .include <bsd.prog.mk>
index de92b95..db9b51b 100644 (file)
@@ -1,15 +1,20 @@
+.include "../Makefile.inc1"
 .include "../Makefile.bu"
 
 .PATH: ${SRCDIR}/binutils ${SRCDIR}/binutils/doc
 
 PROG=  size
-MAN=   size222.1
-MLINKS+=size222.1 size.1
+MFILE= size${MANPAGEVER}.1
+MAN=   ${MFILE}
 WARNS= 2
 
-size222.1: ${SRCDIR}/binutils/doc/size.1
+${MFILE}: ${SRCDIR}/binutils/doc/size.1
        cp ${.ALLSRC} ${.TARGET}
 
-CLEANFILES+=   size222.1
+CLEANFILES+=   ${MFILE}
+
+.if defined(IS_PRIMARY)
+MLINKS+=       ${MFILE} size.1
+.endif
 
 .include <bsd.prog.mk>
index 958ed71..09f68c2 100644 (file)
@@ -1,15 +1,20 @@
+.include "../Makefile.inc1"
 .include "../Makefile.bu"
 
 .PATH: ${SRCDIR}/binutils ${SRCDIR}/binutils/doc
 
 PROG=  strings
-MAN=   strings222.1
-MLINKS+=strings222.1 strings.1
+MFILE= strings${MANPAGEVER}.1
+MAN=   ${MFILE}
 WARNS= 2
 
-strings222.1: ${SRCDIR}/binutils/doc/strings.1
+${MFILE}: ${SRCDIR}/binutils/doc/strings.1
        cp ${.ALLSRC} ${.TARGET}
 
-CLEANFILES+=   strings222.1
+CLEANFILES+=   ${MFILE}
+
+.if defined(IS_PRIMARY)
+MLINKS+=       ${MFILE} strings.1
+.endif
 
 .include <bsd.prog.mk>
index 20264e8..80496b1 100644 (file)
@@ -1,11 +1,12 @@
+.include "../Makefile.inc1"
 .include "../Makefile.bu"
 
 .PATH: ${SRCDIR}/binutils ${SRCDIR}/binutils/doc
 
 PROG=  strip
 SRCS=  objcopy.c is-strip.c
-MAN=   strip222.1
-MLINKS+=strip222.1 strip.1
+MFILE= strip${MANPAGEVER}.1
+MAN=   ${MFILE}
 WARNS= 1
 
 CLEANFILES+=   maybe_stripped
@@ -20,10 +21,14 @@ maybe_stripped: strip
 .endif
 .endif
 
-strip222.1: ${SRCDIR}/binutils/doc/strip.1
+${MFILE}: ${SRCDIR}/binutils/doc/strip.1
        cp ${.ALLSRC} ${.TARGET}
 
-CLEANFILES+=   strip222.1
+CLEANFILES+=   ${MFILE}
+
+.if defined(IS_PRIMARY)
+MLINKS+=       ${MFILE} strip.1
+.endif
 
 realinstall:
        ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \