# A Makefile for the BSD source tree.
# @(#)bsd.prog.mk 5.6 (Berkeley) %G%
# BINDIR, BINGRP, BINMODE, BINOWN
# binary target directory, group, mode, owner
# list of files to be removed for the target clean; used,
# for example, to specify .c's produced from .y's.
# LDLIB the list of libraries that the program loads, in the format
# expected by the loader.
# LINKS list of binary links of the form "link target link target";
# for example, "/bin/[ /usr/bin/test" would link /bin/[ to
# /usr/bin/test"; not particularly labor saving, but prevents
# needing your own install target.
# manual page installation directory, mode
# MLINKS list of man page links of the form "link target link target",
# with some trickiness so the suffix specifies the directory to
# use. For example, "a.1 b.2 c.3 d.4" would link ${MANDIR}1/a.0
# to ${MANDIR}2/b.0 and ${MANDIR}3/c.0 to ${MANDIR}4/d.0.
# objects share strings using ${XSTR}
# SRCS list of .c sources if the program has multiple files.
# SRCLIB the list of libraries that the program depends on; normally
# from the LIB* list in this file.
# STDALL standard all target
# standard cleandir target
# standard install target
# STDTAGS standard tags target
# permit a hierarchy of Makefile include files
.if exists
(..
/Make.
include)
.
include "../Make.include"
# name of the dependency file
LIBCOMPAT
= /usr
/lib
/libcompat.a
LIBDES
= /usr
/lib
/libdes.a
LIBKRB
= /usr
/lib
/libkrb.a
LIBUTIL
= /usr
/lib
/libutil.a
# read-only version of standard .c.o rule
${CC} ${CFLAGS} -c
-R
${.IMPSRC
}
# if the user defines SHAREDSTRINGS, they want objects to share strings.
# Turn off parallel makes (the strings file is single threaded) and
# rewrite the .c.o rule to use XSTR to build the objects.
.if defined
(SHAREDSTRINGS
)
${CC} -E
${CFLAGS} ${.IMPSRC
} |
${XSTR} -c
-
@
${CC} ${CFLAGS} -c x.c
-o
${.TARGET
}
# manual pages -- if the Makefile doesn't specify one, assume that they're
# named in a standard way, i.e. it's in section 1 with the same name as the
MANALL
= ${MAN1} ${MAN2} ${MAN3} ${MAN4} ${MAN5} ${MAN6} ${MAN7} ${MAN8}
# In the BSD source tree, each program Makefile should specify PROG, the
# if the program is composed of several object modules, the modules are
# the list of sources with the .o's translated to .c's.
.if
!defined
(MAN1
) && !defined
(MAN2
) && !defined
(MAN3
) && !defined
(MAN4
) && \
!defined
(MAN5
) && !defined
(MAN6
) && !defined
(MAN7
) && !defined
(MAN8
)
${PROG}: ${OBJS} ${LIBC} ${SRCLIB}
${CC} ${LDFLAGS} -o
${.TARGET
} ${OBJS} ${LDLIB}
for entry in
${.ALLSRC
}; do \
`${CPP} -M ${CFLAGS:M-[ID]*} ${.INCLUDES} $$entry`; \
.if
!defined
(MAN1
) && !defined
(MAN2
) && !defined
(MAN3
) && !defined
(MAN4
) && \
!defined
(MAN5
) && !defined
(MAN6
) && !defined
(MAN7
) && !defined
(MAN8
)
${PROG}: ${SRCS} ${LIBC} ${SRCLIB}
${CC} ${CFLAGS} -o
${.TARGET
} ${CURDIR}/${SRCS} ${LDLIB}
`${CPP} -M ${CFLAGS:M-[ID]*} ${.INCLUDES} ${.ALLSRC}` \
rm -f a.out Errs errs mklog core
${CLEANFILES} ${PROG} ${OBJS}
rm -f
${MANALL} ${TAGSFILE} ${DEPENDFILE}
cleandir
: clean STDCLEANDIR
lint
${LINTFLAGS} ${CFLAGS} ${.ALLSRC
}
MANDIR?
= /usr
/share
/man
/cat
# install target -- creates manual pages, then installs the binaries,
# links, manual pages, and manual page links.
install ${STRIP} -o
${BINOWN} -g
${BINGRP} -m
${BINMODE} \
${PROG} ${DESTDIR}${BINDIR}
install -c
-o
${BINOWN} -g
${BINGRP} -m
${MANMODE} ${MAN1} \
install -c
-o
${BINOWN} -g
${BINGRP} -m
${MANMODE} ${MAN2} \
install -c
-o
${BINOWN} -g
${BINGRP} -m
${MANMODE} ${MAN3} \
install -c
-o
${BINOWN} -g
${BINGRP} -m
${MANMODE} ${MAN4} \
install -c
-o
${BINOWN} -g
${BINGRP} -m
${MANMODE} ${MAN5} \
install -c
-o
${BINOWN} -g
${BINGRP} -m
${MANMODE} ${MAN6} \
install -c
-o
${BINOWN} -g
${BINGRP} -m
${MANMODE} ${MAN7} \
install -c
-o
${BINOWN} -g
${BINGRP} -m
${MANMODE} ${MAN8} \
while
test $$# -ge 2; do \
ln
${DESTDIR}$$l ${DESTDIR}$$t; \
while
test $$# -ge 2; do \
dir=${MANDIR}`expr $$name : '[^\.]*\.\(.*\)'`; \
t
=${DESTDIR}$${dir}/`expr $$name : '\([^\.]*\)'`.0; \
dir=${MANDIR}`expr $$name : '[^\.]*\.\(.*\)'`; \
l
=${DESTDIR}$${dir}/`expr $$name : '\([^\.]*\)'`.0; \
install: ${MANALL} STDINSTALL