Import of pkgsrc-2013Q2

This commit is contained in:
2013-09-26 17:14:40 +02:00
commit 785076ae39
74991 changed files with 4380255 additions and 0 deletions

71
pkgtools/Makefile Normal file
View File

@@ -0,0 +1,71 @@
# $NetBSD: Makefile,v 1.104 2012/08/26 10:31:39 wiz Exp $
#
COMMENT= Tools for use in the packages collection
SUBDIR+= autoswc
SUBDIR+= binpatch
SUBDIR+= bootstrap-extras
SUBDIR+= bootstrap-mk-files
SUBDIR+= cdpack
SUBDIR+= compat_headers
SUBDIR+= createbuildlink
SUBDIR+= dfdisk
SUBDIR+= digest
SUBDIR+= distbb
SUBDIR+= genrpm
SUBDIR+= gensolpkg
SUBDIR+= gnome-packagekit
SUBDIR+= libkver
SUBDIR+= libnbcompat
SUBDIR+= lintpkgsrc
SUBDIR+= mksandbox
SUBDIR+= mtree
SUBDIR+= nih
SUBDIR+= osabi
SUBDIR+= p5-pkgsrc-Dewey
SUBDIR+= packagekit
SUBDIR+= pbulk
SUBDIR+= pbulk-base
SUBDIR+= pkg_alternatives
SUBDIR+= pkg_chk
SUBDIR+= pkg_comp
SUBDIR+= pkg_distinst
SUBDIR+= pkg_filecheck
SUBDIR+= pkg_install
SUBDIR+= pkg_install-info
SUBDIR+= pkg_leaves
SUBDIR+= pkg_notify
SUBDIR+= pkg_online-client
SUBDIR+= pkg_online-server
SUBDIR+= pkg_p5up2date
SUBDIR+= pkg_regress
SUBDIR+= pkg_rolling-replace
SUBDIR+= pkg_select
SUBDIR+= pkg_summary-utils
SUBDIR+= pkg_tarup
SUBDIR+= pkgclean
SUBDIR+= pkgdep
SUBDIR+= pkgdepgraph
SUBDIR+= pkgdiff
SUBDIR+= pkgfind
SUBDIR+= pkgin
SUBDIR+= pkglint
SUBDIR+= pkgse
SUBDIR+= pkgsrc-todo
SUBDIR+= pkgsurvey
SUBDIR+= port2pkg
#SUBDIR+= prereq-readme # Only used by the README.html generation
SUBDIR+= rc.subr
SUBDIR+= rcorder
SUBDIR+= rdigest
SUBDIR+= revbump
SUBDIR+= rpm2pkg
SUBDIR+= shlock
SUBDIR+= tinderbox-dragonfly
SUBDIR+= url2pkg
SUBDIR+= verifypc
SUBDIR+= x11-links
SUBDIR+= xpkgwedge
.include "../mk/misc/category.mk"

3
pkgtools/autoswc/DESCR Normal file
View File

@@ -0,0 +1,3 @@
autoswc is an utility that automatically generates system wide cache files
for use with configure scripts created by GNU autoconf, and specially by
those executed within pkgsrc.

67
pkgtools/autoswc/Makefile Normal file
View File

@@ -0,0 +1,67 @@
# $NetBSD: Makefile,v 1.19 2012/09/11 23:19:33 asau Exp $
DISTNAME= autoswc-1.6
CATEGORIES= pkgtools sysutils
MASTER_SITES= # empty
DISTFILES= # empty
MAINTAINER= jmmv@NetBSD.org
COMMENT= Generates system wide cache files for GNU autoconf
DEPENDS+= autoconf>=2.59:../../devel/autoconf
DEPENDS+= automake>=1.8.2:../../devel/automake
DEPENDS+= libtool-base>=1.5.2:../../devel/libtool-base
NO_CONFIGURE= YES
WRKSRC= ${WRKDIR}
PKG_SYSCONFSUBDIR= autoswc
CACHEDIR= /var/db/autoswc
MKCONF= /etc/mk.conf
OWN_DIRS= ${CACHEDIR}
EVAL_PREFIX+= PREFIX.autoconf=autoconf
PREFIX.autoconf_DEFAULT= ${LOCALBASE}
EVAL_PREFIX+= PREFIX.automake=automake
PREFIX.automake_DEFAULT= ${LOCALBASE}
EVAL_PREFIX+= PREFIX.libtool=libtool
PREFIX.libtool_DEFAULT= ${LOCALBASE}
SUBST_CLASSES+= build
SUBST_MESSAGE.build= Building autoswc.
SUBST_STAGE.build= do-build
SUBST_FILES.build= autoswc
SUBST_FILES.build+= autoswc.8
SUBST_FILES.build+= autoswc.mk
SUBST_FILES.build+= config.site
SUBST_SED.build= -e 's|@ACLOCAL@|${PREFIX.automake}/bin/aclocal|g'
SUBST_SED.build+= -e 's|@AUTOCONF@|${PREFIX.autoconf}/bin/autoconf|g'
SUBST_SED.build+= -e 's|@AUTOMAKE@|${PREFIX.automake}/bin/automake|g'
SUBST_SED.build+= -e 's|@CACHEDIR@|${CACHEDIR}|g'
SUBST_SED.build+= -e 's|@LIBTOOLIZE@|${PREFIX.libtool}/bin/libtoolize|g'
SUBST_SED.build+= -e 's|@MACHINE_GNU_PLATFORM@|${MACHINE_GNU_PLATFORM}|g'
SUBST_SED.build+= -e 's|@MAKE@|${MAKE}|g'
SUBST_SED.build+= -e 's|@MKCONF@|${MKCONF}|g'
SUBST_SED.build+= -e 's|@PREFIX@|${PREFIX}|g'
SUBST_SED.build+= -e 's|@SH@|${SH}|g'
SUBST_SED.build+= -e 's|@SYSCONFDIR@|${PKG_SYSCONFDIR}|g'
INSTALLATION_DIRS= ${PKGMANDIR}/man8 sbin share/autoswc
do-extract:
${CP} ${FILESDIR}/autoswc.8 ${WRKSRC}
${CP} ${FILESDIR}/autoswc.mk ${WRKSRC}
${CP} ${FILESDIR}/autoswc.sh ${WRKSRC}/autoswc
${CP} ${FILESDIR}/config.site ${WRKSRC}
do-build:
@${DO_NADA}
do-install:
${INSTALL_SCRIPT} ${WRKSRC}/autoswc ${DESTDIR}${PREFIX}/sbin
${INSTALL_DATA} ${WRKSRC}/autoswc.8 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man8
${INSTALL_DATA} ${WRKSRC}/autoswc.mk ${DESTDIR}${PREFIX}/share/autoswc
${INSTALL_DATA} ${WRKSRC}/config.site ${DESTDIR}${PREFIX}/share/autoswc
${INSTALL_DATA} ${FILESDIR}/configure.ac ${DESTDIR}${PREFIX}/share/autoswc
.include "../../mk/bsd.pkg.mk"

6
pkgtools/autoswc/PLIST Normal file
View File

@@ -0,0 +1,6 @@
@comment $NetBSD: PLIST,v 1.2 2009/06/14 18:11:01 joerg Exp $
man/man8/autoswc.8
sbin/autoswc
share/autoswc/autoswc.mk
share/autoswc/config.site
share/autoswc/configure.ac

View File

@@ -0,0 +1,130 @@
.\" $NetBSD: autoswc.8,v 1.1.1.1 2004/02/21 23:28:36 jmmv Exp $
.\"
.\" autoswc - Generates system wide cache files for GNU autoconf
.\" Copyright (c) 2004 Julio M. Merino Vidal <jmmv@NetBSD.org>
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Neither the name of The NetBSD Foundation nor the names of its
.\" contributors may be used to endorse or promote products derived
.\" from this software without specific prior written permission.
.\" 3. Neither the name of author nor the names of its contributors may
.\" be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd February 21, 2004
.Dt AUTOSWC 8
.Os
.Sh NAME
.Nm autoswc
.Nd generates system wide cache files for GNU autoconf
.Sh SYNOPSIS
.Nm
.Op Fl c Ar ac_file
.Op Fl n Ar cache_name
.Sh DESCRIPTION
.Nm
is an utility that automatically generates system wide cache files for use
with configure scripts created by
.Nm GNU autoconf ,
and specially by those executed within
.Nm pkgsrc .
.Pp
.Nm
starts by reading the configuration script template.
It will use
.Pa @SYSCONFDIR@/configure.ac
if found, or fallback to
.Pa @PREFIX@/share/autoswc/configure.ac
otherwise (a custom file may be given using the
.Fl c
flag, though).
This issues all checks that the user wants to store in the system wide
cache file, and are basically calls to standard
.Nm GNU autoconf ,
.Nm GNU automake
and/or
.Nm GNU libtool
macros.
There is no need to manually execute any of the
.Sq AC_INIT ,
.Sq AM_INIT_AUTOMAKE ,
.Sq AC_CACHE_SAVE
and
.Sq AC_OUTPUT
macros, as they are automatically inserted in the right place during
execution.
.Pp
The default cache file is stored inside the
.Pa @CACHEDIR@
directory, using
.Pa config.cache.default
as the file name.
The
.Sq default
part can be changed using the
.Fl n
flag, which takes the base name of the cache file.
.Pp
To tell
.Nm pkgsrc
to use the system wide cache, all you need to do is append the following
line to your
.Pa @MKCONF@
file:
.Bd -literal -offset indent
\&.sinclude "@PREFIX@/share/autoswc/autoswc.mk"
.Ed
.Pp
In case you used the
.Fl n
flag, you also need to define the
.Va AUTOSWC_CACHE_NAME
variable in this file, setting it to the value passed to the flag.
.Sh NOTES
Be very careful about what you add to
.Pa configure.ac .
You should only check for things that are unlikely to change over time,
as functions in the
.Lb libc
and its header files.
Failure to do so can easily lead to cache files that get outdated very
easily during installation of new packages, and cause unexpected
configuration errors.
.Pp
It is recommended that you rebuild the cache file periodically.
You can configure a simple
.Xr cron 8
job to it, which just needs to launch this utility.
.Pp
If you hit a compilation problem in any package when using
.Nm ,
be
.Em absolutely
sure it is not beeing caused by an outdated cache before reporting
problems.
The safest and easiest way to do this is to clean the package in question
and restart the build with the
.Va AUTOSWC_DISABLE
variable set, like in the following example:
.Bd -literal -offset indent
$ @MAKE@ clean
$ @MAKE@ AUTOSWC_DISABLE=YES
.Ed
.Sh AUTHORS
.An Julio M. Merino Vidal Aq jmmv@netbsd.org

View File

@@ -0,0 +1,50 @@
# $NetBSD: autoswc.mk,v 1.1.1.1 2004/02/21 23:28:36 jmmv Exp $
#
# autoswc - Generates system wide cache files for GNU autoconf
# Copyright (c) 2004 Julio M. Merino Vidal <jmmv@NetBSD.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name of author nor the names of its contributors may
# be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
.if !defined(AUTOSWC_MK)
AUTOSWC_MK= # defined
. if !defined(AUTOSWC_DISABLE)
AUTOSWC_CACHE_FILE?= @CACHEDIR@/config.cache.${AUTOSWC_CACHE_NAME}
AUTOSWC_CACHE_NAME?= default
. if exists(@SYSCONFDIR@/config.site)
AUTOSWC_CONFIG_SITE?= @SYSCONFDIR@/config.site
. else
AUTOSWC_CONFIG_SITE?= @PREFIX@/share/autoswc/config.site
. endif
CONFIGURE_ENV+= AUTOSWC_CACHE_FILE="${AUTOSWC_CACHE_FILE}"
CONFIGURE_ENV+= AUTOSWC_CACHE_NAME="${AUTOSWC_CACHE_NAME}"
CONFIGURE_ENV+= CONFIG_SITE="${AUTOSWC_CONFIG_SITE}"
. endif
.endif # AUTOSWC_MK

View File

@@ -0,0 +1,210 @@
#!@SH@
#
# $NetBSD: autoswc.sh,v 1.3 2008/10/11 18:03:58 jmmv Exp $
#
# autoswc - Generates system wide cache files for GNU autoconf
# Copyright (c) 2004 Julio M. Merino Vidal <jmmv@NetBSD.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name of author nor the names of its contributors may
# be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
ProgName=${0##*/}
err() {
echo "${ProgName}: $*" 1>&2
exit 1
}
info() {
echo "${ProgName}: $*" 1>&2
}
mktempdir() {
local d tmpdir
# Check if mktemp exists in the current system.
for d in $(echo ${PATH} | tr ':' ' '); do
if [ -x $d/mktemp ]; then
$d/mktemp -d /tmp/autoswc.XXXX
return
fi
done
# Emulate mktemp; this is not safe.
info "mktemp(1) not found; race conditions may appear"
tmpdir=/tmp/autoswc.$$
mkdir -p ${tmpdir}
chmod 700 ${tmpdir}
echo ${tmpdir}
}
usage() {
echo "Usage: ${ProgName} [-c ac_file] [-n cache_name]" 1>&2
exit 1
}
# -------------------------------------------------------------------------
# Main program
cachename="default"
confsrc="@PREFIX@/share/autoswc/configure.ac"
[ -f "@SYSCONFDIR@/configure.ac" ] && confsrc="@SYSCONFDIR@/configure.ac"
# Parse command line options
args=$(getopt c:n: $*)
[ $? -ne 0 ] && usage
set -- ${args}
while [ $# -gt 0 ]; do
case "$1" in
-c)
confsrc="$2"; shift
;;
-n)
cachename="$2"; shift
;;
--)
shift; break
;;
esac
shift
done
[ $# -gt 0 ] && usage
# Set the cache name.
confcache="@CACHEDIR@/config.cache.${cachename}"
# Check if we will be able to store the resulting cache file.
# The permissions may change during the execution of this script, but this
# won't bring us problems. This check is just done to save some time in
# case we got the wrong user running autoswc.
touch ${confcache} >/dev/null 2>&1 || err "can't update ${confcache}"
# Ensure that the source configure.ac exists.
[ ! -f ${confsrc} ] && err "${confsrc} does not exist"
# Create work directory.
wrkdir=$(mktempdir)
info "using ${wrkdir} as work directory"
cd ${wrkdir}
# Create work project. This includes:
# - Makefile.am - empty, just needs to be present.
# - configure.ac - the user-defined configure.ac file, modified to include
# basic and required macros.
# - NEWS README AUTHORS ChangeLog - empty, just need to be present.
echo "# empty" >Makefile.am
echo "AC_INIT(configure.ac, 1)" >configure.ac
echo "AM_INIT_AUTOMAKE" >>configure.ac
cat ${confsrc} >>configure.ac
echo "AC_CACHE_SAVE" >>configure.ac
echo "AC_OUTPUT(Makefile)" >>configure.ac
touch NEWS README AUTHORS ChangeLog
# Generate scripts and add missing files.
info "running @ACLOCAL@..."
@ACLOCAL@
if grep LIBTOOL configure.ac >/dev/null 2>&1; then
info "running @LIBTOOLIZE@..."
@LIBTOOLIZE@ --force
fi
info "running @AUTOMAKE@..."
@AUTOMAKE@ --add-missing --force-missing
info "running @AUTOCONF@..."
@AUTOCONF@
# Run the configure script.
[ ! -f configure ] && err "autoconf failed"
CONFIG_SITE= ./configure --cache-file=config.cache \
--build=@MACHINE_GNU_PLATFORM@ --host=@MACHINE_GNU_PLATFORM@ || \
err "configure failed"
mv config.cache config.cache.in
# Prune the cache file from entries that will abort configure scripts when
# running from within pkgsrc. This is not 100% safe, because configure is
# right in warning from changed values, but is needed to get this working.
grep -v "^ac_cv_env" <config.cache.in >config.cache
# Update the cache file. We don't give it write permissions since we don't
# want third-party configure scripts update it with unwanted results.
install -c -m 444 config.cache ${confcache} || err "can't update ${confcache}"
cd -
rm -rf ${wrkdir}
# Start of summary.
cat <<EOF
===========================================================================
AUTOSWC - SUMMARY FOR \`${cachename}' CACHE
${confcache} updated successfully.
EOF
# Warn the user if autoswc.mk is not included from mk.conf.
if ! egrep '^.-?[ \t]*s?include[ \t]+"@PREFIX@/share/autoswc/autoswc.mk"' \
@MKCONF@ >/dev/null 2>&1; then
cat <<EOF
The @MKCONF@ file seems to not include autoswc.mk. This means that
configure scripts will not find the generated cache file. Add the
following line to it:
.sinclude "@PREFIX@/share/autoswc/autoswc.mk"
EOF
fi
# Tell the user to define AUTOSWC_CACHE_NAME if he used a custom cache
# name.
if [ ${cachename} != default ]; then
cat <<EOF
You have used a non-standard cache name. To let configure scripts
find it, you should add the following line somewhere in your
@MKCONF@ file, in case it is not there yet:
AUTOSWC_CACHE_NAME= ${cachename}
EOF
fi
# Warn the user about the dangers of using a system wide cache file.
cat <<EOF
Please remember that by using a system wide cache file, you assume
that the results stored in it may get outdated and cause strange build
failures in third-party packages. When reporting bugs, be absolutely
sure it is not your fault. Check the autoswc(8) manpage for more
details.
===========================================================================
EOF
exit 0
# vim: syntax=sh:expandtab:shiftwidth=4:softtabstop=4

View File

@@ -0,0 +1,41 @@
# $NetBSD: config.site,v 1.1.1.1 2004/02/21 23:28:36 jmmv Exp $
#
# autoswc - Generates system wide cache files for GNU autoconf
# Copyright (c) 2004 Julio M. Merino Vidal <jmmv@NetBSD.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name of author nor the names of its contributors may
# be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# Set default values.
: ${AUTOSWC_CACHE_NAME:=default}
: ${AUTOSWC_CACHE_FILE:=@CACHEDIR@/config.cache.${AUTOSWC_CACHE_NAME}}
# Set which cache file to use, if not already set.
if test "${cache_file}" = /dev/null; then
cache_file="${AUTOSWC_CACHE_FILE}"
fi
# vim: syntax=sh:expandtab:shiftwidth=4:softtabstop=4

View File

@@ -0,0 +1,304 @@
dnl $NetBSD: configure.ac,v 1.5 2004/10/25 20:58:05 tv Exp $
dnl -----------------------------------------------------------------------
dnl Check for host details.
AC_CANONICAL_HOST
dnl -----------------------------------------------------------------------
dnl Check for compilers and preprocessors.
AC_PROG_CC
AC_PROG_CPP
AC_PROG_CXX
AC_PROG_CXXCPP
dnl -----------------------------------------------------------------------
dnl Check for libtool and the maximum command line length supported by the
dnl system, as this takes a long time.
AM_PROG_LIBTOOL
AC_LIBTOOL_SYS_MAX_CMD_LEN
dnl -----------------------------------------------------------------------
dnl Check for compiler features.
AC_C_BACKSLASH_A
AC_C_BIGENDIAN
AC_C_CONST
AC_C_RESTRICT
AC_C_VOLATILE
AC_C_INLINE
AC_C_CHAR_UNSIGNED
AC_C_LONG_DOUBLE
AC_C_STRINGIZE
AC_C_PROTOTYPES
AC_PROG_CC_C_O
AC_PROG_GCC_TRADITIONAL
dnl -----------------------------------------------------------------------
dnl Check for standard header files.
AC_HEADER_DIRENT
AC_HEADER_MAJOR
AC_HEADER_STAT
AC_HEADER_STDBOOL
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_HEADER_TIME
AC_HEADER_TIOCGWINSZ
AC_CHECK_HEADERS([sys/cdefs.h \
sys/param.h \
sys/types.h \
sys/file.h \
sys/ioctl.h \
sys/mount.h \
sys/resource.h \
sys/socket.h \
sys/stat.h \
sys/statvfs.h \
sys/sysctl.h \
sys/times.h \
sys/utsname.h \
sys/varargs.h \
sys/vfs.h \
netinet/in.h \
argz.h \
assert.h \
ctype.h \
err.h \
fcntl.h \
fstab.h \
grp.h \
inttypes.h \
libgen.h \
limits.h \
malloc.h \
mntent.h \
mount.h \
paths.h \
signal.h \
stdarg.h \
stddef.h \
stdint.h \
strings.h \
util.h \
varargs.h \
wctype.h],,,
[[#if HAVE_SYS_CDEFS_H
# include <sys/cdefs.h>
#endif
#if HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif]])
AC_LANG_PUSH(C++)
AC_CHECK_HEADERS([bitset \
deque \
fstream \
iostream \
list \
map \
queue \
set \
stack \
string \
vector])
AC_LANG_POP(C++)
dnl -----------------------------------------------------------------------
dnl Check for standard functions.
AC_FUNC_ALLOCA
AC_FUNC_CHOWN
AC_FUNC_CLOSEDIR_VOID
AC_FUNC_ERROR_AT_LINE
AC_FUNC_FORK
AC_FUNC_FSEEKO
AC_FUNC_GETGROUPS
AC_FUNC_GETMNTENT
AC_FUNC_GETPGRP
AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
AC_FUNC_MALLOC
AC_FUNC_MEMCMP
AC_FUNC_MBRTOWC
AC_FUNC_MKTIME
AC_FUNC_MMAP
AC_FUNC_OBSTACK
AC_FUNC_REALLOC
AC_FUNC_SELECT_ARGTYPES
AC_FUNC_SETPGRP
AC_FUNC_STAT
AC_FUNC_LSTAT
AC_FUNC_SETVBUF_REVERSED
AC_FUNC_STRCOLL
AC_FUNC_STRTOD
AC_FUNC_STRERROR_R
AC_FUNC_STRFTIME
AC_FUNC_STRNLEN
AC_FUNC_UTIME_NULL
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([__argz_count \
__argz_next \
__argz_stringify \
__fsetlocking \
asprintf \
basename \
bzero \
confstr \
connect \
dirname \
dup2 \
err \
errx \
feof_unlocked \
fgets_unlocked \
fnmatch \
getc_unlocked \
getcwd \
getdelim \
getdtablesize \
getegid \
geteuid \
getgid \
getmode \
getprogname \
getrlimit \
getrusage \
gettimeofday \
getuid \
inet_pton \
isascii \
isblank \
isdigit \
isgraph \
isinf \
isprint \
isspace \
isxdigit \
killpg \
lockf \
lseek64 \
lstat \
memchr \
memcpy \
memmove \
memset \
mempcpy \
mmap \
mkdir \
mkfifo \
mkstemp \
mkstemps \
mktemp \
munmap \
open64 \
pathconf \
poll \
putenv \
readdir_r \
readlink \
remove \
rename \
sbrk \
select \
setegid \
setenv \
seteuid \
setlinebuf \
setmode \
setprogname \
setresgid \
setresuid \
setvbuf \
shmat \
sigaction \
siginterrupt \
sigset \
snprintf \
socket \
statvfs \
stpcpy \
strcasecmp \
strchr \
strrchr \
strdup \
strerror \
stricmp \
strlcat \
strlcpy \
strncasecmp \
strncat \
strncpy \
strndup \
strpbrk \
strspn \
strstr \
strtol \
strtoll \
strtoul \
strtoull \
strtoimax \
strtoumax \
sysconf \
times \
tsearch \
ttyname \
tzset \
ulimit \
uname \
unsetenv \
utime \
utimes \
vasprintf \
vsnprintf \
waitpid \
wait3 \
warn \
warnx])
dnl -----------------------------------------------------------------------
dnl Check for standard types.
AC_CHECK_TYPES([gid_t,
int16_t,
int32_t,
int64_t,
int8_t,
intmax_t,
long long,
mode_t,
off_t,
ptrdiff_t,
quad_t,
rlim_t,
sig_t,
size_t,
ssize_t,
time_t,
u_int,
u_int16_t,
u_int32_t,
u_int64_t,
u_int8_t,
u_long,
u_quad_t,
uid_t,
uint16_t,
uint32_t,
uint64_t,
uint8_t,
uintmax_t,
unsigned long long])
dnl -----------------------------------------------------------------------
dnl Check for standard sizes.
AC_CHECK_SIZEOF(char)
AC_CHECK_SIZEOF(short)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(long long)
AC_CHECK_SIZEOF(float)
AC_CHECK_SIZEOF(double)
dnl vim: syntax=config:expandtab:shiftwidth=4:softtabstop=4

2
pkgtools/binpatch/DESCR Normal file
View File

@@ -0,0 +1,2 @@
Apply small, arbitrary binary patches using an arcane command line
syntax.

View File

@@ -0,0 +1,29 @@
# $NetBSD: Makefile,v 1.12 2012/09/11 23:19:33 asau Exp $
#
DISTNAME= binpatch-1.0
CATEGORIES= pkgtools
MASTER_SITES= # empty
DISTFILES= # empty
MAINTAINER= pkgsrc-users@NetBSD.org
HOMEPAGE= ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/doc/pkgsrc.html
COMMENT= Trivial binary patch applicator
.include "../../mk/bsd.prefs.mk"
INSTALLATION_DIRS= bin ${PKGMANDIR}/man1
do-extract:
@${CP} -R ${FILESDIR} ${WRKSRC}
do-build:
@(cd ${WRKSRC}; \
${ECHO} "${CC} -o binpatch binpatch.c"; \
${CC} -o binpatch binpatch.c )
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/binpatch ${DESTDIR}${PREFIX}/bin/binpatch
${INSTALL_MAN} ${WRKSRC}/binpatch.1 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man1
.include "../../mk/bsd.pkg.mk"

3
pkgtools/binpatch/PLIST Normal file
View File

@@ -0,0 +1,3 @@
@comment $NetBSD: PLIST,v 1.1.1.1 2004/07/23 03:37:26 atatat Exp $
bin/binpatch
man/man1/binpatch.1

View File

@@ -0,0 +1,116 @@
.\" $NetBSD: binpatch.1,v 1.1.1.1 2004/07/23 03:37:26 atatat Exp $
.\"
.\" Copyright (c) 2004 by Andrew Brown <atatat@netbsd.org>
.\" Absolutely no warranty.
.\"
.Dd July 20, 2004
.Dt BINPATCH 1
.Sh NAME
.Nm binpatch
.Nd trivial binary patch applicator
.Sh SYNOPSIS
.Nm
.Pa file=...
.Pa size=...
.Pa offset=...
.Pa compare=...
.Pa skip=...
.Pa replace=...
.Sh DESCRIPTION
The
.Nm
utility can read and replace a small section of a given file.
It is designed for use in those instances where a problem exists with
a given binary that cannot be reconstructed from source code, but the
required change can be implemented by replacing a few bytes in the
existing binary.
All arguments must be given.
.Sh EXAMPLES
Given a binary called
.Dq a.out
of 10713 bytes in size with the following text segment:
.Bd -literal -offset indent
% objdump -h a.out
.sp
a.out: file format elf32-i386
.sp
Sections:
Idx Name Size VMA LMA File off Algn
[...]
9 .text 00000be4 08048968 08048968 00000968 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
[...]
% objdump -d -j .text a.out
[...]
8048b0f: 83 ef 04 sub $0x4,%edi
8048b12: ff d0 call *%eax
8048b14: 83 fe ff cmp $0xffffffff,%esi
[...]
.sp
.Ed
where we wish to elide the call through
.Ar %eax
by replacing it with a series of
.Ar nop
(or
.Dq no operation )
instructions (the machine code for this on the i386 platform is 0x90),
we first calculate the offset into the file of the previous
.Ar sub
instruction. To do this, we take the address of the
.Ar sub
instruction as given by the dissassembly output, subtract the
.Dq LMA
and add the
.Dq File off
values from the objdump output (note that
.Xr bc 1
expects hexadecimal values to be given using upper case):
.Bd -literal -offset indent
% bc
ibase=16
8048B0F-08048968+00000968
2831
.sp
.Ed
The region of the binary we want to compare to before applying the
patch is the concatenation of the relevant machine codes from the
dissassembly dump (\c
.Ar 83ef04ffd083feff )
and the replacement is simply two
.Ar nop
instructions (\c
.Ar 9090 ) ,
that will replace the
.Ar ffd0
of the original call.
The offset of the replacement is 3, since that is the number of bytes
in the
.Ar sub
instruction.
From this we have our patch:
.Bd -literal -offset indent
% binpatch file=a.out size=10713 offset=2831 \\
compare=83ef04ffd083feff skip=3 replace=9090
% objdump -d -j .text a.out
[...]
8048b0f: 83 ef 04 sub $0x4,%edi
8048b12: 90 nop
8048b13: 90 nop
8048b14: 83 fe ff cmp $0xffffffff,%esi
[...]
.sp
.Ed
And thus the call is removed.
.Sh DIAGNOSTICS
The diagnostics are terse and almost unhelpful, but are more verbose
than users of
.Xr ed 1
might be used to.
They typically mention the command line argument that was in error.
.Sh SEE ALSO
.Xr bc 1 ,
.Xr objdump 1 ,
.Xr patch 1
.Sh AUTHORS
.An Andrew Brown Aq atatat@netbsd.org

View File

@@ -0,0 +1,174 @@
/* $NetBSD: binpatch.c,v 1.1.1.1 2004/07/23 03:37:26 atatat Exp $ */
/*
* ------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* Andrew Brown <atatat@NetBSD.org> wrote this file. As long as you
* retain this notice you can do whatever you want with this stuff.
* If we meet some day, and you think this stuff is worth it, you can
* buy me a beer in return.
* ------------------------------------------------------------------------
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static int
die(int rc, const char *msg)
{
if (rc)
perror(msg);
else
fprintf(stderr, "%s\n", msg);
exit(1);
}
static void
cvt(const char *s, const char *i, unsigned char *o, size_t l)
{
int t, x;
for (t = 0; t < l; t++) {
x = i[2 * t];
if (x >= '0' && x <= '9')
x -= '0';
else if (x >= 'a' && x <= 'f')
x -= 'a' - 10;
else if (x >= 'A' && x <= 'F')
x -= 'A' - 10;
else
die(0, s);
o[t] = x * 16;
x = i[2 * t + 1];
if (x >= '0' && x <= '9')
x -= '0';
else if (x >= 'a' && x <= 'f')
x -= 'a' - 10;
else if (x >= 'A' && x <= 'F')
x -= 'A' - 10;
else
die(0, s);
o[t] += x;
}
}
int
main(int argc, char *argv[])
{
struct stat st;
char *key, *value;
int f, i;
unsigned char *buf, *get, *put;
size_t lget, lput;
off_t sz, cmp_off, skip_off;
f = -1;
get = put = NULL;
lget = lput = 0;
sz = cmp_off = skip_off = -1;
while (--argc > 0) {
key = *++argv;
if ((value = strchr(key, '=')) == NULL)
die(0, "value required");
else
*value++ = '\0';
if (strcmp(key, "file") == 0) {
f = open(value, O_RDWR);
if (f == -1)
die(1, "file");
}
else if (strcmp(key, "size") == 0) {
char *t;
errno = 0;
sz = strtol(value, &t, 0);
if (errno != 0)
die(1, "size");
}
else if (strcmp(key, "offset") == 0) {
char *t;
errno = 0;
cmp_off = strtol(value, &t, 0);
if (errno != 0)
die(1, "offset");
}
else if (strcmp(key, "compare") == 0) {
lget = strlen(value);
if (lget % 2 != 0)
die(0, "compare");
lget /= 2;
get = malloc(lget);
buf = malloc(lget);
cvt("compare", value, get, lget);
}
else if (strcmp(key, "skip") == 0) {
char *t;
errno = 0;
skip_off = strtol(value, &t, 0);
if (errno != 0)
die(1, "offset");
}
else if (strcmp(key, "replace") == 0) {
lput = strlen(value);
if (lput % 2 != 0)
die(0, "replace");
lput /= 2;
put = malloc(lput);
cvt("replace", value, put, lput);
}
}
/*
* ./binpatch
* file=${MOZILLA_HOME}/netscape
* size=13823336
* offset=0x008073e9
* compare=6a00e82406a3ffe81f0ca3ff
* skip=2
* replace=9090909090
*/
if (f == -1)
die(0, "file missing");
if (get == NULL || lget == 0)
die(0, "compare missing");
if (put == NULL || lput == 0)
die(0, "replace missing");
if (sz == -1)
die(0, "size missing");
if (cmp_off == -1)
die(0, "offset missing");
if (skip_off == -1)
die(0, "skip missing");
if (skip_off < 0 ||
(skip_off == 0 && lput >= lget) ||
(skip_off > 0 && skip_off + lput > lget))
die(0, "illegal skip");
if (fstat(f, &st) == -1)
die(1, "fstat");
if (st.st_size != sz)
die(0, "wrong size");
if (lseek(f, cmp_off, SEEK_SET) == -1)
die(1, "lseek");
if (read(f, buf, lget) != lget)
die(1, "read");
if (memcmp(buf, get, lget) != 0)
die(0, "instructions not found");
if (lseek(f, cmp_off + skip_off, SEEK_SET) == -1)
die(1, "lseek");
if (write(f, put, lput) != lput)
die(1, "write");
if (close(f) != 0)
die(1, "close");
return (0);
}

View File

@@ -0,0 +1,2 @@
This package provides extra files and scripts needed to bootstrap pkgsrc
on this platform.

View File

@@ -0,0 +1,73 @@
# $NetBSD: Makefile,v 1.11 2012/09/11 23:19:34 asau Exp $
DISTNAME= bootstrap-extra-files-20070702
CATEGORIES= pkgtools
MASTER_SITES= # empty
DISTFILES= # empty
MAINTAINER= pkgsrc-users@NetBSD.org
COMMENT= Extra bootstrap files and scripts for ${OPSYS}
BOOTSTRAP_PKG= yes
NO_CONFIGURE= yes
NO_BUILD= yes
.include "../../mk/bsd.prefs.mk"
EXTRA_FILES= fakeldd mkdir strip xargs
PLIST_VARS+= ${EXTRA_FILES}
.PHONY: ${EXTRA_FILES:S/^/do-install-/}
NEED_FAKELDD= Haiku IRIX
.if !empty(NEED_FAKELDD:M${OPSYS})
PLIST.fakeldd= yes
do-install: do-install-fakeldd
.endif
NEED_MKDIR= UnixWare
.if !empty(NEED_MKDIR:M${OPSYS})
PLIST.mkdir= yes
do-install: do-install-mkdir
.endif
NEED_STRIP= AIX
.if !empty(NEED_STRIP:M${OPSYS})
PLIST.strip= yes
do-install: do-install-strip
.endif
NEED_XARGS= Interix
.if !empty(NEED_XARGS:M${OPSYS})
PLIST.xargs= yes
do-install: do-install-xargs
.endif
do-extract:
${CP} -R ${FILESDIR} ${WRKSRC}
do-install:
@${ECHO} ${.ALLSRC}
do-install-fakeldd:
${INSTALL_SCRIPT_DIR} ${DESTDIR}${PREFIX}/sbin
.if ${OPSYS} == "Haiku"
${INSTALL_SCRIPT} ${WRKSRC}/fakeldd-${OPSYS} ${DESTDIR}${PREFIX}/sbin/fakeldd
.else
${INSTALL_SCRIPT} ${WRKSRC}/fakeldd ${DESTDIR}${PREFIX}/sbin/fakeldd
.endif
do-install-mkdir:
${INSTALL_SCRIPT_DIR} ${DESTDIR}${PREFIX}/bin
${INSTALL_SCRIPT} ${WRKSRC}/mkdir-sh ${DESTDIR}${PREFIX}/bin/mkdir-sh
do-install-strip:
${INSTALL_SCRIPT_DIR} ${DESTDIR}${PREFIX}/bin
${INSTALL_SCRIPT} ${WRKSRC}/strip-sh ${DESTDIR}${PREFIX}/bin/strip
do-install-xargs:
${INSTALL_SCRIPT_DIR} ${DESTDIR}${PREFIX}/bin
${INSTALL_SCRIPT} ${WRKSRC}/xargs-sh ${DESTDIR}${PREFIX}/bin/xargs
.include "../../mk/bsd.pkg.mk"

View File

@@ -0,0 +1,5 @@
@comment $NetBSD: PLIST,v 1.3 2008/04/12 22:43:09 jlam Exp $
${PLIST.mkdir}bin/mkdir-sh
${PLIST.strip}bin/strip
${PLIST.fakeldd}sbin/fakeldd
${PLIST.xargs}bin/xargs

View File

@@ -0,0 +1,6 @@
#!/bin/sh
#
# $NetBSD: fakeldd,v 1.1.1.1 2006/07/17 14:21:31 jlam Exp $
#
/usr/bin/elfdump -Dl "$@" |
/usr/bin/nawk 'NF == 7 || NF == 8 {printf "x x %s\n",$1}'

View File

@@ -0,0 +1,40 @@
#! /bin/sh
#
# $NetBSD: fakeldd-Haiku,v 1.1 2010/02/06 10:26:09 obache Exp $
#
read_rpath_needed_from_obj ()
{
objdump -p "$1" | awk '
/^ *NEEDED */ {num++; libs[num] = $2;}
/^ *RPATH */ {rpath = $2;}
END {
print rpath;
for(x = 1; x <= num; x++) {
print libs[x];
}
}'
}
print_as_ldd ()
{
read rpath
rpath="$rpath:$LIBRARY_PATH"
while read f; do
abpath="not found"
IFS=':'
for r in $rpath; do
if test -e "$r/$f"; then
abpath="$r/$f"
break;
fi
done
echo " $f => $abpath";
done
}
while test $# -gt 0; do
echo $1:
read_rpath_needed_from_obj $1 | print_as_ldd
shift
done

View File

@@ -0,0 +1,53 @@
#! /bin/sh
#
# $NetBSD: mkdir-sh,v 1.1.1.1 2006/07/17 14:21:31 jlam Exp $
#
PATH=/bin:/sbin:/usr/bin:/usr/sbin; export PATH
MKDIRCMD=mkdir
cmdargs="$@"
# variable 'options' is unused
for options in p m
do
if [ $# -lt 1 ]
then
${MKDIRCMD} ${cmdargs}
exit $?
fi
case $1 in
-p) pathopt=-p;
shift;;
-m) modeopt="-m ${2}"
shift;
if [ $# -ne 0 ]
then
shift
else
${MKDIRCMD} ${cmdargs}
exit $?
fi
;;
esac
done
if [ $# -gt 0 ]
then
while [ $# -gt 0 ]
do
if [ -z "${pathopt}" ]
then
${MKDIRCMD} ${modeopt} -- "$1"
elif [ ! -d $1 ]
then
${MKDIRCMD} ${pathopt} ${modeopt} -- "$1"
else
: # directory exists, nothing to do
fi
shift
done
else
${MKDIRCMD} ${cmdargs}
fi

View File

@@ -0,0 +1,28 @@
#!/bin/sh
#
# $NetBSD: strip-sh,v 1.1.1.1 2006/07/17 14:21:31 jlam Exp $
#
# On some platforms strip complains too much if the file is not writable,
# or if it's already stripped.
#
for f in "$@" ; do
if ! /usr/bin/file "$f" | grep -q "not stripped" ; then
# Skip the file if it's already stripped
continue
fi
nowrite=0
if [ ! -w "$f" ] ; then
# Make sure it's writable.
nowrite=1
chmod +w "$f"
fi
/usr/bin/strip "$f"
ret=$?
if [ $nowrite -eq 1 ] ; then
chmod -w "$f"
fi
if [ $ret -ne 0 ] ; then
exit $ret
fi
done
exit 0

View File

@@ -0,0 +1,13 @@
#! /bin/sh
#
# $NetBSD: xargs-sh,v 1.1 2007/07/01 23:27:43 tnn Exp $
#
# xargs(1) on Interix is broken. It executes the utility on the command line
# even if standard input is the empty string.
d="`/bin/cat`"
if [ "$d" != "" ]
then
echo "$d" | /bin/xargs $@
exit $?
fi

View File

@@ -0,0 +1,4 @@
The bootstrap bmake(1) utility uses some customised .mk files in order
to pre-define certain definitions and targets, which guide the build
process. This package provides those *.mk files for the bmake(1)
utility.

View File

@@ -0,0 +1,47 @@
# $NetBSD: Makefile,v 1.32 2012/09/11 23:19:34 asau Exp $
DISTNAME= bootstrap-mk-files-20120415
CATEGORIES= pkgtools
MASTER_SITES= # empty
DISTFILES= # empty
CONFLICTS+= mk-files-[0-9]*
MAINTAINER= pkgsrc-users@NetBSD.org
HOMEPAGE= http://www.pkgsrc.org/
COMMENT= *.mk files for the bootstrap bmake utility
NO_PKGTOOLS_REQD_CHECK= # defined
BOOTSTRAP_PKG= yes
NO_BUILD= yes
USE_TOOLS+= sed
INSTALLATION_DIRS= share/mk
do-extract:
@${CP} -R ${FILESDIR} ${WRKSRC}
do-configure:
cd ${WRKSRC}; for file in bsd.* sys.mk; do \
${TEST} ! -f mods/${OPSYS}.$$file || \
${CP} -f mods/${OPSYS}.$$file ${WRKSRC}/$$file; \
done
cd ${WRKSRC}; \
if ${TEST} -f mods/${OPSYS}.bsd.own.mk.in; then \
own_mk=mods/${OPSYS}.bsd.own.mk.in; \
else \
own_mk=mods/bsd.own.mk.in; \
fi; \
${SED} -e 's|@ROOT_GROUP@|'${REAL_ROOT_GROUP}'|g' \
-e 's|@ROOT_USER@|'${REAL_ROOT_USER}'|g' \
-e 's|@SYSCONFDIR@|'${PKG_SYSCONFDIR}'|g' \
$$own_mk > bsd.own.mk
do-install:
cd ${WRKSRC} && for file in bsd.* sys.mk; do \
${INSTALL_DATA} $$file ${DESTDIR}${PREFIX}/share/mk/$$file; \
done
.include "../../mk/bsd.pkg.mk"

View File

@@ -0,0 +1,22 @@
@comment $NetBSD: PLIST,v 1.3 2009/06/14 18:11:02 joerg Exp $
share/mk/bsd.README
share/mk/bsd.dep.mk
share/mk/bsd.depall.mk
share/mk/bsd.doc.mk
share/mk/bsd.files.mk
share/mk/bsd.hostprog.mk
share/mk/bsd.inc.mk
share/mk/bsd.info.mk
share/mk/bsd.kernobj.mk
share/mk/bsd.kinc.mk
share/mk/bsd.kmod.mk
share/mk/bsd.lib.mk
share/mk/bsd.links.mk
share/mk/bsd.man.mk
share/mk/bsd.nls.mk
share/mk/bsd.obj.mk
share/mk/bsd.own.mk
share/mk/bsd.prog.mk
share/mk/bsd.subdir.mk
share/mk/bsd.sys.mk
share/mk/sys.mk

View File

@@ -0,0 +1,40 @@
#!/bin/sh
#
# Install mk-files for bootstrap.
#
# Expected environment:
# - CP
# - OPSYS
# - MK_DST
# - ROOT_GROUP
# - ROOT_USER
# - SED
# - SYSCONFDIR
#
: ${CP:=cp}
: ${SED:=sed}
: ${OPSYS:=`uname`}
: ${ROOT_USER:=`id -un 0`}
: ${ROOT_GROUP:=`id -gn "${ROOT_USER}"`}
: ${MK_DST:=/usr/local/share/mk}
: ${SYSCONFDIR:=/usr/local/etc}
for file in bsd.README bsd.dep.mk bsd.depall.mk bsd.doc.mk bsd.files.mk \
bsd.hostprog.mk bsd.inc.mk bsd.info.mk bsd.kernobj.mk bsd.kinc.mk \
bsd.kmod.mk bsd.lib.mk bsd.links.mk bsd.man.mk bsd.nls.mk \
bsd.obj.mk bsd.prog.mk bsd.subdir.mk bsd.sys.mk sys.mk; do
if [ -f mods/${OPSYS}.${file} ]; then
${CP} mods/${OPSYS}.${file} ${MK_DST}/${file}
else
${CP} ${file} ${MK_DST}/${file}
fi
done
subst_pattern='s|@ROOT_GROUP@|'${ROOT_GROUP}'|g;s|@ROOT_USER@|'${ROOT_USER}'|g;s|@SYSCONFDIR@|'${SYSCONFDIR}'|g'
if [ -f mods/${OPSYS}.bsd.own.mk.in ]; then
${SED} -e "${subst_pattern}" mods/${OPSYS}.bsd.own.mk.in > ${MK_DST}/bsd.own.mk
else
${SED} -e "${subst_pattern}" mods/bsd.own.mk.in > ${MK_DST}/bsd.own.mk
fi

View File

@@ -0,0 +1,687 @@
# $NetBSD: bsd.README,v 1.2 2009/12/30 20:46:22 abs Exp $
# @(#)bsd.README 8.2 (Berkeley) 4/2/94
This is the README file for the new make "include" files for the BSD
source tree. The files are installed in /usr/share/mk, and are, by
convention, named with the suffix ".mk".
Note, this file is not intended to replace reading through the .mk
files for anything tricky.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
RANDOM THINGS WORTH KNOWING:
The files are simply C-style #include files, and pretty much behave like
you'd expect. The syntax is slightly different in that a single '.' is
used instead of the hash mark, i.e. ".include <bsd.prog.mk>".
One difference that will save you lots of debugging time is that inclusion
of the file is normally done at the *end* of the Makefile. The reason for
this is because .mk files often modify variables and behavior based on the
values of variables set in the Makefile. To make this work, remember that
the FIRST target found is the target that is used, i.e. if the Makefile has:
a:
echo a
a:
echo a number two
the command "make a" will echo "a". To make things confusing, the SECOND
variable assignment is the overriding one, i.e. if the Makefile has:
a= foo
a= bar
b:
echo ${a}
the command "make b" will echo "bar". This is for compatibility with the
way the V7 make behaved.
It's fairly difficult to make the BSD .mk files work when you're building
multiple programs in a single directory. It's a lot easier to split up the
programs than to deal with the problem. Most of the agony comes from making
the "obj" directory stuff work right, not because we switched to a new version
of make. So, don't get mad at us, figure out a better way to handle multiple
architectures so we can quit using the symbolic link stuff. (Imake doesn't
count.)
The file .depend in the source directory is expected to contain dependencies
for the source files. This file is read automatically by make after reading
the Makefile.
The variable DESTDIR works as before. It's not set anywhere but will change
the tree where the file gets installed.
The profiled libraries are no longer built in a different directory than
the regular libraries. A new suffix, ".po", is used to denote a profiled
object, and ".so" denotes a shared (position-independent) object.
The following variables that control how things are made/installed that
are not set by default. These should not be set by Makefiles; they're for
the user to define in MAKECONF (see bsd.own.mk, below) or on the make(1)
command line:
BUILD If defined, 'make install' checks that the targets in the
source directories are up-to-date and remakes them if they
are out of date, instead of blindly trying to install
out of date or non-existent targets.
UPDATE If defined, 'make install' only installs targets that are
more recently modified in the source directories that their
installed counterparts.
UNPRIVILEGED If defined, don't set the owner/group/mode when installing
files or directories. This allows a non-root "make install".
MKCATPAGES If "no", don't build or install the catman pages.
MKDOC If "no", don't build or install the documentation.
MKINFO If "no", don't build or install Info documentation from
Texinfo source files.
MKLINT If "no", don't build or install the lint libraries.
MKMAN If "no", don't build or install the man or catman pages.
Also acts as "MKCATPAGES=no"
MKNLS If "no", don't build or install the NLS files and locale
definition files.
MKOBJ If "no", don't enable the rule which creates objdirs.
"yes" by default.
MKOBJDIRS If "no", don't create objdirs during a "make build".
"no" by default.
MKPIC If "no", don't build or install shared libraries.
MKPICINSTALL If "no", don't install the *_pic.a libraries.
MKPROFILE If "no", don't build or install the profiling libraries.
MKSHARE If "no", act as "MKCATPAGES=no MKDOC=no MKINFO=no MKMAN=no
MKNLS=no". I.e, don't build catman pages, documentation,
Info documentation, man pages, NLS files, ...
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
The include file <sys.mk> has the default rules for all makes, in the BSD
environment or otherwise. You probably don't want to touch this file.
If you intend to run a cross build, you will need to supply the following
host tools, and configure the following variables properly:
OBJCOPY objcopy - copy and translate object files
STRIP strip - Discard symbols from object files
CONFIG config - build kernel compilation directories
RPCGEN rpcgen - Remote Procedure Call (RPC) protocol compiler
MKLOCALE mklocale - make LC_CTYPE locale files
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
The include file <bsd.man.mk> handles installing manual pages and their
links.
It has a two targets:
maninstall:
Install the manual page sources and their links.
catinstall:
Install the preformatted manual pages and their links.
It sets/uses the following variables:
MANDIR Base path for manual installation.
MANGRP Manual group.
MANOWN Manual owner.
MANMODE Manual mode.
MANSUBDIR Subdirectory under the manual page section, i.e. "/vax"
or "/tahoe" for machine specific manual pages.
MAN The manual pages to be installed (use a .1 - .9 suffix).
MLINKS List of manual page links (using a .1 - .9 suffix). The
linked-to file must come first, the linked file second,
and there may be multiple pairs. The files are soft-linked.
The include file <bsd.man.mk> includes a file named "../Makefile.inc" if
it exists.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
The include file <bsd.own.mk> contains source tree configuration parameters,
such as the owners, groups, etc. for both manual pages and binaries, and
a few global "feature configuration" parameters.
It has no targets.
To get system-specific configuration parameters, bsd.own.mk will try to
include the file specified by the "MAKECONF" variable. If MAKECONF is not
set, or no such file exists, the system make configuration file, /etc/mk.conf
is included. These files may define any of the variables described below.
bsd.own.mk sets the following variables, if they are not already defined
(defaults are in brackets):
BSDSRCDIR The real path to the system sources, so that 'make obj'
will work correctly. [/usr/src]
BSDOBJDIR The real path to the system 'obj' tree, so that 'make obj'
will work correctly. [/usr/obj]
BINGRP Binary group. [wheel]
BINOWN Binary owner. [root]
BINMODE Binary mode. [555]
NONBINMODE Mode for non-executable files. [444]
MANDIR Base path for manual installation. [/usr/share/man/cat]
MANGRP Manual group. [wheel]
MANOWN Manual owner. [root]
MANMODE Manual mode. [${NONBINMODE}]
MANINSTALL Manual installation type: maninstall, catinstall, or both
LDSTATIC Control program linking; if set blank, link everything
dynamically. If set to "-static", link everything statically.
If not set, programs link according to their makefile.
LIBDIR Base path for library installation. [/usr/lib]
LINTLIBDIR Base path for lint(1) library installation. [/usr/libdata/lint]
LIBGRP Library group. [${BINGRP}]
LIBOWN Library owner. [${BINOWN}]
LIBMODE Library mode. [${NONBINMODE}]
DOCDIR Base path for system documentation (e.g. PSD, USD, etc.)
installation. [/usr/share/doc]
HTMLDOCDIR Base path for html system documentation installation.
[/usr/share/doc/html]
DOCGRP Documentation group. [wheel]
DOCOWN Documentation owner. [root]
DOCMODE Documentation mode. [${NONBINMODE}]
NLSDIR Base path for National Language Support files installation.
[/usr/share/nls]
NLSGRP National Language Support files group. [wheel]
NLSOWN National Language Support files owner. [root]
NLSMODE National Language Support files mode. [${NONBINMODE}]
STRIPFLAG The flag passed to the install program to cause the binary
to be stripped. This is to be used when building your
own install script so that the entire system can be made
stripped/not-stripped using a single knob. [-s]
COPY The flag passed to the install program to cause the binary
to be copied rather than moved. This is to be used when
building our own install script so that the entire system
can either be installed with copies, or with moves using
a single knob. [-c]
Additionally, the following variables may be set by bsd.own.mk or in a
make configuration file to modify the behaviour of the system build
process (default values are in brackets along with comments, if set by
bsd.own.mk):
MKCRYPTO If set to "no", no cryptography support will be built
into the system. Defaults to "yes".
NOCRYPTO If set, it is equivalent to setting MKCRYPTO to "no".
MKCRYPTO_IDEA If set to "yes", IDEA support will be built into
libcrypto_idea.a. Defaults to "no".
MKCRYPTO_RC5 If set to "yes", RC5 support will be built into
libcrypto_rc5.a. Defaults to "no".
MKKERBEROS If set to "no", disables building Kerberos (v4 or v5)
support into various system utilities that support it.
Defaults to "yes". NOTE: This does not affect the
building of the Kerberos libraries or infrastructure
programs themselves. To completely disable Kerberos,
set MKCRYPTO to "no".
NOKERBEROS If set, it is equivalent to setting MKKERBEROS to "no".
SKEY Compile in support for S/key authentication. [yes, set
unconditionally]
MANZ Compress manual pages at installation time.
SYS_INCLUDE Copy or symlink kernel include files into /usr/include.
Possible values are "symlinks" or "copies" (which is
the same as the variable being unset).
NOPROFILE Do not build profiled versions of system libraries
NOPIC Do not build PIC versions of system libraries, and
do not build shared libraries. [set if ${MACHINE_ARCH}
is "sh3" and ${OBJECT_FMT} is "COFF", unset otherwise.]
NOLINT Do not build lint libraries.
OBJECT_FMT Object file format. [set to "ELF" on architectures that
use ELF -- currently if ${MACHINE_ARCH} is "alpha",
"mipsel", "mipseb", "powerpc", "sparc", "sparc64",
"i386" and some m68k machines, or set to "a.out" on
other architectures].
MKSOFTFLOAT If "yes", build with options to enable the compiler to
generate output containing library calls for floating
point and possibly soft-float library support. Defaults
to "no".
bsd.own.mk is generally useful when building your own Makefiles so that
they use the same default owners etc. as the rest of the tree.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
The include file <bsd.prog.mk> handles building programs from one or
more source files, along with their manual pages. It has a limited number
of suffixes, consistent with the current needs of the BSD tree.
It has eight targets:
all:
build the program and its manual page
clean:
remove the program, any object files and the files a.out,
Errs, errs, mklog, and ${PROG}.core.
cleandir:
remove all of the files removed by the target clean, as
well as .depend, tags, and any manual pages.
`distclean' is a synonym for `cleandir'.
depend:
make the dependencies for the source files, and store
them in the file .depend.
includes:
install any header files.
install:
install the program and its manual pages; if the Makefile
does not itself define the target install, the targets
beforeinstall and afterinstall may also be used to cause
actions immediately before and after the install target
is executed.
lint:
run lint on the source files
tags:
create a tags file for the source files.
It sets/uses the following variables:
BINGRP Binary group.
BINOWN Binary owner.
BINMODE Binary mode.
CLEANFILES Additional files to remove for the clean and cleandir targets.
COPTS Additional flags to the compiler when creating C objects.
CPPFLAGS Additional flags to the C pre-processor
LDADD Additional loader objects. Usually used for libraries.
For example, to load with the compatibility and utility
libraries, use:
LDADD+=-lutil -lcompat
LDFLAGS Additional loader flags.
LINKS The list of binary links; should be full pathnames, the
linked-to file coming first, followed by the linked
file. The files are hard-linked. For example, to link
/bin/test and /bin/[, use:
LINKS= ${DESTDIR}/bin/test ${DESTDIR}/bin/[
SYMLINKS The list of symbolic links; should be full pathnames.
Syntax is identical to LINKS. Note that DESTDIR is not
automatically included in the link.
MAN Manual pages (should end in .1 - .9). If no MAN variable is
defined, "MAN=${PROG}.1" is assumed.
PROG The name of the program to build. If not supplied, nothing
is built.
PROGNAME The name that the above program will be installed as, if
different from ${PROG}.
SRCS List of source files to build the program. If SRCS is not
defined, it's assumed to be ${PROG}.c.
DPADD Additional dependencies for the program. Usually used for
libraries. For example, to depend on the compatibility and
utility libraries use:
DPADD+=${LIBCOMPAT} ${LIBUTIL}
The following libraries are predefined for DPADD:
LIBCRT0?= ${DESTDIR}/usr/lib/crt0.o
LIBC?= ${DESTDIR}/usr/lib/libc.a
LIBC_PIC?= ${DESTDIR}/usr/lib/libc_pic.a
LIBCOMPAT?= ${DESTDIR}/usr/lib/libcompat.a
LIBCRYPT?= ${DESTDIR}/usr/lib/libcrypt.a
LIBCURSES?= ${DESTDIR}/usr/lib/libcurses.a
LIBDBM?= ${DESTDIR}/usr/lib/libdbm.a
LIBDES?= ${DESTDIR}/usr/lib/libdes.a
LIBEDIT?= ${DESTDIR}/usr/lib/libedit.a
LIBFORM?= ${DESTDIR}/usr/lib/libform.a
LIBGCC?= ${DESTDIR}/usr/lib/libgcc.a
LIBGNUMALLOC?= ${DESTDIR}/usr/lib/libgnumalloc.a
LIBINTL?= ${DESTDIR}/usr/lib/libintl.a
LIBIPSEC?= ${DESTDIR}/usr/lib/libipsec.a
LIBKDB?= ${DESTDIR}/usr/lib/libkdb.a
LIBKRB?= ${DESTDIR}/usr/lib/libkrb.a
LIBKVM?= ${DESTDIR}/usr/lib/libkvm.a
LIBL?= ${DESTDIR}/usr/lib/libl.a
LIBM?= ${DESTDIR}/usr/lib/libm.a
LIBMENU?= ${DESTDIR}/usr/lib/libmenu.a
LIBMP?= ${DESTDIR}/usr/lib/libmp.a
LIBNTP?= ${DESTDIR}/usr/lib/libntp.a
LIBPC?= ${DESTDIR}/usr/lib/libpc.a
LIBPCAP?= ${DESTDIR}/usr/lib/libpcap.a
LIBPLOT?= ${DESTDIR}/usr/lib/libplot.a
LIBPOSIX?= ${DESTDIR}/usr/lib/libposix.a
LIBRESOLV?= ${DESTDIR}/usr/lib/libresolv.a
LIBRPCSVC?= ${DESTDIR}/usr/lib/librpcsvc.a
LIBSKEY?= ${DESTDIR}/usr/lib/libskey.a
LIBTERMCAP?= ${DESTDIR}/usr/lib/libtermcap.a
LIBTELNET?= ${DESTDIR}/usr/lib/libtelnet.a
LIBUTIL?= ${DESTDIR}/usr/lib/libutil.a
LIBWRAP?= ${DESTDIR}/usr/lib/libwrap.a
LIBY?= ${DESTDIR}/usr/lib/liby.a
LIBZ?= ${DESTDIR}/usr/lib/libz.a
SHAREDSTRINGS If defined, a new .c.o rule is used that results in shared
strings, using xstr(1). Note that this will not work with
parallel makes.
STRIPFLAG The flag passed to the install program to cause the binary
to be stripped.
SUBDIR A list of subdirectories that should be built as well.
Each of the targets will execute the same target in the
subdirectories.
SCRIPTS A list of interpreter scripts [file.{sh,csh,pl,awk,...}].
These are installed exactly like programs.
SCRIPTSNAME The name that the above program will be installed as, if
different from ${SCRIPTS}. These can be further specialized
by setting SCRIPTSNAME_<script>.
FILES A list of files to install. The installation is controlled
by the FILESNAME, FILESOWN, FILESGRP, FILESMODE, FILESDIR
variables that can be further specialized by FILES<VAR>_<file>
The include file <bsd.prog.mk> includes the file named "../Makefile.inc"
if it exists, as well as the include file <bsd.man.mk>.
Some simple examples:
To build foo from foo.c with a manual page foo.1, use:
PROG= foo
.include <bsd.prog.mk>
To build foo from foo.c with a manual page foo.2, add the line:
MAN= foo.2
If foo does not have a manual page at all, add the line:
MKMAN= no
If foo has multiple source files, add the line:
SRCS= a.c b.c c.c d.c
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
The include file <bsd.subdir.mk> contains the default targets for building
subdirectories. It has the same eight targets as <bsd.prog.mk>: all,
clean, cleandir, depend, includes, install, lint, and tags. For all of
the directories listed in the variable SUBDIR, the specified directory
will be visited and the target made. There is also a default target which
allows the command "make subdir" where subdir is any directory listed in
the variable SUBDIR.
As a special case, the use of a token .WAIT as an entry in SUBDIR acts
as a synchronization barrier when multiple make jobs are run; subdirs
before the .WAIT must complete before any subdirs after .WAIT are
started. See make(1) for some caveats on use of .WAIT and other
special sources.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
The include file <bsd.links.mk> handles the LINKS and SYMLINKS variables
and is included from from bsd.lib.mk and bsd.prog.mk.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
The include file <bsd.files.mk> handles the FILES variables and is included
from bsd.lib.mk and bsd.prog.mk.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
The include file <bsd.inc.mk> defines the includes target and uses two
variables:
INCS The list of include files
INCSDIR The location to install the include files.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
The include file <bsd.kinc.mk> defines the many targets (includes,
subdirectories, etc.), and is used by kernel makefiles to handle
include file installation. It is intended to be included alone, by
kernel Makefiles. Please see bsd.kinc.mk for more details, and keep
the documentation in that file up to date.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
The include file <bsd.info.mk> is used to generate and install GNU Info
documentation from respective Texinfo source files. It defines three
implicit targets (.txi.info, .texi.info, and .texinfo.info), and uses the
following variables:
TEXINFO List of Texinfo source files. Info documentation will
consist of single files with the extension replaced by
.info.
INFOFLAGS Flags to pass to makeinfo. []
INSTALL_INFO Name of install-info program. [install-info]
MAKEINFO Name of makeinfo program. [makeinfo]
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
The include file <bsd.sys.mk> is used by <bsd.prog.mk> and
<bsd.lib.mk>. It contains overrides that are used when building
the NetBSD source tree. For instance, if "PARALLEL" is defined by
the program/library Makefile, it includes a set of rules for lex and
yacc that allow multiple lex and yacc targets to be built in parallel.
Other variables of note (incomplete list):
WARNS Crank up gcc warning options; WARNS=1 and WARNS=2 are the two
distinct levels.
FORMAT_AUDIT If FORMAT_AUDIT is set, and WFORMAT is set and > 1, turn on
WFORMAT -Wnetbsd-format-audit for extra-stringent format checking.
WFORMAT belongs in individual makefiles and/or
Makefile.inc files. (set WFORMAT=1 in individual
makefiles if a program is not security critical and is
doing bizarre things with format strings which would
be even uglier if rewritten) FORMAT_AUDIT should go in
mk.conf if you're doing format-string auditing.
FORMAT_AUDIT may go away in time.
=-=-=-=-= bsd.lib.mk =-=-=-=-=
The include file <bsd.lib.mk> has support for building libraries. It has
the same eight targets as <bsd.prog.mk>: all, clean, cleandir, depend,
includes, install, lint, and tags. Additionally, it has a checkver target
which checks for installed shared object libraries whose version is greater
that the version of the source. It has a limited number of suffixes,
consistent with the current needs of the BSD tree.
It sets/uses the following variables:
LIB The name of the library to build.
LIBDIR Target directory for libraries.
SHLIB_MAJOR
SHLIB_MINOR
SHLIB_TEENY Major, minor, and teeny version numbers of shared library
LINTLIBDIR Target directory for lint libraries.
LIBGRP Library group.
LIBOWN Library owner.
LIBMODE Library mode.
LDADD Additional loader objects.
MAN The manual pages to be installed (use a .1 - .9 suffix).
MKLINKLIB If "no", act as "MKPICINSTALL=no MKPROFILE=no".
Also:
- don't install the .a libraries
- don't install _pic.a libraries on PIC systems
- don't build .a libraries on PIC systems
- don't install the .so symlink on ELF systems
I.e, only install the shared library (and the .so.major
symlink on ELF).
MKPICLIB If "no", don't build _pic.a libraries, and build the
shared object libraries from the .a libraries. A
symlink is installed in ${DESTDIR}/usr/lib for the
_pic.a library pointing to the .a library.
NOCHECKVER_<library>
NOCHECKVER If set, disables checking for installed shared object
libraries with versions greater than the source. A
particular library name, without the "lib" prefix, may
be appended to the variable name to disable the check for
only that library.
SRCS List of source files to build the library. Suffix types
.s, .c, and .f are supported. Note, .s files are preferred
to .c files of the same name. (This is not the default for
versions of make.)
The include file <bsd.lib.mk> includes the file named "../Makefile.inc"
if it exists, as well as the include file <bsd.man.mk>.
It has rules for building profiled objects; profiled libraries are
built by default.
Libraries are ranlib'd when made.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
The include file <bsd.obj.mk> defines targets related to the creation
and use of separated object and source directories.
If an environment variable named MAKEOBJDIRPREFIX is set, make(1) uses
${MAKEOBJDIRPREFIX}${.CURDIR} as the name of the object directory if
it exists. Otherwise make(1) looks for the existence of a
subdirectory (or a symlink to a directory) of the source directory
into which built targets should be placed. If an environment variable
named MAKEOBJDIR is set, make(1) uses its value as the name of the
object directory; failing that, make first looks for a subdirectory
named "obj.${MACHINE}", and if that doesn't exist, it looks for "obj".
Object directories are not created automatically by make(1) if they
don't exist; you need to run a separate "make obj". (This will happen
during a top-level build if "MKOBJDIRS" is set to a value other than
"no"). When the source directory is a subdirectory of ${BSDSRCDIR} --
and this is determined by a simple string prefix comparison -- object
directories are created in a separate object directory tree, and a
symlink to the object directory in that tree is created in the source
directory; otherwise, "make obj" assumes that you're not in the main
source tree and that it's not safe to use a separate object tree.
Several variables used by <bsd.obj.mk> control exactly what
directories and links get created during a "make obj":
MAKEOBJDIR If set, this is the component name of the object
directory.
OBJMACHINE If this is set but MAKEOBJDIR is not set, creates
object directories or links named "obj.${MACHINE}";
otherwise, just creates ones named "obj".
USR_OBJMACHINE If set, and the current directory is a subdirectory of
${BSDSRCDIR}, create object directory in the
corresponding subdirectory of ${BSDOBJDIR}.${MACHINE};
otherwise, create it in the corresponding subdirectory
of ${BSDOBJDIR}
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
The include file <bsd.kernobj.mk> defines variables related to the
location of kernel sources and object directories.
KERNSRCDIR Is the location of the top of the kernel src.
It defaults to ${BSDSRCDIR}/sys, but the top-level
Makefile.inc sets it to ${ABSTOP}/sys (ABSTOP is the
absolute path to the directory where the top-level
Makefile.inc was found.
KERNARCHDIR Is the location of the machine dependent kernel
sources. It defaults to arch/${MACHINE}
KERNCONFDIR Is where the configuration files for kernels are
found; default is ${KERNSRCDIR}/${KERNARCHDIR}/conf.
KERNOBJDIR Is the kernel build directory. The kernel GENERIC for
instance will be compiled in ${KERNOBJDIR}/GENERIC.
The default value is
${MAKEOBJDIRPREFIX}${KERNSRCDIR}/${KERNARCHDIR}/compile
if it exists or the target 'obj' is being made.
Otherwise the default is
${KERNSRCDIR}/${KERNARCHDIR}/compile.
It is important that Makefiles (such as those under src/distrib) that
wish to find compiled kernels use bsd.kernobj.mk and ${KERNOBJDIR}
rather than make assumptions about the location of the compiled kernel.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

View File

@@ -0,0 +1,32 @@
# $NetBSD: bsd.dep.mk,v 1.2 2008/04/15 16:49:56 joerg Exp $
.PHONY: cleandepend
cleandir: cleandepend
# some of the rules involve .h sources, so remove them from mkdep line
realdepend: beforedepend
.if defined(SRCS)
realdepend: .depend
.NOPATH: .depend
.depend: ${SRCS} ${DPSRCS}
@rm -f .depend
@touch .depend
cleandepend:
rm -f .depend ${.CURDIR}/tags ${CLEANDEPEND}
.else
cleandepend:
.endif
realdepend: afterdepend
beforedepend:
afterdepend:
.if !target(tags)
.if defined(SRCS)
tags: ${SRCS}
-cd ${.CURDIR}; ctags -f /dev/stdout ${.ALLSRC:N*.h} | \
sed "s;\${.CURDIR}/;;" > tags
.else
tags:
.endif
.endif

View File

@@ -0,0 +1,5 @@
# $NetBSD: bsd.depall.mk,v 1.1.1.1 2006/07/14 23:13:00 jlam Exp $
dependall: realdepend .MAKE
@cd ${.CURDIR}; \
${MAKE} realall

View File

@@ -0,0 +1,84 @@
# $NetBSD: bsd.doc.mk,v 1.1.1.1 2006/07/14 23:13:00 jlam Exp $
# @(#)bsd.doc.mk 8.1 (Berkeley) 8/14/93
.if !target(__initialized__)
__initialized__:
.if exists(${.CURDIR}/../Makefile.inc)
.include "${.CURDIR}/../Makefile.inc"
.endif
.include <bsd.own.mk>
.MAIN: all
.endif
.PHONY: cleandoc docinstall print spell
.if ${MKSHARE} != "no"
realinstall: docinstall
.endif
clean cleandir: cleandoc
BIB?= bib
EQN?= eqn
GREMLIN?= grn
GRIND?= vgrind -f
INDXBIB?= indxbib
PIC?= pic
REFER?= refer
ROFF?= groff -M/usr/share/tmac ${MACROS} ${PAGES}
SOELIM?= soelim
TBL?= tbl
.if !target(all)
.if ${MKSHARE} != "no"
realall: paper.ps
.else
realall:
.endif
.endif
.if !target(paper.ps)
paper.ps: ${SRCS}
${ROFF} ${.ALLSRC} > ${.TARGET}
.endif
.if !target(print)
print: paper.ps
lpr -P${PRINTER} ${.ALLSRC}
.endif
cleandoc:
rm -f paper.* [eE]rrs mklog ${CLEANFILES}
.if ${MKDOC} != "no"
FILES?=${SRCS}
ALLFILES=Makefile ${FILES} ${EXTRA}
docinstall:: ${ALLFILES:@F@${DESTDIR}${DOCDIR}/${DIR}/${F}@}
.PRECIOUS: ${ALLFILES:@F@${DESTDIR}${DOCDIR}/${DIR}/${F}@}
.if !defined(UPDATE)
.PHONY: ${ALLFILES:@F@${DESTDIR}${DOCDIR}/${DIR}/${F}@}
.endif
__docinstall: .USE
${INSTALL} ${RENAME} ${PRESERVE} ${INSTPRIV} -c -o ${DOCOWN} \
-g ${DOCGRP} -m ${DOCMODE} ${.ALLSRC} ${.TARGET}
.for F in ${ALLFILES:O:u}
.if !defined(BUILD) && !make(all) && !make(${F})
${DESTDIR}${DOCDIR}/${DIR}/${F}: .MADE
.endif
${DESTDIR}${DOCDIR}/${DIR}/${F}: ${F} __docinstall
.endfor
.endif
.if !target(docinstall)
docinstall::
.endif
spell: ${SRCS}
spell ${.ALLSRC} | sort | comm -23 - spell.ok > paper.spell
depend includes lint obj tags:
dependall: all
.include <bsd.obj.mk>

View File

@@ -0,0 +1,40 @@
# $NetBSD: bsd.files.mk,v 1.2 2010/01/15 22:00:36 abs Exp $
.if !defined(_BSD_FILES_MK_)
_BSD_FILES_MK_=1
.PHONY: filesinstall
realinstall: filesinstall
.if defined(FILES) && !empty(FILES)
FILESDIR?=${BINDIR}
FILESOWN?=${BINOWN}
FILESGRP?=${BINGRP}
FILESMODE?=${NONBINMODE}
filesinstall:: ${FILES:@F@${DESTDIR}${FILESDIR_${F}:U${FILESDIR}}/${FILESNAME_${F}:U${FILESNAME:U${F:T}}}@}
.PRECIOUS: ${FILES:@F@${DESTDIR}${FILESDIR_${F}:U${FILESDIR}}/${FILESNAME_${F}:U${FILESNAME:U${F:T}}}@}
.if !defined(UPDATE)
.PHONY: ${FILES:@F@${DESTDIR}${FILESDIR_${F}:U${FILESDIR}}/${FILESNAME_${F}:U${FILESNAME:U${F:T}}}@}
.endif
__fileinstall: .USE
${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} \
-o ${FILESOWN_${.ALLSRC:T}:U${FILESOWN}} \
-g ${FILESGRP_${.ALLSRC:T}:U${FILESGRP}} \
-m ${FILESMODE_${.ALLSRC:T}:U${FILESMODE}} \
${.ALLSRC} ${.TARGET}
.for F in ${FILES:O:u}
.if !defined(BUILD) && !make(all) && !make(${F})
${DESTDIR}${FILESDIR_${F}:U${FILESDIR}}/${FILESNAME_${F}:U${FILESNAME:U${F:T}}}: .MADE
.endif
${DESTDIR}${FILESDIR_${F}:U${FILESDIR}}/${FILESNAME_${F}:U${FILESNAME:U${F:T}}}: ${F} __fileinstall
.endfor
.endif
.if !target(filesinstall)
filesinstall::
.endif
.endif # !defined(_BSD_FILES_MK_)

View File

@@ -0,0 +1,137 @@
# $NetBSD: bsd.hostprog.mk,v 1.1.1.1 2006/07/14 23:13:00 jlam Exp $
# @(#)bsd.prog.mk 8.2 (Berkeley) 4/2/94
.if !target(__initialized__)
__initialized__:
.if exists(${.CURDIR}/../Makefile.inc)
.include "${.CURDIR}/../Makefile.inc"
.endif
.include <bsd.own.mk>
.include <bsd.obj.mk>
.include <bsd.depall.mk>
.MAIN: all
.endif
.PHONY: cleanprog
clean cleandir: cleanprog
CFLAGS+= ${COPTS}
LIBBZ2?= /usr/lib/libbz2.a
LIBC?= /usr/lib/libc.a
LIBC_PIC?= /usr/lib/libc_pic.a
LIBCDK?= /usr/lib/libcdk.a
LIBCOMPAT?= /usr/lib/libcompat.a
LIBCRYPT?= /usr/lib/libcrypt.a
LIBCURSES?= /usr/lib/libcurses.a
LIBDBM?= /usr/lib/libdbm.a
LIBDES?= /usr/lib/libdes.a
LIBEDIT?= /usr/lib/libedit.a
LIBFORM?= /usr/lib/libform.a
LIBGCC?= /usr/lib/libgcc.a
LIBGNUMALLOC?= /usr/lib/libgnumalloc.a
LIBINTL?= /usr/lib/libintl.a
LIBIPSEC?= /usr/lib/libipsec.a
LIBKDB?= /usr/lib/libkdb.a
LIBKRB?= /usr/lib/libkrb.a
LIBKVM?= /usr/lib/libkvm.a
LIBL?= /usr/lib/libl.a
LIBM?= /usr/lib/libm.a
LIBMENU?= /usr/lib/libmenu.a
LIBMP?= /usr/lib/libmp.a
LIBNTP?= /usr/lib/libntp.a
LIBOBJC?= /usr/lib/libobjc.a
LIBPC?= /usr/lib/libpc.a
LIBPCAP?= /usr/lib/libpcap.a
LIBPLOT?= /usr/lib/libplot.a
LIBPOSIX?= /usr/lib/libposix.a
LIBRESOLV?= /usr/lib/libresolv.a
LIBRPCSVC?= /usr/lib/librpcsvc.a
LIBSKEY?= /usr/lib/libskey.a
LIBTERMCAP?= /usr/lib/libtermcap.a
LIBTELNET?= /usr/lib/libtelnet.a
LIBUTIL?= /usr/lib/libutil.a
LIBWRAP?= /usr/lib/libwrap.a
LIBY?= /usr/lib/liby.a
LIBZ?= /usr/lib/libz.a
.if defined(SHAREDSTRINGS)
CLEANFILES+=strings
.c.lo:
${HOST_CC} -E ${CFLAGS} ${.IMPSRC} | xstr -c -
@${HOST_CC} ${CFLAGS} -c x.c -o ${.TARGET}
@rm -f x.c
.cc.lo:
${HOST_CXX} -E ${CXXFLAGS} ${.IMPSRC} | xstr -c -
@mv -f x.c x.cc
@${HOST_CXX} ${CXXFLAGS} -c x.cc -o ${.TARGET}
@rm -f x.cc
.C.lo:
${HOST_CXX} -E ${CXXFLAGS} ${.IMPSRC} | xstr -c -
@mv -f x.c x.C
@${HOST_CXX} ${CXXFLAGS} -c x.C -o ${.TARGET}
@rm -f x.C
.endif
.if defined(HOSTPROG)
SRCS?= ${HOSTPROG}.c
DPSRCS+= ${SRCS:M*.l:.l=.c} ${SRCS:M*.y:.y=.c}
CLEANFILES+= ${DPSRCS}
.if defined(YHEADER)
CLEANFILES+= ${SRCS:M*.y:.y=.h}
.endif
.if !empty(SRCS:N*.h:N*.sh)
OBJS+= ${SRCS:N*.h:N*.sh:R:S/$/.lo/g}
LOBJS+= ${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
.endif
.if defined(OBJS) && !empty(OBJS)
.NOPATH: ${OBJS}
${HOSTPROG}: ${DPSRCS} ${OBJS} ${LIBC} ${DPADD}
${HOST_LINK.c} ${HOST_LDSTATIC} -o ${.TARGET} ${OBJS} ${LDADD}
.endif # defined(OBJS) && !empty(OBJS)
.if !defined(MAN)
MAN= ${HOSTPROG}.1
.endif # !defined(MAN)
.endif # defined(HOSTPROG)
realall: ${HOSTPROG}
cleanprog:
rm -f a.out [Ee]rrs mklog core *.core \
${HOSTPROG} ${OBJS} ${LOBJS} ${CLEANFILES}
beforedepend:
CPPFLAGS= ${HOST_CPPFLAGS}
.if defined(SRCS)
afterdepend: .depend
@(TMP=/tmp/_depend$$$$; \
sed -e 's/^\([^\.]*\).o[ ]*:/\1.lo \1.ln:/' \
< .depend > $$TMP; \
mv $$TMP .depend)
.endif
lint: ${LOBJS}
.if defined(LOBJS) && !empty(LOBJS)
${LINT} ${LINTFLAGS} ${LDFLAGS:M-L*} ${LOBJS} ${LDADD}
.endif
.include <bsd.man.mk>
.include <bsd.nls.mk>
.include <bsd.files.mk>
.include <bsd.inc.mk>
.include <bsd.links.mk>
.include <bsd.dep.mk>
.include <bsd.sys.mk>
# Make sure all of the standard targets are defined, even if they do nothing.
regress:

View File

@@ -0,0 +1,29 @@
# $NetBSD: bsd.inc.mk,v 1.1.1.1 2006/07/14 23:13:00 jlam Exp $
.PHONY: incinstall
includes: ${INCS} incinstall
.if defined(INCS)
incinstall:: ${INCS:@I@${DESTDIR}${INCSDIR}/$I@}
.PRECIOUS: ${INCS:@I@${DESTDIR}${INCSDIR}/$I@}
.if !defined(UPDATE)
.PHONY: ${INCS:@I@${DESTDIR}${INCSDIR}/$I@}
.endif
__incinstall: .USE
@cmp -s ${.ALLSRC} ${.TARGET} > /dev/null 2>&1 || \
(echo "${INSTALL} ${RENAME} ${PRESERVE} ${INSTPRIV} -c \
-o ${BINOWN} -g ${BINGRP} -m ${NONBINMODE} \
${.ALLSRC} ${.TARGET}" && \
${INSTALL} ${RENAME} ${PRESERVE} ${INSTPRIV} -c \
-o ${BINOWN} \
-g ${BINGRP} -m ${NONBINMODE} ${.ALLSRC} ${.TARGET})
.for I in ${INCS:O:u}
${DESTDIR}${INCSDIR}/$I: $I __incinstall
.endfor
.endif
.if !target(incinstall)
incinstall::
.endif

View File

@@ -0,0 +1,64 @@
# $NetBSD: bsd.info.mk,v 1.1.1.1 2006/07/14 23:13:00 jlam Exp $
.if !target(__initialized__)
__initialized__:
.if exists(${.CURDIR}/../Makefile.inc)
.include "${.CURDIR}/../Makefile.inc"
.endif
.include <bsd.own.mk>
.include <bsd.obj.mk>
.include <bsd.depall.mk>
.MAIN: all
.endif
MAKEINFO?= makeinfo
INFOFLAGS?=
INSTALL_INFO?= install-info
.PHONY: infoinstall cleaninfo
cleandir: cleaninfo
.SUFFIXES: .txi .texi .texinfo .info
.txi.info .texi.info .texinfo.info:
${MAKEINFO} ${INFOFLAGS} --no-split -o $@ $<
.if defined(TEXINFO) && !empty(TEXINFO)
INFOFILES= ${TEXINFO:C/\.te?xi(nfo)?$/.info/}
.NOPATH: ${INFOFILES}
.if ${MKINFO} != "no"
realinstall: infoinstall
realall: ${INFOFILES}
.endif
cleaninfo:
rm -f ${INFOFILES}
infoinstall:: ${INFOFILES:@F@${DESTDIR}${INFODIR_${F}:U${INFODIR}}/${INFONAME_${F}:U${INFONAME:U${F:T}}}@}
.PRECIOUS: ${INFOFILES:@F@${DESTDIR}${INFODIR_${F}:U${INFODIR}}/${INFONAME_${F}:U${INFONAME:U${F:T}}}@}
.if !defined(UPDATE)
.PHONY: ${INFOFILES:@F@${DESTDIR}${INFODIR_${F}:U${INFODIR}}/${INFONAME_${F}:U${INFONAME:U${F:T}}}@}
.endif
__infoinstall: .USE
${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} \
-o ${INFOOWN_${.ALLSRC:T}:U${INFOOWN}} \
-g ${INFOGRP_${.ALLSRC:T}:U${INFOGRP}} \
-m ${INFOMODE_${.ALLSRC:T}:U${INFOMODE}} \
${.ALLSRC} ${.TARGET}
@${INSTALL_INFO} --remove --info-dir=${DESTDIR}${INFODIR} ${.TARGET}
${INSTALL_INFO} --info-dir=${DESTDIR}${INFODIR} ${.TARGET}
.for F in ${INFOFILES:O:u}
.if !defined(BUILD) && !make(all) && !make(${F})
${DESTDIR}${INFODIR_${F}:U${INFODIR}}/${INFONAME_${F}:U${INFONAME:U${F:T}}}: .MADE
.endif
${DESTDIR}${INFODIR_${F}:U${INFODIR}}/${INFONAME_${F}:U${INFONAME:U${F:T}}}: ${F} __infoinstall
.endfor
.else
cleaninfo:
.endif
# Make sure all of the standard targets are defined, even if they do nothing.
clean depend includes lint regress tags:

View File

@@ -0,0 +1,33 @@
# $NetBSD: bsd.kernobj.mk,v 1.1.1.1 2006/07/14 23:13:00 jlam Exp $
# KERNSRCDIR Is the location of the top of the kernel src.
# It defaults to ${BSDSRCDIR}/sys, but the top-level
# Makefile.inc sets it to ${ABSTOP}/sys (ABSTOP is the
# absolute path to the directory where the top-level
# Makefile.inc was found.
#
# KERNARCHDIR Is the location of the machine dependent kernel
# sources. It defaults to arch/${MACHINE}
#
# KERNCONFDIR Is where the configuration files for kernels are
# found; default is ${KERNSRCDIR}/${KERNARCHDIR}/conf.
#
# KERNOBJDIR Is the kernel build directory. The kernel GENERIC for
# instance will be compiled in ${KERNOBJDIR}/GENERIC.
# The default value is
# ${MAKEOBJDIRPREFIX}${KERNSRCDIR}/${KERNARCHDIR}/compile
# if it exists or the target 'obj' is being made.
# Otherwise the default is
# ${KERNSRCDIR}/${KERNARCHDIR}/compile.
#
KERNSRCDIR?= ${BSDSRCDIR}/sys
# just incase ${MACHINE} is not always correct
KERNARCHDIR?= arch/${MACHINE}
.if make(obj) || exists(${MAKEOBJDIRPREFIX}${KERNSRCDIR}/${KERNARCHDIR}/compile)
KERNOBJDIR?= ${MAKEOBJDIRPREFIX}${KERNSRCDIR}/${KERNARCHDIR}/compile
.else
KERNOBJDIR?= ${KERNSRCDIR}/${KERNARCHDIR}/compile
.endif
KERNCONFDIR?= ${KERNSRCDIR}/${KERNARCHDIR}/conf

View File

@@ -0,0 +1,145 @@
# $NetBSD: bsd.kinc.mk,v 1.1.1.1 2006/07/14 23:13:00 jlam Exp $
# System configuration variables:
#
# SYS_INCLUDE "symlinks": symlinks to include directories are created.
# This may not work 100% properly for all headers.
#
# "copies": directories are made, if necessary, and headers
# are installed into them.
#
# Variables:
#
# INCSDIR Directory to install includes into (and/or make, and/or
# symlink, depending on what's going on).
#
# KDIR Kernel directory to symlink to, if SYS_INCLUDE is symlinks.
# If unspecified, no action will be taken when making include
# for the directory if SYS_INCLUDE is symlinks.
#
# INCS Headers to install, if SYS_INCLUDE is copies.
#
# DEPINCS Headers to install which are built dynamically.
#
# SUBDIR Subdirectories to enter
#
# SYMLINKS Symlinks to make (unconditionally), a la bsd.links.mk.
# Note that the original bits will be 'rm -rf'd rather than
# just 'rm -f'd, to make the right thing happen with include
# directories.
#
.if !target(__initialized__)
__initialized__:
.if exists(${.CURDIR}/../Makefile.inc)
.include "${.CURDIR}/../Makefile.inc"
.endif
.include <bsd.own.mk>
.MAIN: all
.endif
# Change SYS_INCLUDE in bsd.own.mk or /etc/mk.conf to "symlinks" if you
# don't want copies
SYS_INCLUDE?= copies
# If DESTDIR is set, we're probably building a release, so force "copies".
.if defined(DESTDIR) && (${DESTDIR} != "/" && !empty(DESTDIR))
SYS_INCLUDE= copies
.endif
.PHONY: incinstall
includes: ${INCS} incinstall
.if ${SYS_INCLUDE} == "symlinks"
# don't install includes, just make symlinks.
.if defined(KDIR)
SYMLINKS+= ${KDIR} ${INCSDIR}
.endif
.else # not symlinks
# make sure the directory is OK, and install includes.
incinstall:: ${DESTDIR}${INCSDIR}
.PRECIOUS: ${DESTDIR}${INCSDIR}
.PHONY: ${DESTDIR}${INCSDIR}
${DESTDIR}${INCSDIR}:
@if [ ! -d ${.TARGET} ] || [ -h ${.TARGET} ] ; then \
echo creating ${.TARGET}; \
/bin/rm -rf ${.TARGET}; \
${INSTALL} ${INSTPRIV} -d -o ${BINOWN} \
-g ${BINGRP} -m 755 ${.TARGET}; \
fi
.if defined(INCS)
incinstall:: ${INCS:@I@${DESTDIR}${INCSDIR}/$I@}
.PRECIOUS: ${INCS:@I@${DESTDIR}${INCSDIR}/$I@}
.if !defined(UPDATE)
.PHONY: ${INCS:@I@${DESTDIR}${INCSDIR}/$I@}
.endif
__incinstall: .USE
@cmp -s ${.ALLSRC} ${.TARGET} > /dev/null 2>&1 || \
(echo "${INSTALL} ${RENAME} ${PRESERVE} ${INSTPRIV} -c \
-o ${BINOWN} -g ${BINGRP} -m ${NONBINMODE} \
${.ALLSRC} ${.TARGET}" && \
${INSTALL} ${RENAME} ${PRESERVE} ${INSTPRIV} -c \
-o ${BINOWN} \
-g ${BINGRP} -m ${NONBINMODE} ${.ALLSRC} ${.TARGET})
.for I in ${INCS:O:u}
${DESTDIR}${INCSDIR}/$I: $I __incinstall
.endfor
.endif
.if defined(DEPINCS)
incinstall:: ${DEPINCS:@I@${DESTDIR}${INCSDIR}/$I@}
.PRECIOUS: ${DEPINCS:@I@${DESTDIR}${INCSDIR}/$I@}
.if !defined(UPDATE)
.PHONY: ${DEPINCS:@I@${DESTDIR}${INCSDIR}/$I@}
.endif
__depincinstall: .USE
@cmp -s ${.ALLSRC} ${.TARGET} > /dev/null 2>&1 || \
(echo "${INSTALL} ${RENAME} ${PRESERVE} -c \
-o ${BINOWN} \
-g ${BINGRP} -m ${NONBINMODE} ${.ALLSRC} ${.TARGET}" && \
${INSTALL} ${RENAME} ${PRESERVE} -c -o ${BINOWN} \
-g ${BINGRP} -m ${NONBINMODE} ${.ALLSRC} ${.TARGET})
.for I in ${DEPINCS:O:u}
${DESTDIR}${INCSDIR}/$I: $I __depincinstall
.endfor
.endif
.endif # not symlinks
.if defined(SYMLINKS) && !empty(SYMLINKS)
incinstall::
@(set ${SYMLINKS}; \
while test $$# -ge 2; do \
l=$$1; \
shift; \
t=${DESTDIR}$$1; \
shift; \
if [ -h $$t ]; then \
cur=`ls -ld $$t | awk '{print $$NF}'` ; \
if [ "$$cur" = "$$l" ]; then \
continue ; \
fi; \
fi; \
echo "$$t -> $$l"; \
rm -rf $$t; ln -s $$l $$t; \
done; )
.endif
.if !target(incinstall)
incinstall::
.endif
.include <bsd.subdir.mk>

View File

@@ -0,0 +1,98 @@
# $NetBSD: bsd.kmod.mk,v 1.1.1.1 2006/07/14 23:13:00 jlam Exp $
.if !target(__initialized__)
__initialized__:
.if exists(${.CURDIR}/../Makefile.inc)
.include "${.CURDIR}/../Makefile.inc"
.endif
.include <bsd.own.mk>
.include <bsd.obj.mk>
.include <bsd.depall.mk>
.MAIN: all
.endif
.PHONY: cleankmod kmodinstall load unload
realinstall: kmodinstall
clean cleandir: cleankmod
S?= /sys
KERN= $S/kern
CFLAGS+= ${COPTS} -D_KERNEL -D_LKM -I. -I${.CURDIR} -I$S -I$S/arch
DPSRCS+= ${SRCS:M*.l:.l=.c} ${SRCS:M*.y:.y=.c}
CLEANFILES+= ${DPSRCS}
.if defined(YHEADER)
CLEANFILES+= ${SRCS:M*.y:.y=.h}
.endif
OBJS+= ${SRCS:N*.h:N*.sh:R:S/$/.o/g}
.if !defined(PROG)
PROG= ${KMOD}.o
.endif
${PROG}: ${DPSRCS} ${OBJS} ${DPADD}
${LD} -r ${LDFLAGS} -o tmp.o ${OBJS}
mv tmp.o ${.TARGET}
.if !defined(MAN)
MAN= ${KMOD}.4
.endif
realall: machine-links ${PROG}
.PHONY: machine-links
beforedepend: machine-links
machine-links:
-rm -f machine && \
ln -s $S/arch/${MACHINE}/include machine
-rm -f ${MACHINE_ARCH} && \
ln -s $S/arch/${MACHINE_ARCH}/include ${MACHINE_ARCH}
CLEANFILES+=machine ${MACHINE_ARCH}
cleankmod:
rm -f a.out [Ee]rrs mklog core *.core \
${PROG} ${OBJS} ${LOBJS} ${CLEANFILES}
#
# define various install targets
#
.if !target(kmodinstall)
kmodinstall:: ${DESTDIR}${KMODDIR}/${PROG}
.PRECIOUS: ${DESTDIR}${KMODDIR}/${PROG}
.if !defined(UPDATE)
.PHONY: ${DESTDIR}${KMODDIR}/${PROG}
.endif
__kmodinstall: .USE
${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} -o ${KMODOWN} \
-g ${KMODGRP} -m ${KMODMODE} ${.ALLSRC} ${.TARGET}
.if !defined(BUILD) && !make(all) && !make(${PROG})
${DESTDIR}${KMODDIR}/${PROG}: .MADE
.endif
${DESTDIR}${KMODDIR}/${PROG}: ${PROG} __kmodinstall
.endif
lint: ${LOBJS}
.if defined(LOBJS) && !empty(LOBJS)
${LINT} ${LINTFLAGS} ${LDFLAGS:M-L*} ${LOBJS} ${LDADD}
.endif
.if !target(load)
load: ${PROG}
/sbin/modload ${KMOD_LOADFLAGS} -o ${KMOD} -e${KMOD}_lkmentry ${PROG}
.endif
.if !target(unload)
unload:
/sbin/modunload -n ${KMOD}
.endif
.include <bsd.man.mk>
.include <bsd.links.mk>
.include <bsd.dep.mk>
.include <bsd.sys.mk>
.-include "machine/Makefile.inc"

View File

@@ -0,0 +1,531 @@
# $NetBSD: bsd.lib.mk,v 1.5 2011/11/26 15:54:44 dholland Exp $
# @(#)bsd.lib.mk 8.3 (Berkeley) 4/22/94
.if !target(__initialized__)
__initialized__:
.if exists(${.CURDIR}/../Makefile.inc)
.include "${.CURDIR}/../Makefile.inc"
.endif
.include <bsd.own.mk>
.include <bsd.obj.mk>
.include <bsd.depall.mk>
.MAIN: all
.endif
.PHONY: checkver cleanlib libinstall
realinstall: checkver libinstall
clean cleandir: cleanlib
.if exists(${SHLIB_VERSION_FILE})
SHLIB_MAJOR != . ${SHLIB_VERSION_FILE} ; echo $$major
SHLIB_MINOR != . ${SHLIB_VERSION_FILE} ; echo $$minor
SHLIB_TEENY != . ${SHLIB_VERSION_FILE} ; echo $$teeny
# Check for higher installed library versions.
.if !defined(NOCHECKVER) && !defined(NOCHECKVER_${LIB}) && \
exists(${BSDSRCDIR}/lib/checkver)
checkver:
@(cd ${.CURDIR} && \
sh ${BSDSRCDIR}/lib/checkver -v ${SHLIB_VERSION_FILE} \
-d ${DESTDIR}${LIBDIR} ${LIB})
.endif
.endif
.if !target(checkver)
checkver:
.endif
print-shlib-major:
.if defined(SHLIB_MAJOR)
@echo ${SHLIB_MAJOR}
.else
@false
.endif
print-shlib-minor:
.if defined(SHLIB_MINOR)
@echo ${SHLIB_MINOR}
.else
@false
.endif
print-shlib-teeny:
.if defined(SHLIB_TEENY)
@echo ${SHLIB_TEENY}
.else
@false
.endif
.if defined(SHLIB_MAJOR) && !empty(SHLIB_MAJOR)
.if defined(SHLIB_MINOR) && !empty(SHLIB_MINOR)
.if defined(SHLIB_TEENY) && !empty(SHLIB_TEENY)
SHLIB_FULLVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR}.${SHLIB_TEENY}
.else
SHLIB_FULLVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR}
.endif
.else
SHLIB_FULLVERSION=${SHLIB_MAJOR}
.endif
.endif
# add additional suffixes not exported.
# .po is used for profiling object files.
# .so is used for PIC object files.
.SUFFIXES: .out .a .ln .so .po .o .s .S .c .cc .C .m .F .f .r .y .l .cl .p .h
.SUFFIXES: .sh .m4 .m
# Set PICFLAGS to cc flags for producing position-independent code,
# if not already set. Includes -DPIC, if required.
# Data-driven table using make variables to control how shared libraries
# are built for different platforms and object formats.
# OBJECT_FMT: currently either "ELF" or "a.out", from <bsd.own.mk>
# SHLIB_MAJOR, SHLIB_MINOR, SHLIB_TEENY: Major, minor, and teeny version
# numbers of shared library
# SHLIB_SOVERSION: version number to be compiled into a shared library
# via -soname. Usualy ${SHLIB_MAJOR} on ELF.
# NetBSD/pmax used to use ${SHLIB_MAJOR}[.${SHLIB_MINOR}
# [.${SHLIB_TEENY}]]
# SHLIB_SHFLAGS: Flags to tell ${LD} to emit shared library.
# with ELF, also set shared-lib version for ld.so.
# SHLIB_LDSTARTFILE: support .o file, call C++ file-level constructors
# SHLIB_LDENDFILE: support .o file, call C++ file-level destructors
# FPICFLAGS: flags for ${FC} to compile .[fF] files to .so objects.
# CPPPICFLAGS: flags for ${CPP} to preprocess .[sS] files for ${AS}
# CPICFLAGS: flags for ${CC} to compile .[cC] files to pic objects.
# CSHLIBFLAGS: flags for ${CC} to compile .[cC] files to .so objects.
# (usually includes ${CPICFLAGS})
# CAPICFLAGS: flags for ${CC} to compiling .[Ss] files
# (usually just ${CPPPICFLAGS} ${CPICFLAGS})
# APICFLAGS: flags for ${AS} to assemble .[sS] to .so objects.
.if ${MACHINE_ARCH} == "alpha"
# Alpha-specific shared library flags
FPICFLAGS ?= -fPIC
CPICFLAGS ?= -fPIC -DPIC
CPPPICFLAGS?= -DPIC
CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS}
APICFLAGS ?=
.elif ${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb"
# mips-specific shared library flags
# On mips, all libs are compiled with ABIcalls, not just sharedlibs.
MKPICLIB= no
# so turn shlib PIC flags on for ${AS}.
AINC+=-DABICALLS
AFLAGS+= -fPIC
AS+= -KPIC
.elif ${MACHINE_ARCH} == "vax" && ${OBJECT_FMT} == "ELF"
# On the VAX, all object are PIC by default, not just sharedlibs.
MKPICLIB= no
.elif (${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64") && \
${OBJECT_FMT} == "ELF"
FPICFLAGS ?= -fPIC
CPICFLAGS ?= -fPIC -DPIC
CPPPICFLAGS?= -DPIC
CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS}
APICFLAGS ?= -KPIC
.else
# Platform-independent flags for NetBSD a.out shared libraries (and PowerPC)
SHLIB_LDSTARTFILE=
SHLIB_LDENDFILE=
SHLIB_SOVERSION=${SHLIB_FULLVERSION}
SHLIB_SHFLAGS=
FPICFLAGS ?= -fPIC
CPICFLAGS?= -fPIC -DPIC
CPPPICFLAGS?= -DPIC
CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS}
APICFLAGS?= -k
.endif
MKPICLIB?= yes
# Platform-independent linker flags for ELF shared libraries
.if ${OBJECT_FMT} == "ELF"
SHLIB_SOVERSION= ${SHLIB_MAJOR}
SHLIB_SHFLAGS= -soname lib${LIB}.so.${SHLIB_SOVERSION}
SHLIB_LDSTARTFILE?= ${DESTDIR}/usr/lib/crtbeginS.o
SHLIB_LDENDFILE?= ${DESTDIR}/usr/lib/crtendS.o
.endif
CFLAGS+= ${COPTS}
FFLAGS+= ${FOPTS}
.c.o:
.if defined(COPTS) && !empty(COPTS:M*-g*)
${COMPILE.c} ${.IMPSRC}
.else
@echo ${COMPILE.c:Q} ${.IMPSRC}
@${COMPILE.c} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.c.po:
.if defined(COPTS) && !empty(COPTS:M*-g*)
${COMPILE.c} -pg ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.c:Q} -pg ${.IMPSRC} -o ${.TARGET}
@${COMPILE.c} -pg ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.c.so:
.if defined(COPTS) && !empty(COPTS:M*-g*)
${COMPILE.c} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.c:Q} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
@${COMPILE.c} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.c.ln:
${LINT} ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i ${.IMPSRC}
.cc.o .C.o:
.if defined(COPTS) && !empty(COPTS:M*-g*)
${COMPILE.cc} ${.IMPSRC}
.else
@echo ${COMPILE.cc:Q} ${.IMPSRC}
@${COMPILE.cc} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.cc.po .C.po:
.if defined(COPTS) && !empty(COPTS:M*-g*)
${COMPILE.cc} -pg ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.cc:Q} -pg ${.IMPSRC} -o ${.TARGET}
@${COMPILE.cc} -pg ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.cc.so .C.so:
.if defined(COPTS) && !empty(COPTS:M*-g*)
${COMPILE.cc} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.cc:Q} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
@${COMPILE.cc} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.f.o:
.if defined(FOPTS) && !empty(FOPTS:M*-g*)
${COMPILE.f} ${.IMPSRC}
.else
@echo ${COMPILE.f:Q} ${.IMPSRC}
@${COMPILE.f} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.f.po:
.if defined(FOPTS) && !empty(FOPTS:M*-g*)
${COMPILE.f} -pg ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.f:Q} -pg ${.IMPSRC} -o ${.TARGET}
@${COMPILE.f} -pg ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.f.so:
.if defined(FOPTS) && !empty(FOPTS:M*-g*)
${COMPILE.f} ${FPICFLAGS} ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.f:Q} ${FPICFLAGS} ${.IMPSRC} -o ${.TARGET}
@${COMPILE.f} ${FPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.f.ln:
${ECHO} Skipping lint for Fortran libraries.
.m.o:
.if defined(OBJCFLAGS) && !empty(OBJCFLAGS:M*-g*)
${COMPILE.m} ${.IMPSRC}
.else
@echo ${COMPILE.m:Q} ${.IMPSRC}
@${COMPILE.m} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.m.po:
.if defined(OBJCFLAGS) && !empty(OBJCFLAGS:M*-g*)
${COMPILE.m} -pg ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.m:Q} -pg ${.IMPSRC} -o ${.TARGET}
@${COMPILE.m} -pg ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.m.so:
.if defined(OBJCFLAGS) && !empty(OBJCFLAGS:M*-g*)
${COMPILE.m} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.m:Q} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
@${COMPILE.m} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.S.o .s.o:
@echo ${COMPILE.S:Q} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC}
@${COMPILE.S} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.S.po .s.po:
@echo ${COMPILE.S:Q} -DGPROF -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}
@${COMPILE.S} -DGPROF -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.S.so .s.so:
@echo ${COMPILE.S:Q} ${CAPICFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}
@${COMPILE.S} ${CAPICFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.if ${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
|| ${MKLINKLIB} != "no"
_LIBS=lib${LIB}.a
.else
_LIBS=
.endif
OBJS+=${SRCS:N*.h:N*.sh:R:S/$/.o/g}
.if ${MKPROFILE} != "no"
_LIBS+=lib${LIB}_p.a
POBJS+=${OBJS:.o=.po}
.endif
.if ${MKPIC} != "no"
.if ${MKPICLIB} == "no"
SOLIB=lib${LIB}.a
.else
SOLIB=lib${LIB}_pic.a
_LIBS+=${SOLIB}
SOBJS+=${OBJS:.o=.so}
.endif
.if defined(SHLIB_FULLVERSION)
_LIBS+=lib${LIB}.so.${SHLIB_FULLVERSION}
.endif
.endif
LOBJS+=${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
.if ${MKLINT} != "no" && ${MKLINKLIB} != "no" && !empty(LOBJS)
_LIBS+=llib-l${LIB}.ln
.endif
.if ${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
|| ${MKLINKLIB} != "no"
ALLOBJS=${OBJS} ${POBJS} ${SOBJS}
.else
ALLOBJS=${POBJS} ${SOBJS}
.endif
.if ${MKLINT} != "no" && ${MKLINKLIB} != "no" && !empty(LOBJS)
ALLOBJS+=${LOBJS}
.endif
.NOPATH: ${ALLOBJS} ${_LIBS}
realall: ${SRCS} ${ALLOBJS:O} ${_LIBS}
__archivebuild: .USE
@rm -f ${.TARGET}
${AR} cq ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`
${RANLIB} ${.TARGET}
__archiveinstall: .USE
${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} -o ${LIBOWN} \
-g ${LIBGRP} -m 600 ${.ALLSRC} ${.TARGET}
${RANLIB} -t ${.TARGET}
chmod ${LIBMODE} ${.TARGET}
DPSRCS+= ${SRCS:M*.l:.l=.c} ${SRCS:M*.y:.y=.c}
CLEANFILES+= ${DPSRCS}
.if defined(YHEADER)
CLEANFILES+= ${SRCS:M*.y:.y=.h}
.endif
lib${LIB}.a:: ${OBJS} __archivebuild
@echo building standard ${LIB} library
lib${LIB}_p.a:: ${POBJS} __archivebuild
@echo building profiled ${LIB} library
lib${LIB}_pic.a:: ${SOBJS} __archivebuild
@echo building shared object ${LIB} library
lib${LIB}.so.${SHLIB_FULLVERSION}: ${SOLIB} ${DPADD} \
${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE}
@echo building shared ${LIB} library \(version ${SHLIB_FULLVERSION}\)
@rm -f lib${LIB}.so.${SHLIB_FULLVERSION}
.if defined(DESTDIR)
$(LD) -nostdlib -shared ${SHLIB_SHFLAGS} -o ${.TARGET} \
${SHLIB_LDSTARTFILE} \
--whole-archive ${SOLIB} \
--no-whole-archive ${LDADD} \
-L${DESTDIR}${LIBDIR} ${RPATH_FLAG}${LIBDIR} \
${SHLIB_LDENDFILE}
.else
$(LD) -shared ${SHLIB_SHFLAGS} -o ${.TARGET} \
${SHLIB_LDSTARTFILE} \
--whole-archive ${SOLIB} --no-whole-archive ${LDADD} \
${SHLIB_LDENDFILE}
.endif
.if ${OBJECT_FMT} == "ELF"
.if defined(SHLIB_FULLVERSION) && defined(SHLIB_MAJOR) && \
"${SHLIB_FULLVERSION}" != "${SHLIB_MAJOR}"
ln -sf lib${LIB}.so.${SHLIB_FULLVERSION} lib${LIB}.so.${SHLIB_MAJOR}.tmp
mv -f lib${LIB}.so.${SHLIB_MAJOR}.tmp lib${LIB}.so.${SHLIB_MAJOR}
.endif
ln -sf lib${LIB}.so.${SHLIB_FULLVERSION} lib${LIB}.so.tmp
mv -f lib${LIB}.so.tmp lib${LIB}.so
.endif
.if !empty(LOBJS)
LLIBS?= -lc
llib-l${LIB}.ln: ${LOBJS}
@echo building llib-l${LIB}.ln
@rm -f llib-l${LIB}.ln
@${LINT} -C${LIB} ${.ALLSRC} ${LLIBS}
.endif
cleanlib:
rm -f a.out [Ee]rrs mklog core *.core ${CLEANFILES}
rm -f lib${LIB}.a ${OBJS}
rm -f lib${LIB}_p.a ${POBJS}
rm -f lib${LIB}_pic.a lib${LIB}.so.* lib${LIB}.so ${SOBJS}
rm -f llib-l${LIB}.ln ${LOBJS}
.if defined(SRCS)
afterdepend: .depend
@(TMP=/tmp/_depend$$$$; \
sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.po \1.so \1.ln:/' \
< .depend > $$TMP; \
mv $$TMP .depend)
.endif
.if !target(libinstall)
# Make sure it gets defined, in case MKPIC==no && MKLINKLIB==no
libinstall::
.if ${MKLINKLIB} != "no"
libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}.a
.PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}.a
.if !defined(UPDATE)
.PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}.a
.endif
.if !defined(BUILD) && !make(all) && !make(lib${LIB}.a)
${DESTDIR}${LIBDIR}/lib${LIB}.a: .MADE
.endif
${DESTDIR}${LIBDIR}/lib${LIB}.a: lib${LIB}.a __archiveinstall
.endif
.if ${MKPROFILE} != "no"
libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
.PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
.if !defined(UPDATE)
.PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
.endif
.if !defined(BUILD) && !make(all) && !make(lib${LIB}_p.a)
${DESTDIR}${LIBDIR}/lib${LIB}_p.a: .MADE
.endif
${DESTDIR}${LIBDIR}/lib${LIB}_p.a: lib${LIB}_p.a __archiveinstall
.endif
.if ${MKPIC} != "no" && ${MKPICINSTALL} != "no"
libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
.PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
.if !defined(UPDATE)
.PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
.endif
.if !defined(BUILD) && !make(all) && !make(lib${LIB}_pic.a)
${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: .MADE
.endif
.if ${MKPICLIB} == "no"
${DESTDIR}${LIBDIR}/lib${LIB}_pic.a:
rm -f ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
ln -s lib${LIB}.a ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
.else
${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: lib${LIB}_pic.a __archiveinstall
.endif
.endif
.if ${MKPIC} != "no" && defined(SHLIB_FULLVERSION)
libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}
.PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}
.if !defined(UPDATE)
.PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}
.endif
.if !defined(BUILD) && !make(all) && !make(lib${LIB}.so.${SHLIB_FULLVERSION})
${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}: .MADE
.endif
${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}: lib${LIB}.so.${SHLIB_FULLVERSION}
${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} -o ${LIBOWN} \
-g ${LIBGRP} -m ${LIBMODE} ${.ALLSRC} ${.TARGET}
.if ${OBJECT_FMT} == "a.out" && !defined(DESTDIR)
/sbin/ldconfig -m ${LIBDIR}
.endif
.if ${OBJECT_FMT} == "ELF"
ln -sf lib${LIB}.so.${SHLIB_FULLVERSION}\
${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}.tmp
mv -f ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}.tmp\
${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}
.if ${MKLINKLIB} != "no"
ln -sf lib${LIB}.so.${SHLIB_FULLVERSION}\
${DESTDIR}${LIBDIR}/lib${LIB}.so.tmp
mv -f ${DESTDIR}${LIBDIR}/lib${LIB}.so.tmp\
${DESTDIR}${LIBDIR}/lib${LIB}.so
.endif
.endif
.endif
.if ${MKLINT} != "no" && ${MKLINKLIB} != "no" && !empty(LOBJS)
libinstall:: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
.PRECIOUS: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
.if !defined(UPDATE)
.PHONY: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
.endif
.if !defined(BUILD) && !make(all) && !make(llib-l${LIB}.ln)
${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln: .MADE
.endif
${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln: llib-l${LIB}.ln
${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} -o ${LIBOWN} \
-g ${LIBGRP} -m ${LIBMODE} ${.ALLSRC} ${DESTDIR}${LINTLIBDIR}
.endif
.endif
.include <bsd.man.mk>
.include <bsd.nls.mk>
.include <bsd.files.mk>
.include <bsd.inc.mk>
.include <bsd.links.mk>
.include <bsd.dep.mk>
.include <bsd.sys.mk>
# Make sure all of the standard targets are defined, even if they do nothing.
lint regress:

View File

@@ -0,0 +1,44 @@
# $NetBSD: bsd.links.mk,v 1.1.1.1 2006/07/14 23:13:00 jlam Exp $
.PHONY: linksinstall
realinstall: linksinstall
.if defined(SYMLINKS) && !empty(SYMLINKS)
linksinstall::
@(set ${SYMLINKS}; \
while test $$# -ge 2; do \
l=$$1; \
shift; \
t=${DESTDIR}$$1; \
shift; \
if [ -h $$t ]; then \
cur=`ls -ld $$t | awk '{print $$NF}'` ; \
if [ "$$cur" = "$$l" ]; then \
continue ; \
fi; \
fi; \
echo "$$t -> $$l"; \
rm -rf $$t; ln -s $$l $$t; \
done; )
.endif
.if defined(LINKS) && !empty(LINKS)
linksinstall::
@(set ${LINKS}; \
echo ".include <bsd.own.mk>"; \
while test $$# -ge 2; do \
l=${DESTDIR}$$1; \
shift; \
t=${DESTDIR}$$1; \
shift; \
echo "realall: $$t"; \
echo ".PHONY: $$t"; \
echo "$$t:"; \
echo " @echo \"$$t -> $$l\""; \
echo " @rm -f $$t; ln $$l $$t"; \
done; \
) | ${MAKE} -f- all
.endif
.if !target(linksinstall)
linksinstall:
.endif

View File

@@ -0,0 +1,201 @@
# $NetBSD: bsd.man.mk,v 1.1.1.1 2006/07/14 23:13:00 jlam Exp $
# @(#)bsd.man.mk 8.1 (Berkeley) 6/8/93
.if !target(__initialized__)
__initialized__:
.if exists(${.CURDIR}/../Makefile.inc)
.include "${.CURDIR}/../Makefile.inc"
.endif
.include <bsd.own.mk>
.include <bsd.obj.mk>
.include <bsd.depall.mk>
.MAIN: all
.endif
.PHONY: catinstall maninstall catpages manpages catlinks manlinks cleanman html installhtml cleanhtml
.if ${MKMAN} != "no"
realinstall: ${MANINSTALL}
.endif
cleandir: cleanman
TMACDIR?= ${DESTDIR}/usr/share/groff/tmac
HTMLDIR?= ${DESTDIR}/usr/share/man
.if exists(${TMACDIR}/tmac.andoc) && exists(${TMACDIR}/tmac.doc)
CATDEPS?= ${TMACDIR}/tmac.andoc \
${TMACDIR}/tmac.doc
.endif
MANTARGET?= cat
NROFF?= nroff -Tascii
GROFF?= groff -Tascii
TBL?= tbl
.SUFFIXES: .1 .2 .3 .4 .5 .6 .7 .8 .9 \
.cat1 .cat2 .cat3 .cat4 .cat5 .cat6 .cat7 .cat8 .cat9 \
.html1 .html2 .html3 .html4 .html5 .html6 .html7 .html8 .html9
.9.cat9 .8.cat8 .7.cat7 .6.cat6 .5.cat5 .4.cat4 .3.cat3 .2.cat2 .1.cat1: \
${CATDEPS}
.if !defined(USETBL)
@echo "${NROFF} -mandoc ${.IMPSRC} > ${.TARGET}"
@${NROFF} -mandoc ${.IMPSRC} > ${.TARGET} || \
(rm -f ${.TARGET}; false)
.else
@echo "${TBL} ${.IMPSRC} | ${NROFF} -mandoc > ${.TARGET}"
@${TBL} ${.IMPSRC} | ${NROFF} -mandoc > ${.TARGET} || \
(rm -f ${.TARGET}; false)
.endif
.9.html9 .8.html8 .7.html7 .6.html6 .5.html5 .4.html4 .3.html3 .2.html2 .1.html1: \
${CATDEPS}
.if !defined(USETBL)
@echo "${GROFF} -mdoc2html -P-b -P-u -P-o ${.IMPSRC} > ${.TARGET}"
@${GROFF} -mdoc2html -P-b -P-u -P-o ${.IMPSRC} > ${.TARGET} || \
(rm -f ${.TARGET}; false)
.else
@echo "${TBL} ${.IMPSRC} | ${GROFF} -mdoc2html -P-b -P-u -P-o > ${.TARGET}"
@cat ${.IMPSRC} | ${GROFF} -mdoc2html -P-b -P-u -P-o > ${.TARGET} || \
(rm -f ${.TARGET}; false)
.endif
.if defined(MAN) && !empty(MAN)
MANPAGES= ${MAN}
CATPAGES= ${MANPAGES:C/(.*).([1-9])/\1.cat\2/}
.NOPATH: ${CATPAGES}
.if !defined(NOHTML)
HTMLPAGES= ${MANPAGES:C/(.*).([1-9])/\1.html\2/}
.endif
.endif
MINSTALL= ${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} \
-o ${MANOWN} -g ${MANGRP} -m ${MANMODE}
.if defined(MANZ)
# chown and chmod are done afterward automatically
MCOMPRESS= gzip -cf
MCOMPRESSSUFFIX= .gz
.endif
catinstall: catlinks
maninstall: manlinks
__installpage: .USE
.if defined(MCOMPRESS) && !empty(MCOMPRESS)
@rm -f ${.TARGET}
${MCOMPRESS} ${.ALLSRC} > ${.TARGET}
@chown ${MANOWN}:${MANGRP} ${.TARGET}
@chmod ${MANMODE} ${.TARGET}
.else
@cmp -s ${.ALLSRC} ${.TARGET} > /dev/null 2>&1 || \
(echo "${MINSTALL} ${.ALLSRC} ${.TARGET}" && \
${MINSTALL} ${.ALLSRC} ${.TARGET})
.endif
# Rules for cat'ed man page installation
.if defined(CATPAGES) && !empty(CATPAGES) && ${MKCATPAGES} != "no"
catpages:: ${CATPAGES:@P@${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}@}
.PRECIOUS: ${CATPAGES:@P@${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}@}
.if !defined(UPDATE)
.PHONY: ${CATPAGES:@P@${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}@}
.endif
. for P in ${CATPAGES:O:u}
. if !defined(BUILD) && !make(all) && !make(${P})
${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}: .MADE
. endif
${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}: ${P} __installpage
. endfor
.else
catpages::
.endif
# Rules for source page installation
.if defined(MANPAGES) && !empty(MANPAGES)
manpages:: ${MANPAGES:@P@${DESTDIR}${MANDIR}/man${P:T:E}${MANSUBDIR}/${P}${MCOMPRESSSUFFIX}@}
.PRECIOUS: ${MANPAGES:@P@${DESTDIR}${MANDIR}/man${P:T:E}${MANSUBDIR}/${P}${MCOMPRESSSUFFIX}@}
.if !defined(UPDATE)
.PHONY: ${MANPAGES:@P@${DESTDIR}${MANDIR}/man${P:T:E}${MANSUBDIR}/${P}${MCOMPRESSSUFFIX}@}
.endif
. for P in ${MANPAGES:O:u}
${DESTDIR}${MANDIR}/man${P:T:E}${MANSUBDIR}/${P}${MCOMPRESSSUFFIX}: ${P} __installpage
. endfor
.else
manpages::
.endif
.if ${MKCATPAGES} != "no"
catlinks: catpages
.if defined(MLINKS) && !empty(MLINKS)
@set ${MLINKS}; \
while test $$# -ge 2; do \
name=$$1; \
shift; \
dir=${DESTDIR}${MANDIR}/cat$${name##*.}; \
l=$${dir}${MANSUBDIR}/$${name%.*}.0${MCOMPRESSSUFFIX}; \
name=$$1; \
shift; \
dir=${DESTDIR}${MANDIR}/cat$${name##*.}; \
t=$${dir}${MANSUBDIR}/$${name%.*}.0${MCOMPRESSSUFFIX}; \
if test $$l -nt $$t -o ! -f $$t; then \
echo $$t -\> $$l; \
ln -f $$l $$t; \
fi; \
done
.endif
.else
catlinks:
.endif
manlinks: manpages
.if defined(MLINKS) && !empty(MLINKS)
@set ${MLINKS}; \
while test $$# -ge 2; do \
name=$$1; \
shift; \
dir=${DESTDIR}${MANDIR}/man$${name##*.}; \
l=$${dir}${MANSUBDIR}/$${name}${MCOMPRESSSUFFIX}; \
name=$$1; \
shift; \
dir=${DESTDIR}${MANDIR}/man$${name##*.}; \
t=$${dir}${MANSUBDIR}/$${name}${MCOMPRESSSUFFIX}; \
if test $$l -nt $$t -o ! -f $$t; then \
echo $$t -\> $$l; \
ln -f $$l $$t; \
fi; \
done
.endif
# Html rules
html: ${HTMLPAGES}
.if defined(HTMLPAGES) && !empty(HTMLPAGES)
.for P in ${HTMLPAGES:O:u}
${HTMLDIR}/${P:T:E}/${P:T:R}.html: ${P}
${MINSTALL} ${.ALLSRC} ${.TARGET}
.endfor
.endif
installhtml: ${HTMLPAGES:@P@${HTMLDIR}/${P:T:E}/${P:T:R}.html@}
cleanhtml:
.if defined(HTMLPAGES) && !empty(HTMLPAGES)
rm -f ${HTMLPAGES}
.endif
.if defined(CATPAGES)
.if ${MKCATPAGES} != "no" && ${MKMAN} != "no"
realall: ${CATPAGES}
.else
realall:
.endif
cleanman:
rm -f ${CATPAGES}
.else
cleanman:
.endif
# Make sure all of the standard targets are defined, even if they do nothing.
clean depend includes lint regress tags:

View File

@@ -0,0 +1,65 @@
# $NetBSD: bsd.nls.mk,v 1.1.1.1 2006/07/14 23:13:00 jlam Exp $
.if !target(__initialized__)
__initialized__:
.if exists(${.CURDIR}/../Makefile.inc)
.include "${.CURDIR}/../Makefile.inc"
.endif
.MAIN: all
.endif
.PHONY: cleannls nlsinstall
cleandir: cleannls
.SUFFIXES: .cat .msg
.msg.cat:
@rm -f ${.TARGET}
gencat ${.TARGET} ${.IMPSRC}
.if defined(NLS) && !empty(NLS)
NLSALL= ${NLS:.msg=.cat}
.NOPATH: ${NLSALL}
NLSNAME?=${PROG:Ulib${LIB}}
.if ${MKNLS} != "no"
realinstall: nlsinstall
realall: ${NLSALL}
.endif
cleannls:
rm -f ${NLSALL}
nlsinstall:: ${DESTDIR}${NLSDIR}
.PRECIOUS:: ${DESTDIR}${NLSDIR}
.PHONY:: ${DESTDIR}${NLSDIR}
${DESTDIR}${NLSDIR}:
@if [ ! -d ${.TARGET} ] || [ -h ${.TARGET} ] ; then \
echo creating ${.TARGET}; \
/bin/rm -rf ${.TARGET}; \
${INSTALL} ${INSTPRIV} -d -o ${NLSOWN} -g ${NLSGRP} -m 755 \
${.TARGET}; \
fi
nlsinstall:: ${NLSALL:@F@${DESTDIR}${NLSDIR}/${F:T:R}/${NLSNAME}.cat@}
.PRECIOUS: ${NLSALL:@F@${DESTDIR}${NLSDIR}/${F:T:R}/${NLSNAME}.cat@}
.if !defined(UPDATE)
.PHONY: ${NLSALL:@F@${DESTDIR}${NLSDIR}/${F:T:R}/${NLSNAME}.cat@}
.endif
__nlsinstall: .USE
${INSTALL} ${INSTPRIV} -d -o ${NLSOWN} -g ${NLSGRP} ${.TARGET:H}
${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} -o ${NLSOWN} \
-g ${NLSGRP} -m ${NLSMODE} ${.ALLSRC} ${.TARGET}
.for F in ${NLSALL:O:u}
.if !defined(BUILD) && !make(all) && !make(${F})
${DESTDIR}${NLSDIR}/${F:T:R}/${NLSNAME}.cat: .MADE
.endif
${DESTDIR}${NLSDIR}/${F:T:R}/${NLSNAME}.cat: ${F} __nlsinstall
.endfor
.else
cleannls:
.endif

View File

@@ -0,0 +1,91 @@
# $NetBSD: bsd.obj.mk,v 1.1.1.1 2006/07/14 23:13:01 jlam Exp $
.if !target(__initialized_obj__)
__initialized_obj__:
.include <bsd.own.mk>
.endif
.if ${MKOBJ} == "no"
obj:
.else
.if defined(MAKEOBJDIRPREFIX) || defined(MAKEOBJDIR)
.if defined(MAKEOBJDIRPREFIX)
__objdir:= ${MAKEOBJDIRPREFIX}${.CURDIR}
.else
__objdir:= ${MAKEOBJDIR}
.endif
# MAKEOBJDIR and MAKEOBJDIRPREFIX are env variables supported
# by make(1). We simply mkdir -p the specified path.
# If that fails - we do a mkdir to get the appropriate error message
# before bailing out.
obj:
@if test ! -d ${__objdir}; then \
mkdir -p ${__objdir}; \
if test ! -d ${__objdir}; then \
mkdir ${__objdir}; exit 1; \
fi; \
echo "${.CURDIR} -> ${__objdir}"; \
fi
.else
.if defined(OBJMACHINE)
__objdir= obj.${MACHINE}
.else
__objdir= obj
.endif
.if defined(USR_OBJMACHINE)
__usrobjdir= ${BSDOBJDIR}.${MACHINE}
__usrobjdirpf=
.else
__usrobjdir= ${BSDOBJDIR}
.if defined(OBJMACHINE)
__usrobjdirpf= .${MACHINE}
.else
__usrobjdirpf=
.endif
.endif
PAWD?= /bin/pwd
obj:
@cd ${.CURDIR}; \
here=`${PAWD}`; subdir=$${here#${BSDSRCDIR}/}; \
if test $$here != $$subdir ; then \
if test ! -d ${__usrobjdir}; then \
echo "BSDOBJDIR ${__usrobjdir} does not exist, bailing..."; \
exit 1; \
fi; \
dest=${__usrobjdir}/$$subdir${__usrobjdirpf} ; \
if [ -h $$here/${__objdir} ]; then \
curtarg=`ls -ld $$here/${__objdir} | awk '{print $$NF}'` ; \
if [ "$$curtarg" = "$$dest" ]; then \
: ; \
else \
echo "$$here/${__objdir} -> $$dest"; \
rm -rf ${__objdir}; \
ln -s $$dest ${__objdir}; \
fi; \
else \
echo "$$here/${__objdir} -> $$dest"; \
rm -rf ${__objdir}; \
ln -s $$dest ${__objdir}; \
fi; \
if test ! -d $$dest; then \
mkdir -p $$dest; \
else \
true; \
fi; \
else \
true ; \
dest=$$here/${__objdir} ; \
if test ! -d ${__objdir} || test -h ${__objdir}; then \
echo "making $$dest" ; \
rm -f ${__objdir}; \
mkdir $$dest; \
fi ; \
fi;
.endif
.endif
print-objdir:
@echo ${.OBJDIR}

View File

@@ -0,0 +1,174 @@
# $NetBSD: bsd.prog.mk,v 1.1.1.1 2006/07/14 23:13:01 jlam Exp $
# @(#)bsd.prog.mk 8.2 (Berkeley) 4/2/94
.if !target(__initialized__)
__initialized__:
.if exists(${.CURDIR}/../Makefile.inc)
.include "${.CURDIR}/../Makefile.inc"
.endif
.include <bsd.own.mk>
.include <bsd.obj.mk>
.include <bsd.depall.mk>
.MAIN: all
.endif
.PHONY: cleanprog proginstall scriptsinstall
realinstall: proginstall scriptsinstall
clean cleandir: cleanprog
CFLAGS+= ${COPTS}
# ELF platforms depend on crtbegin.o and crtend.o
.if ${OBJECT_FMT} == "ELF" && ${MACHINE:Mirix} != ""
LIBCRTBEGIN?= ${DESTDIR}/usr/lib/crtbegin.o
LIBCRTEND?= ${DESTDIR}/usr/lib/crtend.o
.else
LIBCRTBEGIN?=
LIBCRTEND?=
.endif
# here is where you can define what LIB* are
.-include <libnames.mk>
.if defined(SHAREDSTRINGS)
CLEANFILES+=strings
.c.o:
${CC} -E ${CFLAGS} ${.IMPSRC} | xstr -c -
@${CC} ${CFLAGS} -c x.c -o ${.TARGET}
@rm -f x.c
.cc.o:
${CXX} -E ${CXXFLAGS} ${.IMPSRC} | xstr -c -
@mv -f x.c x.cc
@${CXX} ${CXXFLAGS} -c x.cc -o ${.TARGET}
@rm -f x.cc
.C.o:
${CXX} -E ${CXXFLAGS} ${.IMPSRC} | xstr -c -
@mv -f x.c x.C
@${CXX} ${CXXFLAGS} -c x.C -o ${.TARGET}
@rm -f x.C
.endif
.if defined(PROG)
SRCS?= ${PROG}.c
DPSRCS+= ${SRCS:M*.l:.l=.c} ${SRCS:M*.y:.y=.c}
CLEANFILES+= ${DPSRCS}
.if defined(YHEADER)
CLEANFILES+= ${SRCS:M*.y:.y=.h}
.endif
.if !empty(SRCS:N*.h:N*.sh:N*.fth)
OBJS+= ${SRCS:N*.h:N*.sh:N*.fth:R:S/$/.o/g}
LOBJS+= ${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
.endif
.if defined(OBJS) && !empty(OBJS)
.NOPATH: ${OBJS}
.if defined(DESTDIR)
${PROG}: ${LIBCRT0} ${DPSRCS} ${OBJS} ${LIBC} ${LIBCRTBEGIN} ${LIBCRTEND} ${DPADD}
.if !commands(${PROG})
${CC} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} -nostdlib -Wl,-rpath-link,${DESTDIR}/usr/lib ${LIBCRT0} ${LIBCRTBEGIN} ${OBJS} ${LDADD} -L${DESTDIR}/usr/lib -lgcc -lc -lgcc ${LIBCRTEND}
.endif
.else
${PROG}: ${LIBCRT0} ${DPSRCS} ${OBJS} ${LIBC} ${LIBCRTBEGIN} ${LIBCRTEND} ${DPADD}
.if !commands(${PROG})
${CC} ${LDFLAGS} ${LDSTATIC} -o ${.TARGET} ${OBJS} ${LDADD}
.endif
.endif # defined(DESTDIR)
.endif # defined(OBJS) && !empty(OBJS)
.if !defined(MAN)
MAN= ${PROG}.1
.endif # !defined(MAN)
.endif # defined(PROG)
realall: ${PROG} ${SCRIPTS}
cleanprog:
rm -f a.out [Ee]rrs mklog core *.core \
${PROG} ${OBJS} ${LOBJS} ${CLEANFILES}
.if defined(SRCS) && !target(afterdepend)
afterdepend: .depend
@(TMP=/tmp/_depend$$$$; \
sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.ln:/' \
< .depend > $$TMP; \
mv $$TMP .depend)
.endif
.if defined(PROG) && !target(proginstall)
PROGNAME?=${PROG}
proginstall:: ${DESTDIR}${BINDIR}/${PROGNAME}
.PRECIOUS: ${DESTDIR}${BINDIR}/${PROGNAME}
.if !defined(UPDATE)
.PHONY: ${DESTDIR}${BINDIR}/${PROGNAME}
.endif
__proginstall: .USE
${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${STRIPFLAG} ${INSTPRIV} \
-o ${BINOWN} -g ${BINGRP} -m ${BINMODE} ${.ALLSRC} ${.TARGET}
.if !defined(BUILD) && !make(all) && !make(${PROG})
${DESTDIR}${BINDIR}/${PROGNAME}: .MADE
.endif
${DESTDIR}${BINDIR}/${PROGNAME}: ${PROG} __proginstall
.endif
.if !target(proginstall)
proginstall::
.endif
.if defined(SCRIPTS) && !target(scriptsinstall)
SCRIPTSDIR?=${BINDIR}
SCRIPTSOWN?=${BINOWN}
SCRIPTSGRP?=${BINGRP}
SCRIPTSMODE?=${BINMODE}
scriptsinstall:: ${SCRIPTS:@S@${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}@}
.PRECIOUS: ${SCRIPTS:@S@${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}@}
.if !defined(UPDATE)
.PHONY: ${SCRIPTS:@S@${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}@}
.endif
__scriptinstall: .USE
${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} \
-o ${SCRIPTSOWN_${.ALLSRC:T}:U${SCRIPTSOWN}} \
-g ${SCRIPTSGRP_${.ALLSRC:T}:U${SCRIPTSGRP}} \
-m ${SCRIPTSMODE_${.ALLSRC:T}:U${SCRIPTSMODE}} \
${.ALLSRC} ${.TARGET}
.for S in ${SCRIPTS:O:u}
.if !defined(BUILD) && !make(all) && !make(${S})
${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}: .MADE
.endif
${DESTDIR}${SCRIPTSDIR_${S}:U${SCRIPTSDIR}}/${SCRIPTSNAME_${S}:U${SCRIPTSNAME:U${S:T:R}}}: ${S} __scriptinstall
.endfor
.endif
.if !target(scriptsinstall)
scriptsinstall::
.endif
lint: ${LOBJS}
.if defined(LOBJS) && !empty(LOBJS)
${LINT} ${LINTFLAGS} ${LDFLAGS:M-L*} ${LOBJS} ${LDADD}
.endif
.include <bsd.man.mk>
.include <bsd.nls.mk>
.include <bsd.files.mk>
.include <bsd.inc.mk>
.include <bsd.links.mk>
.include <bsd.dep.mk>
.include <bsd.sys.mk>
# Make sure all of the standard targets are defined, even if they do nothing.
regress:

View File

@@ -0,0 +1,62 @@
# $NetBSD: bsd.subdir.mk,v 1.1.1.1 2006/07/14 23:13:01 jlam Exp $
# @(#)bsd.subdir.mk 8.1 (Berkeley) 6/8/93
.if !target(__initialized__)
__initialized__:
.if exists(${.CURDIR}/../Makefile.inc)
.include "${.CURDIR}/../Makefile.inc"
.endif
.include <bsd.own.mk>
.MAIN: all
.endif
.for dir in ${SUBDIR}
.if exists(${dir}.${MACHINE})
__REALSUBDIR+=${dir}.${MACHINE}
.else
__REALSUBDIR+=${dir}
.endif
.endfor
.if defined(DESTDIR) && exists(${DESTDIR}/usr/share/mk/sys.mk)
_M=-m ${DESTDIR}/usr/share/mk
.else
_M=
.endif
__recurse: .USE
@targ=${.TARGET:C/-.*$//};dir=${.TARGET:C/^[^-]*-//}; \
case "$$dir" in /*) \
echo "$$targ ===> $$dir"; \
cd "$$dir"; \
${MAKE} ${_M} "_THISDIR_=$$dir/" $$targ; \
;; \
*) \
echo "$$targ ===> ${_THISDIR_}$$dir"; \
cd "${.CURDIR}/$$dir"; \
${MAKE} ${_M} "_THISDIR_=${_THISDIR_}$$dir/" $$targ; \
;; \
esac
# for obscure reasons, we can't do a simple .if ${dir} == ".WAIT"
# but have to assign to __TARGDIR first.
.for targ in ${TARGETS}
.for dir in ${__REALSUBDIR}
__TARGDIR := ${dir}
.if ${__TARGDIR} == ".WAIT"
SUBDIR_${targ} += .WAIT
.else
.PHONY: ${targ}-${dir}
${targ}-${dir}: .MAKE __recurse
SUBDIR_${targ} += ${targ}-${dir}
.endif
.endfor
.if defined(__REALSUBDIR)
.PHONY: subdir-${targ}
subdir-${targ}: ${SUBDIR_${targ}}
${targ}: subdir-${targ}
.endif
.endfor
# Make sure all of the standard targets are defined, even if they do nothing.
${TARGETS}:

View File

@@ -0,0 +1,134 @@
# $NetBSD: bsd.sys.mk,v 1.1.1.1 2006/07/14 23:13:01 jlam Exp $
#
# Overrides used for NetBSD source tree builds.
.if defined(WARNS)
.if ${WARNS} > 0
CFLAGS+= -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith
# XXX Delete -Wuninitialized by default for now -- the compiler doesn't
# XXX always get it right.
CFLAGS+= -Wno-uninitialized
.endif
.if ${WARNS} > 1
CFLAGS+=-Wreturn-type -Wcast-qual -Wpointer-arith -Wwrite-strings
CFLAGS+=-Wswitch -Wshadow
.endif
.endif
.if defined(WFORMAT) && defined(FORMAT_AUDIT)
.if ${WFORMAT} > 1
CFLAGS+=-Wnetbsd-format-audit -Wno-format-extra-args
.endif
.endif
.if !defined(NOGCCERROR)
CFLAGS+= -Werror
.endif
CFLAGS+= ${CWARNFLAGS}
.if defined(DESTDIR)
CPPFLAGS+= -nostdinc -idirafter ${DESTDIR}/usr/include
LINTFLAGS+= -d ${DESTDIR}/usr/include
.endif
.if defined(AUDIT)
CPPFLAGS+= -D__AUDIT__
.endif
.if defined(MKSOFTFLOAT) && (${MKSOFTFLOAT} != "no")
COPTS+= -msoft-float
FOPTS+= -msoft-float
.endif
# Helpers for cross-compiling
HOST_CC?= cc
HOST_CFLAGS?= -O
HOST_COMPILE.c?=${HOST_CC} ${HOST_CFLAGS} ${HOST_CPPFLAGS} -c
HOST_LINK.c?= ${HOST_CC} ${HOST_CFLAGS} ${HOST_CPPFLAGS} ${HOST_LDFLAGS}
HOST_CPP?= cpp
HOST_CPPFLAGS?=
HOST_LD?= ld
HOST_LDFLAGS?=
OBJCOPY?= objcopy
STRIP?= strip
CONFIG?= config
RPCGEN?= rpcgen
MKLOCALE?= mklocale
.SUFFIXES: .m .o .ln .lo
# Objective C
# (Defined here rather than in <sys.mk> because `.m' is not just
# used for Objective C source)
.m:
${LINK.m} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.m.o:
${COMPILE.m} ${.IMPSRC}
# Host-compiled C objects
.c.lo:
${HOST_COMPILE.c} -o ${.TARGET} ${.IMPSRC}
.if defined(PARALLEL) || defined(LPREFIX)
LPREFIX?=yy
LFLAGS+=-P${LPREFIX}
# Lex
.l:
${LEX.l} -o${.TARGET:R}.${LPREFIX}.c ${.IMPSRC}
${LINK.c} -o ${.TARGET} ${.TARGET:R}.${LPREFIX}.c ${LDLIBS} -ll
rm -f ${.TARGET:R}.${LPREFIX}.c
.l.c:
${LEX.l} -o${.TARGET} ${.IMPSRC}
.l.o:
${LEX.l} -o${.TARGET:R}.${LPREFIX}.c ${.IMPSRC}
${COMPILE.c} -o ${.TARGET} ${.TARGET:R}.${LPREFIX}.c
rm -f ${.TARGET:R}.${LPREFIX}.c
.l.lo:
${LEX.l} -o${.TARGET:R}.${LPREFIX}.c ${.IMPSRC}
${HOST_COMPILE.c} -o ${.TARGET} ${.TARGET:R}.${LPREFIX}.c
rm -f ${.TARGET:R}.${LPREFIX}.c
.endif
# Yacc
.if defined(YHEADER) || defined(YPREFIX)
.if defined(YPREFIX)
YFLAGS+=-p${YPREFIX}
.endif
.if defined(YHEADER)
YFLAGS+=-d
.endif
.y:
${YACC.y} -b ${.TARGET:R} ${.IMPSRC}
${LINK.c} -o ${.TARGET} ${.TARGET:R}.tab.c ${LDLIBS}
rm -f ${.TARGET:R}.tab.c ${.TARGET:R}.tab.h
.y.h: ${.TARGET:R}.c
.y.c:
${YACC.y} -o ${.TARGET} ${.IMPSRC}
.y.o:
${YACC.y} -b ${.TARGET:R} ${.IMPSRC}
${COMPILE.c} -o ${.TARGET} ${.TARGET:R}.tab.c
rm -f ${.TARGET:R}.tab.c ${TARGET:R}.tab.h
.y.lo:
${YACC.y} -b ${.TARGET:R} ${.IMPSRC}
${HOST_COMPILE.c} -o ${.TARGET} ${.TARGET:R}.tab.c
rm -f ${.TARGET:R}.tab.c ${TARGET:R}.tab.h
.elif defined(PARALLEL)
.y:
${YACC.y} -b ${.TARGET:R} ${.IMPSRC}
${LINK.c} -o ${.TARGET} ${.TARGET:R}.tab.c ${LDLIBS}
rm -f ${.TARGET:R}.tab.c
.y.c:
${YACC.y} -o ${.TARGET} ${.IMPSRC}
.y.o:
${YACC.y} -b ${.TARGET:R} ${.IMPSRC}
${COMPILE.c} -o ${.TARGET} ${.TARGET:R}.tab.c
rm -f ${.TARGET:R}.tab.c
.y.lo:
${YACC.y} -b ${.TARGET:R} ${.IMPSRC}
${HOST_COMPILE.c} -o ${.TARGET} ${.TARGET:R}.tab.c
rm -f ${.TARGET:R}.tab.c
.endif

View File

@@ -0,0 +1,208 @@
# $NetBSD: AIX.sys.mk,v 1.1 2008/07/03 20:06:21 joerg Exp $
# @(#)sys.mk 8.2 (Berkeley) 3/21/94
unix?= We run Unix
OS!= uname -s
.SUFFIXES: .out .a .ln .o .s .S .c .cc .cpp .cxx .C .F .f .r .y .l .cl .p .h
.SUFFIXES: .sh .m4
.LIBS: .a
AR?= ar
ARFLAGS?= rl
RANLIB?= ranlib
AS?= as
AFLAGS?=
.if ${MACHINE_ARCH} == "sparc64"
AFLAGS+= -Wa,-Av9a
.endif
COMPILE.s?= ${CC} ${AFLAGS} -c
LINK.s?= ${CC} ${AFLAGS} ${LDFLAGS}
COMPILE.S?= ${CC} ${AFLAGS} ${CPPFLAGS} -c -traditional-cpp
LINK.S?= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
CC?= cc
.if ${MACHINE_ARCH} == "alpha" || \
${MACHINE_ARCH} == "arm" || ${MACHINE_ARCH} == "arm26" || \
${MACHINE_ARCH} == "arm32" || \
${MACHINE_ARCH} == "i386" || \
${MACHINE_ARCH} == "m68k" || \
${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb" || \
${MACHINE_ARCH} == "sparc" || \
${MACHINE_ARCH} == "vax"
DBG?= -O2
.elif ${MACHINE_ARCH} == "x86_64"
DBG?=
.else
DBG?= -O
.endif
CFLAGS?= ${DBG}
COMPILE.c?= ${CC} ${CFLAGS} ${CPPFLAGS} -c
LINK.c?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
CXX?= c++
CXXFLAGS?= ${CFLAGS}
COMPILE.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
LINK.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
OBJC?= ${CC}
OBJCFLAGS?= ${CFLAGS}
COMPILE.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c
LINK.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} ${LDFLAGS}
CPP?= cpp
CPPFLAGS?=
FC?= f77
FFLAGS?= -O
RFLAGS?=
COMPILE.f?= ${FC} ${FFLAGS} -c
LINK.f?= ${FC} ${FFLAGS} ${LDFLAGS}
COMPILE.F?= ${FC} ${FFLAGS} ${CPPFLAGS} -c
LINK.F?= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
COMPILE.r?= ${FC} ${FFLAGS} ${RFLAGS} -c
LINK.r?= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
INSTALL?= install
LEX?= lex
LFLAGS?=
LEX.l?= ${LEX} ${LFLAGS}
LD?= ld
LDFLAGS?=
LINT?= lint
LINTFLAGS?= -chapbxzF
LORDER?= lorder
MAKE?= make
NM?= nm
PC?= pc
PFLAGS?=
COMPILE.p?= ${PC} ${PFLAGS} ${CPPFLAGS} -c
LINK.p?= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
SHELL?= sh
SIZE?= size
TSORT?= tsort
YACC?= yacc
YFLAGS?=
YACC.y?= ${YACC} ${YFLAGS}
# C
.c:
${LINK.c} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.c.o:
${COMPILE.c} ${.IMPSRC}
.c.a:
${COMPILE.c} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.c.ln:
${LINT} ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i ${.IMPSRC}
# C++
.cc .cpp .cxx .C:
${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.cc.o .cpp.o .cxx.o .C.o:
${COMPILE.cc} ${.IMPSRC}
.cc.a .cpp.a .cxx.a .C.a:
${COMPILE.cc} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Fortran/Ratfor
.f:
${LINK.f} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.f.o:
${COMPILE.f} ${.IMPSRC}
.f.a:
${COMPILE.f} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.F:
${LINK.F} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.F.o:
${COMPILE.F} ${.IMPSRC}
.F.a:
${COMPILE.F} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.r:
${LINK.r} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.r.o:
${COMPILE.r} ${.IMPSRC}
.r.a:
${COMPILE.r} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Pascal
.p:
${LINK.p} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.p.o:
${COMPILE.p} ${.IMPSRC}
.p.a:
${COMPILE.p} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Assembly
.s:
${LINK.s} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.s.o:
${COMPILE.s} ${.IMPSRC}
.s.a:
${COMPILE.s} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.S:
${LINK.S} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.S.o:
${COMPILE.S} ${.IMPSRC}
.S.a:
${COMPILE.S} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Lex
.l:
${LEX.l} ${.IMPSRC}
${LINK.c} -o ${.TARGET} lex.yy.c ${LDLIBS} -ll
rm -f lex.yy.c
.l.c:
${LEX.l} ${.IMPSRC}
mv lex.yy.c ${.TARGET}
.l.o:
${LEX.l} ${.IMPSRC}
${COMPILE.c} -o ${.TARGET} lex.yy.c
rm -f lex.yy.c
# Yacc
.y:
${YACC.y} ${.IMPSRC}
${LINK.c} -o ${.TARGET} y.tab.c ${LDLIBS}
rm -f y.tab.c
.y.c:
${YACC.y} ${.IMPSRC}
mv y.tab.c ${.TARGET}
.y.o:
${YACC.y} ${.IMPSRC}
${COMPILE.c} -o ${.TARGET} y.tab.c
rm -f y.tab.c
# Shell
.sh:
rm -f ${.TARGET}
cp ${.IMPSRC} ${.TARGET}

View File

@@ -0,0 +1,472 @@
# $NetBSD: Cygwin.bsd.lib.mk,v 1.1 2013/02/10 06:15:52 obache Exp $
# @(#)bsd.lib.mk 8.3 (Berkeley) 4/22/94
.if !target(__initialized__)
__initialized__:
.if exists(${.CURDIR}/../Makefile.inc)
.include "${.CURDIR}/../Makefile.inc"
.endif
.include <bsd.own.mk>
.include <bsd.obj.mk>
.include <bsd.depall.mk>
.MAIN: all
.endif
.PHONY: checkver cleanlib libinstall
realinstall: checkver libinstall
clean cleandir: cleanlib
.if exists(${SHLIB_VERSION_FILE})
SHLIB_MAJOR != . ${SHLIB_VERSION_FILE} ; echo $$major
SHLIB_MINOR != . ${SHLIB_VERSION_FILE} ; echo $$minor
SHLIB_TEENY != . ${SHLIB_VERSION_FILE} ; echo $$teeny
# Check for higher installed library versions.
.if !defined(NOCHECKVER) && !defined(NOCHECKVER_${LIB}) && \
exists(${BSDSRCDIR}/lib/checkver)
checkver:
@(cd ${.CURDIR} && \
sh ${BSDSRCDIR}/lib/checkver -v ${SHLIB_VERSION_FILE} \
-d ${DESTDIR}${LIBDIR} ${LIB})
.endif
.endif
.if !target(checkver)
checkver:
.endif
print-shlib-major:
.if defined(SHLIB_MAJOR)
@echo ${SHLIB_MAJOR}
.else
@false
.endif
print-shlib-minor:
.if defined(SHLIB_MINOR)
@echo ${SHLIB_MINOR}
.else
@false
.endif
print-shlib-teeny:
.if defined(SHLIB_TEENY)
@echo ${SHLIB_TEENY}
.else
@false
.endif
.if defined(SHLIB_MAJOR) && !empty(SHLIB_MAJOR)
.if defined(SHLIB_MINOR) && !empty(SHLIB_MINOR)
.if defined(SHLIB_TEENY) && !empty(SHLIB_TEENY)
SHLIB_FULLVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR}.${SHLIB_TEENY}
.else
SHLIB_FULLVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR}
.endif
.else
SHLIB_FULLVERSION=${SHLIB_MAJOR}
.endif
.endif
# add additional suffixes not exported.
# .po is used for profiling object files.
# .so is used for PIC object files.
.SUFFIXES: .out .a .ln .so .po .o .s .S .c .cc .C .m .F .f .r .y .l .cl .p .h
.SUFFIXES: .sh .m4 .m
# Set PICFLAGS to cc flags for producing position-independent code,
# if not already set. Includes -DPIC, if required.
# Data-driven table using make variables to control how shared libraries
# are built for different platforms and object formats.
# OBJECT_FMT: currently either "ELF" or "a.out", from <bsd.own.mk>
# SHLIB_SOVERSION: version number to be compiled into a shared library
# via -soname. Usualy ${SHLIB_MAJOR} on ELF.
# NetBSD/pmax used to use ${SHLIB_MAJOR}[.${SHLIB_MINOR}
# [.${SHLIB_TEENY}]]
# SHLIB_SHFLAGS: Flags to tell ${LD} to emit shared library.
# with ELF, also set shared-lib version for ld.so.
# SHLIB_LDSTARTFILE: support .o file, call C++ file-level constructors
# SHLIB_LDENDFILE: support .o file, call C++ file-level destructors
# FPICFLAGS: flags for ${FC} to compile .[fF] files to .so objects.
# CPPICFLAGS: flags for ${CPP} to preprocess .[sS] files for ${AS}
# CPICFLAGS: flags for ${CC} to compile .[cC] files to .so objects.
# CAPICFLAGS flags for {$CC} to compiling .[Ss] files
# (usually just ${CPPPICFLAGS} ${CPICFLAGS})
# APICFLAGS: flags for ${AS} to assemble .[sS] to .so objects.
SHLIB_LDSTARTFILE=
SHLIB_LDENDFILE=
SHLIB_SOVERSION= ${SHLIB_MAJOR}
SHLIB_SHFLAGS= -Wl,-h,lib${LIB}.so.${SHLIB_SOVERSION}
FPICFLAGS?=
CPICFLAGS?= -DPIC
CPPPICFLAGS?= -DPIC
CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS}
APICFLAGS?=
MKPICLIB?= yes
CFLAGS+= ${COPTS}
FFLAGS+= ${FOPTS}
.c.o:
.if defined(COPTS) && !empty(COPTS:M*-g*)
${COMPILE.c} ${.IMPSRC}
.else
@echo ${COMPILE.c:Q} ${.IMPSRC}
@${COMPILE.c} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.c.po:
.if defined(COPTS) && !empty(COPTS:M*-g*)
${COMPILE.c} -pg ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.c:Q} -pg ${.IMPSRC} -o ${.TARGET}
@${COMPILE.c} -pg ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.c.so:
.if defined(COPTS) && !empty(COPTS:M*-g*)
${COMPILE.c} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.c:Q} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
@${COMPILE.c} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.c.ln:
${LINT} ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i ${.IMPSRC}
.cc.o .C.o:
.if defined(COPTS) && !empty(COPTS:M*-g*)
${COMPILE.cc} ${.IMPSRC}
.else
@echo ${COMPILE.cc:Q} ${.IMPSRC}
@${COMPILE.cc} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.cc.po .C.po:
.if defined(COPTS) && !empty(COPTS:M*-g*)
${COMPILE.cc} -pg ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.cc:Q} -pg ${.IMPSRC} -o ${.TARGET}
@${COMPILE.cc} -pg ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.cc.so .C.so:
.if defined(COPTS) && !empty(COPTS:M*-g*)
${COMPILE.cc} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.cc:Q} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
@${COMPILE.cc} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.f.o:
.if defined(FOPTS) && !empty(FOPTS:M*-g*)
${COMPILE.f} ${.IMPSRC}
.else
@echo ${COMPILE.f:Q} ${.IMPSRC}
@${COMPILE.f} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.f.po:
.if defined(FOPTS) && !empty(FOPTS:M*-g*)
${COMPILE.f} -pg ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.f:Q} -pg ${.IMPSRC} -o ${.TARGET}
@${COMPILE.f} -pg ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.f.so:
.if defined(FOPTS) && !empty(FOPTS:M*-g*)
${COMPILE.f} ${FPICFLAGS} ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.f:Q} ${FPICFLAGS} ${.IMPSRC} -o ${.TARGET}
@${COMPILE.f} ${FPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.f.ln:
${ECHO} Skipping lint for Fortran libraries.
.m.o:
.if defined(OBJCFLAGS) && !empty(OBJCFLAGS:M*-g*)
${COMPILE.m} ${.IMPSRC}
.else
@echo ${COMPILE.m:Q} ${.IMPSRC}
@${COMPILE.m} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.m.po:
.if defined(OBJCFLAGS) && !empty(OBJCFLAGS:M*-g*)
${COMPILE.m} -pg ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.m:Q} -pg ${.IMPSRC} -o ${.TARGET}
@${COMPILE.m} -pg ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.m.so:
.if defined(OBJCFLAGS) && !empty(OBJCFLAGS:M*-g*)
${COMPILE.m} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.m:Q} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
@${COMPILE.m} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.S.o .s.o:
@echo ${COMPILE.S:Q} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC}
@${COMPILE.S} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.S.po .s.po:
@echo ${COMPILE.S:Q} -DGPROF -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}
@${COMPILE.S} -DGPROF -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.S.so .s.so:
@echo ${COMPILE.S:Q} ${CAPICFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}
@${COMPILE.S} ${CAPICFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.if ${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
|| ${MKLINKLIB} != "no"
_LIBS=lib${LIB}.a
.else
_LIBS=
.endif
OBJS+=${SRCS:N*.h:N*.sh:R:S/$/.o/g}
.if ${MKPROFILE} != "no"
_LIBS+=lib${LIB}_p.a
POBJS+=${OBJS:.o=.po}
.endif
.if ${MKPIC} != "no"
.if ${MKPICLIB} == "no"
SOLIB=lib${LIB}.a
.else
SOLIB=lib${LIB}_pic.a
_LIBS+=${SOLIB}
SOBJS+=${OBJS:.o=.so}
.endif
.if defined(SHLIB_FULLVERSION)
_LIBS+=lib${LIB}.so.${SHLIB_FULLVERSION}
.endif
.endif
LOBJS+=${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
.if ${MKLINT} != "no" && ${MKLINKLIB} != "no" && !empty(LOBJS)
_LIBS+=llib-l${LIB}.ln
.endif
.if ${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
|| ${MKLINKLIB} != "no"
ALLOBJS=${OBJS} ${POBJS} ${SOBJS}
.else
ALLOBJS=${POBJS} ${SOBJS}
.endif
.if ${MKLINT} != "no" && ${MKLINKLIB} != "no" && !empty(LOBJS)
ALLOBJS+=${LOBJS}
.endif
.NOPATH: ${ALLOBJS} ${_LIBS}
realall: ${SRCS} ${ALLOBJS:O} ${_LIBS}
__archivebuild: .USE
@rm -f ${.TARGET}
${AR} cq ${.TARGET} ${.ALLSRC:M*o}
${RANLIB} ${.TARGET}
__archiveinstall: .USE
${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} -o ${LIBOWN} \
-g ${LIBGRP} -m 600 ${.ALLSRC} ${.TARGET}
${RANLIB} -t ${.TARGET}
chmod ${LIBMODE} ${.TARGET}
DPSRCS+= ${SRCS:M*.l:.l=.c} ${SRCS:M*.y:.y=.c}
CLEANFILES+= ${DPSRCS}
.if defined(YHEADER)
CLEANFILES+= ${SRCS:M*.y:.y=.h}
.endif
lib${LIB}.a:: ${OBJS} __archivebuild
@echo building standard ${LIB} library
lib${LIB}_p.a:: ${POBJS} __archivebuild
@echo building profiled ${LIB} library
lib${LIB}_pic.a:: ${SOBJS} __archivebuild
@echo building shared object ${LIB} library
lib${LIB}.so.${SHLIB_FULLVERSION}: ${SOLIB} ${DPADD} \
${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE}
@echo building shared ${LIB} library \(version ${SHLIB_FULLVERSION}\)
@rm -f lib${LIB}.so.${SHLIB_FULLVERSION}
$(CC) -shared ${SHLIB_SHFLAGS} -o ${.TARGET} \
${SHLIB_LDSTARTFILE} \
-Wl,--image-base,$$(($$RANDOM %4096/2*262144+1342177280)) \
-Wl,--whole-archive ${SOLIB} -Wl,--no-whole-archive ${LDADD} \
${SHLIB_LDENDFILE}
.if ${OBJECT_FMT} == "ELF"
ln -sf lib${LIB}.so.${SHLIB_FULLVERSION} lib${LIB}.so.${SHLIB_MAJOR}.tmp
mv -f lib${LIB}.so.${SHLIB_MAJOR}.tmp lib${LIB}.so.${SHLIB_MAJOR}
ln -sf lib${LIB}.so.${SHLIB_FULLVERSION} lib${LIB}.so.tmp
mv -f lib${LIB}.so.tmp lib${LIB}.so
.endif
.if !empty(LOBJS)
LLIBS?= -lc
llib-l${LIB}.ln: ${LOBJS}
@echo building llib-l${LIB}.ln
@rm -f llib-l${LIB}.ln
@${LINT} -C${LIB} ${.ALLSRC} ${LLIBS}
.endif
cleanlib:
rm -f a.out [Ee]rrs mklog core *.core ${CLEANFILES}
rm -f lib${LIB}.a ${OBJS}
rm -f lib${LIB}_p.a ${POBJS}
rm -f lib${LIB}_pic.a lib${LIB}.so.* lib${LIB}.so ${SOBJS}
rm -f llib-l${LIB}.ln ${LOBJS}
.if defined(SRCS)
afterdepend: .depend
@(TMP=/tmp/_depend$$$$; \
sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.po \1.so \1.ln:/' \
< .depend > $$TMP; \
mv $$TMP .depend)
.endif
.if !target(libinstall)
# Make sure it gets defined, in case MKPIC==no && MKLINKLIB==no
libinstall::
.if ${MKLINKLIB} != "no"
libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}.a
.PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}.a
.if !defined(UPDATE)
.PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}.a
.endif
.if !defined(BUILD) && !make(all) && !make(lib${LIB}.a)
${DESTDIR}${LIBDIR}/lib${LIB}.a: .MADE
.endif
${DESTDIR}${LIBDIR}/lib${LIB}.a: lib${LIB}.a __archiveinstall
.endif
.if ${MKPROFILE} != "no"
libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
.PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
.if !defined(UPDATE)
.PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
.endif
.if !defined(BUILD) && !make(all) && !make(lib${LIB}_p.a)
${DESTDIR}${LIBDIR}/lib${LIB}_p.a: .MADE
.endif
${DESTDIR}${LIBDIR}/lib${LIB}_p.a: lib${LIB}_p.a __archiveinstall
.endif
.if ${MKPIC} != "no" && ${MKPICINSTALL} != "no"
libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
.PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
.if !defined(UPDATE)
.PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
.endif
.if !defined(BUILD) && !make(all) && !make(lib${LIB}_pic.a)
${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: .MADE
.endif
.if ${MKPICLIB} == "no"
${DESTDIR}${LIBDIR}/lib${LIB}_pic.a:
rm -f ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
ln -s lib${LIB}.a ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
.else
${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: lib${LIB}_pic.a __archiveinstall
.endif
.endif
.if ${MKPIC} != "no" && defined(SHLIB_FULLVERSION)
libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}
.PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}
.if !defined(UPDATE)
.PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}
.endif
.if !defined(BUILD) && !make(all) && !make(lib${LIB}.so.${SHLIB_FULLVERSION})
${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}: .MADE
.endif
${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}: lib${LIB}.so.${SHLIB_FULLVERSION}
${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} -o ${LIBOWN} \
-g ${LIBGRP} -m ${LIBMODE} ${.ALLSRC} ${.TARGET}
.if ${OBJECT_FMT} == "a.out" && !defined(DESTDIR)
/sbin/ldconfig -m ${LIBDIR}
.endif
.if ${OBJECT_FMT} == "ELF"
ln -sf lib${LIB}.so.${SHLIB_FULLVERSION}\
${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}.tmp
mv -f ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}.tmp\
${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}
.if ${MKLINKLIB} != "no"
ln -sf lib${LIB}.so.${SHLIB_FULLVERSION}\
${DESTDIR}${LIBDIR}/lib${LIB}.so.tmp
mv -f ${DESTDIR}${LIBDIR}/lib${LIB}.so.tmp\
${DESTDIR}${LIBDIR}/lib${LIB}.so
.endif
.endif
.endif
.if ${MKLINT} != "no" && ${MKLINKLIB} != "no" && !empty(LOBJS)
libinstall:: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
.PRECIOUS: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
.if !defined(UPDATE)
.PHONY: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
.endif
.if !defined(BUILD) && !make(all) && !make(llib-l${LIB}.ln)
${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln: .MADE
.endif
${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln: llib-l${LIB}.ln
${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} -o ${LIBOWN} \
-g ${LIBGRP} -m ${LIBMODE} ${.ALLSRC} ${DESTDIR}${LINTLIBDIR}
.endif
.endif
.include <bsd.man.mk>
.include <bsd.nls.mk>
.include <bsd.files.mk>
.include <bsd.inc.mk>
.include <bsd.links.mk>
.include <bsd.dep.mk>
.include <bsd.sys.mk>
# Make sure all of the standard targets are defined, even if they do nothing.
lint regress:

View File

@@ -0,0 +1,194 @@
# $NetBSD: Cygwin.sys.mk,v 1.1 2013/02/10 06:15:52 obache Exp $
unix?= We run Unix
OS!= uname -s
.SUFFIXES: .out .a .ln .o .s .S .c .cc .cpp .cxx .C .F .f .r .y .l .cl .p .h
.SUFFIXES: .sh .m4
.LIBS: .a
AR?= ar
ARFLAGS?= rl
RANLIB?= ranlib
AS?= as
AFLAGS?=
COMPILE.s?= ${CC} ${AFLAGS} -c
LINK.s?= ${CC} ${AFLAGS} ${LDFLAGS}
COMPILE.S?= ${CC} ${AFLAGS} ${CPPFLAGS} -c -traditional-cpp
LINK.S?= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
# Unless told otherwise, assume GNU CC
CC?= gcc
DBG?= -O
CFLAGS?= ${DBG}
COMPILE.c?= ${CC} ${CFLAGS} ${CPPFLAGS} -c
LINK.c?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
CXX?= c++
CXXFLAGS?= ${CFLAGS}
COMPILE.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
LINK.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
OBJC?= ${CC}
OBJCFLAGS?= ${CFLAGS}
COMPILE.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c
LINK.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} ${LDFLAGS}
CPP?= cpp
CPPFLAGS?=
FC?= f77
FFLAGS?= -O
RFLAGS?=
COMPILE.f?= ${FC} ${FFLAGS} -c
LINK.f?= ${FC} ${FFLAGS} ${LDFLAGS}
COMPILE.F?= ${FC} ${FFLAGS} ${CPPFLAGS} -c
LINK.F?= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
COMPILE.r?= ${FC} ${FFLAGS} ${RFLAGS} -c
LINK.r?= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
INSTALL?= ${LOCALBASE}/bin/install-sh
LEX?= lex
LFLAGS?=
LEX.l?= ${LEX} ${LFLAGS}
LD?= ld
LDFLAGS?=
LINT?= lint
LINTFLAGS?= -chapbxzF
LORDER?= lorder
MAKE?= make
NM?= nm
PC?= pc
PFLAGS?=
COMPILE.p?= ${PC} ${PFLAGS} ${CPPFLAGS} -c
LINK.p?= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
SHELL?= sh
SIZE?= size
TSORT?= tsort -q
YACC?= yacc
YFLAGS?=
YACC.y?= ${YACC} ${YFLAGS}
# C
.c:
${LINK.c} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.c.o:
${COMPILE.c} ${.IMPSRC}
.c.a:
${COMPILE.c} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.c.ln:
${LINT} ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i ${.IMPSRC}
# C++
.cc .cpp .cxx .C:
${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.cc.o .cpp.o .cxx.o .C.o:
${COMPILE.cc} ${.IMPSRC}
.cc.a .cpp.a .cxx.a .C.a:
${COMPILE.cc} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Fortran/Ratfor
.f:
${LINK.f} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.f.o:
${COMPILE.f} ${.IMPSRC}
.f.a:
${COMPILE.f} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.F:
${LINK.F} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.F.o:
${COMPILE.F} ${.IMPSRC}
.F.a:
${COMPILE.F} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.r:
${LINK.r} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.r.o:
${COMPILE.r} ${.IMPSRC}
.r.a:
${COMPILE.r} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Pascal
.p:
${LINK.p} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.p.o:
${COMPILE.p} ${.IMPSRC}
.p.a:
${COMPILE.p} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Assembly
.s:
${LINK.s} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.s.o:
${COMPILE.s} ${.IMPSRC}
.s.a:
${COMPILE.s} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.S:
${LINK.S} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.S.o:
${COMPILE.S} ${.IMPSRC}
.S.a:
${COMPILE.S} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Lex
.l:
${LEX.l} ${.IMPSRC}
${LINK.c} -o ${.TARGET} lex.yy.c ${LDLIBS} -ll
rm -f lex.yy.c
.l.c:
${LEX.l} ${.IMPSRC}
mv lex.yy.c ${.TARGET}
.l.o:
${LEX.l} ${.IMPSRC}
${COMPILE.c} -o ${.TARGET} lex.yy.c
rm -f lex.yy.c
# Yacc
.y:
${YACC.y} ${.IMPSRC}
${LINK.c} -o ${.TARGET} y.tab.c ${LDLIBS}
rm -f y.tab.c
.y.c:
${YACC.y} ${.IMPSRC}
mv y.tab.c ${.TARGET}
.y.o:
${YACC.y} ${.IMPSRC}
${COMPILE.c} -o ${.TARGET} y.tab.c
rm -f y.tab.c
# Shell
.sh:
rm -f ${.TARGET}
cp ${.IMPSRC} ${.TARGET}

View File

@@ -0,0 +1,524 @@
# $NetBSD: Darwin.bsd.lib.mk,v 1.3 2009/05/12 23:21:10 minskim Exp $
# @(#)bsd.lib.mk 8.3 (Berkeley) 4/22/94
.if !target(__initialized__)
__initialized__:
.if exists(${.CURDIR}/../Makefile.inc)
.include "${.CURDIR}/../Makefile.inc"
.endif
.include <bsd.own.mk>
.include <bsd.obj.mk>
.include <bsd.depall.mk>
.MAIN: all
.endif
.PHONY: checkver cleanlib libinstall
realinstall: checkver libinstall
clean cleandir: cleanlib
.if exists(${SHLIB_VERSION_FILE})
SHLIB_MAJOR != . ${SHLIB_VERSION_FILE} ; echo $$major
SHLIB_MINOR != . ${SHLIB_VERSION_FILE} ; echo $$minor
SHLIB_TEENY != . ${SHLIB_VERSION_FILE} ; echo $$teeny
# Check for higher installed library versions.
.if !defined(NOCHECKVER) && !defined(NOCHECKVER_${LIB}) && \
exists(${BSDSRCDIR}/lib/checkver)
checkver:
@(cd ${.CURDIR} && \
sh ${BSDSRCDIR}/lib/checkver -v ${SHLIB_VERSION_FILE} \
-d ${DESTDIR}${LIBDIR} ${LIB})
.endif
.endif
.if !target(checkver)
checkver:
.endif
print-shlib-major:
.if defined(SHLIB_MAJOR)
@echo ${SHLIB_MAJOR}
.else
@false
.endif
print-shlib-minor:
.if defined(SHLIB_MINOR)
@echo ${SHLIB_MINOR}
.else
@false
.endif
print-shlib-teeny:
.if defined(SHLIB_TEENY)
@echo ${SHLIB_TEENY}
.else
@false
.endif
.if defined(SHLIB_MAJOR) && !empty(SHLIB_MAJOR)
.if defined(SHLIB_MINOR) && !empty(SHLIB_MINOR)
.if defined(SHLIB_TEENY) && !empty(SHLIB_TEENY)
SHLIB_FULLVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR}.${SHLIB_TEENY}
.else
SHLIB_FULLVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR}
.endif
.else
SHLIB_FULLVERSION=${SHLIB_MAJOR}
.endif
.endif
# add additional suffixes not exported.
# .po is used for profiling object files.
# .so is used for PIC object files.
.SUFFIXES: .out .a .ln .so .po .o .s .S .c .cc .C .m .F .f .r .y .l .cl .p .h
.SUFFIXES: .sh .m4 .m
# Set PICFLAGS to cc flags for producing position-independent code,
# if not already set. Includes -DPIC, if required.
# Data-driven table using make variables to control how shared libraries
# are built for different platforms and object formats.
# OBJECT_FMT: currently either "ELF" or "a.out", from <bsd.own.mk>
# SHLIB_SOVERSION: version number to be compiled into a shared library
# via -soname. Usualy ${SHLIB_MAJOR} on ELF.
# NetBSD/pmax used to use ${SHLIB_MAJOR}[.${SHLIB_MINOR}
# [.${SHLIB_TEENY}]]
# SHLIB_SHFLAGS: Flags to tell ${LD} to emit shared library.
# with ELF, also set shared-lib version for ld.so.
# SHLIB_LDSTARTFILE: support .o file, call C++ file-level constructors
# SHLIB_LDENDFILE: support .o file, call C++ file-level destructors
# FPICFLAGS: flags for ${FC} to compile .[fF] files to .so objects.
# CPPICFLAGS: flags for ${CPP} to preprocess .[sS] files for ${AS}
# CPICFLAGS: flags for ${CC} to compile .[cC] files to .so objects.
# CAPICFLAGS flags for {$CC} to compiling .[Ss] files
# (usually just ${CPPPICFLAGS} ${CPICFLAGS})
# APICFLAGS: flags for ${AS} to assemble .[sS] to .so objects.
.if ${MACHINE_ARCH} == "alpha"
# Alpha-specific shared library flags
FPICFLAGS ?= -fPIC
CPICFLAGS ?= -fPIC -DPIC
CPPPICFLAGS?= -DPIC
CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS}
APICFLAGS ?=
.elif ${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb"
# mips-specific shared library flags
# On mips, all libs are compiled with ABIcalls, not just sharedlibs.
MKPICLIB= no
# so turn shlib PIC flags on for ${AS}.
AINC+=-DABICALLS
AFLAGS+= -fPIC
AS+= -KPIC
.elif ${MACHINE_ARCH} == "vax" && ${OBJECT_FMT} == "ELF"
# On the VAX, all object are PIC by default, not just sharedlibs.
MKPICLIB= no
.elif (${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64") && \
${OBJECT_FMT} == "ELF"
FPICFLAGS ?= -fPIC
CPICFLAGS ?= -fPIC -DPIC
CPPPICFLAGS?= -DPIC
CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS}
APICFLAGS ?= -KPIC
.else
# Platform-independent flags for NetBSD a.out shared libraries (and PowerPC)
SHLIB_LDSTARTFILE=
SHLIB_LDENDFILE=
SHLIB_SOVERSION=${SHLIB_FULLVERSION}
SHLIB_SHFLAGS=
FPICFLAGS ?= -fPIC
CPICFLAGS?= -fPIC -DPIC
CPPPICFLAGS?= -DPIC
CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS}
APICFLAGS?= -k
.endif
MKPICLIB?= yes
# Platform-independent linker flags for ELF shared libraries
.if ${OBJECT_FMT} == "ELF"
SHLIB_SOVERSION= ${SHLIB_MAJOR}
SHLIB_SHFLAGS= -soname lib${LIB}.so.${SHLIB_SOVERSION}
SHLIB_LDSTARTFILE?= ${DESTDIR}/usr/lib/crtbeginS.o
SHLIB_LDENDFILE?= ${DESTDIR}/usr/lib/crtendS.o
.endif
CFLAGS+= ${COPTS}
FFLAGS+= ${FOPTS}
.c.o:
.if defined(COPTS) && !empty(COPTS:M*-g*)
${COMPILE.c} ${.IMPSRC}
.else
@echo ${COMPILE.c:Q} ${.IMPSRC}
@${COMPILE.c} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.c.po:
.if defined(COPTS) && !empty(COPTS:M*-g*)
${COMPILE.c} -pg ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.c:Q} -pg ${.IMPSRC} -o ${.TARGET}
@${COMPILE.c} -pg ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.c.so:
.if defined(COPTS) && !empty(COPTS:M*-g*)
${COMPILE.c} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.c:Q} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
@${COMPILE.c} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.c.ln:
${LINT} ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i ${.IMPSRC}
.cc.o .C.o:
.if defined(COPTS) && !empty(COPTS:M*-g*)
${COMPILE.cc} ${.IMPSRC}
.else
@echo ${COMPILE.cc:Q} ${.IMPSRC}
@${COMPILE.cc} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.cc.po .C.po:
.if defined(COPTS) && !empty(COPTS:M*-g*)
${COMPILE.cc} -pg ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.cc:Q} -pg ${.IMPSRC} -o ${.TARGET}
@${COMPILE.cc} -pg ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.cc.so .C.so:
.if defined(COPTS) && !empty(COPTS:M*-g*)
${COMPILE.cc} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.cc:Q} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
@${COMPILE.cc} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.f.o:
.if defined(FOPTS) && !empty(FOPTS:M*-g*)
${COMPILE.f} ${.IMPSRC}
.else
@echo ${COMPILE.f:Q} ${.IMPSRC}
@${COMPILE.f} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.f.po:
.if defined(FOPTS) && !empty(FOPTS:M*-g*)
${COMPILE.f} -pg ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.f:Q} -pg ${.IMPSRC} -o ${.TARGET}
@${COMPILE.f} -pg ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.f.so:
.if defined(FOPTS) && !empty(FOPTS:M*-g*)
${COMPILE.f} ${FPICFLAGS} ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.f:Q} ${FPICFLAGS} ${.IMPSRC} -o ${.TARGET}
@${COMPILE.f} ${FPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.f.ln:
${ECHO} Skipping lint for Fortran libraries.
.m.o:
.if defined(OBJCFLAGS) && !empty(OBJCFLAGS:M*-g*)
${COMPILE.m} ${.IMPSRC}
.else
@echo ${COMPILE.m:Q} ${.IMPSRC}
@${COMPILE.m} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.m.po:
.if defined(OBJCFLAGS) && !empty(OBJCFLAGS:M*-g*)
${COMPILE.m} -pg ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.m:Q} -pg ${.IMPSRC} -o ${.TARGET}
@${COMPILE.m} -pg ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.m.so:
.if defined(OBJCFLAGS) && !empty(OBJCFLAGS:M*-g*)
${COMPILE.m} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.m:Q} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
@${COMPILE.m} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.S.o .s.o:
@echo ${COMPILE.S:Q} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC}
@${COMPILE.S} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.S.po .s.po:
@echo ${COMPILE.S:Q} -DGPROF -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}
@${COMPILE.S} -DGPROF -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.S.so .s.so:
@echo ${COMPILE.S:Q} ${CAPICFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}
@${COMPILE.S} ${CAPICFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.if ${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
|| ${MKLINKLIB} != "no"
_LIBS=lib${LIB}.a
.else
_LIBS=
.endif
OBJS+=${SRCS:N*.h:N*.sh:R:S/$/.o/g}
.if ${MKPROFILE} != "no"
_LIBS+=lib${LIB}_p.a
POBJS+=${OBJS:.o=.po}
.endif
.if ${MKPIC} != "no"
.if ${MKPICLIB} == "no"
SOLIB=lib${LIB}.a
.else
SOLIB=lib${LIB}_pic.a
_LIBS+=${SOLIB}
SOBJS+=${OBJS:.o=.so}
.endif
.if defined(SHLIB_FULLVERSION)
_LIBS+=lib${LIB}.so.${SHLIB_FULLVERSION}
.endif
.endif
LOBJS+=${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
.if ${MKLINT} != "no" && ${MKLINKLIB} != "no" && !empty(LOBJS)
_LIBS+=llib-l${LIB}.ln
.endif
.if ${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
|| ${MKLINKLIB} != "no"
ALLOBJS=${OBJS} ${POBJS} ${SOBJS}
.else
ALLOBJS=${POBJS} ${SOBJS}
.endif
.if ${MKLINT} != "no" && ${MKLINKLIB} != "no" && !empty(LOBJS)
ALLOBJS+=${LOBJS}
.endif
.NOPATH: ${ALLOBJS} ${_LIBS}
realall: ${SRCS} ${ALLOBJS:O} ${_LIBS}
__archivebuild: .USE
@rm -f ${.TARGET}
${AR} -c -q ${.TARGET} `NM=${NM} ${LORDER} ${.ALLSRC:M*o} | ${TSORT}`
${RANLIB} ${.TARGET}
__archiveinstall: .USE
${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} -o ${LIBOWN} \
-g ${LIBGRP} -m 600 ${.ALLSRC} ${.TARGET}
touch ${.TARGET}
chmod ${LIBMODE} ${.TARGET}
DPSRCS+= ${SRCS:M*.l:.l=.c} ${SRCS:M*.y:.y=.c}
CLEANFILES+= ${DPSRCS}
.if defined(YHEADER)
CLEANFILES+= ${SRCS:M*.y:.y=.h}
.endif
lib${LIB}.a:: ${OBJS} __archivebuild
@echo building standard ${LIB} library
lib${LIB}_p.a:: ${POBJS} __archivebuild
@echo building profiled ${LIB} library
lib${LIB}_pic.a:: ${SOBJS} __archivebuild
@echo building shared object ${LIB} library
lib${LIB}.so.${SHLIB_FULLVERSION}: ${SOLIB} ${DPADD} \
${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE}
@echo building shared ${LIB} library \(version ${SHLIB_FULLVERSION}\)
@rm -f lib${LIB}.so.${SHLIB_FULLVERSION}
.if defined(DESTDIR)
$(LD) -nostdlib -shared ${SHLIB_SHFLAGS} -o ${.TARGET} \
${SHLIB_LDSTARTFILE} \
--whole-archive ${SOLIB} \
--no-whole-archive ${LDADD} \
-L${DESTDIR}${LIBDIR} -R${LIBDIR} \
${SHLIB_LDENDFILE}
.else
$(LD) -shared ${SHLIB_SHFLAGS} -o ${.TARGET} \
${SHLIB_LDSTARTFILE} \
--whole-archive ${SOLIB} --no-whole-archive ${LDADD} \
${SHLIB_LDENDFILE}
.endif
.if ${OBJECT_FMT} == "ELF"
ln -sf lib${LIB}.so.${SHLIB_FULLVERSION} lib${LIB}.so.${SHLIB_MAJOR}.tmp
mv -f lib${LIB}.so.${SHLIB_MAJOR}.tmp lib${LIB}.so.${SHLIB_MAJOR}
ln -sf lib${LIB}.so.${SHLIB_FULLVERSION} lib${LIB}.so.tmp
mv -f lib${LIB}.so.tmp lib${LIB}.so
.endif
.if !empty(LOBJS)
LLIBS?= -lc
llib-l${LIB}.ln: ${LOBJS}
@echo building llib-l${LIB}.ln
@rm -f llib-l${LIB}.ln
@${LINT} -C${LIB} ${.ALLSRC} ${LLIBS}
.endif
cleanlib:
rm -f a.out [Ee]rrs mklog core *.core ${CLEANFILES}
rm -f lib${LIB}.a ${OBJS}
rm -f lib${LIB}_p.a ${POBJS}
rm -f lib${LIB}_pic.a lib${LIB}.so.* lib${LIB}.so ${SOBJS}
rm -f llib-l${LIB}.ln ${LOBJS}
.if defined(SRCS)
afterdepend: .depend
@(TMP=/tmp/_depend$$$$; \
sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.po \1.so \1.ln:/' \
< .depend > $$TMP; \
mv $$TMP .depend)
.endif
.if !target(libinstall)
# Make sure it gets defined, in case MKPIC==no && MKLINKLIB==no
libinstall::
.if ${MKLINKLIB} != "no"
libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}.a
.PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}.a
.if !defined(UPDATE)
.PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}.a
.endif
.if !defined(BUILD) && !make(all) && !make(lib${LIB}.a)
${DESTDIR}${LIBDIR}/lib${LIB}.a: .MADE
.endif
${DESTDIR}${LIBDIR}/lib${LIB}.a: lib${LIB}.a __archiveinstall
.endif
.if ${MKPROFILE} != "no"
libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
.PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
.if !defined(UPDATE)
.PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
.endif
.if !defined(BUILD) && !make(all) && !make(lib${LIB}_p.a)
${DESTDIR}${LIBDIR}/lib${LIB}_p.a: .MADE
.endif
${DESTDIR}${LIBDIR}/lib${LIB}_p.a: lib${LIB}_p.a __archiveinstall
.endif
.if ${MKPIC} != "no" && ${MKPICINSTALL} != "no"
libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
.PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
.if !defined(UPDATE)
.PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
.endif
.if !defined(BUILD) && !make(all) && !make(lib${LIB}_pic.a)
${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: .MADE
.endif
.if ${MKPICLIB} == "no"
${DESTDIR}${LIBDIR}/lib${LIB}_pic.a:
rm -f ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
ln -s lib${LIB}.a ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
.else
${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: lib${LIB}_pic.a __archiveinstall
.endif
.endif
.if ${MKPIC} != "no" && defined(SHLIB_FULLVERSION)
libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}
.PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}
.if !defined(UPDATE)
.PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}
.endif
.if !defined(BUILD) && !make(all) && !make(lib${LIB}.so.${SHLIB_FULLVERSION})
${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}: .MADE
.endif
${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}: lib${LIB}.so.${SHLIB_FULLVERSION}
${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} -o ${LIBOWN} \
-g ${LIBGRP} -m ${LIBMODE} ${.ALLSRC} ${.TARGET}
.if ${OBJECT_FMT} == "a.out" && !defined(DESTDIR)
/sbin/ldconfig -m ${LIBDIR}
.endif
.if ${OBJECT_FMT} == "ELF"
ln -sf lib${LIB}.so.${SHLIB_FULLVERSION}\
${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}.tmp
mv -f ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}.tmp\
${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}
.if ${MKLINKLIB} != "no"
ln -sf lib${LIB}.so.${SHLIB_FULLVERSION}\
${DESTDIR}${LIBDIR}/lib${LIB}.so.tmp
mv -f ${DESTDIR}${LIBDIR}/lib${LIB}.so.tmp\
${DESTDIR}${LIBDIR}/lib${LIB}.so
.endif
.endif
.endif
.if ${MKLINT} != "no" && ${MKLINKLIB} != "no" && !empty(LOBJS)
libinstall:: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
.PRECIOUS: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
.if !defined(UPDATE)
.PHONY: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
.endif
.if !defined(BUILD) && !make(all) && !make(llib-l${LIB}.ln)
${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln: .MADE
.endif
${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln: llib-l${LIB}.ln
${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} -o ${LIBOWN} \
-g ${LIBGRP} -m ${LIBMODE} ${.ALLSRC} ${DESTDIR}${LINTLIBDIR}
.endif
.endif
.include <bsd.man.mk>
.include <bsd.nls.mk>
.include <bsd.files.mk>
.include <bsd.inc.mk>
.include <bsd.links.mk>
.include <bsd.dep.mk>
.include <bsd.sys.mk>
# Make sure all of the standard targets are defined, even if they do nothing.
lint regress:

View File

@@ -0,0 +1,207 @@
# $NetBSD: Darwin.bsd.man.mk,v 1.2 2007/11/04 08:08:52 minskim Exp $
# @(#)bsd.man.mk 8.1 (Berkeley) 6/8/93
.if !target(__initialized__)
__initialized__:
.if exists(${.CURDIR}/../Makefile.inc)
.include "${.CURDIR}/../Makefile.inc"
.endif
.include <bsd.own.mk>
.include <bsd.obj.mk>
.include <bsd.depall.mk>
.MAIN: all
.endif
.PHONY: catinstall maninstall catpages manpages catlinks manlinks cleanman html installhtml cleanhtml
.if ${MKMAN} != "no"
realinstall: ${MANINSTALL}
.endif
cleandir: cleanman
.if exists(${DESTDIR}/usr/share/groff/1.19.2/tmac)
TMACDIR?= ${DESTDIR}/usr/share/groff/1.19.2/tmac
.elif exists(${DESTDIR}/usr/share/groff/1.19.1/tmac)
TMACDIR?= ${DESTDIR}/usr/share/groff/1.19.1/tmac
.elif exists(${DESTDIR}/usr/share/groff/1.18.1/tmac)
TMACDIR?= ${DESTDIR}/usr/share/groff/1.18.1/tmac
.else
TMACDIR?= ${DESTDIR}/usr/share/groff/tmac
.endif
HTMLDIR?= ${DESTDIR}/usr/share/man
CATDEPS?= ${TMACDIR}/mandoc.tmac \
${TMACDIR}/doc.tmac
MANTARGET?= cat
NROFF?= nroff -Tascii
GROFF?= groff -Tascii
TBL?= tbl
.SUFFIXES: .1 .2 .3 .4 .5 .6 .7 .8 .9 \
.cat1 .cat2 .cat3 .cat4 .cat5 .cat6 .cat7 .cat8 .cat9 \
.html1 .html2 .html3 .html4 .html5 .html6 .html7 .html8 .html9
.9.cat9 .8.cat8 .7.cat7 .6.cat6 .5.cat5 .4.cat4 .3.cat3 .2.cat2 .1.cat1: \
${CATDEPS}
.if !defined(USETBL)
@echo "${NROFF} -mandoc ${.IMPSRC} > ${.TARGET}"
@${NROFF} -mandoc ${.IMPSRC} > ${.TARGET} || \
(rm -f ${.TARGET}; false)
.else
@echo "${TBL} ${.IMPSRC} | ${NROFF} -mandoc > ${.TARGET}"
@${TBL} ${.IMPSRC} | ${NROFF} -mandoc > ${.TARGET} || \
(rm -f ${.TARGET}; false)
.endif
.9.html9 .8.html8 .7.html7 .6.html6 .5.html5 .4.html4 .3.html3 .2.html2 .1.html1: \
${CATDEPS}
.if !defined(USETBL)
@echo "${GROFF} -mdoc2html -P-b -P-u -P-o ${.IMPSRC} > ${.TARGET}"
@${GROFF} -mdoc2html -P-b -P-u -P-o ${.IMPSRC} > ${.TARGET} || \
(rm -f ${.TARGET}; false)
.else
@echo "${TBL} ${.IMPSRC} | ${GROFF} -mdoc2html -P-b -P-u -P-o > ${.TARGET}"
@cat ${.IMPSRC} | ${GROFF} -mdoc2html -P-b -P-u -P-o > ${.TARGET} || \
(rm -f ${.TARGET}; false)
.endif
.if defined(MAN) && !empty(MAN)
MANPAGES= ${MAN}
CATPAGES= ${MANPAGES:C/(.*).([1-9])/\1.cat\2/}
.NOPATH: ${CATPAGES}
.if !defined(NOHTML)
HTMLPAGES= ${MANPAGES:C/(.*).([1-9])/\1.html\2/}
.endif
.endif
MINSTALL= ${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} \
-o ${MANOWN} -g ${MANGRP} -m ${MANMODE}
.if defined(MANZ)
# chown and chmod are done afterward automatically
MCOMPRESS= gzip -cf
MCOMPRESSSUFFIX= .gz
.endif
catinstall: catlinks
maninstall: manlinks
__installpage: .USE
.if defined(MCOMPRESS) && !empty(MCOMPRESS)
@rm -f ${.TARGET}
${MCOMPRESS} ${.ALLSRC} > ${.TARGET}
@chown ${MANOWN}:${MANGRP} ${.TARGET}
@chmod ${MANMODE} ${.TARGET}
.else
@cmp -s ${.ALLSRC} ${.TARGET} > /dev/null 2>&1 || \
(echo "${MINSTALL} ${.ALLSRC} ${.TARGET}" && \
${MINSTALL} ${.ALLSRC} ${.TARGET})
.endif
# Rules for cat'ed man page installation
.if defined(CATPAGES) && !empty(CATPAGES) && ${MKCATPAGES} != "no"
catpages:: ${CATPAGES:@P@${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}@}
.PRECIOUS: ${CATPAGES:@P@${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}@}
.if !defined(UPDATE)
.PHONY: ${CATPAGES:@P@${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}@}
.endif
. for P in ${CATPAGES:O:u}
. if !defined(BUILD) && !make(all) && !make(${P})
${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}: .MADE
. endif
${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}: ${P} __installpage
. endfor
.else
catpages::
.endif
# Rules for source page installation
.if defined(MANPAGES) && !empty(MANPAGES)
manpages:: ${MANPAGES:@P@${DESTDIR}${MANDIR}/man${P:T:E}${MANSUBDIR}/${P}${MCOMPRESSSUFFIX}@}
.PRECIOUS: ${MANPAGES:@P@${DESTDIR}${MANDIR}/man${P:T:E}${MANSUBDIR}/${P}${MCOMPRESSSUFFIX}@}
.if !defined(UPDATE)
.PHONY: ${MANPAGES:@P@${DESTDIR}${MANDIR}/man${P:T:E}${MANSUBDIR}/${P}${MCOMPRESSSUFFIX}@}
.endif
. for P in ${MANPAGES:O:u}
${DESTDIR}${MANDIR}/man${P:T:E}${MANSUBDIR}/${P}${MCOMPRESSSUFFIX}: ${P} __installpage
. endfor
.else
manpages::
.endif
.if ${MKCATPAGES} != "no"
catlinks: catpages
.if defined(MLINKS) && !empty(MLINKS)
@set ${MLINKS}; \
while test $$# -ge 2; do \
name=$$1; \
shift; \
dir=${DESTDIR}${MANDIR}/cat$${name##*.}; \
l=$${dir}${MANSUBDIR}/$${name%.*}.0${MCOMPRESSSUFFIX}; \
name=$$1; \
shift; \
dir=${DESTDIR}${MANDIR}/cat$${name##*.}; \
t=$${dir}${MANSUBDIR}/$${name%.*}.0${MCOMPRESSSUFFIX}; \
if test $$l -nt $$t -o ! -f $$t; then \
echo $$t -\> $$l; \
ln -f $$l $$t; \
fi; \
done
.endif
.else
catlinks:
.endif
manlinks: manpages
.if defined(MLINKS) && !empty(MLINKS)
@set ${MLINKS}; \
while test $$# -ge 2; do \
name=$$1; \
shift; \
dir=${DESTDIR}${MANDIR}/man$${name##*.}; \
l=$${dir}${MANSUBDIR}/$${name}${MCOMPRESSSUFFIX}; \
name=$$1; \
shift; \
dir=${DESTDIR}${MANDIR}/man$${name##*.}; \
t=$${dir}${MANSUBDIR}/$${name}${MCOMPRESSSUFFIX}; \
if test $$l -nt $$t -o ! -f $$t; then \
echo $$t -\> $$l; \
ln -f $$l $$t; \
fi; \
done
.endif
# Html rules
html: ${HTMLPAGES}
.if defined(HTMLPAGES) && !empty(HTMLPAGES)
.for P in ${HTMLPAGES:O:u}
${HTMLDIR}/${P:T:E}/${P:T:R}.html: ${P}
${MINSTALL} ${.ALLSRC} ${.TARGET}
.endfor
.endif
installhtml: ${HTMLPAGES:@P@${HTMLDIR}/${P:T:E}/${P:T:R}.html@}
cleanhtml:
.if defined(HTMLPAGES) && !empty(HTMLPAGES)
rm -f ${HTMLPAGES}
.endif
.if defined(CATPAGES)
.if ${MKCATPAGES} != "no" && ${MKMAN} != "no"
realall: ${CATPAGES}
.else
realall:
.endif
cleanman:
rm -f ${CATPAGES}
.else
cleanman:
.endif
# Make sure all of the standard targets are defined, even if they do nothing.
clean depend includes lint regress tags:

View File

@@ -0,0 +1,65 @@
# $NetBSD: Darwin.bsd.sys.mk,v 1.1.1.1 2006/07/14 23:13:01 jlam Exp $
#OBJCOPY?= objcopy
STRIP?= strip
CONFIG?= config
RPCGEN?= rpcgen
MKLOCALE?= mklocale
.SUFFIXES: .m .o .ln .lo
# Objective C
# (Defined here rather than in <sys.mk> because `.m' is not just
# used for Objective C source)
.m:
${LINK.m} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.m.o:
${COMPILE.m} ${.IMPSRC}
.if defined(PARALLEL) || defined(LPREFIX)
LPREFIX?=yy
LFLAGS+=-P${LPREFIX}
# Lex
.l:
${LEX.l} -o${.TARGET:R}.${LPREFIX}.c ${.IMPSRC}
${LINK.c} -o ${.TARGET} ${.TARGET:R}.${LPREFIX}.c ${LDLIBS} -ll
rm -f ${.TARGET:R}.${LPREFIX}.c
.l.c:
${LEX.l} -o${.TARGET} ${.IMPSRC}
.l.o:
${LEX.l} -o${.TARGET:R}.${LPREFIX}.c ${.IMPSRC}
${COMPILE.c} -o ${.TARGET} ${.TARGET:R}.${LPREFIX}.c
rm -f ${.TARGET:R}.${LPREFIX}.c
.endif
# Yacc
.if defined(YHEADER) || defined(YPREFIX)
.if defined(YPREFIX)
YFLAGS+=-p${YPREFIX}
.endif
.if defined(YHEADER)
YFLAGS+=-d
.endif
.y:
${YACC.y} -b ${.TARGET:R} ${.IMPSRC}
${LINK.c} -o ${.TARGET} ${.TARGET:R}.tab.c ${LDLIBS}
rm -f ${.TARGET:R}.tab.c ${.TARGET:R}.tab.h
.y.h: ${.TARGET:R}.c
.y.c:
${YACC.y} -o ${.TARGET} ${.IMPSRC}
.y.o:
${YACC.y} -b ${.TARGET:R} ${.IMPSRC}
${COMPILE.c} -o ${.TARGET} ${.TARGET:R}.tab.c
rm -f ${.TARGET:R}.tab.c ${TARGET:R}.tab.h
.elif defined(PARALLEL)
.y:
${YACC.y} -b ${.TARGET:R} ${.IMPSRC}
${LINK.c} -o ${.TARGET} ${.TARGET:R}.tab.c ${LDLIBS}
rm -f ${.TARGET:R}.tab.c
.y.c:
${YACC.y} -o ${.TARGET} ${.IMPSRC}
.y.o:
${YACC.y} -b ${.TARGET:R} ${.IMPSRC}
${COMPILE.c} -o ${.TARGET} ${.TARGET:R}.tab.c
rm -f ${.TARGET:R}.tab.c
.endif

View File

@@ -0,0 +1,210 @@
# $NetBSD: Darwin.sys.mk,v 1.2 2006/11/11 18:24:52 jschauma Exp $
# @(#)sys.mk 8.2 (Berkeley) 3/21/94
unix= We run UNIX.
OS!= uname -s
.SUFFIXES: .out .a .ln .o .s .S .c .cc .cpp .cxx .C .F .f .r .y .l .cl .p .h
.SUFFIXES: .sh .m4
.LIBS: .a
AR?= ar
ARFLAGS?= rl
RANLIB?= ranlib
AS?= as
AFLAGS?=
COMPILE.s?= ${AS} ${AFLAGS}
LINK.s?= ${CC} ${AFLAGS} ${LDFLAGS}
COMPILE.S?= ${CC} ${AFLAGS} ${CPPFLAGS} -c
LINK.S?= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
.if exists(/usr/bin/gcc)
CC?= gcc
.else
CC?= cc
.endif
DBG?= -O2
CFLAGS?= -pipe ${DBG}
COMPILE.c?= ${CC} ${CFLAGS} ${CPPFLAGS} -c
LINK.c?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
.if exists(/usr/bin/g++)
CXX?= g++
.else
CXX?= c++
.endif
CXXFLAGS?= ${CFLAGS}
COMPILE.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
LINK.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
OBJC?= ${CC}
OBJCFLAGS?= ${CFLAGS}
COMPILE.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c
LINK.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} ${LDFLAGS}
CPP?= cpp
NOLINT= 1
CPPFLAGS?=
MK_DEP?= mkdeps.sh -N
FC?= f77
FFLAGS?= -O
RFLAGS?=
COMPILE.f?= ${FC} ${FFLAGS} -c
LINK.f?= ${FC} ${FFLAGS} ${LDFLAGS}
COMPILE.F?= ${FC} ${FFLAGS} ${CPPFLAGS} -c
LINK.F?= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
COMPILE.r?= ${FC} ${FFLAGS} ${RFLAGS} -c
LINK.r?= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
INSTALL?= install
LEX?= lex
LFLAGS?=
LEX.l?= ${LEX} ${LFLAGS}
LD?= ld
LDFLAGS?=
LINT?= lint
LINTFLAGS?= -chapbx
LORDER?= lorder
MAKE?= bmake
NM?= nm
PC?= pc
PFLAGS?=
COMPILE.p?= ${PC} ${PFLAGS} ${CPPFLAGS} -c
LINK.p?= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
SHELL?= sh
SIZE?= size
TSORT?= tsort -q
YACC?= yacc
YFLAGS?= -d
YACC.y?= ${YACC} ${YFLAGS}
# C
.c:
${LINK.c} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.c.o:
${COMPILE.c} ${.IMPSRC}
.c.a:
${COMPILE.c} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# C++
.cc:
${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.cc.o:
${COMPILE.cc} ${.IMPSRC}
.cc.a:
${COMPILE.cc} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.C:
${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.C.o:
${COMPILE.cc} ${.IMPSRC}
.C.a:
${COMPILE.cc} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Fortran/Ratfor
.f:
${LINK.f} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.f.o:
${COMPILE.f} ${.IMPSRC}
.f.a:
${COMPILE.f} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.F:
${LINK.F} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.F.o:
${COMPILE.F} ${.IMPSRC}
.F.a:
${COMPILE.F} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.r:
${LINK.r} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.r.o:
${COMPILE.r} ${.IMPSRC}
.r.a:
${COMPILE.r} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Pascal
.p:
${LINK.p} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.p.o:
${COMPILE.p} ${.IMPSRC}
.p.a:
${COMPILE.p} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Assembly
.s:
${LINK.s} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.s.o:
${COMPILE.s} -o ${.TARGET} ${.IMPSRC}
.s.a:
${COMPILE.s} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.S:
${LINK.S} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.S.o:
${COMPILE.S} ${.IMPSRC}
.S.a:
${COMPILE.S} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Lex
.l:
${LEX.l} ${.IMPSRC}
${LINK.c} -o ${.TARGET} lex.yy.c ${LDLIBS} -ll
rm -f lex.yy.c
.l.c:
${LEX.l} ${.IMPSRC}
mv lex.yy.c ${.TARGET}
.l.o:
${LEX.l} ${.IMPSRC}
${COMPILE.c} -o ${.TARGET} lex.yy.c
rm -f lex.yy.c
# Yacc
.y:
${YACC.y} ${.IMPSRC}
${LINK.c} -o ${.TARGET} y.tab.c ${LDLIBS}
rm -f y.tab.c
.y.c:
${YACC.y} ${.IMPSRC}
mv y.tab.c ${.TARGET}
.y.o:
${YACC.y} ${.IMPSRC}
${COMPILE.c} -o ${.TARGET} y.tab.c
rm -f y.tab.c
# Shell
.sh:
rm -f ${.TARGET}
cp ${.IMPSRC} ${.TARGET}

View File

@@ -0,0 +1,193 @@
# $NetBSD: HPUX.sys.mk,v 1.4 2008/01/14 05:55:30 tnn Exp $
# @(#)sys.mk 8.2 (Berkeley) 3/21/94
unix?= We run Unix
OS?= HPUX
.SUFFIXES: .out .a .ln .o .s .S .c .cc .cpp .cxx .C .F .f .r .y .l .cl .p .h
.SUFFIXES: .sh .m4
.LIBS: .a
AR?= ar
ARFLAGS?= rl
RANLIB?= ranlib
AS?= as
AFLAGS?=
COMPILE.s?= ${CC} ${AFLAGS} -c
LINK.s?= ${CC} ${AFLAGS} ${LDFLAGS}
COMPILE.S?= ${CC} ${AFLAGS} ${CPPFLAGS} -c -traditional-cpp
LINK.S?= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
CC?= cc
NOGCCERROR?= # defined
DBG?= -O2
CFLAGS?= ${DBG}
COMPILE.c?= ${CC} ${CFLAGS} ${CPPFLAGS} -c
LINK.c?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
CXX?= c++
CXXFLAGS?= ${CFLAGS}
COMPILE.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
LINK.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
OBJC?= ${CC}
OBJCFLAGS?= ${CFLAGS}
COMPILE.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c
LINK.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} ${LDFLAGS}
CPP?= ${CC} -E
CPPFLAGS?=
FC?= f77
FFLAGS?= -O
RFLAGS?=
COMPILE.f?= ${FC} ${FFLAGS} -c
LINK.f?= ${FC} ${FFLAGS} ${LDFLAGS}
COMPILE.F?= ${FC} ${FFLAGS} ${CPPFLAGS} -c
LINK.F?= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
COMPILE.r?= ${FC} ${FFLAGS} ${RFLAGS} -c
LINK.r?= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
INSTALL?= ${PREFIX}/bin/install-sh
LEX?= lex
LFLAGS?=
LEX.l?= ${LEX} ${LFLAGS}
LD?= ld
LDFLAGS?=
LINT?= lint
LINTFLAGS?= -chapbxzF
LORDER?= lorder
MAKE?= make
NM?= nm
PC?= pc
PFLAGS?=
COMPILE.p?= ${PC} ${PFLAGS} ${CPPFLAGS} -c
LINK.p?= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
SHELL?= sh
SIZE?= size
TSORT?= tsort
YACC?= yacc
YFLAGS?=
YACC.y?= ${YACC} ${YFLAGS}
# C
.c:
${LINK.c} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.c.o:
${COMPILE.c} ${.IMPSRC}
.c.a:
${COMPILE.c} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.c.ln:
${LINT} ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i ${.IMPSRC}
# C++
.cc .cpp .cxx .C:
${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.cc.o .cpp.o .cxx.o .C.o:
${COMPILE.cc} ${.IMPSRC}
.cc.a .cpp.a .cxx.a .C.a:
${COMPILE.cc} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Fortran/Ratfor
.f:
${LINK.f} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.f.o:
${COMPILE.f} ${.IMPSRC}
.f.a:
${COMPILE.f} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.F:
${LINK.F} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.F.o:
${COMPILE.F} ${.IMPSRC}
.F.a:
${COMPILE.F} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.r:
${LINK.r} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.r.o:
${COMPILE.r} ${.IMPSRC}
.r.a:
${COMPILE.r} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Pascal
.p:
${LINK.p} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.p.o:
${COMPILE.p} ${.IMPSRC}
.p.a:
${COMPILE.p} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Assembly
.s:
${LINK.s} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.s.o:
${COMPILE.s} ${.IMPSRC}
.s.a:
${COMPILE.s} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.S:
${LINK.S} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.S.o:
${COMPILE.S} ${.IMPSRC}
.S.a:
${COMPILE.S} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Lex
.l:
${LEX.l} ${.IMPSRC}
${LINK.c} -o ${.TARGET} lex.yy.c ${LDLIBS} -ll
rm -f lex.yy.c
.l.c:
${LEX.l} ${.IMPSRC}
mv lex.yy.c ${.TARGET}
.l.o:
${LEX.l} ${.IMPSRC}
${COMPILE.c} -o ${.TARGET} lex.yy.c
rm -f lex.yy.c
# Yacc
.y:
${YACC.y} ${.IMPSRC}
${LINK.c} -o ${.TARGET} y.tab.c ${LDLIBS}
rm -f y.tab.c
.y.c:
${YACC.y} ${.IMPSRC}
mv y.tab.c ${.TARGET}
.y.o:
${YACC.y} ${.IMPSRC}
${COMPILE.c} -o ${.TARGET} y.tab.c
rm -f y.tab.c
# Shell
.sh:
rm -f ${.TARGET}
cp ${.IMPSRC} ${.TARGET}

View File

@@ -0,0 +1,524 @@
# $NetBSD: Haiku.bsd.lib.mk,v 1.1 2010/02/06 10:50:40 obache Exp $
# @(#)bsd.lib.mk 8.3 (Berkeley) 4/22/94
.if !target(__initialized__)
__initialized__:
.if exists(${.CURDIR}/../Makefile.inc)
.include "${.CURDIR}/../Makefile.inc"
.endif
.include <bsd.own.mk>
.include <bsd.obj.mk>
.include <bsd.depall.mk>
.MAIN: all
.endif
.PHONY: checkver cleanlib libinstall
realinstall: checkver libinstall
clean cleandir: cleanlib
.if exists(${SHLIB_VERSION_FILE})
SHLIB_MAJOR != . ${SHLIB_VERSION_FILE} ; echo $$major
SHLIB_MINOR != . ${SHLIB_VERSION_FILE} ; echo $$minor
SHLIB_TEENY != . ${SHLIB_VERSION_FILE} ; echo $$teeny
# Check for higher installed library versions.
.if !defined(NOCHECKVER) && !defined(NOCHECKVER_${LIB}) && \
exists(${BSDSRCDIR}/lib/checkver)
checkver:
@(cd ${.CURDIR} && \
sh ${BSDSRCDIR}/lib/checkver -v ${SHLIB_VERSION_FILE} \
-d ${DESTDIR}${LIBDIR} ${LIB})
.endif
.endif
.if !target(checkver)
checkver:
.endif
print-shlib-major:
.if defined(SHLIB_MAJOR)
@echo ${SHLIB_MAJOR}
.else
@false
.endif
print-shlib-minor:
.if defined(SHLIB_MINOR)
@echo ${SHLIB_MINOR}
.else
@false
.endif
print-shlib-teeny:
.if defined(SHLIB_TEENY)
@echo ${SHLIB_TEENY}
.else
@false
.endif
.if defined(SHLIB_MAJOR) && !empty(SHLIB_MAJOR)
.if defined(SHLIB_MINOR) && !empty(SHLIB_MINOR)
.if defined(SHLIB_TEENY) && !empty(SHLIB_TEENY)
SHLIB_FULLVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR}.${SHLIB_TEENY}
.else
SHLIB_FULLVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR}
.endif
.else
SHLIB_FULLVERSION=${SHLIB_MAJOR}
.endif
.endif
# add additional suffixes not exported.
# .po is used for profiling object files.
# .so is used for PIC object files.
.SUFFIXES: .out .a .ln .so .po .o .s .S .c .cc .C .m .F .f .r .y .l .cl .p .h
.SUFFIXES: .sh .m4 .m
# Set PICFLAGS to cc flags for producing position-independent code,
# if not already set. Includes -DPIC, if required.
# Data-driven table using make variables to control how shared libraries
# are built for different platforms and object formats.
# OBJECT_FMT: currently either "ELF" or "a.out", from <bsd.own.mk>
# SHLIB_SOVERSION: version number to be compiled into a shared library
# via -soname. Usualy ${SHLIB_MAJOR} on ELF.
# NetBSD/pmax used to use ${SHLIB_MAJOR}[.${SHLIB_MINOR}
# [.${SHLIB_TEENY}]]
# SHLIB_SHFLAGS: Flags to tell ${LD} to emit shared library.
# with ELF, also set shared-lib version for ld.so.
# SHLIB_LDSTARTFILE: support .o file, call C++ file-level constructors
# SHLIB_LDENDFILE: support .o file, call C++ file-level destructors
# FPICFLAGS: flags for ${FC} to compile .[fF] files to .so objects.
# CPPICFLAGS: flags for ${CPP} to preprocess .[sS] files for ${AS}
# CPICFLAGS: flags for ${CC} to compile .[cC] files to .so objects.
# CAPICFLAGS flags for {$CC} to compiling .[Ss] files
# (usually just ${CPPPICFLAGS} ${CPICFLAGS})
# APICFLAGS: flags for ${AS} to assemble .[sS] to .so objects.
.if ${MACHINE_ARCH} == "alpha"
# Alpha-specific shared library flags
FPICFLAGS ?= -fPIC
CPICFLAGS ?= -fPIC -DPIC
CPPPICFLAGS?= -DPIC
CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS}
APICFLAGS ?=
.elif ${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb"
# mips-specific shared library flags
# On mips, all libs are compiled with ABIcalls, not just sharedlibs.
MKPICLIB= no
# so turn shlib PIC flags on for ${AS}.
AINC+=-DABICALLS
AFLAGS+= -fPIC
AS+= -KPIC
.elif ${MACHINE_ARCH} == "vax" && ${OBJECT_FMT} == "ELF"
# On the VAX, all object are PIC by default, not just sharedlibs.
MKPICLIB= no
.elif (${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64") && \
${OBJECT_FMT} == "ELF"
FPICFLAGS ?= -fPIC
CPICFLAGS ?= -fPIC -DPIC
CPPPICFLAGS?= -DPIC
CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS}
APICFLAGS ?= -KPIC
.else
# Platform-independent flags for NetBSD a.out shared libraries (and PowerPC)
SHLIB_LDSTARTFILE=
SHLIB_LDENDFILE=
SHLIB_SOVERSION=${SHLIB_FULLVERSION}
SHLIB_SHFLAGS=
FPICFLAGS ?= -fPIC
CPICFLAGS?= -fPIC -DPIC
CPPPICFLAGS?= -DPIC
CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS}
APICFLAGS?= -k
.endif
MKPICLIB?= yes
# Platform-independent linker flags for ELF shared libraries
.if ${OBJECT_FMT} == "ELF"
SHLIB_SOVERSION= ${SHLIB_MAJOR}
SHLIB_SHFLAGS= -soname lib${LIB}.so.${SHLIB_SOVERSION}
SHLIB_LDSTARTFILE?= ${DESTDIR}/usr/lib/crtbeginS.o
SHLIB_LDENDFILE?= ${DESTDIR}/usr/lib/crtendS.o
.endif
CFLAGS+= ${COPTS}
FFLAGS+= ${FOPTS}
.c.o:
.if defined(COPTS) && !empty(COPTS:M*-g*)
${COMPILE.c} ${.IMPSRC}
.else
@echo ${COMPILE.c:Q} ${.IMPSRC}
@${COMPILE.c} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.c.po:
.if defined(COPTS) && !empty(COPTS:M*-g*)
${COMPILE.c} -pg ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.c:Q} -pg ${.IMPSRC} -o ${.TARGET}
@${COMPILE.c} -pg ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.c.so:
.if defined(COPTS) && !empty(COPTS:M*-g*)
${COMPILE.c} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.c:Q} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
@${COMPILE.c} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.c.ln:
${LINT} ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i ${.IMPSRC}
.cc.o .C.o:
.if defined(COPTS) && !empty(COPTS:M*-g*)
${COMPILE.cc} ${.IMPSRC}
.else
@echo ${COMPILE.cc:Q} ${.IMPSRC}
@${COMPILE.cc} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.cc.po .C.po:
.if defined(COPTS) && !empty(COPTS:M*-g*)
${COMPILE.cc} -pg ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.cc:Q} -pg ${.IMPSRC} -o ${.TARGET}
@${COMPILE.cc} -pg ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.cc.so .C.so:
.if defined(COPTS) && !empty(COPTS:M*-g*)
${COMPILE.cc} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.cc:Q} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
@${COMPILE.cc} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.f.o:
.if defined(FOPTS) && !empty(FOPTS:M*-g*)
${COMPILE.f} ${.IMPSRC}
.else
@echo ${COMPILE.f:Q} ${.IMPSRC}
@${COMPILE.f} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.f.po:
.if defined(FOPTS) && !empty(FOPTS:M*-g*)
${COMPILE.f} -pg ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.f:Q} -pg ${.IMPSRC} -o ${.TARGET}
@${COMPILE.f} -pg ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.f.so:
.if defined(FOPTS) && !empty(FOPTS:M*-g*)
${COMPILE.f} ${FPICFLAGS} ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.f:Q} ${FPICFLAGS} ${.IMPSRC} -o ${.TARGET}
@${COMPILE.f} ${FPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.f.ln:
${ECHO} Skipping lint for Fortran libraries.
.m.o:
.if defined(OBJCFLAGS) && !empty(OBJCFLAGS:M*-g*)
${COMPILE.m} ${.IMPSRC}
.else
@echo ${COMPILE.m:Q} ${.IMPSRC}
@${COMPILE.m} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.m.po:
.if defined(OBJCFLAGS) && !empty(OBJCFLAGS:M*-g*)
${COMPILE.m} -pg ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.m:Q} -pg ${.IMPSRC} -o ${.TARGET}
@${COMPILE.m} -pg ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.m.so:
.if defined(OBJCFLAGS) && !empty(OBJCFLAGS:M*-g*)
${COMPILE.m} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.m:Q} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
@${COMPILE.m} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.S.o .s.o:
@echo ${COMPILE.S:Q} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC}
@${COMPILE.S} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.S.po .s.po:
@echo ${COMPILE.S:Q} -DGPROF -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}
@${COMPILE.S} -DGPROF -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.S.so .s.so:
@echo ${COMPILE.S:Q} ${CAPICFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}
@${COMPILE.S} ${CAPICFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.if ${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
|| ${MKLINKLIB} != "no"
_LIBS=lib${LIB}.a
.else
_LIBS=
.endif
OBJS+=${SRCS:N*.h:N*.sh:R:S/$/.o/g}
.if ${MKPROFILE} != "no"
_LIBS+=lib${LIB}_p.a
POBJS+=${OBJS:.o=.po}
.endif
.if ${MKPIC} != "no"
.if ${MKPICLIB} == "no"
SOLIB=lib${LIB}.a
.else
SOLIB=lib${LIB}_pic.a
_LIBS+=${SOLIB}
SOBJS+=${OBJS:.o=.so}
.endif
.if defined(SHLIB_FULLVERSION)
_LIBS+=lib${LIB}.so.${SHLIB_FULLVERSION}
.endif
.endif
LOBJS+=${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
.if ${MKLINT} != "no" && ${MKLINKLIB} != "no" && !empty(LOBJS)
_LIBS+=llib-l${LIB}.ln
.endif
.if ${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
|| ${MKLINKLIB} != "no"
ALLOBJS=${OBJS} ${POBJS} ${SOBJS}
.else
ALLOBJS=${POBJS} ${SOBJS}
.endif
.if ${MKLINT} != "no" && ${MKLINKLIB} != "no" && !empty(LOBJS)
ALLOBJS+=${LOBJS}
.endif
.NOPATH: ${ALLOBJS} ${_LIBS}
realall: ${SRCS} ${ALLOBJS:O} ${_LIBS}
__archivebuild: .USE
@rm -f ${.TARGET}
${AR} cq ${.TARGET} ${.ALLSRC:M*o}
${RANLIB} ${.TARGET}
__archiveinstall: .USE
${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} -o ${LIBOWN} \
-g ${LIBGRP} -m 600 ${.ALLSRC} ${.TARGET}
${RANLIB} -t ${.TARGET}
chmod ${LIBMODE} ${.TARGET}
DPSRCS+= ${SRCS:M*.l:.l=.c} ${SRCS:M*.y:.y=.c}
CLEANFILES+= ${DPSRCS}
.if defined(YHEADER)
CLEANFILES+= ${SRCS:M*.y:.y=.h}
.endif
lib${LIB}.a:: ${OBJS} __archivebuild
@echo building standard ${LIB} library
lib${LIB}_p.a:: ${POBJS} __archivebuild
@echo building profiled ${LIB} library
lib${LIB}_pic.a:: ${SOBJS} __archivebuild
@echo building shared object ${LIB} library
lib${LIB}.so.${SHLIB_FULLVERSION}: ${SOLIB} ${DPADD} \
${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE}
@echo building shared ${LIB} library \(version ${SHLIB_FULLVERSION}\)
@rm -f lib${LIB}.so.${SHLIB_FULLVERSION}
.if defined(DESTDIR)
$(LD) -nostdlib -shared ${SHLIB_SHFLAGS} -o ${.TARGET} \
${SHLIB_LDSTARTFILE} \
--whole-archive ${SOLIB} \
--no-whole-archive ${LDADD} \
-L${DESTDIR}${LIBDIR} -R${LIBDIR} \
${SHLIB_LDENDFILE}
.else
$(LD) -shared ${SHLIB_SHFLAGS} -o ${.TARGET} \
${SHLIB_LDSTARTFILE} \
--whole-archive ${SOLIB} --no-whole-archive ${LDADD} \
${SHLIB_LDENDFILE}
.endif
.if ${OBJECT_FMT} == "ELF"
ln -sf lib${LIB}.so.${SHLIB_FULLVERSION} lib${LIB}.so.${SHLIB_MAJOR}.tmp
mv -f lib${LIB}.so.${SHLIB_MAJOR}.tmp lib${LIB}.so.${SHLIB_MAJOR}
ln -sf lib${LIB}.so.${SHLIB_FULLVERSION} lib${LIB}.so.tmp
mv -f lib${LIB}.so.tmp lib${LIB}.so
.endif
.if !empty(LOBJS)
LLIBS?= -lc
llib-l${LIB}.ln: ${LOBJS}
@echo building llib-l${LIB}.ln
@rm -f llib-l${LIB}.ln
@${LINT} -C${LIB} ${.ALLSRC} ${LLIBS}
.endif
cleanlib:
rm -f a.out [Ee]rrs mklog core *.core ${CLEANFILES}
rm -f lib${LIB}.a ${OBJS}
rm -f lib${LIB}_p.a ${POBJS}
rm -f lib${LIB}_pic.a lib${LIB}.so.* lib${LIB}.so ${SOBJS}
rm -f llib-l${LIB}.ln ${LOBJS}
.if defined(SRCS)
afterdepend: .depend
@(TMP=/tmp/_depend$$$$; \
sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.po \1.so \1.ln:/' \
< .depend > $$TMP; \
mv $$TMP .depend)
.endif
.if !target(libinstall)
# Make sure it gets defined, in case MKPIC==no && MKLINKLIB==no
libinstall::
.if ${MKLINKLIB} != "no"
libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}.a
.PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}.a
.if !defined(UPDATE)
.PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}.a
.endif
.if !defined(BUILD) && !make(all) && !make(lib${LIB}.a)
${DESTDIR}${LIBDIR}/lib${LIB}.a: .MADE
.endif
${DESTDIR}${LIBDIR}/lib${LIB}.a: lib${LIB}.a __archiveinstall
.endif
.if ${MKPROFILE} != "no"
libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
.PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
.if !defined(UPDATE)
.PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
.endif
.if !defined(BUILD) && !make(all) && !make(lib${LIB}_p.a)
${DESTDIR}${LIBDIR}/lib${LIB}_p.a: .MADE
.endif
${DESTDIR}${LIBDIR}/lib${LIB}_p.a: lib${LIB}_p.a __archiveinstall
.endif
.if ${MKPIC} != "no" && ${MKPICINSTALL} != "no"
libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
.PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
.if !defined(UPDATE)
.PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
.endif
.if !defined(BUILD) && !make(all) && !make(lib${LIB}_pic.a)
${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: .MADE
.endif
.if ${MKPICLIB} == "no"
${DESTDIR}${LIBDIR}/lib${LIB}_pic.a:
rm -f ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
ln -s lib${LIB}.a ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
.else
${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: lib${LIB}_pic.a __archiveinstall
.endif
.endif
.if ${MKPIC} != "no" && defined(SHLIB_FULLVERSION)
libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}
.PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}
.if !defined(UPDATE)
.PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}
.endif
.if !defined(BUILD) && !make(all) && !make(lib${LIB}.so.${SHLIB_FULLVERSION})
${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}: .MADE
.endif
${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}: lib${LIB}.so.${SHLIB_FULLVERSION}
${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} -o ${LIBOWN} \
-g ${LIBGRP} -m ${LIBMODE} ${.ALLSRC} ${.TARGET}
.if ${OBJECT_FMT} == "a.out" && !defined(DESTDIR)
/sbin/ldconfig -m ${LIBDIR}
.endif
.if ${OBJECT_FMT} == "ELF"
ln -sf lib${LIB}.so.${SHLIB_FULLVERSION}\
${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}.tmp
mv -f ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}.tmp\
${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}
.if ${MKLINKLIB} != "no"
ln -sf lib${LIB}.so.${SHLIB_FULLVERSION}\
${DESTDIR}${LIBDIR}/lib${LIB}.so.tmp
mv -f ${DESTDIR}${LIBDIR}/lib${LIB}.so.tmp\
${DESTDIR}${LIBDIR}/lib${LIB}.so
.endif
.endif
.endif
.if ${MKLINT} != "no" && ${MKLINKLIB} != "no" && !empty(LOBJS)
libinstall:: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
.PRECIOUS: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
.if !defined(UPDATE)
.PHONY: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
.endif
.if !defined(BUILD) && !make(all) && !make(llib-l${LIB}.ln)
${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln: .MADE
.endif
${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln: llib-l${LIB}.ln
${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} -o ${LIBOWN} \
-g ${LIBGRP} -m ${LIBMODE} ${.ALLSRC} ${DESTDIR}${LINTLIBDIR}
.endif
.endif
.include <bsd.man.mk>
.include <bsd.nls.mk>
.include <bsd.files.mk>
.include <bsd.inc.mk>
.include <bsd.links.mk>
.include <bsd.dep.mk>
.include <bsd.sys.mk>
# Make sure all of the standard targets are defined, even if they do nothing.
lint regress:

View File

@@ -0,0 +1,200 @@
# $NetBSD: Haiku.sys.mk,v 1.1 2010/02/06 10:50:40 obache Exp $
# NetBSD: sys.mk,v 1.58 2000/08/22 17:38:49 bjh21 Exp
# @(#)sys.mk 8.2 (Berkeley) 3/21/94
unix?= We run Haiku.
OS!= uname -s
# At least Ubuntu 8.1 sets __attribute__((warn_unused_result)) on fwrite()
# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25509
.if !defined(NOGCCERROR)
CFLAGS+= -Wno-error
.endif
.SUFFIXES: .out .a .ln .o .s .S .c .cc .cpp .cxx .C .F .f .r .y .l .cl .p .h
.SUFFIXES: .sh .m4
.LIBS: .a
AR?= ar
ARFLAGS?= rl
RANLIB?= ranlib
AS?= as
AFLAGS?=
COMPILE.s?= ${CC} ${AFLAGS} -c
LINK.s?= ${CC} ${AFLAGS} ${LDFLAGS}
COMPILE.S?= ${CC} ${AFLAGS} ${CPPFLAGS} -c -traditional-cpp
LINK.S?= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
CC?= gcc
DBG?= -O2
CFLAGS?= ${DBG}
COMPILE.c?= ${CC} ${CFLAGS} ${CPPFLAGS} -c
LINK.c?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
CXX?= g++
CXXFLAGS?= ${CFLAGS}
COMPILE.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
LINK.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
OBJC?= ${CC}
OBJCFLAGS?= ${CFLAGS}
COMPILE.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c
LINK.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} ${LDFLAGS}
CPP?= cpp
NOLINT= 1
CPPFLAGS?=
FC?= f77
FFLAGS?= -O
RFLAGS?=
COMPILE.f?= ${FC} ${FFLAGS} -c
LINK.f?= ${FC} ${FFLAGS} ${LDFLAGS}
COMPILE.F?= ${FC} ${FFLAGS} ${CPPFLAGS} -c
LINK.F?= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
COMPILE.r?= ${FC} ${FFLAGS} ${RFLAGS} -c
LINK.r?= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
INSTALL?= install
LEX?= lex
LFLAGS?=
LEX.l?= ${LEX} ${LFLAGS}
LD?= ld
LDFLAGS?=
LINT?= lint
LINTFLAGS?= -chapbxzF
LORDER?= echo
MAKE?= make
NM?= nm
PC?= pc
PFLAGS?=
COMPILE.p?= ${PC} ${PFLAGS} ${CPPFLAGS} -c
LINK.p?= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
SHELL?= sh
SIZE?= size
TSORT?= tsort
YACC?= yacc
YFLAGS?=
YACC.y?= ${YACC} ${YFLAGS}
# C
.c:
${LINK.c} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.c.o:
${COMPILE.c} ${.IMPSRC}
.c.a:
${COMPILE.c} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.c.ln:
${LINT} ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i ${.IMPSRC}
# C++
.cc .cpp .cxx .C:
${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.cc.o .cpp.o .cxx.o .C.o:
${COMPILE.cc} ${.IMPSRC}
.cc.a .cpp.a .cxx.a .C.a:
${COMPILE.cc} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Fortran/Ratfor
.f:
${LINK.f} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.f.o:
${COMPILE.f} ${.IMPSRC}
.f.a:
${COMPILE.f} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.F:
${LINK.F} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.F.o:
${COMPILE.F} ${.IMPSRC}
.F.a:
${COMPILE.F} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.r:
${LINK.r} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.r.o:
${COMPILE.r} ${.IMPSRC}
.r.a:
${COMPILE.r} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Pascal
.p:
${LINK.p} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.p.o:
${COMPILE.p} ${.IMPSRC}
.p.a:
${COMPILE.p} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Assembly
.s:
${LINK.s} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.s.o:
${COMPILE.s} ${.IMPSRC}
.s.a:
${COMPILE.s} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.S:
${LINK.S} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.S.o:
${COMPILE.S} ${.IMPSRC}
.S.a:
${COMPILE.S} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Lex
.l:
${LEX.l} ${.IMPSRC}
${LINK.c} -o ${.TARGET} lex.yy.c ${LDLIBS} -ll
rm -f lex.yy.c
.l.c:
${LEX.l} ${.IMPSRC}
mv lex.yy.c ${.TARGET}
.l.o:
${LEX.l} ${.IMPSRC}
${COMPILE.c} -o ${.TARGET} lex.yy.c
rm -f lex.yy.c
# Yacc
.y:
${YACC.y} ${.IMPSRC}
${LINK.c} -o ${.TARGET} y.tab.c ${LDLIBS}
rm -f y.tab.c
.y.c:
${YACC.y} ${.IMPSRC}
mv y.tab.c ${.TARGET}
.y.o:
${YACC.y} ${.IMPSRC}
${COMPILE.c} -o ${.TARGET} y.tab.c
rm -f y.tab.c
# Shell
.sh:
rm -f ${.TARGET}
cp ${.IMPSRC} ${.TARGET}

View File

@@ -0,0 +1,522 @@
# $NetBSD: IRIX.bsd.lib.mk,v 1.3 2008/03/13 17:28:23 joerg Exp $
# @(#)bsd.lib.mk 8.3 (Berkeley) 4/22/94
.if !target(__initialized__)
__initialized__:
.if exists(${.CURDIR}/../Makefile.inc)
.include "${.CURDIR}/../Makefile.inc"
.endif
.include <bsd.own.mk>
.include <bsd.obj.mk>
.include <bsd.depall.mk>
.MAIN: all
.endif
.PHONY: checkver cleanlib libinstall
realinstall: checkver libinstall
clean cleandir: cleanlib
.if exists(${SHLIB_VERSION_FILE})
SHLIB_MAJOR != . ${SHLIB_VERSION_FILE} ; echo $$major
SHLIB_MINOR != . ${SHLIB_VERSION_FILE} ; echo $$minor
SHLIB_TEENY != . ${SHLIB_VERSION_FILE} ; echo $$teeny
# Check for higher installed library versions.
.if !defined(NOCHECKVER) && !defined(NOCHECKVER_${LIB}) && \
exists(${BSDSRCDIR}/lib/checkver)
checkver:
@(cd ${.CURDIR} && \
sh ${BSDSRCDIR}/lib/checkver -v ${SHLIB_VERSION_FILE} \
-d ${DESTDIR}${LIBDIR} ${LIB})
.endif
.endif
.if !target(checkver)
checkver:
.endif
print-shlib-major:
.if defined(SHLIB_MAJOR)
@echo ${SHLIB_MAJOR}
.else
@false
.endif
print-shlib-minor:
.if defined(SHLIB_MINOR)
@echo ${SHLIB_MINOR}
.else
@false
.endif
print-shlib-teeny:
.if defined(SHLIB_TEENY)
@echo ${SHLIB_TEENY}
.else
@false
.endif
.if defined(SHLIB_MAJOR) && !empty(SHLIB_MAJOR)
.if defined(SHLIB_MINOR) && !empty(SHLIB_MINOR)
.if defined(SHLIB_TEENY) && !empty(SHLIB_TEENY)
SHLIB_FULLVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR}.${SHLIB_TEENY}
.else
SHLIB_FULLVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR}
.endif
.else
SHLIB_FULLVERSION=${SHLIB_MAJOR}
.endif
.endif
# add additional suffixes not exported.
# .po is used for profiling object files.
# .so is used for PIC object files.
.SUFFIXES: .out .a .ln .so .po .o .s .S .c .cc .C .m .F .f .r .y .l .cl .p .h
.SUFFIXES: .sh .m4 .m
# Set PICFLAGS to cc flags for producing position-independent code,
# if not already set. Includes -DPIC, if required.
# Data-driven table using make variables to control how shared libraries
# are built for different platforms and object formats.
# OBJECT_FMT: currently either "ELF" or "a.out", from <bsd.own.mk>
# SHLIB_SOVERSION: version number to be compiled into a shared library
# via -soname. Usualy ${SHLIB_MAJOR} on ELF.
# NetBSD/pmax used to use ${SHLIB_MAJOR}[.${SHLIB_MINOR}
# [.${SHLIB_TEENY}]]
# SHLIB_SHFLAGS: Flags to tell ${LD} to emit shared library.
# with ELF, also set shared-lib version for ld.so.
# SHLIB_LDSTARTFILE: support .o file, call C++ file-level constructors
# SHLIB_LDENDFILE: support .o file, call C++ file-level destructors
# FPICFLAGS: flags for ${FC} to compile .[fF] files to .so objects.
# CPPICFLAGS: flags for ${CPP} to preprocess .[sS] files for ${AS}
# CPICFLAGS: flags for ${CC} to compile .[cC] files to .so objects.
# CAPICFLAGS flags for {$CC} to compiling .[Ss] files
# (usually just ${CPPPICFLAGS} ${CPICFLAGS})
# APICFLAGS: flags for ${AS} to assemble .[sS] to .so objects.
.if ${MACHINE_ARCH} == "alpha"
# Alpha-specific shared library flags
FPICFLAGS ?= -fPIC
CPICFLAGS ?= -fPIC -DPIC
CPPPICFLAGS?= -DPIC
CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS}
APICFLAGS ?=
.elif ${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb"
# mips-specific shared library flags
# On mips, all libs are compiled with ABIcalls, not just sharedlibs.
MKPICLIB= no
# so turn shlib PIC flags on for ${AS}.
AINC+=-DABICALLS
AFLAGS+= -fPIC
AS+= -KPIC
.elif ${MACHINE_ARCH} == "vax" && ${OBJECT_FMT} == "ELF"
# On the VAX, all object are PIC by default, not just sharedlibs.
MKPICLIB= no
.elif (${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64") && \
${OBJECT_FMT} == "ELF"
FPICFLAGS ?= -fPIC
CPICFLAGS ?= -fPIC -DPIC
CPPPICFLAGS?= -DPIC
CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS}
APICFLAGS ?= -KPIC
.else
# Platform-independent flags for NetBSD a.out shared libraries (and PowerPC)
SHLIB_LDSTARTFILE=
SHLIB_LDENDFILE=
SHLIB_SOVERSION=${SHLIB_FULLVERSION}
SHLIB_SHFLAGS=
FPICFLAGS ?= -fPIC
CPICFLAGS?= -fPIC -DPIC
CPPPICFLAGS?= -DPIC
CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS}
APICFLAGS?= -k
.endif
MKPICLIB?= yes
# Platform-independent linker flags for ELF shared libraries
.if ${OBJECT_FMT} == "ELF"
SHLIB_SOVERSION= ${SHLIB_MAJOR}
SHLIB_SHFLAGS= -soname lib${LIB}.so.${SHLIB_SOVERSION}
SHLIB_LDSTARTFILE?= ${DESTDIR}/usr/lib/crtbeginS.o
SHLIB_LDENDFILE?= ${DESTDIR}/usr/lib/crtendS.o
.endif
CFLAGS+= ${COPTS}
FFLAGS+= ${FOPTS}
.c.o:
.if defined(COPTS) && !empty(COPTS:M*-g*)
${COMPILE.c} ${.IMPSRC}
.else
@echo ${COMPILE.c:Q} ${.IMPSRC}
@${COMPILE.c} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.c.po:
.if defined(COPTS) && !empty(COPTS:M*-g*)
${COMPILE.c} -pg ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.c:Q} -pg ${.IMPSRC} -o ${.TARGET}
@${COMPILE.c} -pg ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.c.so:
.if defined(COPTS) && !empty(COPTS:M*-g*)
${COMPILE.c} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.c:Q} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
@${COMPILE.c} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.c.ln:
${LINT} ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i ${.IMPSRC}
.cc.o .C.o:
.if defined(COPTS) && !empty(COPTS:M*-g*)
${COMPILE.cc} ${.IMPSRC}
.else
@echo ${COMPILE.cc:Q} ${.IMPSRC}
@${COMPILE.cc} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.cc.po .C.po:
.if defined(COPTS) && !empty(COPTS:M*-g*)
${COMPILE.cc} -pg ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.cc:Q} -pg ${.IMPSRC} -o ${.TARGET}
@${COMPILE.cc} -pg ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.cc.so .C.so:
.if defined(COPTS) && !empty(COPTS:M*-g*)
${COMPILE.cc} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.cc:Q} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
@${COMPILE.cc} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.f.o:
.if defined(FOPTS) && !empty(FOPTS:M*-g*)
${COMPILE.f} ${.IMPSRC}
.else
@echo ${COMPILE.f:Q} ${.IMPSRC}
@${COMPILE.f} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.f.po:
.if defined(FOPTS) && !empty(FOPTS:M*-g*)
${COMPILE.f} -pg ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.f:Q} -pg ${.IMPSRC} -o ${.TARGET}
@${COMPILE.f} -pg ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.f.so:
.if defined(FOPTS) && !empty(FOPTS:M*-g*)
${COMPILE.f} ${FPICFLAGS} ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.f:Q} ${FPICFLAGS} ${.IMPSRC} -o ${.TARGET}
@${COMPILE.f} ${FPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.f.ln:
${ECHO} Skipping lint for Fortran libraries.
.m.o:
.if defined(OBJCFLAGS) && !empty(OBJCFLAGS:M*-g*)
${COMPILE.m} ${.IMPSRC}
.else
@echo ${COMPILE.m:Q} ${.IMPSRC}
@${COMPILE.m} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.m.po:
.if defined(OBJCFLAGS) && !empty(OBJCFLAGS:M*-g*)
${COMPILE.m} -pg ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.m:Q} -pg ${.IMPSRC} -o ${.TARGET}
@${COMPILE.m} -pg ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.m.so:
.if defined(OBJCFLAGS) && !empty(OBJCFLAGS:M*-g*)
${COMPILE.m} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.m:Q} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
@${COMPILE.m} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.S.o .s.o:
@echo ${COMPILE.S:Q} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC}
@${COMPILE.S} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.S.po .s.po:
@echo ${COMPILE.S:Q} -DGPROF -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}
@${COMPILE.S} -DGPROF -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.S.so .s.so:
@echo ${COMPILE.S:Q} ${CAPICFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}
@${COMPILE.S} ${CAPICFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.if ${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
|| ${MKLINKLIB} != "no"
_LIBS=lib${LIB}.a
.else
_LIBS=
.endif
OBJS+=${SRCS:N*.h:N*.sh:R:S/$/.o/g}
.if ${MKPROFILE} != "no"
_LIBS+=lib${LIB}_p.a
POBJS+=${OBJS:.o=.po}
.endif
.if ${MKPIC} != "no"
.if ${MKPICLIB} == "no"
SOLIB=lib${LIB}.a
.else
SOLIB=lib${LIB}_pic.a
_LIBS+=${SOLIB}
SOBJS+=${OBJS:.o=.so}
.endif
.if defined(SHLIB_FULLVERSION)
_LIBS+=lib${LIB}.so.${SHLIB_FULLVERSION}
.endif
.endif
LOBJS+=${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
.if ${MKLINT} != "no" && ${MKLINKLIB} != "no" && !empty(LOBJS)
_LIBS+=llib-l${LIB}.ln
.endif
.if ${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
|| ${MKLINKLIB} != "no"
ALLOBJS=${OBJS} ${POBJS} ${SOBJS}
.else
ALLOBJS=${POBJS} ${SOBJS}
.endif
.if ${MKLINT} != "no" && ${MKLINKLIB} != "no" && !empty(LOBJS)
ALLOBJS+=${LOBJS}
.endif
.NOPATH: ${ALLOBJS} ${_LIBS}
realall: ${SRCS} ${ALLOBJS:O} ${_LIBS}
__archivebuild: .USE
@rm -f ${.TARGET}
${AR} cq ${.TARGET} ${.ALLSRC:M*o}
__archiveinstall: .USE
${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} -o ${LIBOWN} \
-g ${LIBGRP} -m 600 ${.ALLSRC} ${.TARGET}
chmod ${LIBMODE} ${.TARGET}
DPSRCS+= ${SRCS:M*.l:.l=.c} ${SRCS:M*.y:.y=.c}
CLEANFILES+= ${DPSRCS}
.if defined(YHEADER)
CLEANFILES+= ${SRCS:M*.y:.y=.h}
.endif
lib${LIB}.a:: ${OBJS} __archivebuild
@echo building standard ${LIB} library
lib${LIB}_p.a:: ${POBJS} __archivebuild
@echo building profiled ${LIB} library
lib${LIB}_pic.a:: ${SOBJS} __archivebuild
@echo building shared object ${LIB} library
lib${LIB}.so.${SHLIB_FULLVERSION}: ${SOLIB} ${DPADD} \
${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE}
@echo building shared ${LIB} library \(version ${SHLIB_FULLVERSION}\)
@rm -f lib${LIB}.so.${SHLIB_FULLVERSION}
.if defined(DESTDIR)
$(LD) -nostdlib -shared ${SHLIB_SHFLAGS} -o ${.TARGET} \
${SHLIB_LDSTARTFILE} \
-all archive ${SOLIB} \
-none ${LDADD} \
-L${DESTDIR}${LIBDIR} -rpath ${LIBDIR} \
${SHLIB_LDENDFILE}
.else
$(LD) -shared ${SHLIB_SHFLAGS} -o ${.TARGET} \
${SHLIB_LDSTARTFILE} \
-all ${SOLIB} -none ${LDADD} \
${SHLIB_LDENDFILE}
.endif
.if ${OBJECT_FMT} == "ELF"
ln -sf lib${LIB}.so.${SHLIB_FULLVERSION} lib${LIB}.so.${SHLIB_MAJOR}.tmp
mv -f lib${LIB}.so.${SHLIB_MAJOR}.tmp lib${LIB}.so.${SHLIB_MAJOR}
ln -sf lib${LIB}.so.${SHLIB_FULLVERSION} lib${LIB}.so.tmp
mv -f lib${LIB}.so.tmp lib${LIB}.so
.endif
.if !empty(LOBJS)
LLIBS?= -lc
llib-l${LIB}.ln: ${LOBJS}
@echo building llib-l${LIB}.ln
@rm -f llib-l${LIB}.ln
@${LINT} -C${LIB} ${.ALLSRC} ${LLIBS}
.endif
cleanlib:
rm -f a.out [Ee]rrs mklog core *.core ${CLEANFILES}
rm -f lib${LIB}.a ${OBJS}
rm -f lib${LIB}_p.a ${POBJS}
rm -f lib${LIB}_pic.a lib${LIB}.so.* lib${LIB}.so ${SOBJS}
rm -f llib-l${LIB}.ln ${LOBJS}
.if defined(SRCS)
afterdepend: .depend
@(TMP=/tmp/_depend$$$$; \
sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.po \1.so \1.ln:/' \
< .depend > $$TMP; \
mv $$TMP .depend)
.endif
.if !target(libinstall)
# Make sure it gets defined, in case MKPIC==no && MKLINKLIB==no
libinstall::
.if ${MKLINKLIB} != "no"
libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}.a
.PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}.a
.if !defined(UPDATE)
.PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}.a
.endif
.if !defined(BUILD) && !make(all) && !make(lib${LIB}.a)
${DESTDIR}${LIBDIR}/lib${LIB}.a: .MADE
.endif
${DESTDIR}${LIBDIR}/lib${LIB}.a: lib${LIB}.a __archiveinstall
.endif
.if ${MKPROFILE} != "no"
libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
.PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
.if !defined(UPDATE)
.PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
.endif
.if !defined(BUILD) && !make(all) && !make(lib${LIB}_p.a)
${DESTDIR}${LIBDIR}/lib${LIB}_p.a: .MADE
.endif
${DESTDIR}${LIBDIR}/lib${LIB}_p.a: lib${LIB}_p.a __archiveinstall
.endif
.if ${MKPIC} != "no" && ${MKPICINSTALL} != "no"
libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
.PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
.if !defined(UPDATE)
.PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
.endif
.if !defined(BUILD) && !make(all) && !make(lib${LIB}_pic.a)
${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: .MADE
.endif
.if ${MKPICLIB} == "no"
${DESTDIR}${LIBDIR}/lib${LIB}_pic.a:
rm -f ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
ln -s lib${LIB}.a ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
.else
${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: lib${LIB}_pic.a __archiveinstall
.endif
.endif
.if ${MKPIC} != "no" && defined(SHLIB_FULLVERSION)
libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}
.PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}
.if !defined(UPDATE)
.PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}
.endif
.if !defined(BUILD) && !make(all) && !make(lib${LIB}.so.${SHLIB_FULLVERSION})
${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}: .MADE
.endif
${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}: lib${LIB}.so.${SHLIB_FULLVERSION}
${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} -o ${LIBOWN} \
-g ${LIBGRP} -m ${LIBMODE} ${.ALLSRC} ${.TARGET}
.if ${OBJECT_FMT} == "a.out" && !defined(DESTDIR)
/sbin/ldconfig -m ${LIBDIR}
.endif
.if ${OBJECT_FMT} == "ELF"
ln -sf lib${LIB}.so.${SHLIB_FULLVERSION}\
${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}.tmp
mv -f ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}.tmp\
${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}
.if ${MKLINKLIB} != "no"
ln -sf lib${LIB}.so.${SHLIB_FULLVERSION}\
${DESTDIR}${LIBDIR}/lib${LIB}.so.tmp
mv -f ${DESTDIR}${LIBDIR}/lib${LIB}.so.tmp\
${DESTDIR}${LIBDIR}/lib${LIB}.so
.endif
.endif
.endif
.if ${MKLINT} != "no" && ${MKLINKLIB} != "no" && !empty(LOBJS)
libinstall:: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
.PRECIOUS: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
.if !defined(UPDATE)
.PHONY: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
.endif
.if !defined(BUILD) && !make(all) && !make(llib-l${LIB}.ln)
${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln: .MADE
.endif
${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln: llib-l${LIB}.ln
${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} -o ${LIBOWN} \
-g ${LIBGRP} -m ${LIBMODE} ${.ALLSRC} ${DESTDIR}${LINTLIBDIR}
.endif
.endif
.include <bsd.man.mk>
.include <bsd.nls.mk>
.include <bsd.files.mk>
.include <bsd.inc.mk>
.include <bsd.links.mk>
.include <bsd.dep.mk>
.include <bsd.sys.mk>
# Make sure all of the standard targets are defined, even if they do nothing.
lint regress:

View File

@@ -0,0 +1,246 @@
# $NetBSD: IRIX.bsd.own.mk.in,v 1.1.1.1 2006/07/14 23:13:01 jlam Exp $
.if !defined(_IRIX_OWN_MK_)
_IRIX_OWN_MK_=1
.if defined(MAKECONF) && exists(${MAKECONF})
.include "${MAKECONF}"
.elif exists(@SYSCONFDIR@/mk.conf)
.include "@SYSCONFDIR@/mk.conf"
.elif exists(/etc/mk.conf)
.include "/etc/mk.conf"
.endif
# Defining `SKEY' causes support for S/key authentication to be compiled in.
SKEY= yes
# where the system object and source trees are kept; can be configurable
# by the user in case they want them in ~/foosrc and ~/fooobj, for example
BSDSRCDIR?= /opt/bsd/src
BSDOBJDIR?= /opt/bsd/obj
BINGRP?= @ROOT_GROUP@
BINOWN?= root
BINMODE?= 555
NONBINMODE?= 444
# Define MANZ to have the man pages compressed (gzip)
#MANZ= 1
MANDIR?= /usr/share/man
MANGRP?= @ROOT_GROUP@
MANOWN?= ${BINOWN}
MANMODE?= ${NONBINMODE}
MANINSTALL?= maninstall catinstall
INFODIR?= /usr/share/info
INFOGRP?= @ROOT_GROUP@
INFOOWN?= ${BINOWN}
INFOMODE?= ${NONBINMODE}
LIBDIR?= /usr/lib
LINTLIBDIR?= ${LIBDIR}/lint
LIBGRP?= ${BINGRP}
LIBOWN?= ${BINOWN}
LIBMODE?= ${NONBINMODE}
DOCDIR?= /usr/share/doc
HTMLDOCDIR?= /usr/share/doc/html
DOCGRP?= @ROOT_GROUP@
DOCOWN?= ${BINOWN}
DOCMODE?= ${NONBINMODE}
NLSDIR?= /usr/share/nls
NLSGRP?= @ROOT_GROUP@
NLSOWN?= ${BINOWN}
NLSMODE?= ${NONBINMODE}
LOCALEDIR?= /usr/lib/locale
LOCALEGRP?= @ROOT_GROUP@
LOCALEOWN?= ${BINOWN}
LOCALEMODE?= ${NONBINMODE}
COPY?= -c
.if defined(UPDATE)
PRESERVE?= -p
.else
PRESERVE?=
.endif
.if defined(UNPRIVILEGED)
INSTPRIV?= -U
.endif
STRIPFLAG?= -s
# Define SYS_INCLUDE to indicate whether you want symbolic links to the system
# source (``symlinks''), or a separate copy (``copies''); (latter useful
# in environments where it's not possible to keep /sys publicly readable)
#SYS_INCLUDE= symlinks
OBJECT_FMT?=ELF
# GNU sources and packages sometimes see architecture names differently.
# This table maps an architecture name to its GNU counterpart.
# Use as so: ${GNU_ARCH.${TARGET_ARCH}} or ${MACHINE_GNU_ARCH}
.ifndef MACHINE_GNU_ARCH
GNU_ARCH.alpha=alpha
GNU_ARCH.arm26=arm
GNU_ARCH.arm32=arm
GNU_ARCH.arm=arm
GNU_ARCH.i386=i386
GNU_ARCH.m68k=m68k
GNU_ARCH.mipseb=mipseb
GNU_ARCH.mipsel=mipsel
GNU_ARCH.ns32k=ns32k
GNU_ARCH.powerpc=powerpc
GNU_ARCH.sh3eb=sh
GNU_ARCH.sh3el=sh
GNU_ARCH.sparc=sparc
GNU_ARCH.sparc64=sparc64
GNU_ARCH.vax=vax
MACHINE_GNU_ARCH=${GNU_ARCH.${MACHINE_ARCH}}
.endif
# CPU model, derived from MACHINE_ARCH
MACHINE_CPU= ${MACHINE_ARCH:C/mipse[bl]/mips/:S/arm26/arm/:S/arm32/arm/:C/sh3e[bl]/sh3/:S/m68000/m68k/}
TARGETS+= all clean cleandir depend dependall includes \
install lint obj regress tags html installhtml cleanhtml
.PHONY: all clean cleandir depend dependall distclean includes \
install lint obj regress tags beforedepend afterdepend \
beforeinstall afterinstall realinstall realdepend realall \
html installhtml cheanhtml
# set NEED_OWN_INSTALL_TARGET, if it's not already set, to yes
# this is used by bsd.pkg.mk to stop "install" being defined
NEED_OWN_INSTALL_TARGET?= yes
.if ${NEED_OWN_INSTALL_TARGET} == "yes"
.if !target(install)
install: .NOTMAIN beforeinstall subdir-install realinstall afterinstall
beforeinstall: .NOTMAIN
subdir-install: .NOTMAIN beforeinstall
realinstall: .NOTMAIN beforeinstall
afterinstall: .NOTMAIN subdir-install realinstall
.endif
all: .NOTMAIN realall subdir-all
subdir-all: .NOTMAIN
realall: .NOTMAIN
depend: .NOTMAIN realdepend subdir-depend
subdir-depend: .NOTMAIN
realdepend: .NOTMAIN
distclean: .NOTMAIN cleandir
.endif
PRINTOBJDIR= printf "xxx: .MAKE\n\t@echo \$${.OBJDIR}\n" | ${MAKE} -B -s -f-
# Define MKxxx variables (which are either yes or no) for users
# to set in /etc/mk.conf and override on the make commandline.
# These should be tested with `== "no"' or `!= "no"'.
# The NOxxx variables should only be used by Makefiles.
#
MKCATPAGES?=yes
.if defined(NODOC)
MKDOC=no
#.elif !defined(MKDOC)
#MKDOC=yes
.else
MKDOC?=yes
.endif
MKINFO?=yes
.if defined(NOLINKLIB)
MKLINKLIB=no
.else
MKLINKLIB?=yes
.endif
.if ${MKLINKLIB} == "no"
MKPICINSTALL=no
MKPROFILE=no
.endif
.if defined(NOLINT)
MKLINT=no
.else
MKLINT?=yes
.endif
.if defined(NOMAN)
MKMAN=no
.else
MKMAN?=yes
.endif
.if ${MKMAN} == "no"
MKCATPAGES=no
.endif
.if defined(NONLS)
MKNLS=no
.else
MKNLS?=yes
.endif
#
# MKOBJDIRS controls whether object dirs are created during "make build".
# MKOBJ controls whether the "make obj" rule does anything.
#
.if defined(NOOBJ)
MKOBJ=no
MKOBJDIRS=no
.else
MKOBJ?=yes
MKOBJDIRS?=no
.endif
.if defined(NOPIC)
MKPIC=no
.else
MKPIC?=yes
.endif
.if defined(NOPICINSTALL)
MKPICINSTALL=no
.else
MKPICINSTALL?=yes
.endif
.if defined(NOPROFILE)
MKPROFILE=no
.else
MKPROFILE?=yes
.endif
.if defined(NOSHARE)
MKSHARE=no
.else
MKSHARE?=yes
.endif
.if ${MKSHARE} == "no"
MKCATPAGES=no
MKDOC=no
MKINFO=no
MKMAN=no
MKNLS=no
.endif
.if defined(NOCRYPTO)
MKCRYPTO=no
.else
MKCRYPTO?=yes
.endif
MKCRYPTO_IDEA?=no
MKCRYPTO_RC5?=no
.if defined(NOKERBEROS) || (${MKCRYPTO} == "no")
MKKERBEROS=no
.else
MKKERBEROS?=yes
.endif
MKSOFTFLOAT?=no
.endif # _IRIX_OWN_MK_

View File

@@ -0,0 +1,198 @@
# $NetBSD: IRIX.sys.mk,v 1.4 2011/08/29 10:43:35 cheusov Exp $
# @(#)sys.mk 8.2 (Berkeley) 3/21/94
unix?= We run Unix
OS!= uname -s
.SUFFIXES: .out .a .ln .o .s .S .c .cc .cpp .cxx .C .F .f .r .y .l .cl .p .h
.SUFFIXES: .sh .m4
.LIBS: .a
AR?= ar
ARFLAGS?= rl
RANLIB?= true
AS?= as
AFLAGS?=
COMPILE.s?= ${CC} ${AFLAGS} -c
LINK.s?= ${CC} ${AFLAGS} ${LDFLAGS}
COMPILE.S?= ${CC} ${AFLAGS} ${CPPFLAGS} -c -traditional-cpp
LINK.S?= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
CC?= cc
NOGCCERROR?= # defined
DBG?= -O2
CFLAGS?= ${DBG}
COMPILE.c?= ${CC} ${CFLAGS} ${CPPFLAGS} -c
LINK.c?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
CXX?= CC
CXXFLAGS?= ${CFLAGS}
COMPILE.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
LINK.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
OBJC?= ${CC}
OBJCFLAGS?= ${CFLAGS}
COMPILE.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c
LINK.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} ${LDFLAGS}
_IRIXVERS!= uname -r
.if !empty(_IRIXVERS:M6*)
CPP?= ${CC} -E
.else
CPP?= cpp
.endif
CPPFLAGS?=
FC?= f77
FFLAGS?= -O
RFLAGS?=
COMPILE.f?= ${FC} ${FFLAGS} -c
LINK.f?= ${FC} ${FFLAGS} ${LDFLAGS}
COMPILE.F?= ${FC} ${FFLAGS} ${CPPFLAGS} -c
LINK.F?= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
COMPILE.r?= ${FC} ${FFLAGS} ${RFLAGS} -c
LINK.r?= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
INSTALL?= ${PREFIX}/bin/install-sh
LEX?= lex
LFLAGS?=
LEX.l?= ${LEX} ${LFLAGS}
LD?= ld
LDFLAGS?=
LINT?= lint
LINTFLAGS?= -chapbxzF
LORDER?= echo
MAKE?= make
NM?= nm
PC?= pc
PFLAGS?=
COMPILE.p?= ${PC} ${PFLAGS} ${CPPFLAGS} -c
LINK.p?= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
SHELL?= sh
SIZE?= size
TSORT?= tsort
YACC?= yacc
YFLAGS?=
YACC.y?= ${YACC} ${YFLAGS}
# C
.c:
${LINK.c} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.c.o:
${COMPILE.c} ${.IMPSRC}
.c.a:
${COMPILE.c} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.c.ln:
${LINT} ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i ${.IMPSRC}
# C++
.cc .cpp .cxx .C:
${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.cc.o .cpp.o .cxx.o .C.o:
${COMPILE.cc} ${.IMPSRC}
.cc.a .cpp.a .cxx.a .C.a:
${COMPILE.cc} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Fortran/Ratfor
.f:
${LINK.f} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.f.o:
${COMPILE.f} ${.IMPSRC}
.f.a:
${COMPILE.f} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.F:
${LINK.F} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.F.o:
${COMPILE.F} ${.IMPSRC}
.F.a:
${COMPILE.F} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.r:
${LINK.r} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.r.o:
${COMPILE.r} ${.IMPSRC}
.r.a:
${COMPILE.r} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Pascal
.p:
${LINK.p} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.p.o:
${COMPILE.p} ${.IMPSRC}
.p.a:
${COMPILE.p} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Assembly
.s:
${LINK.s} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.s.o:
${COMPILE.s} ${.IMPSRC}
.s.a:
${COMPILE.s} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.S:
${LINK.S} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.S.o:
${COMPILE.S} ${.IMPSRC}
.S.a:
${COMPILE.S} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Lex
.l:
${LEX.l} ${.IMPSRC}
${LINK.c} -o ${.TARGET} lex.yy.c ${LDLIBS} -ll
rm -f lex.yy.c
.l.c:
${LEX.l} ${.IMPSRC}
mv lex.yy.c ${.TARGET}
.l.o:
${LEX.l} ${.IMPSRC}
${COMPILE.c} -o ${.TARGET} lex.yy.c
rm -f lex.yy.c
# Yacc
.y:
${YACC.y} ${.IMPSRC}
${LINK.c} -o ${.TARGET} y.tab.c ${LDLIBS}
rm -f y.tab.c
.y.c:
${YACC.y} ${.IMPSRC}
mv y.tab.c ${.TARGET}
.y.o:
${YACC.y} ${.IMPSRC}
${COMPILE.c} -o ${.TARGET} y.tab.c
rm -f y.tab.c
# Shell
.sh:
rm -f ${.TARGET}
cp ${.IMPSRC} ${.TARGET}

View File

@@ -0,0 +1,472 @@
# $NetBSD: Interix.bsd.lib.mk,v 1.2 2007/08/10 13:04:13 joerg Exp $
# @(#)bsd.lib.mk 8.3 (Berkeley) 4/22/94
.if !target(__initialized__)
__initialized__:
.if exists(${.CURDIR}/../Makefile.inc)
.include "${.CURDIR}/../Makefile.inc"
.endif
.include <bsd.own.mk>
.include <bsd.obj.mk>
.include <bsd.depall.mk>
.MAIN: all
.endif
.PHONY: checkver cleanlib libinstall
realinstall: checkver libinstall
clean cleandir: cleanlib
.if exists(${SHLIB_VERSION_FILE})
SHLIB_MAJOR != . ${SHLIB_VERSION_FILE} ; echo $$major
SHLIB_MINOR != . ${SHLIB_VERSION_FILE} ; echo $$minor
SHLIB_TEENY != . ${SHLIB_VERSION_FILE} ; echo $$teeny
# Check for higher installed library versions.
.if !defined(NOCHECKVER) && !defined(NOCHECKVER_${LIB}) && \
exists(${BSDSRCDIR}/lib/checkver)
checkver:
@(cd ${.CURDIR} && \
sh ${BSDSRCDIR}/lib/checkver -v ${SHLIB_VERSION_FILE} \
-d ${DESTDIR}${LIBDIR} ${LIB})
.endif
.endif
.if !target(checkver)
checkver:
.endif
print-shlib-major:
.if defined(SHLIB_MAJOR)
@echo ${SHLIB_MAJOR}
.else
@false
.endif
print-shlib-minor:
.if defined(SHLIB_MINOR)
@echo ${SHLIB_MINOR}
.else
@false
.endif
print-shlib-teeny:
.if defined(SHLIB_TEENY)
@echo ${SHLIB_TEENY}
.else
@false
.endif
.if defined(SHLIB_MAJOR) && !empty(SHLIB_MAJOR)
.if defined(SHLIB_MINOR) && !empty(SHLIB_MINOR)
.if defined(SHLIB_TEENY) && !empty(SHLIB_TEENY)
SHLIB_FULLVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR}.${SHLIB_TEENY}
.else
SHLIB_FULLVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR}
.endif
.else
SHLIB_FULLVERSION=${SHLIB_MAJOR}
.endif
.endif
# add additional suffixes not exported.
# .po is used for profiling object files.
# .so is used for PIC object files.
.SUFFIXES: .out .a .ln .so .po .o .s .S .c .cc .C .m .F .f .r .y .l .cl .p .h
.SUFFIXES: .sh .m4 .m
# Set PICFLAGS to cc flags for producing position-independent code,
# if not already set. Includes -DPIC, if required.
# Data-driven table using make variables to control how shared libraries
# are built for different platforms and object formats.
# OBJECT_FMT: currently either "ELF" or "a.out", from <bsd.own.mk>
# SHLIB_SOVERSION: version number to be compiled into a shared library
# via -soname. Usualy ${SHLIB_MAJOR} on ELF.
# NetBSD/pmax used to use ${SHLIB_MAJOR}[.${SHLIB_MINOR}
# [.${SHLIB_TEENY}]]
# SHLIB_SHFLAGS: Flags to tell ${LD} to emit shared library.
# with ELF, also set shared-lib version for ld.so.
# SHLIB_LDSTARTFILE: support .o file, call C++ file-level constructors
# SHLIB_LDENDFILE: support .o file, call C++ file-level destructors
# FPICFLAGS: flags for ${FC} to compile .[fF] files to .so objects.
# CPPICFLAGS: flags for ${CPP} to preprocess .[sS] files for ${AS}
# CPICFLAGS: flags for ${CC} to compile .[cC] files to .so objects.
# CAPICFLAGS flags for {$CC} to compiling .[Ss] files
# (usually just ${CPPPICFLAGS} ${CPICFLAGS})
# APICFLAGS: flags for ${AS} to assemble .[sS] to .so objects.
SHLIB_LDSTARTFILE=
SHLIB_LDENDFILE=
SHLIB_SOVERSION= ${SHLIB_MAJOR}
SHLIB_SHFLAGS= -Wl,-h,lib${LIB}.so.${SHLIB_SOVERSION}
FPICFLAGS?=
CPICFLAGS?= -DPIC
CPPPICFLAGS?= -DPIC
CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS}
APICFLAGS?=
MKPICLIB?= yes
CFLAGS+= ${COPTS}
FFLAGS+= ${FOPTS}
.c.o:
.if defined(COPTS) && !empty(COPTS:M*-g*)
${COMPILE.c} ${.IMPSRC}
.else
@echo ${COMPILE.c:Q} ${.IMPSRC}
@${COMPILE.c} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.c.po:
.if defined(COPTS) && !empty(COPTS:M*-g*)
${COMPILE.c} -pg ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.c:Q} -pg ${.IMPSRC} -o ${.TARGET}
@${COMPILE.c} -pg ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.c.so:
.if defined(COPTS) && !empty(COPTS:M*-g*)
${COMPILE.c} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.c:Q} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
@${COMPILE.c} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.c.ln:
${LINT} ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i ${.IMPSRC}
.cc.o .C.o:
.if defined(COPTS) && !empty(COPTS:M*-g*)
${COMPILE.cc} ${.IMPSRC}
.else
@echo ${COMPILE.cc:Q} ${.IMPSRC}
@${COMPILE.cc} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.cc.po .C.po:
.if defined(COPTS) && !empty(COPTS:M*-g*)
${COMPILE.cc} -pg ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.cc:Q} -pg ${.IMPSRC} -o ${.TARGET}
@${COMPILE.cc} -pg ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.cc.so .C.so:
.if defined(COPTS) && !empty(COPTS:M*-g*)
${COMPILE.cc} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.cc:Q} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
@${COMPILE.cc} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.f.o:
.if defined(FOPTS) && !empty(FOPTS:M*-g*)
${COMPILE.f} ${.IMPSRC}
.else
@echo ${COMPILE.f:Q} ${.IMPSRC}
@${COMPILE.f} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.f.po:
.if defined(FOPTS) && !empty(FOPTS:M*-g*)
${COMPILE.f} -pg ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.f:Q} -pg ${.IMPSRC} -o ${.TARGET}
@${COMPILE.f} -pg ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.f.so:
.if defined(FOPTS) && !empty(FOPTS:M*-g*)
${COMPILE.f} ${FPICFLAGS} ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.f:Q} ${FPICFLAGS} ${.IMPSRC} -o ${.TARGET}
@${COMPILE.f} ${FPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.f.ln:
${ECHO} Skipping lint for Fortran libraries.
.m.o:
.if defined(OBJCFLAGS) && !empty(OBJCFLAGS:M*-g*)
${COMPILE.m} ${.IMPSRC}
.else
@echo ${COMPILE.m:Q} ${.IMPSRC}
@${COMPILE.m} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.m.po:
.if defined(OBJCFLAGS) && !empty(OBJCFLAGS:M*-g*)
${COMPILE.m} -pg ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.m:Q} -pg ${.IMPSRC} -o ${.TARGET}
@${COMPILE.m} -pg ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.m.so:
.if defined(OBJCFLAGS) && !empty(OBJCFLAGS:M*-g*)
${COMPILE.m} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.m:Q} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
@${COMPILE.m} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.S.o .s.o:
@echo ${COMPILE.S:Q} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC}
@${COMPILE.S} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.S.po .s.po:
@echo ${COMPILE.S:Q} -DGPROF -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}
@${COMPILE.S} -DGPROF -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.S.so .s.so:
@echo ${COMPILE.S:Q} ${CAPICFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}
@${COMPILE.S} ${CAPICFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.if ${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
|| ${MKLINKLIB} != "no"
_LIBS=lib${LIB}.a
.else
_LIBS=
.endif
OBJS+=${SRCS:N*.h:N*.sh:R:S/$/.o/g}
.if ${MKPROFILE} != "no"
_LIBS+=lib${LIB}_p.a
POBJS+=${OBJS:.o=.po}
.endif
.if ${MKPIC} != "no"
.if ${MKPICLIB} == "no"
SOLIB=lib${LIB}.a
.else
SOLIB=lib${LIB}_pic.a
_LIBS+=${SOLIB}
SOBJS+=${OBJS:.o=.so}
.endif
.if defined(SHLIB_FULLVERSION)
_LIBS+=lib${LIB}.so.${SHLIB_FULLVERSION}
.endif
.endif
LOBJS+=${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
.if ${MKLINT} != "no" && ${MKLINKLIB} != "no" && !empty(LOBJS)
_LIBS+=llib-l${LIB}.ln
.endif
.if ${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
|| ${MKLINKLIB} != "no"
ALLOBJS=${OBJS} ${POBJS} ${SOBJS}
.else
ALLOBJS=${POBJS} ${SOBJS}
.endif
.if ${MKLINT} != "no" && ${MKLINKLIB} != "no" && !empty(LOBJS)
ALLOBJS+=${LOBJS}
.endif
.NOPATH: ${ALLOBJS} ${_LIBS}
realall: ${SRCS} ${ALLOBJS:O} ${_LIBS}
__archivebuild: .USE
@rm -f ${.TARGET}
${AR} cq ${.TARGET} ${.ALLSRC:M*o}
${RANLIB} ${.TARGET}
__archiveinstall: .USE
${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} -o ${LIBOWN} \
-g ${LIBGRP} -m 600 ${.ALLSRC} ${.TARGET}
${RANLIB} -t ${.TARGET}
chmod ${LIBMODE} ${.TARGET}
DPSRCS+= ${SRCS:M*.l:.l=.c} ${SRCS:M*.y:.y=.c}
CLEANFILES+= ${DPSRCS}
.if defined(YHEADER)
CLEANFILES+= ${SRCS:M*.y:.y=.h}
.endif
lib${LIB}.a:: ${OBJS} __archivebuild
@echo building standard ${LIB} library
lib${LIB}_p.a:: ${POBJS} __archivebuild
@echo building profiled ${LIB} library
lib${LIB}_pic.a:: ${SOBJS} __archivebuild
@echo building shared object ${LIB} library
lib${LIB}.so.${SHLIB_FULLVERSION}: ${SOLIB} ${DPADD} \
${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE}
@echo building shared ${LIB} library \(version ${SHLIB_FULLVERSION}\)
@rm -f lib${LIB}.so.${SHLIB_FULLVERSION}
$(CC) -shared ${SHLIB_SHFLAGS} -o ${.TARGET} \
${SHLIB_LDSTARTFILE} \
-Wl,--image-base,$$(($$RANDOM %4096/2*262144+1342177280)) \
-Wl,--whole-archive ${SOLIB} -Wl,--no-whole-archive ${LDADD} \
${SHLIB_LDENDFILE}
.if ${OBJECT_FMT} == "ELF"
ln -sf lib${LIB}.so.${SHLIB_FULLVERSION} lib${LIB}.so.${SHLIB_MAJOR}.tmp
mv -f lib${LIB}.so.${SHLIB_MAJOR}.tmp lib${LIB}.so.${SHLIB_MAJOR}
ln -sf lib${LIB}.so.${SHLIB_FULLVERSION} lib${LIB}.so.tmp
mv -f lib${LIB}.so.tmp lib${LIB}.so
.endif
.if !empty(LOBJS)
LLIBS?= -lc
llib-l${LIB}.ln: ${LOBJS}
@echo building llib-l${LIB}.ln
@rm -f llib-l${LIB}.ln
@${LINT} -C${LIB} ${.ALLSRC} ${LLIBS}
.endif
cleanlib:
rm -f a.out [Ee]rrs mklog core *.core ${CLEANFILES}
rm -f lib${LIB}.a ${OBJS}
rm -f lib${LIB}_p.a ${POBJS}
rm -f lib${LIB}_pic.a lib${LIB}.so.* lib${LIB}.so ${SOBJS}
rm -f llib-l${LIB}.ln ${LOBJS}
.if defined(SRCS)
afterdepend: .depend
@(TMP=/tmp/_depend$$$$; \
sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.po \1.so \1.ln:/' \
< .depend > $$TMP; \
mv $$TMP .depend)
.endif
.if !target(libinstall)
# Make sure it gets defined, in case MKPIC==no && MKLINKLIB==no
libinstall::
.if ${MKLINKLIB} != "no"
libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}.a
.PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}.a
.if !defined(UPDATE)
.PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}.a
.endif
.if !defined(BUILD) && !make(all) && !make(lib${LIB}.a)
${DESTDIR}${LIBDIR}/lib${LIB}.a: .MADE
.endif
${DESTDIR}${LIBDIR}/lib${LIB}.a: lib${LIB}.a __archiveinstall
.endif
.if ${MKPROFILE} != "no"
libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
.PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
.if !defined(UPDATE)
.PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
.endif
.if !defined(BUILD) && !make(all) && !make(lib${LIB}_p.a)
${DESTDIR}${LIBDIR}/lib${LIB}_p.a: .MADE
.endif
${DESTDIR}${LIBDIR}/lib${LIB}_p.a: lib${LIB}_p.a __archiveinstall
.endif
.if ${MKPIC} != "no" && ${MKPICINSTALL} != "no"
libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
.PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
.if !defined(UPDATE)
.PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
.endif
.if !defined(BUILD) && !make(all) && !make(lib${LIB}_pic.a)
${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: .MADE
.endif
.if ${MKPICLIB} == "no"
${DESTDIR}${LIBDIR}/lib${LIB}_pic.a:
rm -f ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
ln -s lib${LIB}.a ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
.else
${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: lib${LIB}_pic.a __archiveinstall
.endif
.endif
.if ${MKPIC} != "no" && defined(SHLIB_FULLVERSION)
libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}
.PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}
.if !defined(UPDATE)
.PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}
.endif
.if !defined(BUILD) && !make(all) && !make(lib${LIB}.so.${SHLIB_FULLVERSION})
${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}: .MADE
.endif
${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}: lib${LIB}.so.${SHLIB_FULLVERSION}
${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} -o ${LIBOWN} \
-g ${LIBGRP} -m ${LIBMODE} ${.ALLSRC} ${.TARGET}
.if ${OBJECT_FMT} == "a.out" && !defined(DESTDIR)
/sbin/ldconfig -m ${LIBDIR}
.endif
.if ${OBJECT_FMT} == "ELF"
ln -sf lib${LIB}.so.${SHLIB_FULLVERSION}\
${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}.tmp
mv -f ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}.tmp\
${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}
.if ${MKLINKLIB} != "no"
ln -sf lib${LIB}.so.${SHLIB_FULLVERSION}\
${DESTDIR}${LIBDIR}/lib${LIB}.so.tmp
mv -f ${DESTDIR}${LIBDIR}/lib${LIB}.so.tmp\
${DESTDIR}${LIBDIR}/lib${LIB}.so
.endif
.endif
.endif
.if ${MKLINT} != "no" && ${MKLINKLIB} != "no" && !empty(LOBJS)
libinstall:: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
.PRECIOUS: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
.if !defined(UPDATE)
.PHONY: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
.endif
.if !defined(BUILD) && !make(all) && !make(llib-l${LIB}.ln)
${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln: .MADE
.endif
${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln: llib-l${LIB}.ln
${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} -o ${LIBOWN} \
-g ${LIBGRP} -m ${LIBMODE} ${.ALLSRC} ${DESTDIR}${LINTLIBDIR}
.endif
.endif
.include <bsd.man.mk>
.include <bsd.nls.mk>
.include <bsd.files.mk>
.include <bsd.inc.mk>
.include <bsd.links.mk>
.include <bsd.dep.mk>
.include <bsd.sys.mk>
# Make sure all of the standard targets are defined, even if they do nothing.
lint regress:

View File

@@ -0,0 +1,194 @@
# $NetBSD: Interix.sys.mk,v 1.2 2006/11/11 18:24:52 jschauma Exp $
unix?= We run Unix
OS!= uname -s
.SUFFIXES: .out .a .ln .o .s .S .c .cc .cpp .cxx .C .F .f .r .y .l .cl .p .h
.SUFFIXES: .sh .m4
.LIBS: .a
AR?= ar
ARFLAGS?= rl
RANLIB?= ranlib
AS?= as
AFLAGS?=
COMPILE.s?= ${CC} ${AFLAGS} -c
LINK.s?= ${CC} ${AFLAGS} ${LDFLAGS}
COMPILE.S?= ${CC} ${AFLAGS} ${CPPFLAGS} -c -traditional-cpp
LINK.S?= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
# Unless told otherwise, assume GNU CC
CC?= gcc
DBG?= -O
CFLAGS?= -D_ALL_SOURCE ${DBG}
COMPILE.c?= ${CC} ${CFLAGS} ${CPPFLAGS} -c
LINK.c?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
CXX?= c++
CXXFLAGS?= ${CFLAGS}
COMPILE.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
LINK.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
OBJC?= ${CC}
OBJCFLAGS?= ${CFLAGS}
COMPILE.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c
LINK.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} ${LDFLAGS}
CPP?= cpp
CPPFLAGS?=
FC?= f77
FFLAGS?= -O
RFLAGS?=
COMPILE.f?= ${FC} ${FFLAGS} -c
LINK.f?= ${FC} ${FFLAGS} ${LDFLAGS}
COMPILE.F?= ${FC} ${FFLAGS} ${CPPFLAGS} -c
LINK.F?= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
COMPILE.r?= ${FC} ${FFLAGS} ${RFLAGS} -c
LINK.r?= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
INSTALL?= ${LOCALBASE}/bin/install-sh
LEX?= lex
LFLAGS?=
LEX.l?= ${LEX} ${LFLAGS}
LD?= ld
LDFLAGS?=
LINT?= lint
LINTFLAGS?= -chapbxzF
LORDER?= lorder
MAKE?= make
NM?= nm
PC?= pc
PFLAGS?=
COMPILE.p?= ${PC} ${PFLAGS} ${CPPFLAGS} -c
LINK.p?= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
SHELL?= sh
SIZE?= size
TSORT?= tsort -q
YACC?= yacc
YFLAGS?=
YACC.y?= ${YACC} ${YFLAGS}
# C
.c:
${LINK.c} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.c.o:
${COMPILE.c} ${.IMPSRC}
.c.a:
${COMPILE.c} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.c.ln:
${LINT} ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i ${.IMPSRC}
# C++
.cc .cpp .cxx .C:
${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.cc.o .cpp.o .cxx.o .C.o:
${COMPILE.cc} ${.IMPSRC}
.cc.a .cpp.a .cxx.a .C.a:
${COMPILE.cc} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Fortran/Ratfor
.f:
${LINK.f} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.f.o:
${COMPILE.f} ${.IMPSRC}
.f.a:
${COMPILE.f} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.F:
${LINK.F} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.F.o:
${COMPILE.F} ${.IMPSRC}
.F.a:
${COMPILE.F} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.r:
${LINK.r} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.r.o:
${COMPILE.r} ${.IMPSRC}
.r.a:
${COMPILE.r} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Pascal
.p:
${LINK.p} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.p.o:
${COMPILE.p} ${.IMPSRC}
.p.a:
${COMPILE.p} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Assembly
.s:
${LINK.s} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.s.o:
${COMPILE.s} ${.IMPSRC}
.s.a:
${COMPILE.s} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.S:
${LINK.S} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.S.o:
${COMPILE.S} ${.IMPSRC}
.S.a:
${COMPILE.S} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Lex
.l:
${LEX.l} ${.IMPSRC}
${LINK.c} -o ${.TARGET} lex.yy.c ${LDLIBS} -ll
rm -f lex.yy.c
.l.c:
${LEX.l} ${.IMPSRC}
mv lex.yy.c ${.TARGET}
.l.o:
${LEX.l} ${.IMPSRC}
${COMPILE.c} -o ${.TARGET} lex.yy.c
rm -f lex.yy.c
# Yacc
.y:
${YACC.y} ${.IMPSRC}
${LINK.c} -o ${.TARGET} y.tab.c ${LDLIBS}
rm -f y.tab.c
.y.c:
${YACC.y} ${.IMPSRC}
mv y.tab.c ${.TARGET}
.y.o:
${YACC.y} ${.IMPSRC}
${COMPILE.c} -o ${.TARGET} y.tab.c
rm -f y.tab.c
# Shell
.sh:
rm -f ${.TARGET}
cp ${.IMPSRC} ${.TARGET}

View File

@@ -0,0 +1,524 @@
# $NetBSD: Linux.bsd.lib.mk,v 1.3 2008/03/13 17:28:23 joerg Exp $
# @(#)bsd.lib.mk 8.3 (Berkeley) 4/22/94
.if !target(__initialized__)
__initialized__:
.if exists(${.CURDIR}/../Makefile.inc)
.include "${.CURDIR}/../Makefile.inc"
.endif
.include <bsd.own.mk>
.include <bsd.obj.mk>
.include <bsd.depall.mk>
.MAIN: all
.endif
.PHONY: checkver cleanlib libinstall
realinstall: checkver libinstall
clean cleandir: cleanlib
.if exists(${SHLIB_VERSION_FILE})
SHLIB_MAJOR != . ${SHLIB_VERSION_FILE} ; echo $$major
SHLIB_MINOR != . ${SHLIB_VERSION_FILE} ; echo $$minor
SHLIB_TEENY != . ${SHLIB_VERSION_FILE} ; echo $$teeny
# Check for higher installed library versions.
.if !defined(NOCHECKVER) && !defined(NOCHECKVER_${LIB}) && \
exists(${BSDSRCDIR}/lib/checkver)
checkver:
@(cd ${.CURDIR} && \
sh ${BSDSRCDIR}/lib/checkver -v ${SHLIB_VERSION_FILE} \
-d ${DESTDIR}${LIBDIR} ${LIB})
.endif
.endif
.if !target(checkver)
checkver:
.endif
print-shlib-major:
.if defined(SHLIB_MAJOR)
@echo ${SHLIB_MAJOR}
.else
@false
.endif
print-shlib-minor:
.if defined(SHLIB_MINOR)
@echo ${SHLIB_MINOR}
.else
@false
.endif
print-shlib-teeny:
.if defined(SHLIB_TEENY)
@echo ${SHLIB_TEENY}
.else
@false
.endif
.if defined(SHLIB_MAJOR) && !empty(SHLIB_MAJOR)
.if defined(SHLIB_MINOR) && !empty(SHLIB_MINOR)
.if defined(SHLIB_TEENY) && !empty(SHLIB_TEENY)
SHLIB_FULLVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR}.${SHLIB_TEENY}
.else
SHLIB_FULLVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR}
.endif
.else
SHLIB_FULLVERSION=${SHLIB_MAJOR}
.endif
.endif
# add additional suffixes not exported.
# .po is used for profiling object files.
# .so is used for PIC object files.
.SUFFIXES: .out .a .ln .so .po .o .s .S .c .cc .C .m .F .f .r .y .l .cl .p .h
.SUFFIXES: .sh .m4 .m
# Set PICFLAGS to cc flags for producing position-independent code,
# if not already set. Includes -DPIC, if required.
# Data-driven table using make variables to control how shared libraries
# are built for different platforms and object formats.
# OBJECT_FMT: currently either "ELF" or "a.out", from <bsd.own.mk>
# SHLIB_SOVERSION: version number to be compiled into a shared library
# via -soname. Usualy ${SHLIB_MAJOR} on ELF.
# NetBSD/pmax used to use ${SHLIB_MAJOR}[.${SHLIB_MINOR}
# [.${SHLIB_TEENY}]]
# SHLIB_SHFLAGS: Flags to tell ${LD} to emit shared library.
# with ELF, also set shared-lib version for ld.so.
# SHLIB_LDSTARTFILE: support .o file, call C++ file-level constructors
# SHLIB_LDENDFILE: support .o file, call C++ file-level destructors
# FPICFLAGS: flags for ${FC} to compile .[fF] files to .so objects.
# CPPICFLAGS: flags for ${CPP} to preprocess .[sS] files for ${AS}
# CPICFLAGS: flags for ${CC} to compile .[cC] files to .so objects.
# CAPICFLAGS flags for {$CC} to compiling .[Ss] files
# (usually just ${CPPPICFLAGS} ${CPICFLAGS})
# APICFLAGS: flags for ${AS} to assemble .[sS] to .so objects.
.if ${MACHINE_ARCH} == "alpha"
# Alpha-specific shared library flags
FPICFLAGS ?= -fPIC
CPICFLAGS ?= -fPIC -DPIC
CPPPICFLAGS?= -DPIC
CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS}
APICFLAGS ?=
.elif ${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb"
# mips-specific shared library flags
# On mips, all libs are compiled with ABIcalls, not just sharedlibs.
MKPICLIB= no
# so turn shlib PIC flags on for ${AS}.
AINC+=-DABICALLS
AFLAGS+= -fPIC
AS+= -KPIC
.elif ${MACHINE_ARCH} == "vax" && ${OBJECT_FMT} == "ELF"
# On the VAX, all object are PIC by default, not just sharedlibs.
MKPICLIB= no
.elif (${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64") && \
${OBJECT_FMT} == "ELF"
FPICFLAGS ?= -fPIC
CPICFLAGS ?= -fPIC -DPIC
CPPPICFLAGS?= -DPIC
CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS}
APICFLAGS ?= -KPIC
.else
# Platform-independent flags for NetBSD a.out shared libraries (and PowerPC)
SHLIB_LDSTARTFILE=
SHLIB_LDENDFILE=
SHLIB_SOVERSION=${SHLIB_FULLVERSION}
SHLIB_SHFLAGS=
FPICFLAGS ?= -fPIC
CPICFLAGS?= -fPIC -DPIC
CPPPICFLAGS?= -DPIC
CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS}
APICFLAGS?= -k
.endif
MKPICLIB?= yes
# Platform-independent linker flags for ELF shared libraries
.if ${OBJECT_FMT} == "ELF"
SHLIB_SOVERSION= ${SHLIB_MAJOR}
SHLIB_SHFLAGS= -soname lib${LIB}.so.${SHLIB_SOVERSION}
SHLIB_LDSTARTFILE?= ${DESTDIR}/usr/lib/crtbeginS.o
SHLIB_LDENDFILE?= ${DESTDIR}/usr/lib/crtendS.o
.endif
CFLAGS+= ${COPTS}
FFLAGS+= ${FOPTS}
.c.o:
.if defined(COPTS) && !empty(COPTS:M*-g*)
${COMPILE.c} ${.IMPSRC}
.else
@echo ${COMPILE.c:Q} ${.IMPSRC}
@${COMPILE.c} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.c.po:
.if defined(COPTS) && !empty(COPTS:M*-g*)
${COMPILE.c} -pg ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.c:Q} -pg ${.IMPSRC} -o ${.TARGET}
@${COMPILE.c} -pg ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.c.so:
.if defined(COPTS) && !empty(COPTS:M*-g*)
${COMPILE.c} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.c:Q} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
@${COMPILE.c} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.c.ln:
${LINT} ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i ${.IMPSRC}
.cc.o .C.o:
.if defined(COPTS) && !empty(COPTS:M*-g*)
${COMPILE.cc} ${.IMPSRC}
.else
@echo ${COMPILE.cc:Q} ${.IMPSRC}
@${COMPILE.cc} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.cc.po .C.po:
.if defined(COPTS) && !empty(COPTS:M*-g*)
${COMPILE.cc} -pg ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.cc:Q} -pg ${.IMPSRC} -o ${.TARGET}
@${COMPILE.cc} -pg ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.cc.so .C.so:
.if defined(COPTS) && !empty(COPTS:M*-g*)
${COMPILE.cc} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.cc:Q} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
@${COMPILE.cc} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.f.o:
.if defined(FOPTS) && !empty(FOPTS:M*-g*)
${COMPILE.f} ${.IMPSRC}
.else
@echo ${COMPILE.f:Q} ${.IMPSRC}
@${COMPILE.f} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.f.po:
.if defined(FOPTS) && !empty(FOPTS:M*-g*)
${COMPILE.f} -pg ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.f:Q} -pg ${.IMPSRC} -o ${.TARGET}
@${COMPILE.f} -pg ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.f.so:
.if defined(FOPTS) && !empty(FOPTS:M*-g*)
${COMPILE.f} ${FPICFLAGS} ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.f:Q} ${FPICFLAGS} ${.IMPSRC} -o ${.TARGET}
@${COMPILE.f} ${FPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.f.ln:
${ECHO} Skipping lint for Fortran libraries.
.m.o:
.if defined(OBJCFLAGS) && !empty(OBJCFLAGS:M*-g*)
${COMPILE.m} ${.IMPSRC}
.else
@echo ${COMPILE.m:Q} ${.IMPSRC}
@${COMPILE.m} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.m.po:
.if defined(OBJCFLAGS) && !empty(OBJCFLAGS:M*-g*)
${COMPILE.m} -pg ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.m:Q} -pg ${.IMPSRC} -o ${.TARGET}
@${COMPILE.m} -pg ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.m.so:
.if defined(OBJCFLAGS) && !empty(OBJCFLAGS:M*-g*)
${COMPILE.m} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.m:Q} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
@${COMPILE.m} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.S.o .s.o:
@echo ${COMPILE.S:Q} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC}
@${COMPILE.S} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.S.po .s.po:
@echo ${COMPILE.S:Q} -DGPROF -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}
@${COMPILE.S} -DGPROF -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.S.so .s.so:
@echo ${COMPILE.S:Q} ${CAPICFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}
@${COMPILE.S} ${CAPICFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.if ${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
|| ${MKLINKLIB} != "no"
_LIBS=lib${LIB}.a
.else
_LIBS=
.endif
OBJS+=${SRCS:N*.h:N*.sh:R:S/$/.o/g}
.if ${MKPROFILE} != "no"
_LIBS+=lib${LIB}_p.a
POBJS+=${OBJS:.o=.po}
.endif
.if ${MKPIC} != "no"
.if ${MKPICLIB} == "no"
SOLIB=lib${LIB}.a
.else
SOLIB=lib${LIB}_pic.a
_LIBS+=${SOLIB}
SOBJS+=${OBJS:.o=.so}
.endif
.if defined(SHLIB_FULLVERSION)
_LIBS+=lib${LIB}.so.${SHLIB_FULLVERSION}
.endif
.endif
LOBJS+=${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
.if ${MKLINT} != "no" && ${MKLINKLIB} != "no" && !empty(LOBJS)
_LIBS+=llib-l${LIB}.ln
.endif
.if ${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
|| ${MKLINKLIB} != "no"
ALLOBJS=${OBJS} ${POBJS} ${SOBJS}
.else
ALLOBJS=${POBJS} ${SOBJS}
.endif
.if ${MKLINT} != "no" && ${MKLINKLIB} != "no" && !empty(LOBJS)
ALLOBJS+=${LOBJS}
.endif
.NOPATH: ${ALLOBJS} ${_LIBS}
realall: ${SRCS} ${ALLOBJS:O} ${_LIBS}
__archivebuild: .USE
@rm -f ${.TARGET}
${AR} cq ${.TARGET} ${.ALLSRC:M*o}
${RANLIB} ${.TARGET}
__archiveinstall: .USE
${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} -o ${LIBOWN} \
-g ${LIBGRP} -m 600 ${.ALLSRC} ${.TARGET}
${RANLIB} -t ${.TARGET}
chmod ${LIBMODE} ${.TARGET}
DPSRCS+= ${SRCS:M*.l:.l=.c} ${SRCS:M*.y:.y=.c}
CLEANFILES+= ${DPSRCS}
.if defined(YHEADER)
CLEANFILES+= ${SRCS:M*.y:.y=.h}
.endif
lib${LIB}.a:: ${OBJS} __archivebuild
@echo building standard ${LIB} library
lib${LIB}_p.a:: ${POBJS} __archivebuild
@echo building profiled ${LIB} library
lib${LIB}_pic.a:: ${SOBJS} __archivebuild
@echo building shared object ${LIB} library
lib${LIB}.so.${SHLIB_FULLVERSION}: ${SOLIB} ${DPADD} \
${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE}
@echo building shared ${LIB} library \(version ${SHLIB_FULLVERSION}\)
@rm -f lib${LIB}.so.${SHLIB_FULLVERSION}
.if defined(DESTDIR)
$(LD) -nostdlib -shared ${SHLIB_SHFLAGS} -o ${.TARGET} \
${SHLIB_LDSTARTFILE} \
--whole-archive ${SOLIB} \
--no-whole-archive ${LDADD} \
-L${DESTDIR}${LIBDIR} -R${LIBDIR} \
${SHLIB_LDENDFILE}
.else
$(LD) -shared ${SHLIB_SHFLAGS} -o ${.TARGET} \
${SHLIB_LDSTARTFILE} \
--whole-archive ${SOLIB} --no-whole-archive ${LDADD} \
${SHLIB_LDENDFILE}
.endif
.if ${OBJECT_FMT} == "ELF"
ln -sf lib${LIB}.so.${SHLIB_FULLVERSION} lib${LIB}.so.${SHLIB_MAJOR}.tmp
mv -f lib${LIB}.so.${SHLIB_MAJOR}.tmp lib${LIB}.so.${SHLIB_MAJOR}
ln -sf lib${LIB}.so.${SHLIB_FULLVERSION} lib${LIB}.so.tmp
mv -f lib${LIB}.so.tmp lib${LIB}.so
.endif
.if !empty(LOBJS)
LLIBS?= -lc
llib-l${LIB}.ln: ${LOBJS}
@echo building llib-l${LIB}.ln
@rm -f llib-l${LIB}.ln
@${LINT} -C${LIB} ${.ALLSRC} ${LLIBS}
.endif
cleanlib:
rm -f a.out [Ee]rrs mklog core *.core ${CLEANFILES}
rm -f lib${LIB}.a ${OBJS}
rm -f lib${LIB}_p.a ${POBJS}
rm -f lib${LIB}_pic.a lib${LIB}.so.* lib${LIB}.so ${SOBJS}
rm -f llib-l${LIB}.ln ${LOBJS}
.if defined(SRCS)
afterdepend: .depend
@(TMP=/tmp/_depend$$$$; \
sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.po \1.so \1.ln:/' \
< .depend > $$TMP; \
mv $$TMP .depend)
.endif
.if !target(libinstall)
# Make sure it gets defined, in case MKPIC==no && MKLINKLIB==no
libinstall::
.if ${MKLINKLIB} != "no"
libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}.a
.PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}.a
.if !defined(UPDATE)
.PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}.a
.endif
.if !defined(BUILD) && !make(all) && !make(lib${LIB}.a)
${DESTDIR}${LIBDIR}/lib${LIB}.a: .MADE
.endif
${DESTDIR}${LIBDIR}/lib${LIB}.a: lib${LIB}.a __archiveinstall
.endif
.if ${MKPROFILE} != "no"
libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
.PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
.if !defined(UPDATE)
.PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
.endif
.if !defined(BUILD) && !make(all) && !make(lib${LIB}_p.a)
${DESTDIR}${LIBDIR}/lib${LIB}_p.a: .MADE
.endif
${DESTDIR}${LIBDIR}/lib${LIB}_p.a: lib${LIB}_p.a __archiveinstall
.endif
.if ${MKPIC} != "no" && ${MKPICINSTALL} != "no"
libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
.PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
.if !defined(UPDATE)
.PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
.endif
.if !defined(BUILD) && !make(all) && !make(lib${LIB}_pic.a)
${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: .MADE
.endif
.if ${MKPICLIB} == "no"
${DESTDIR}${LIBDIR}/lib${LIB}_pic.a:
rm -f ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
ln -s lib${LIB}.a ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
.else
${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: lib${LIB}_pic.a __archiveinstall
.endif
.endif
.if ${MKPIC} != "no" && defined(SHLIB_FULLVERSION)
libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}
.PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}
.if !defined(UPDATE)
.PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}
.endif
.if !defined(BUILD) && !make(all) && !make(lib${LIB}.so.${SHLIB_FULLVERSION})
${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}: .MADE
.endif
${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}: lib${LIB}.so.${SHLIB_FULLVERSION}
${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} -o ${LIBOWN} \
-g ${LIBGRP} -m ${LIBMODE} ${.ALLSRC} ${.TARGET}
.if ${OBJECT_FMT} == "a.out" && !defined(DESTDIR)
/sbin/ldconfig -m ${LIBDIR}
.endif
.if ${OBJECT_FMT} == "ELF"
ln -sf lib${LIB}.so.${SHLIB_FULLVERSION}\
${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}.tmp
mv -f ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}.tmp\
${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}
.if ${MKLINKLIB} != "no"
ln -sf lib${LIB}.so.${SHLIB_FULLVERSION}\
${DESTDIR}${LIBDIR}/lib${LIB}.so.tmp
mv -f ${DESTDIR}${LIBDIR}/lib${LIB}.so.tmp\
${DESTDIR}${LIBDIR}/lib${LIB}.so
.endif
.endif
.endif
.if ${MKLINT} != "no" && ${MKLINKLIB} != "no" && !empty(LOBJS)
libinstall:: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
.PRECIOUS: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
.if !defined(UPDATE)
.PHONY: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
.endif
.if !defined(BUILD) && !make(all) && !make(llib-l${LIB}.ln)
${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln: .MADE
.endif
${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln: llib-l${LIB}.ln
${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} -o ${LIBOWN} \
-g ${LIBGRP} -m ${LIBMODE} ${.ALLSRC} ${DESTDIR}${LINTLIBDIR}
.endif
.endif
.include <bsd.man.mk>
.include <bsd.nls.mk>
.include <bsd.files.mk>
.include <bsd.inc.mk>
.include <bsd.links.mk>
.include <bsd.dep.mk>
.include <bsd.sys.mk>
# Make sure all of the standard targets are defined, even if they do nothing.
lint regress:

View File

@@ -0,0 +1,219 @@
# $NetBSD: Linux.bsd.man.mk,v 1.10 2011/10/30 22:12:45 wiz Exp $
# @(#)bsd.man.mk 8.1 (Berkeley) 6/8/93
.if !target(__initialized__)
__initialized__:
.if exists(${.CURDIR}/../Makefile.inc)
.include "${.CURDIR}/../Makefile.inc"
.endif
.include <bsd.own.mk>
.include <bsd.obj.mk>
.include <bsd.depall.mk>
.MAIN: all
.endif
.PHONY: catinstall maninstall catpages manpages catlinks manlinks cleanman html installhtml cleanhtml
.if ${MKMAN} != "no"
realinstall: ${MANINSTALL}
.endif
cleandir: cleanman
.if exists(${DESTDIR}/usr/share/groff/1.21/tmac)
TMACDIR?= ${DESTDIR}/usr/share/groff/1.21/tmac
.elif exists(${DESTDIR}/usr/share/groff/1.20.1/tmac)
TMACDIR?= ${DESTDIR}/usr/share/groff/1.20.1/tmac
.elif exists(${DESTDIR}/usr/share/groff/1.19.2/tmac)
TMACDIR?= ${DESTDIR}/usr/share/groff/1.19.2/tmac
.elif exists(${DESTDIR}/usr/share/groff/1.19.1/tmac)
TMACDIR?= ${DESTDIR}/usr/share/groff/1.19.1/tmac
.elif exists(${DESTDIR}/usr/share/groff/1.18.1.1/tmac)
TMACDIR?= ${DESTDIR}/usr/share/groff/1.18.1.1/tmac
.elif exists(${DESTDIR}/usr/share/groff/1.18.1.4/tmac)
TMACDIR?= ${DESTDIR}/usr/share/groff/1.18.1.4/tmac
.elif exists(${DESTDIR}/usr/share/groff/1.18.1/tmac)
TMACDIR?= ${DESTDIR}/usr/share/groff/1.18.1/tmac
.elif exists(${DESTDIR}/usr/share/groff/1.18/tmac)
TMACDIR?= ${DESTDIR}/usr/share/groff/1.18/tmac
.elif exists(${DESTDIR}/usr/share/groff/1.17.2/tmac)
TMACDIR?= ${DESTDIR}/usr/share/groff/1.17.2/tmac
.else
TMACDIR?= ${DESTDIR}/usr/share/groff/tmac
.endif
HTMLDIR?= ${DESTDIR}/usr/share/man
CATDEPS?= ${TMACDIR}/mandoc.tmac \
${TMACDIR}/doc.tmac
MANTARGET?= cat
NROFF?= nroff -Tascii
GROFF?= groff -Tascii
TBL?= tbl
.SUFFIXES: .1 .2 .3 .4 .5 .6 .7 .8 .9 \
.cat1 .cat2 .cat3 .cat4 .cat5 .cat6 .cat7 .cat8 .cat9 \
.html1 .html2 .html3 .html4 .html5 .html6 .html7 .html8 .html9
.9.cat9 .8.cat8 .7.cat7 .6.cat6 .5.cat5 .4.cat4 .3.cat3 .2.cat2 .1.cat1: \
${CATDEPS}
.if !defined(USETBL)
@echo "${NROFF} -mandoc ${.IMPSRC} > ${.TARGET}"
@${NROFF} -mandoc ${.IMPSRC} > ${.TARGET} || \
(rm -f ${.TARGET}; false)
.else
@echo "${TBL} ${.IMPSRC} | ${NROFF} -mandoc > ${.TARGET}"
@${TBL} ${.IMPSRC} | ${NROFF} -mandoc > ${.TARGET} || \
(rm -f ${.TARGET}; false)
.endif
.9.html9 .8.html8 .7.html7 .6.html6 .5.html5 .4.html4 .3.html3 .2.html2 .1.html1: \
${CATDEPS}
.if !defined(USETBL)
@echo "${GROFF} -mdoc2html -P-b -P-u -P-o ${.IMPSRC} > ${.TARGET}"
@${GROFF} -mdoc2html -P-b -P-u -P-o ${.IMPSRC} > ${.TARGET} || \
(rm -f ${.TARGET}; false)
.else
@echo "${TBL} ${.IMPSRC} | ${GROFF} -mdoc2html -P-b -P-u -P-o > ${.TARGET}"
@cat ${.IMPSRC} | ${GROFF} -mdoc2html -P-b -P-u -P-o > ${.TARGET} || \
(rm -f ${.TARGET}; false)
.endif
.if defined(MAN) && !empty(MAN)
MANPAGES= ${MAN}
CATPAGES= ${MANPAGES:C/(.*).([1-9])/\1.cat\2/}
.NOPATH: ${CATPAGES}
.if !defined(NOHTML)
HTMLPAGES= ${MANPAGES:C/(.*).([1-9])/\1.html\2/}
.endif
.endif
MINSTALL= ${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} \
-o ${MANOWN} -g ${MANGRP} -m ${MANMODE}
.if defined(MANZ)
# chown and chmod are done afterward automatically
MCOMPRESS= gzip -cf
MCOMPRESSSUFFIX= .gz
.endif
catinstall: catlinks
maninstall: manlinks
__installpage: .USE
.if defined(MCOMPRESS) && !empty(MCOMPRESS)
@rm -f ${.TARGET}
${MCOMPRESS} ${.ALLSRC} > ${.TARGET}
@chown ${MANOWN}:${MANGRP} ${.TARGET}
@chmod ${MANMODE} ${.TARGET}
.else
@cmp -s ${.ALLSRC} ${.TARGET} > /dev/null 2>&1 || \
(echo "${MINSTALL} ${.ALLSRC} ${.TARGET}" && \
${MINSTALL} ${.ALLSRC} ${.TARGET})
.endif
# Rules for cat'ed man page installation
.if defined(CATPAGES) && !empty(CATPAGES) && ${MKCATPAGES} != "no"
catpages:: ${CATPAGES:@P@${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}@}
.PRECIOUS: ${CATPAGES:@P@${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}@}
.if !defined(UPDATE)
.PHONY: ${CATPAGES:@P@${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}@}
.endif
. for P in ${CATPAGES:O:u}
. if !defined(BUILD) && !make(all) && !make(${P})
${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}: .MADE
. endif
${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}: ${P} __installpage
. endfor
.else
catpages::
.endif
# Rules for source page installation
.if defined(MANPAGES) && !empty(MANPAGES)
manpages:: ${MANPAGES:@P@${DESTDIR}${MANDIR}/man${P:T:E}${MANSUBDIR}/${P}${MCOMPRESSSUFFIX}@}
.PRECIOUS: ${MANPAGES:@P@${DESTDIR}${MANDIR}/man${P:T:E}${MANSUBDIR}/${P}${MCOMPRESSSUFFIX}@}
.if !defined(UPDATE)
.PHONY: ${MANPAGES:@P@${DESTDIR}${MANDIR}/man${P:T:E}${MANSUBDIR}/${P}${MCOMPRESSSUFFIX}@}
.endif
. for P in ${MANPAGES:O:u}
${DESTDIR}${MANDIR}/man${P:T:E}${MANSUBDIR}/${P}${MCOMPRESSSUFFIX}: ${P} __installpage
. endfor
.else
manpages::
.endif
.if ${MKCATPAGES} != "no"
catlinks: catpages
.if defined(MLINKS) && !empty(MLINKS)
@set ${MLINKS}; \
while test $$# -ge 2; do \
name=$$1; \
shift; \
dir=${DESTDIR}${MANDIR}/cat$${name##*.}; \
l=$${dir}${MANSUBDIR}/$${name%.*}.0${MCOMPRESSSUFFIX}; \
name=$$1; \
shift; \
dir=${DESTDIR}${MANDIR}/cat$${name##*.}; \
t=$${dir}${MANSUBDIR}/$${name%.*}.0${MCOMPRESSSUFFIX}; \
if test $$l -nt $$t -o ! -f $$t; then \
echo $$t -\> $$l; \
ln -f $$l $$t; \
fi; \
done
.endif
.else
catlinks:
.endif
manlinks: manpages
.if defined(MLINKS) && !empty(MLINKS)
@set ${MLINKS}; \
while test $$# -ge 2; do \
name=$$1; \
shift; \
dir=${DESTDIR}${MANDIR}/man$${name##*.}; \
l=$${dir}${MANSUBDIR}/$${name}${MCOMPRESSSUFFIX}; \
name=$$1; \
shift; \
dir=${DESTDIR}${MANDIR}/man$${name##*.}; \
t=$${dir}${MANSUBDIR}/$${name}${MCOMPRESSSUFFIX}; \
if test $$l -nt $$t -o ! -f $$t; then \
echo $$t -\> $$l; \
ln -f $$l $$t; \
fi; \
done
.endif
# Html rules
html: ${HTMLPAGES}
.if defined(HTMLPAGES) && !empty(HTMLPAGES)
.for P in ${HTMLPAGES:O:u}
${HTMLDIR}/${P:T:E}/${P:T:R}.html: ${P}
${MINSTALL} ${.ALLSRC} ${.TARGET}
.endfor
.endif
installhtml: ${HTMLPAGES:@P@${HTMLDIR}/${P:T:E}/${P:T:R}.html@}
cleanhtml:
.if defined(HTMLPAGES) && !empty(HTMLPAGES)
rm -f ${HTMLPAGES}
.endif
.if defined(CATPAGES)
.if ${MKCATPAGES} != "no" && ${MKMAN} != "no"
realall: ${CATPAGES}
.else
realall:
.endif
cleanman:
rm -f ${CATPAGES}
.else
cleanman:
.endif
# Make sure all of the standard targets are defined, even if they do nothing.
clean depend includes lint regress tags:

View File

@@ -0,0 +1,200 @@
# $NetBSD: Linux.sys.mk,v 1.3 2011/10/31 23:41:21 sbd Exp $
# NetBSD: sys.mk,v 1.58 2000/08/22 17:38:49 bjh21 Exp
# @(#)sys.mk 8.2 (Berkeley) 3/21/94
unix?= We run Unix.
OS?= Linux
.SUFFIXES: .out .a .ln .o .s .S .c .cc .cpp .cxx .C .F .f .r .y .l .cl .p .h
.SUFFIXES: .sh .m4
.LIBS: .a
AR?= ar
ARFLAGS?= rl
RANLIB?= ranlib
AS?= as
AFLAGS?=
COMPILE.s?= ${CC} ${AFLAGS} -c
LINK.s?= ${CC} ${AFLAGS} ${LDFLAGS}
COMPILE.S?= ${CC} ${AFLAGS} ${CPPFLAGS} -c -traditional-cpp
LINK.S?= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
CC?= gcc
DBG?= -O2
CFLAGS?= ${DBG}
COMPILE.c?= ${CC} ${CFLAGS} ${CPPFLAGS} -c
LINK.c?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
CXX?= g++
CXXFLAGS?= ${CFLAGS}
COMPILE.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
LINK.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
OBJC?= ${CC}
OBJCFLAGS?= ${CFLAGS}
COMPILE.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c
LINK.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} ${LDFLAGS}
CPP?= cpp
NOLINT= 1
CPPFLAGS?=
FC?= f77
FFLAGS?= -O
RFLAGS?=
COMPILE.f?= ${FC} ${FFLAGS} -c
LINK.f?= ${FC} ${FFLAGS} ${LDFLAGS}
COMPILE.F?= ${FC} ${FFLAGS} ${CPPFLAGS} -c
LINK.F?= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
COMPILE.r?= ${FC} ${FFLAGS} ${RFLAGS} -c
LINK.r?= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
INSTALL?= install
LEX?= lex
LFLAGS?=
LEX.l?= ${LEX} ${LFLAGS}
LD?= ld
LDFLAGS?=
LINT?= lint
LINTFLAGS?= -chapbxzF
LORDER?= echo
MAKE?= make
NM?= nm
PC?= pc
PFLAGS?=
COMPILE.p?= ${PC} ${PFLAGS} ${CPPFLAGS} -c
LINK.p?= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
SHELL?= sh
SIZE?= size
TSORT?= tsort
YACC?= yacc
YFLAGS?=
YACC.y?= ${YACC} ${YFLAGS}
# At least Ubuntu 8.1 sets __attribute__((warn_unused_result)) on fwrite()
# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25509
.if !defined(NOGCCERROR)
CFLAGS+= -Wno-error
.endif
# C
.c:
${LINK.c} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.c.o:
${COMPILE.c} ${.IMPSRC}
.c.a:
${COMPILE.c} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.c.ln:
${LINT} ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i ${.IMPSRC}
# C++
.cc .cpp .cxx .C:
${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.cc.o .cpp.o .cxx.o .C.o:
${COMPILE.cc} ${.IMPSRC}
.cc.a .cpp.a .cxx.a .C.a:
${COMPILE.cc} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Fortran/Ratfor
.f:
${LINK.f} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.f.o:
${COMPILE.f} ${.IMPSRC}
.f.a:
${COMPILE.f} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.F:
${LINK.F} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.F.o:
${COMPILE.F} ${.IMPSRC}
.F.a:
${COMPILE.F} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.r:
${LINK.r} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.r.o:
${COMPILE.r} ${.IMPSRC}
.r.a:
${COMPILE.r} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Pascal
.p:
${LINK.p} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.p.o:
${COMPILE.p} ${.IMPSRC}
.p.a:
${COMPILE.p} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Assembly
.s:
${LINK.s} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.s.o:
${COMPILE.s} ${.IMPSRC}
.s.a:
${COMPILE.s} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.S:
${LINK.S} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.S.o:
${COMPILE.S} ${.IMPSRC}
.S.a:
${COMPILE.S} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Lex
.l:
${LEX.l} ${.IMPSRC}
${LINK.c} -o ${.TARGET} lex.yy.c ${LDLIBS} -ll
rm -f lex.yy.c
.l.c:
${LEX.l} ${.IMPSRC}
mv lex.yy.c ${.TARGET}
.l.o:
${LEX.l} ${.IMPSRC}
${COMPILE.c} -o ${.TARGET} lex.yy.c
rm -f lex.yy.c
# Yacc
.y:
${YACC.y} ${.IMPSRC}
${LINK.c} -o ${.TARGET} y.tab.c ${LDLIBS}
rm -f y.tab.c
.y.c:
${YACC.y} ${.IMPSRC}
mv y.tab.c ${.TARGET}
.y.o:
${YACC.y} ${.IMPSRC}
${COMPILE.c} -o ${.TARGET} y.tab.c
rm -f y.tab.c
# Shell
.sh:
rm -f ${.TARGET}
cp ${.IMPSRC} ${.TARGET}

View File

@@ -0,0 +1,525 @@
# $NetBSD: Minix.bsd.lib.mk,v 1.1 2011/11/06 21:01:30 tcort Exp $
# @(#)bsd.lib.mk 8.3 (Berkeley) 4/22/94
.if !target(__initialized__)
__initialized__:
.if exists(${.CURDIR}/../Makefile.inc)
.include "${.CURDIR}/../Makefile.inc"
.endif
.include <bsd.own.mk>
.include <bsd.obj.mk>
.include <bsd.depall.mk>
.MAIN: all
.endif
.PHONY: checkver cleanlib libinstall
realinstall: checkver libinstall
clean cleandir: cleanlib
.if exists(${SHLIB_VERSION_FILE})
SHLIB_MAJOR != . ${SHLIB_VERSION_FILE} ; echo $$major
SHLIB_MINOR != . ${SHLIB_VERSION_FILE} ; echo $$minor
SHLIB_TEENY != . ${SHLIB_VERSION_FILE} ; echo $$teeny
# Check for higher installed library versions.
.if !defined(NOCHECKVER) && !defined(NOCHECKVER_${LIB}) && \
exists(${BSDSRCDIR}/lib/checkver)
checkver:
@(cd ${.CURDIR} && \
sh ${BSDSRCDIR}/lib/checkver -v ${SHLIB_VERSION_FILE} \
-d ${DESTDIR}${LIBDIR} ${LIB})
.endif
.endif
.if !target(checkver)
checkver:
.endif
print-shlib-major:
.if defined(SHLIB_MAJOR)
@echo ${SHLIB_MAJOR}
.else
@false
.endif
print-shlib-minor:
.if defined(SHLIB_MINOR)
@echo ${SHLIB_MINOR}
.else
@false
.endif
print-shlib-teeny:
.if defined(SHLIB_TEENY)
@echo ${SHLIB_TEENY}
.else
@false
.endif
.if defined(SHLIB_MAJOR) && !empty(SHLIB_MAJOR)
.if defined(SHLIB_MINOR) && !empty(SHLIB_MINOR)
.if defined(SHLIB_TEENY) && !empty(SHLIB_TEENY)
SHLIB_FULLVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR}.${SHLIB_TEENY}
.else
SHLIB_FULLVERSION=${SHLIB_MAJOR}.${SHLIB_MINOR}
.endif
.else
SHLIB_FULLVERSION=${SHLIB_MAJOR}
.endif
.endif
# add additional suffixes not exported.
# .po is used for profiling object files.
# .so is used for PIC object files.
.SUFFIXES: .out .a .ln .so .po .o .s .S .c .cc .C .m .F .f .r .y .l .cl .p .h
.SUFFIXES: .sh .m4 .m
# Set PICFLAGS to cc flags for producing position-independent code,
# if not already set. Includes -DPIC, if required.
# Data-driven table using make variables to control how shared libraries
# are built for different platforms and object formats.
# OBJECT_FMT: currently either "ELF" or "a.out", from <bsd.own.mk>
# SHLIB_SOVERSION: version number to be compiled into a shared library
# via -soname. Usualy ${SHLIB_MAJOR} on ELF.
# NetBSD/pmax used to use ${SHLIB_MAJOR}[.${SHLIB_MINOR}
# [.${SHLIB_TEENY}]]
# SHLIB_SHFLAGS: Flags to tell ${LD} to emit shared library.
# with ELF, also set shared-lib version for ld.so.
# SHLIB_LDSTARTFILE: support .o file, call C++ file-level constructors
# SHLIB_LDENDFILE: support .o file, call C++ file-level destructors
# FPICFLAGS: flags for ${FC} to compile .[fF] files to .so objects.
# CPPICFLAGS: flags for ${CPP} to preprocess .[sS] files for ${AS}
# CPICFLAGS: flags for ${CC} to compile .[cC] files to .so objects.
# CAPICFLAGS flags for {$CC} to compiling .[Ss] files
# (usually just ${CPPPICFLAGS} ${CPICFLAGS})
# APICFLAGS: flags for ${AS} to assemble .[sS] to .so objects.
.if ${MACHINE_ARCH} == "alpha"
# Alpha-specific shared library flags
FPICFLAGS ?= -fPIC
CPICFLAGS ?= -fPIC -DPIC
CPPPICFLAGS?= -DPIC
CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS}
APICFLAGS ?=
.elif ${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb"
# mips-specific shared library flags
# On mips, all libs are compiled with ABIcalls, not just sharedlibs.
MKPICLIB= no
# so turn shlib PIC flags on for ${AS}.
AINC+=-DABICALLS
AFLAGS+= -fPIC
AS+= -KPIC
.elif ${MACHINE_ARCH} == "vax" && ${OBJECT_FMT} == "ELF"
# On the VAX, all object are PIC by default, not just sharedlibs.
MKPICLIB= no
.elif (${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64") && \
${OBJECT_FMT} == "ELF"
FPICFLAGS ?= -fPIC
CPICFLAGS ?= -fPIC -DPIC
CPPPICFLAGS?= -DPIC
CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS}
APICFLAGS ?= -KPIC
.else
# Platform-independent flags for NetBSD a.out shared libraries (and PowerPC)
SHLIB_LDSTARTFILE=
SHLIB_LDENDFILE=
SHLIB_SOVERSION=${SHLIB_FULLVERSION}
SHLIB_SHFLAGS=
FPICFLAGS ?= -fPIC
CPICFLAGS?= -fPIC -DPIC
CPPPICFLAGS?= -DPIC
CAPICFLAGS?= ${CPPPICFLAGS} ${CPICFLAGS}
APICFLAGS?= -k
.endif
# Minix does not support shared libraries yet
MKPICLIB?= no
# Platform-independent linker flags for ELF shared libraries
.if ${OBJECT_FMT} == "ELF"
SHLIB_SOVERSION= ${SHLIB_MAJOR}
SHLIB_SHFLAGS= -soname lib${LIB}.so.${SHLIB_SOVERSION}
SHLIB_LDSTARTFILE?= ${DESTDIR}/usr/lib/crtbeginS.o
SHLIB_LDENDFILE?= ${DESTDIR}/usr/lib/crtendS.o
.endif
CFLAGS+= ${COPTS}
FFLAGS+= ${FOPTS}
.c.o:
.if defined(COPTS) && !empty(COPTS:M*-g*)
${COMPILE.c} ${.IMPSRC}
.else
@echo ${COMPILE.c:Q} ${.IMPSRC}
@${COMPILE.c} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.c.po:
.if defined(COPTS) && !empty(COPTS:M*-g*)
${COMPILE.c} -pg ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.c:Q} -pg ${.IMPSRC} -o ${.TARGET}
@${COMPILE.c} -pg ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.c.so:
.if defined(COPTS) && !empty(COPTS:M*-g*)
${COMPILE.c} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.c:Q} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
@${COMPILE.c} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.c.ln:
${LINT} ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i ${.IMPSRC}
.cc.o .C.o:
.if defined(COPTS) && !empty(COPTS:M*-g*)
${COMPILE.cc} ${.IMPSRC}
.else
@echo ${COMPILE.cc:Q} ${.IMPSRC}
@${COMPILE.cc} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.cc.po .C.po:
.if defined(COPTS) && !empty(COPTS:M*-g*)
${COMPILE.cc} -pg ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.cc:Q} -pg ${.IMPSRC} -o ${.TARGET}
@${COMPILE.cc} -pg ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.cc.so .C.so:
.if defined(COPTS) && !empty(COPTS:M*-g*)
${COMPILE.cc} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.cc:Q} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
@${COMPILE.cc} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.f.o:
.if defined(FOPTS) && !empty(FOPTS:M*-g*)
${COMPILE.f} ${.IMPSRC}
.else
@echo ${COMPILE.f:Q} ${.IMPSRC}
@${COMPILE.f} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.f.po:
.if defined(FOPTS) && !empty(FOPTS:M*-g*)
${COMPILE.f} -pg ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.f:Q} -pg ${.IMPSRC} -o ${.TARGET}
@${COMPILE.f} -pg ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.f.so:
.if defined(FOPTS) && !empty(FOPTS:M*-g*)
${COMPILE.f} ${FPICFLAGS} ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.f:Q} ${FPICFLAGS} ${.IMPSRC} -o ${.TARGET}
@${COMPILE.f} ${FPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.f.ln:
${ECHO} Skipping lint for Fortran libraries.
.m.o:
.if defined(OBJCFLAGS) && !empty(OBJCFLAGS:M*-g*)
${COMPILE.m} ${.IMPSRC}
.else
@echo ${COMPILE.m:Q} ${.IMPSRC}
@${COMPILE.m} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.m.po:
.if defined(OBJCFLAGS) && !empty(OBJCFLAGS:M*-g*)
${COMPILE.m} -pg ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.m:Q} -pg ${.IMPSRC} -o ${.TARGET}
@${COMPILE.m} -pg ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.m.so:
.if defined(OBJCFLAGS) && !empty(OBJCFLAGS:M*-g*)
${COMPILE.m} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
.else
@echo ${COMPILE.m:Q} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}
@${COMPILE.m} ${CPICFLAGS} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.endif
.S.o .s.o:
@echo ${COMPILE.S:Q} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC}
@${COMPILE.S} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.S.po .s.po:
@echo ${COMPILE.S:Q} -DGPROF -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}
@${COMPILE.S} -DGPROF -DPROF ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.S.so .s.so:
@echo ${COMPILE.S:Q} ${CAPICFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}
@${COMPILE.S} ${CAPICFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} -o ${.TARGET}.o
@${LD} -r ${.TARGET}.o -o ${.TARGET}
@rm -f ${.TARGET}.o
.if ${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
|| ${MKLINKLIB} != "no"
_LIBS=lib${LIB}.a
.else
_LIBS=
.endif
OBJS+=${SRCS:N*.h:N*.sh:R:S/$/.o/g}
.if ${MKPROFILE} != "no"
_LIBS+=lib${LIB}_p.a
POBJS+=${OBJS:.o=.po}
.endif
.if ${MKPIC} != "no"
.if ${MKPICLIB} == "no"
SOLIB=lib${LIB}.a
.else
SOLIB=lib${LIB}_pic.a
_LIBS+=${SOLIB}
SOBJS+=${OBJS:.o=.so}
.endif
.if defined(SHLIB_FULLVERSION)
_LIBS+=lib${LIB}.so.${SHLIB_FULLVERSION}
.endif
.endif
LOBJS+=${LSRCS:.c=.ln} ${SRCS:M*.c:.c=.ln}
.if ${MKLINT} != "no" && ${MKLINKLIB} != "no" && !empty(LOBJS)
_LIBS+=llib-l${LIB}.ln
.endif
.if ${MKPIC} == "no" || (defined(LDSTATIC) && ${LDSTATIC} != "") \
|| ${MKLINKLIB} != "no"
ALLOBJS=${OBJS} ${POBJS} ${SOBJS}
.else
ALLOBJS=${POBJS} ${SOBJS}
.endif
.if ${MKLINT} != "no" && ${MKLINKLIB} != "no" && !empty(LOBJS)
ALLOBJS+=${LOBJS}
.endif
.NOPATH: ${ALLOBJS} ${_LIBS}
realall: ${SRCS} ${ALLOBJS:O} ${_LIBS}
__archivebuild: .USE
@rm -f ${.TARGET}
${AR} cq ${.TARGET} ${.ALLSRC:M*o}
${RANLIB} ${.TARGET}
__archiveinstall: .USE
${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} -o ${LIBOWN} \
-g ${LIBGRP} -m 600 ${.ALLSRC} ${.TARGET}
${RANLIB} -t ${.TARGET}
chmod ${LIBMODE} ${.TARGET}
DPSRCS+= ${SRCS:M*.l:.l=.c} ${SRCS:M*.y:.y=.c}
CLEANFILES+= ${DPSRCS}
.if defined(YHEADER)
CLEANFILES+= ${SRCS:M*.y:.y=.h}
.endif
lib${LIB}.a:: ${OBJS} __archivebuild
@echo building standard ${LIB} library
lib${LIB}_p.a:: ${POBJS} __archivebuild
@echo building profiled ${LIB} library
lib${LIB}_pic.a:: ${SOBJS} __archivebuild
@echo building shared object ${LIB} library
lib${LIB}.so.${SHLIB_FULLVERSION}: ${SOLIB} ${DPADD} \
${SHLIB_LDSTARTFILE} ${SHLIB_LDENDFILE}
@echo building shared ${LIB} library \(version ${SHLIB_FULLVERSION}\)
@rm -f lib${LIB}.so.${SHLIB_FULLVERSION}
.if defined(DESTDIR)
$(LD) -nostdlib -shared ${SHLIB_SHFLAGS} -o ${.TARGET} \
${SHLIB_LDSTARTFILE} \
--whole-archive ${SOLIB} \
--no-whole-archive ${LDADD} \
-L${DESTDIR}${LIBDIR} -R${LIBDIR} \
${SHLIB_LDENDFILE}
.else
$(LD) -shared ${SHLIB_SHFLAGS} -o ${.TARGET} \
${SHLIB_LDSTARTFILE} \
--whole-archive ${SOLIB} --no-whole-archive ${LDADD} \
${SHLIB_LDENDFILE}
.endif
.if ${OBJECT_FMT} == "ELF"
ln -sf lib${LIB}.so.${SHLIB_FULLVERSION} lib${LIB}.so.${SHLIB_MAJOR}.tmp
mv -f lib${LIB}.so.${SHLIB_MAJOR}.tmp lib${LIB}.so.${SHLIB_MAJOR}
ln -sf lib${LIB}.so.${SHLIB_FULLVERSION} lib${LIB}.so.tmp
mv -f lib${LIB}.so.tmp lib${LIB}.so
.endif
.if !empty(LOBJS)
LLIBS?= -lc
llib-l${LIB}.ln: ${LOBJS}
@echo building llib-l${LIB}.ln
@rm -f llib-l${LIB}.ln
@${LINT} -C${LIB} ${.ALLSRC} ${LLIBS}
.endif
cleanlib:
rm -f a.out [Ee]rrs mklog core *.core ${CLEANFILES}
rm -f lib${LIB}.a ${OBJS}
rm -f lib${LIB}_p.a ${POBJS}
rm -f lib${LIB}_pic.a lib${LIB}.so.* lib${LIB}.so ${SOBJS}
rm -f llib-l${LIB}.ln ${LOBJS}
.if defined(SRCS)
afterdepend: .depend
@(TMP=/tmp/_depend$$$$; \
sed -e 's/^\([^\.]*\).o[ ]*:/\1.o \1.po \1.so \1.ln:/' \
< .depend > $$TMP; \
mv $$TMP .depend)
.endif
.if !target(libinstall)
# Make sure it gets defined, in case MKPIC==no && MKLINKLIB==no
libinstall::
.if ${MKLINKLIB} != "no"
libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}.a
.PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}.a
.if !defined(UPDATE)
.PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}.a
.endif
.if !defined(BUILD) && !make(all) && !make(lib${LIB}.a)
${DESTDIR}${LIBDIR}/lib${LIB}.a: .MADE
.endif
${DESTDIR}${LIBDIR}/lib${LIB}.a: lib${LIB}.a __archiveinstall
.endif
.if ${MKPROFILE} != "no"
libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
.PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
.if !defined(UPDATE)
.PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
.endif
.if !defined(BUILD) && !make(all) && !make(lib${LIB}_p.a)
${DESTDIR}${LIBDIR}/lib${LIB}_p.a: .MADE
.endif
${DESTDIR}${LIBDIR}/lib${LIB}_p.a: lib${LIB}_p.a __archiveinstall
.endif
.if ${MKPIC} != "no" && ${MKPICINSTALL} != "no"
libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
.PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
.if !defined(UPDATE)
.PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
.endif
.if !defined(BUILD) && !make(all) && !make(lib${LIB}_pic.a)
${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: .MADE
.endif
.if ${MKPICLIB} == "no"
${DESTDIR}${LIBDIR}/lib${LIB}_pic.a:
rm -f ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
ln -s lib${LIB}.a ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
.else
${DESTDIR}${LIBDIR}/lib${LIB}_pic.a: lib${LIB}_pic.a __archiveinstall
.endif
.endif
.if ${MKPIC} != "no" && defined(SHLIB_FULLVERSION)
libinstall:: ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}
.PRECIOUS: ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}
.if !defined(UPDATE)
.PHONY: ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}
.endif
.if !defined(BUILD) && !make(all) && !make(lib${LIB}.so.${SHLIB_FULLVERSION})
${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}: .MADE
.endif
${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_FULLVERSION}: lib${LIB}.so.${SHLIB_FULLVERSION}
${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} -o ${LIBOWN} \
-g ${LIBGRP} -m ${LIBMODE} ${.ALLSRC} ${.TARGET}
.if ${OBJECT_FMT} == "a.out" && !defined(DESTDIR)
/sbin/ldconfig -m ${LIBDIR}
.endif
.if ${OBJECT_FMT} == "ELF"
ln -sf lib${LIB}.so.${SHLIB_FULLVERSION}\
${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}.tmp
mv -f ${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}.tmp\
${DESTDIR}${LIBDIR}/lib${LIB}.so.${SHLIB_MAJOR}
.if ${MKLINKLIB} != "no"
ln -sf lib${LIB}.so.${SHLIB_FULLVERSION}\
${DESTDIR}${LIBDIR}/lib${LIB}.so.tmp
mv -f ${DESTDIR}${LIBDIR}/lib${LIB}.so.tmp\
${DESTDIR}${LIBDIR}/lib${LIB}.so
.endif
.endif
.endif
.if ${MKLINT} != "no" && ${MKLINKLIB} != "no" && !empty(LOBJS)
libinstall:: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
.PRECIOUS: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
.if !defined(UPDATE)
.PHONY: ${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln
.endif
.if !defined(BUILD) && !make(all) && !make(llib-l${LIB}.ln)
${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln: .MADE
.endif
${DESTDIR}${LINTLIBDIR}/llib-l${LIB}.ln: llib-l${LIB}.ln
${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} -o ${LIBOWN} \
-g ${LIBGRP} -m ${LIBMODE} ${.ALLSRC} ${DESTDIR}${LINTLIBDIR}
.endif
.endif
.include <bsd.man.mk>
.include <bsd.nls.mk>
.include <bsd.files.mk>
.include <bsd.inc.mk>
.include <bsd.links.mk>
.include <bsd.dep.mk>
.include <bsd.sys.mk>
# Make sure all of the standard targets are defined, even if they do nothing.
lint regress:

View File

@@ -0,0 +1,191 @@
# $NetBSD: Minix.bsd.man.mk,v 1.1 2011/11/06 21:01:30 tcort Exp $
# @(#)bsd.man.mk 8.1 (Berkeley) 6/8/93
.if !target(__initialized__)
__initialized__:
.if exists(${.CURDIR}/../Makefile.inc)
.include "${.CURDIR}/../Makefile.inc"
.endif
.include <bsd.own.mk>
.include <bsd.obj.mk>
.include <bsd.depall.mk>
.MAIN: all
.endif
.PHONY: catinstall maninstall catpages manpages catlinks manlinks cleanman html installhtml cleanhtml
.if ${MKMAN} != "no"
realinstall: ${MANINSTALL}
.endif
cleandir: cleanman
HTMLDIR?= ${DESTDIR}/usr/share/man
MANTARGET?= cat
MANDOC?= mandoc -Tascii
TBL?= tbl
.SUFFIXES: .1 .2 .3 .4 .5 .6 .7 .8 .9 \
.cat1 .cat2 .cat3 .cat4 .cat5 .cat6 .cat7 .cat8 .cat9 \
.html1 .html2 .html3 .html4 .html5 .html6 .html7 .html8 .html9
.9.cat9 .8.cat8 .7.cat7 .6.cat6 .5.cat5 .4.cat4 .3.cat3 .2.cat2 .1.cat1:
.if !defined(USETBL)
@echo "${MANDOC} ${.IMPSRC} > ${.TARGET}"
${MANDOC} ${.IMPSRC} > ${.TARGET} || \
(rm -f ${.TARGET}; false)
.else
@echo "${TBL} ${.IMPSRC} | ${MANDOC} > ${.TARGET}"
@${TBL} ${.IMPSRC} | ${MANDOC} > ${.TARGET} || \
(rm -f ${.TARGET}; false)
.endif
.9.html9 .8.html8 .7.html7 .6.html6 .5.html5 .4.html4 .3.html3 .2.html2 .1.html1:
.if !defined(USETBL)
@echo "${MANDOC} -Thtml ${.IMPSRC} > ${.TARGET}"
@${MANDOC} -Thtml ${.IMPSRC} > ${.TARGET} || \
(rm -f ${.TARGET}; false)
.else
@echo "${TBL} ${.IMPSRC} | ${MANDOC} -Thtml > ${.TARGET}"
@cat ${.IMPSRC} | ${MANDOC} -Thtml > ${.TARGET} || \
(rm -f ${.TARGET}; false)
.endif
.if defined(MAN) && !empty(MAN)
MANPAGES= ${MAN}
CATPAGES= ${MANPAGES:C/(.*).([1-9])/\1.cat\2/}
.NOPATH: ${CATPAGES}
.if !defined(NOHTML)
HTMLPAGES= ${MANPAGES:C/(.*).([1-9])/\1.html\2/}
.endif
.endif
MINSTALL= ${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} \
-o ${MANOWN} -g ${MANGRP} -m ${MANMODE}
.if defined(MANZ)
# chown and chmod are done afterward automatically
MCOMPRESS= gzip -cf
MCOMPRESSSUFFIX= .gz
.endif
catinstall: catlinks
maninstall: manlinks
__installpage: .USE
.if defined(MCOMPRESS) && !empty(MCOMPRESS)
@rm -f ${.TARGET}
${MCOMPRESS} ${.ALLSRC} > ${.TARGET}
@chown ${MANOWN}:${MANGRP} ${.TARGET}
@chmod ${MANMODE} ${.TARGET}
.else
@cmp -s ${.ALLSRC} ${.TARGET} > /dev/null 2>&1 || \
(echo "${MINSTALL} ${.ALLSRC} ${.TARGET}" && \
${MINSTALL} ${.ALLSRC} ${.TARGET})
.endif
# Rules for cat'ed man page installation
.if defined(CATPAGES) && !empty(CATPAGES) && ${MKCATPAGES} != "no"
catpages:: ${CATPAGES:@P@${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}@}
.PRECIOUS: ${CATPAGES:@P@${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}@}
.if !defined(UPDATE)
.PHONY: ${CATPAGES:@P@${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}@}
.endif
. for P in ${CATPAGES:O:u}
. if !defined(BUILD) && !make(all) && !make(${P})
${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}: .MADE
. endif
${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}: ${P} __installpage
. endfor
.else
catpages::
.endif
# Rules for source page installation
.if defined(MANPAGES) && !empty(MANPAGES)
manpages:: ${MANPAGES:@P@${DESTDIR}${MANDIR}/man${P:T:E}${MANSUBDIR}/${P}${MCOMPRESSSUFFIX}@}
.PRECIOUS: ${MANPAGES:@P@${DESTDIR}${MANDIR}/man${P:T:E}${MANSUBDIR}/${P}${MCOMPRESSSUFFIX}@}
.if !defined(UPDATE)
.PHONY: ${MANPAGES:@P@${DESTDIR}${MANDIR}/man${P:T:E}${MANSUBDIR}/${P}${MCOMPRESSSUFFIX}@}
.endif
. for P in ${MANPAGES:O:u}
${DESTDIR}${MANDIR}/man${P:T:E}${MANSUBDIR}/${P}${MCOMPRESSSUFFIX}: ${P} __installpage
. endfor
.else
manpages::
.endif
.if ${MKCATPAGES} != "no"
catlinks: catpages
.if defined(MLINKS) && !empty(MLINKS)
@set ${MLINKS}; \
while test $$# -ge 2; do \
name=$$1; \
shift; \
dir=${DESTDIR}${MANDIR}/cat$${name##*.}; \
l=$${dir}${MANSUBDIR}/$${name%.*}.0${MCOMPRESSSUFFIX}; \
name=$$1; \
shift; \
dir=${DESTDIR}${MANDIR}/cat$${name##*.}; \
t=$${dir}${MANSUBDIR}/$${name%.*}.0${MCOMPRESSSUFFIX}; \
if test $$l -nt $$t -o ! -f $$t; then \
echo $$t -\> $$l; \
ln -f $$l $$t; \
fi; \
done
.endif
.else
catlinks:
.endif
manlinks: manpages
.if defined(MLINKS) && !empty(MLINKS)
@set ${MLINKS}; \
while test $$# -ge 2; do \
name=$$1; \
shift; \
dir=${DESTDIR}${MANDIR}/man$${name##*.}; \
l=$${dir}${MANSUBDIR}/$${name}${MCOMPRESSSUFFIX}; \
name=$$1; \
shift; \
dir=${DESTDIR}${MANDIR}/man$${name##*.}; \
t=$${dir}${MANSUBDIR}/$${name}${MCOMPRESSSUFFIX}; \
if test $$l -nt $$t -o ! -f $$t; then \
echo $$t -\> $$l; \
ln -f $$l $$t; \
fi; \
done
.endif
# Html rules
html: ${HTMLPAGES}
.if defined(HTMLPAGES) && !empty(HTMLPAGES)
.for P in ${HTMLPAGES:O:u}
${HTMLDIR}/${P:T:E}/${P:T:R}.html: ${P}
${MINSTALL} ${.ALLSRC} ${.TARGET}
.endfor
.endif
installhtml: ${HTMLPAGES:@P@${HTMLDIR}/${P:T:E}/${P:T:R}.html@}
cleanhtml:
.if defined(HTMLPAGES) && !empty(HTMLPAGES)
rm -f ${HTMLPAGES}
.endif
.if defined(CATPAGES)
.if ${MKCATPAGES} != "no" && ${MKMAN} != "no"
realall: ${CATPAGES}
.else
realall:
.endif
cleanman:
rm -f ${CATPAGES}
.else
cleanman:
.endif
# Make sure all of the standard targets are defined, even if they do nothing.
clean depend includes lint regress tags:

View File

@@ -0,0 +1,286 @@
# $NetBSD: Minix.bsd.own.mk.in,v 1.1 2011/11/06 21:01:30 tcort Exp $
.if !defined(_BSD_OWN_MK_)
_BSD_OWN_MK_=1
.if defined(MAKECONF) && exists(${MAKECONF})
.include "${MAKECONF}"
.elif exists(@SYSCONFDIR@/mk.conf)
.include "@SYSCONFDIR@/mk.conf"
.elif exists(/etc/mk.conf)
.include "/etc/mk.conf"
.endif
# Defining `SKEY' causes support for S/key authentication to be compiled in.
SKEY= yes
# where the system object and source trees are kept; can be configurable
# by the user in case they want them in ~/foosrc and ~/fooobj, for example
BSDSRCDIR?= /usr/src
BSDOBJDIR?= /usr/obj
BINGRP?= @ROOT_GROUP@
BINOWN?= @ROOT_USER@
BINMODE?= 555
NONBINMODE?= 444
# Define MANZ to have the man pages compressed (gzip)
#MANZ= 1
MANDIR?= /usr/share/man
MANGRP?= @ROOT_GROUP@
MANOWN?= @ROOT_USER@
MANMODE?= ${NONBINMODE}
MANINSTALL?= maninstall catinstall
INFODIR?= /usr/share/info
INFOGRP?= @ROOT_GROUP@
INFOOWN?= @ROOT_USER@
INFOMODE?= ${NONBINMODE}
LIBDIR?= /usr/lib
LINTLIBDIR?= /usr/libdata/lint
LIBGRP?= ${BINGRP}
LIBOWN?= ${BINOWN}
LIBMODE?= ${NONBINMODE}
DOCDIR?= /usr/share/doc
HTMLDOCDIR?= /usr/share/doc/html
DOCGRP?= @ROOT_GROUP@
DOCOWN?= @ROOT_USER@
DOCMODE?= ${NONBINMODE}
NLSDIR?= /usr/share/nls
NLSGRP?= @ROOT_GROUP@
NLSOWN?= @ROOT_USER@
NLSMODE?= ${NONBINMODE}
KMODDIR?= /usr/lkm
KMODGRP?= @ROOT_GROUP@
KMODOWN?= @ROOT_USER@
KMODMODE?= ${NONBINMODE}
LOCALEDIR?= /usr/share/locale
LOCALEGRP?= @ROOT_GROUP@
LOCALEOWN?= @ROOT_USER@
LOCALEMODE?= ${NONBINMODE}
COPY?= -c
.if defined(UPDATE)
PRESERVE?= -p
.else
PRESERVE?=
.endif
.if defined(UNPRIVILEGED)
INSTPRIV?= -U
.endif
STRIPFLAG?= -s
# Define SYS_INCLUDE to indicate whether you want symbolic links to the system
# source (``symlinks''), or a separate copy (``copies''); (latter useful
# in environments where it's not possible to keep /sys publicly readable)
#SYS_INCLUDE= symlinks
# The sh3 port is incomplete.
.if ${MACHINE_ARCH} == "sh3eb" || ${MACHINE_ARCH} == "sh3el"
NOLINT=1
NOPROFILE=1
OBJECT_FMT?=COFF
NOPIC?=1
.endif
# The sparc64 port is incomplete.
# Profiling and linting is also off on the x86_64 port at the moment.
.if ${MACHINE_ARCH} == "sparc64" || ${MACHINE_ARCH} == "x86_64"
NOPROFILE=1
NOLINT=1
.endif
# The m68000 port is incomplete.
.if ${MACHINE_ARCH} == "m68000"
NOLINT=1
NOPROFILE=1
NOPIC?=1
.endif
# Data-driven table using make variables to control how
# toolchain-dependent targets and shared libraries are built
# for different platforms and object formats.
# OBJECT_FMT: currently either "ELF" or "a.out".
# SHLIB_TYPE: "ELF" or "a.out" or "" to force static libraries.
#
OBJECT_FMT?=a.out
.if ${CC:M*gcc*} != ""
.if ${MACHINE_ARCH} == "x86_64"
CFLAGS+=-Wno-format -fno-builtin
.endif
.endif
# Location of the file that contains the major and minor numbers of the
# version of a shared library. If this file exists a shared library
# will be built by <bsd.lib.mk>.
SHLIB_VERSION_FILE?= ${.CURDIR}/shlib_version
# GNU sources and packages sometimes see architecture names differently.
# This table maps an architecture name to its GNU counterpart.
# Use as so: ${GNU_ARCH.${TARGET_ARCH}} or ${MACHINE_GNU_ARCH}
.ifndef MACHINE_GNU_ARCH
GNU_ARCH.alpha=alpha
GNU_ARCH.arm26=arm
GNU_ARCH.arm32=arm
GNU_ARCH.arm=arm
GNU_ARCH.i386=i386
GNU_ARCH.m68k=m68k
GNU_ARCH.mipseb=mipseb
GNU_ARCH.mipsel=mipsel
GNU_ARCH.ns32k=ns32k
GNU_ARCH.powerpc=powerpc
GNU_ARCH.sh3eb=sh
GNU_ARCH.sh3el=sh
GNU_ARCH.sparc=sparc
GNU_ARCH.sparc64=sparc64
GNU_ARCH.vax=vax
MACHINE_GNU_ARCH=${GNU_ARCH.${MACHINE_ARCH}}
.endif
# CPU model, derived from MACHINE_ARCH
MACHINE_CPU= ${MACHINE_ARCH:C/mipse[bl]/mips/:S/arm26/arm/:S/arm32/arm/:C/sh3e[bl]/sh3/:S/m68000/m68k/}
TARGETS+= all clean cleandir depend dependall includes \
install lint obj regress tags html installhtml cleanhtml
.PHONY: all clean cleandir depend dependall distclean includes \
install lint obj regress tags beforedepend afterdepend \
beforeinstall afterinstall realinstall realdepend realall \
html installhtml cheanhtml
# set NEED_OWN_INSTALL_TARGET, if it's not already set, to yes
# this is used by bsd.pkg.mk to stop "install" being defined
NEED_OWN_INSTALL_TARGET?= yes
.if ${NEED_OWN_INSTALL_TARGET} == "yes"
.if !target(install)
install: .NOTMAIN beforeinstall subdir-install realinstall afterinstall
beforeinstall: .NOTMAIN
subdir-install: .NOTMAIN beforeinstall
realinstall: .NOTMAIN beforeinstall
afterinstall: .NOTMAIN subdir-install realinstall
.endif
all: .NOTMAIN realall subdir-all
subdir-all: .NOTMAIN
realall: .NOTMAIN
depend: .NOTMAIN realdepend subdir-depend
subdir-depend: .NOTMAIN
realdepend: .NOTMAIN
distclean: .NOTMAIN cleandir
.endif
PRINTOBJDIR= printf "xxx: .MAKE\n\t@echo \$${.OBJDIR}\n" | ${MAKE} -B -s -f-
# Define MKxxx variables (which are either yes or no) for users
# to set in /etc/mk.conf and override on the make commandline.
# These should be tested with `== "no"' or `!= "no"'.
# The NOxxx variables should only be used by Makefiles.
#
MKCATPAGES?=yes
.if defined(NODOC)
MKDOC=no
#.elif !defined(MKDOC)
#MKDOC=yes
.else
MKDOC?=yes
.endif
MKINFO?=yes
.if defined(NOLINKLIB)
MKLINKLIB=no
.else
MKLINKLIB?=yes
.endif
.if ${MKLINKLIB} == "no"
MKPICINSTALL=no
MKPROFILE=no
.endif
MKLINT?=no
.if defined(NOMAN)
MKMAN=no
.else
MKMAN?=yes
.endif
.if ${MKMAN} == "no"
MKCATPAGES=no
.endif
.if defined(NONLS)
MKNLS=no
.else
MKNLS?=yes
.endif
#
# MKOBJDIRS controls whether object dirs are created during "make build".
# MKOBJ controls whether the "make obj" rule does anything.
#
.if defined(NOOBJ)
MKOBJ=no
MKOBJDIRS=no
.else
MKOBJ?=yes
MKOBJDIRS?=no
.endif
.if defined(NOPIC)
MKPIC=no
.else
MKPIC?=yes
.endif
.if defined(NOPICINSTALL)
MKPICINSTALL=no
.else
MKPICINSTALL?=yes
.endif
.if defined(NOPROFILE)
MKPROFILE=no
.else
MKPROFILE?=yes
.endif
.if defined(NOSHARE)
MKSHARE=no
.else
MKSHARE?=yes
.endif
.if ${MKSHARE} == "no"
MKCATPAGES=no
MKDOC=no
MKINFO=no
MKMAN=no
MKNLS=no
.endif
.if defined(NOCRYPTO)
MKCRYPTO=no
.else
MKCRYPTO?=yes
.endif
MKCRYPTO_IDEA?=no
MKCRYPTO_RC5?=no
.if defined(NOKERBEROS) || (${MKCRYPTO} == "no")
MKKERBEROS=no
.else
MKKERBEROS?=yes
.endif
MKSOFTFLOAT?=no
.endif # _BSD_OWN_MK_

View File

@@ -0,0 +1,198 @@
# $NetBSD: Minix.sys.mk,v 1.1 2011/11/06 21:01:30 tcort Exp $
# @(#)sys.mk 8.2 (Berkeley) 3/21/94
unix?= We run Unix.
OS?= Minix
# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25509
.if !defined(NOGCCERROR)
CFLAGS+= -Wno-error
.endif
.SUFFIXES: .out .a .ln .o .s .S .c .cc .cpp .cxx .C .F .f .r .y .l .cl .p .h
.SUFFIXES: .sh .m4
.LIBS: .a
AR?= ar
ARFLAGS?= rl
RANLIB?= ranlib
AS?= gas
AFLAGS?=
COMPILE.s?= ${CC} ${AFLAGS} -c
LINK.s?= ${CC} ${AFLAGS} ${LDFLAGS}
COMPILE.S?= ${CC} ${AFLAGS} ${CPPFLAGS} -c -traditional-cpp
LINK.S?= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
CC?= gcc
DBG?=
CFLAGS?= ${DBG}
COMPILE.c?= ${CC} ${CFLAGS} ${CPPFLAGS} -c
LINK.c?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
CXX?= g++
CXXFLAGS?= ${CFLAGS}
COMPILE.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
LINK.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
OBJC?= ${CC}
OBJCFLAGS?= ${CFLAGS}
COMPILE.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c
LINK.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} ${LDFLAGS}
CPP?= cpp
NOLINT= 1
CPPFLAGS?=
FC?= f77
FFLAGS?= -O
RFLAGS?=
COMPILE.f?= ${FC} ${FFLAGS} -c
LINK.f?= ${FC} ${FFLAGS} ${LDFLAGS}
COMPILE.F?= ${FC} ${FFLAGS} ${CPPFLAGS} -c
LINK.F?= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
COMPILE.r?= ${FC} ${FFLAGS} ${RFLAGS} -c
LINK.r?= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
INSTALL?= install
LEX?= lex
LFLAGS?=
LEX.l?= ${LEX} ${LFLAGS}
LD?= ld
LDFLAGS?=
LINT?= lint
LINTFLAGS?= -chapbxzF
LORDER?= echo
MAKE?= make
NM?= nm
PC?= pc
PFLAGS?=
COMPILE.p?= ${PC} ${PFLAGS} ${CPPFLAGS} -c
LINK.p?= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
SHELL?= sh
SIZE?= size
TSORT?= tsort
YACC?= yacc
YFLAGS?=
YACC.y?= ${YACC} ${YFLAGS}
# C
.c:
${LINK.c} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.c.o:
${COMPILE.c} ${.IMPSRC}
.c.a:
${COMPILE.c} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.c.ln:
${LINT} ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i ${.IMPSRC}
# C++
.cc .cpp .cxx .C:
${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.cc.o .cpp.o .cxx.o .C.o:
${COMPILE.cc} ${.IMPSRC}
.cc.a .cpp.a .cxx.a .C.a:
${COMPILE.cc} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Fortran/Ratfor
.f:
${LINK.f} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.f.o:
${COMPILE.f} ${.IMPSRC}
.f.a:
${COMPILE.f} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.F:
${LINK.F} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.F.o:
${COMPILE.F} ${.IMPSRC}
.F.a:
${COMPILE.F} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.r:
${LINK.r} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.r.o:
${COMPILE.r} ${.IMPSRC}
.r.a:
${COMPILE.r} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Pascal
.p:
${LINK.p} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.p.o:
${COMPILE.p} ${.IMPSRC}
.p.a:
${COMPILE.p} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Assembly
.s:
${LINK.s} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.s.o:
${COMPILE.s} ${.IMPSRC}
.s.a:
${COMPILE.s} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.S:
${LINK.S} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.S.o:
${COMPILE.S} ${.IMPSRC}
.S.a:
${COMPILE.S} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Lex
.l:
${LEX.l} ${.IMPSRC}
${LINK.c} -o ${.TARGET} lex.yy.c ${LDLIBS} -ll
rm -f lex.yy.c
.l.c:
${LEX.l} ${.IMPSRC}
mv lex.yy.c ${.TARGET}
.l.o:
${LEX.l} ${.IMPSRC}
${COMPILE.c} -o ${.TARGET} lex.yy.c
rm -f lex.yy.c
# Yacc
.y:
${YACC.y} ${.IMPSRC}
${LINK.c} -o ${.TARGET} y.tab.c ${LDLIBS}
rm -f y.tab.c
.y.c:
${YACC.y} ${.IMPSRC}
mv y.tab.c ${.TARGET}
.y.o:
${YACC.y} ${.IMPSRC}
${COMPILE.c} -o ${.TARGET} y.tab.c
rm -f y.tab.c
# Shell
.sh:
rm -f ${.TARGET}
cp ${.IMPSRC} ${.TARGET}

View File

@@ -0,0 +1,213 @@
# $NetBSD: MirBSD.sys.mk,v 1.1 2011/01/23 19:07:26 agc Exp $
# $MirOS: src/share/mk/sys.mk,v 1.103 2007/04/28 00:12:46 tg Exp $
# @(#)sys.mk 5.11 (Berkeley) 3/13/91
unix?= We run MirOS BSD.
.SUFFIXES: .out .a .ln .o .s .S .c .m .cc .cxx .cpp .C .F .f .r .y .l .cl .p .i .h .sh .m4
.LIBS: .a
AR?= ar
ARFLAGS?= rl
RANLIB?= ranlib
NM?= nm
LORDER?= lorder
AS?= as
CC?= mgcc
HOST_CC?= mgcc
CPP?= ${CC} -E
CPPFLAGS?=
AFLAGS?= ${DEBUG}
COMPILE.s?= ${CC} -D_ASM_SOURCE ${AFLAGS} -c
LINK.s?= ${CC} -D_ASM_SOURCE ${AFLAGS} ${LDFLAGS}
COMPILE.S?= ${CC} -D_ASM_SOURCE ${AFLAGS} ${CPPFLAGS} -c -traditional-cpp
LINK.S?= ${CC} -D_ASM_SOURCE ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
DBG?= -O2 -pipe
CFLAGS?= ${DBG} ${DEBUG}
COMPILE.c?= ${CC} ${CFLAGS:M*} ${CPPFLAGS} -c
LINK.c?= ${CC} ${CFLAGS:M*} ${CPPFLAGS} ${LDFLAGS}
CXX?= c++
CXXFLAGS?= ${CFLAGS}
COMPILE.cc?= ${CXX} ${CXXFLAGS:M*} ${CPPFLAGS} -c
LINK.cc?= ${CXX} ${CXXFLAGS:M*} ${CPPFLAGS} ${LDFLAGS}
OBJC?= ${CC}
OBJCFLAGS?= ${CFLAGS}
COMPILE.m?= ${CC} ${OBJCFLAGS:M*} ${CPPFLAGS} -c
LINK.m?= ${CC} ${OBJCFLAGS:M*} ${CPPFLAGS} ${LDFLAGS}
FC?= f77
FFLAGS?= -O
RFLAGS?=
COMPILE.f?= ${FC} ${FFLAGS} -c
LINK.f?= ${FC} ${FFLAGS} ${LDFLAGS}
COMPILE.F?= ${FC} ${FFLAGS} ${CPPFLAGS} -c
LINK.F?= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
COMPILE.r?= ${FC} ${FFLAGS} ${RFLAGS} -c
LINK.r?= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
LEX?= lex
LFLAGS?=
LEX.l?= ${LEX} ${LFLAGS}
LD?= ld
LDFLAGS+= ${DEBUG}
LINT?= lint
LINTFLAGS?= -chapbxzF
MAKE?= make
PC?= pc
PFLAGS?=
COMPILE.p?= ${PC} ${PFLAGS} ${CPPFLAGS} -c
LINK.p?= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
SHELL?= /bin/mksh
SIZE?= size
TSORT?= tsort -q
YACC?= yacc
YFLAGS?=
YACC.y?= ${YACC} ${YFLAGS}
INSTALL?= install
CTAGS?= /usr/bin/ctags
# C
.c:
${LINK.c} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.c.o:
${COMPILE.c} ${CFLAGS_${.TARGET}:M*} ${.IMPSRC}
.c.i:
${COMPILE.c} ${CFLAGS_${.TARGET}:M*} -o ${.TARGET} -E ${.IMPSRC}
.c.a:
${COMPILE.c} ${CFLAGS_${.TARGET:S/.a$/.o/}:M*} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.c.ln:
${LINT} ${LINTFLAGS} ${CFLAGS:M-[IDU]*} ${CPPFLAGS:M-[IDU]*} \
-i ${.IMPSRC}
# Objective-C
.m:
${LINK.m} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.m.o:
${COMPILE.m} ${OBJCFLAGS_${.TARGET}:M*} ${.IMPSRC}
.m.i:
${COMPILE.m} ${OBJCFLAGS_${.TARGET}:M*} -o ${.TARGET} -E ${.IMPSRC}
.m.a:
${COMPILE.m} ${OBJCFLAGS_${.TARGET:S/.a$/.o/}:M*} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.m.ln:
${LINT} ${LINTFLAGS} ${OBJCFLAGS:M-[IDU]*} ${CPPFLAGS:M-[IDU]*} \
-i ${.IMPSRC}
# C++
.cc .cxx .cpp .C:
${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.cc.o .cxx.o .cpp.o .C.o:
${COMPILE.cc} ${CXXFLAGS_${.TARGET}:M*} ${.IMPSRC}
.cc.i .cxx.i .cpp.i .C.i:
${COMPILE.cc} ${CXXFLAGS_${.TARGET}:M*} -o ${.TARGET} -E ${.IMPSRC}
.cc.a .cxx.a .cpp.a .C.a:
${COMPILE.cc} ${CXXFLAGS_${.TARGET:S/.a$/.o/}:M*} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Fortran/Ratfor
.f:
${LINK.f} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.f.o:
${COMPILE.f} ${.IMPSRC}
.f.a:
${COMPILE.f} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.F:
${LINK.F} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.F.o:
${COMPILE.F} ${.IMPSRC}
.F.a:
${COMPILE.F} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.r:
${LINK.r} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.r.o:
${COMPILE.r} ${.IMPSRC}
.r.a:
${COMPILE.r} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Pascal
.p:
${LINK.p} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.p.o:
${COMPILE.p} ${.IMPSRC}
.p.a:
${COMPILE.p} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Assembly
.s:
${LINK.s} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.s.o:
${COMPILE.s} ${AFLAGS_${.TARGET}:M*} ${.IMPSRC}
.s.a:
${COMPILE.s} ${AFLAGS_${.TARGET:S/.a$/.o/}:M*} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.S:
${LINK.S} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.S.o:
${COMPILE.S} ${AFLAGS_${.TARGET}:M*} ${.IMPSRC}
.S.i:
${COMPILE.S} ${AFLAGS_${.TARGET}:M*} -o ${.TARGET} -E ${.IMPSRC}
.S.a:
${COMPILE.S} ${AFLAGS_${.TARGET:S/.a$/.o/}:M*} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Lex
.l:
${LEX.l} -o${.TARGET:R}.yy.c ${.IMPSRC}
${LINK.c} -o ${.TARGET} ${.TARGET:R}.yy.c ${LDLIBS} -ll
rm -f ${.TARGET:R}.yy.c
.l.c:
${LEX.l} -o${.TARGET} ${.IMPSRC}
.l.o:
${LEX.l} -o${.TARGET:R}.yy.c ${.IMPSRC}
${COMPILE.c} ${CFLAGS_${.TARGET}:M*} -o ${.TARGET} ${.TARGET:R}.yy.c
rm -f ${.TARGET:R}.yy.c
# Yacc
.y:
${YACC.y} -o ${.TARGET:R}.tab.c ${.IMPSRC}
${LINK.c} -o ${.TARGET} ${.TARGET:R}.tab.c ${LDLIBS}
rm -f ${.TARGET:R}.tab.c
.y.c:
${YACC.y} -o ${.TARGET} ${.IMPSRC}
.y.o:
${YACC.y} -o ${.TARGET:R}.tab.c ${.IMPSRC}
${COMPILE.c} ${CFLAGS_${.TARGET}:M*} -o ${.TARGET} ${.TARGET:R}.tab.c
rm -f ${.TARGET:R}.tab.c
# Shell
.sh:
rm -f ${.TARGET}
cp ${.IMPSRC} ${.TARGET}

View File

@@ -0,0 +1,206 @@
# $NetBSD: NetBSD.bsd.man.mk,v 1.1.1.1 2006/07/14 23:13:01 jlam Exp $
# @(#)bsd.man.mk 8.1 (Berkeley) 6/8/93
.if !target(__initialized__)
__initialized__:
.if exists(${.CURDIR}/../Makefile.inc)
.include "${.CURDIR}/../Makefile.inc"
.endif
.include <bsd.own.mk>
.include <bsd.obj.mk>
.include <bsd.depall.mk>
.MAIN: all
.endif
.PHONY: catinstall maninstall catpages manpages catlinks manlinks cleanman html installhtml cleanhtml
.if ${MKMAN} != "no"
realinstall: ${MANINSTALL}
.endif
cleandir: cleanman
TMACDIR?= ${DESTDIR}/usr/share/tmac
HTMLDIR?= ${DESTDIR}/usr/share/man
# tmac.andoc and tmac.doc were renamed in the update to groff-1.19 in
# NetBSD-current 20030630.
.if exists(${TMACDIR}/tmac.andoc)
CATDEPS?= ${TMACDIR}/tmac.andoc ${TMACDIR}/tmac.doc
.elif exists(${TMACDIR}/andoc.tmac)
CATDEPS?= ${TMACDIR}/andoc.tmac ${TMACDIR}/doc.tmac
.endif
MANTARGET?= cat
NROFF?= nroff -Tascii
GROFF?= groff -Tascii
TBL?= tbl
.SUFFIXES: .1 .2 .3 .4 .5 .6 .7 .8 .9 \
.cat1 .cat2 .cat3 .cat4 .cat5 .cat6 .cat7 .cat8 .cat9 \
.html1 .html2 .html3 .html4 .html5 .html6 .html7 .html8 .html9
.9.cat9 .8.cat8 .7.cat7 .6.cat6 .5.cat5 .4.cat4 .3.cat3 .2.cat2 .1.cat1: \
${CATDEPS}
.if !defined(USETBL)
@echo "${NROFF} -mandoc ${.IMPSRC} > ${.TARGET}"
@${NROFF} -mandoc ${.IMPSRC} > ${.TARGET} || \
(rm -f ${.TARGET}; false)
.else
@echo "${TBL} ${.IMPSRC} | ${NROFF} -mandoc > ${.TARGET}"
@${TBL} ${.IMPSRC} | ${NROFF} -mandoc > ${.TARGET} || \
(rm -f ${.TARGET}; false)
.endif
.9.html9 .8.html8 .7.html7 .6.html6 .5.html5 .4.html4 .3.html3 .2.html2 .1.html1: \
${CATDEPS}
.if !defined(USETBL)
@echo "${GROFF} -mdoc2html -P-b -P-u -P-o ${.IMPSRC} > ${.TARGET}"
@${GROFF} -mdoc2html -P-b -P-u -P-o ${.IMPSRC} > ${.TARGET} || \
(rm -f ${.TARGET}; false)
.else
@echo "${TBL} ${.IMPSRC} | ${GROFF} -mdoc2html -P-b -P-u -P-o > ${.TARGET}"
@cat ${.IMPSRC} | ${GROFF} -mdoc2html -P-b -P-u -P-o > ${.TARGET} || \
(rm -f ${.TARGET}; false)
.endif
.if defined(MAN) && !empty(MAN)
MANPAGES= ${MAN}
CATPAGES= ${MANPAGES:C/(.*).([1-9])/\1.cat\2/}
.NOPATH: ${CATPAGES}
.if !defined(NOHTML)
HTMLPAGES= ${MANPAGES:C/(.*).([1-9])/\1.html\2/}
.endif
.endif
MINSTALL= ${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} \
-o ${MANOWN} -g ${MANGRP} -m ${MANMODE}
.if defined(MANZ)
# chown and chmod are done afterward automatically
MCOMPRESS= gzip -cf
MCOMPRESSSUFFIX= .gz
.endif
catinstall: catlinks
maninstall: manlinks
__installpage: .USE
.if defined(MCOMPRESS) && !empty(MCOMPRESS)
@rm -f ${.TARGET}
${MCOMPRESS} ${.ALLSRC} > ${.TARGET}
@chown ${MANOWN}:${MANGRP} ${.TARGET}
@chmod ${MANMODE} ${.TARGET}
.else
@cmp -s ${.ALLSRC} ${.TARGET} > /dev/null 2>&1 || \
(echo "${MINSTALL} ${.ALLSRC} ${.TARGET}" && \
${MINSTALL} ${.ALLSRC} ${.TARGET})
.endif
# Rules for cat'ed man page installation
.if defined(CATPAGES) && !empty(CATPAGES) && ${MKCATPAGES} != "no"
catpages:: ${CATPAGES:@P@${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}@}
.PRECIOUS: ${CATPAGES:@P@${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}@}
.if !defined(UPDATE)
.PHONY: ${CATPAGES:@P@${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}@}
.endif
. for P in ${CATPAGES:O:u}
. if !defined(BUILD) && !make(all) && !make(${P})
${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}: .MADE
. endif
${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}: ${P} __installpage
. endfor
.else
catpages::
.endif
# Rules for source page installation
.if defined(MANPAGES) && !empty(MANPAGES)
manpages:: ${MANPAGES:@P@${DESTDIR}${MANDIR}/man${P:T:E}${MANSUBDIR}/${P}${MCOMPRESSSUFFIX}@}
.PRECIOUS: ${MANPAGES:@P@${DESTDIR}${MANDIR}/man${P:T:E}${MANSUBDIR}/${P}${MCOMPRESSSUFFIX}@}
.if !defined(UPDATE)
.PHONY: ${MANPAGES:@P@${DESTDIR}${MANDIR}/man${P:T:E}${MANSUBDIR}/${P}${MCOMPRESSSUFFIX}@}
.endif
. for P in ${MANPAGES:O:u}
${DESTDIR}${MANDIR}/man${P:T:E}${MANSUBDIR}/${P}${MCOMPRESSSUFFIX}: ${P} __installpage
. endfor
.else
manpages::
.endif
.if ${MKCATPAGES} != "no"
catlinks: catpages
.if defined(MLINKS) && !empty(MLINKS)
@set ${MLINKS}; \
while test $$# -ge 2; do \
name=$$1; \
shift; \
dir=${DESTDIR}${MANDIR}/cat$${name##*.}; \
l=$${dir}${MANSUBDIR}/$${name%.*}.0${MCOMPRESSSUFFIX}; \
name=$$1; \
shift; \
dir=${DESTDIR}${MANDIR}/cat$${name##*.}; \
t=$${dir}${MANSUBDIR}/$${name%.*}.0${MCOMPRESSSUFFIX}; \
if test $$l -nt $$t -o ! -f $$t; then \
echo $$t -\> $$l; \
ln -f $$l $$t; \
fi; \
done
.endif
.else
catlinks:
.endif
manlinks: manpages
.if defined(MLINKS) && !empty(MLINKS)
@set ${MLINKS}; \
while test $$# -ge 2; do \
name=$$1; \
shift; \
dir=${DESTDIR}${MANDIR}/man$${name##*.}; \
l=$${dir}${MANSUBDIR}/$${name}${MCOMPRESSSUFFIX}; \
name=$$1; \
shift; \
dir=${DESTDIR}${MANDIR}/man$${name##*.}; \
t=$${dir}${MANSUBDIR}/$${name}${MCOMPRESSSUFFIX}; \
if test $$l -nt $$t -o ! -f $$t; then \
echo $$t -\> $$l; \
ln -f $$l $$t; \
fi; \
done
.endif
# Html rules
html: ${HTMLPAGES}
.if defined(HTMLPAGES) && !empty(HTMLPAGES)
.for P in ${HTMLPAGES:O:u}
${HTMLDIR}/${P:T:E}/${P:T:R}.html: ${P}
${MINSTALL} ${.ALLSRC} ${.TARGET}
.endfor
.endif
installhtml: ${HTMLPAGES:@P@${HTMLDIR}/${P:T:E}/${P:T:R}.html@}
cleanhtml:
.if defined(HTMLPAGES) && !empty(HTMLPAGES)
rm -f ${HTMLPAGES}
.endif
.if defined(CATPAGES)
.if ${MKCATPAGES} != "no" && ${MKMAN} != "no"
realall: ${CATPAGES}
.else
realall:
.endif
cleanman:
rm -f ${CATPAGES}
.else
cleanman:
.endif
# Make sure all of the standard targets are defined, even if they do nothing.
clean depend includes lint regress tags:

View File

@@ -0,0 +1,207 @@
# $NetBSD: NetBSD.sys.mk,v 1.1.1.1 2006/07/14 23:13:01 jlam Exp $
# @(#)sys.mk 8.2 (Berkeley) 3/21/94
unix?= We run NetBSD.
.SUFFIXES: .out .a .ln .o .s .S .c .cc .cpp .cxx .C .F .f .r .y .l .cl .p .h
.SUFFIXES: .sh .m4
.LIBS: .a
AR?= ar
ARFLAGS?= rl
RANLIB?= ranlib
AS?= as
AFLAGS?=
.if ${MACHINE_ARCH} == "sparc64"
AFLAGS+= -Wa,-Av9a
.endif
COMPILE.s?= ${CC} ${AFLAGS} -c
LINK.s?= ${CC} ${AFLAGS} ${LDFLAGS}
COMPILE.S?= ${CC} ${AFLAGS} ${CPPFLAGS} -c -traditional-cpp
LINK.S?= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
CC?= cc
.if ${MACHINE_ARCH} == "alpha" || \
${MACHINE_ARCH} == "arm" || ${MACHINE_ARCH} == "arm26" || \
${MACHINE_ARCH} == "arm32" || \
${MACHINE_ARCH} == "i386" || \
${MACHINE_ARCH} == "m68k" || \
${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb" || \
${MACHINE_ARCH} == "sparc" || \
${MACHINE_ARCH} == "vax"
DBG?= -O2
.elif ${MACHINE_ARCH} == "x86_64"
DBG?=
.else
DBG?= -O
.endif
CFLAGS?= ${DBG}
COMPILE.c?= ${CC} ${CFLAGS} ${CPPFLAGS} -c
LINK.c?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
CXX?= c++
CXXFLAGS?= ${CFLAGS}
COMPILE.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
LINK.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
OBJC?= ${CC}
OBJCFLAGS?= ${CFLAGS}
COMPILE.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c
LINK.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} ${LDFLAGS}
CPP?= cpp
CPPFLAGS?=
FC?= f77
FFLAGS?= -O
RFLAGS?=
COMPILE.f?= ${FC} ${FFLAGS} -c
LINK.f?= ${FC} ${FFLAGS} ${LDFLAGS}
COMPILE.F?= ${FC} ${FFLAGS} ${CPPFLAGS} -c
LINK.F?= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
COMPILE.r?= ${FC} ${FFLAGS} ${RFLAGS} -c
LINK.r?= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
INSTALL?= install
LEX?= lex
LFLAGS?=
LEX.l?= ${LEX} ${LFLAGS}
LD?= ld
LDFLAGS?=
LINT?= lint
LINTFLAGS?= -chapbxzF
LORDER?= lorder
MAKE?= make
NM?= nm
PC?= pc
PFLAGS?=
COMPILE.p?= ${PC} ${PFLAGS} ${CPPFLAGS} -c
LINK.p?= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
SHELL?= sh
SIZE?= size
TSORT?= tsort -q
YACC?= yacc
YFLAGS?=
YACC.y?= ${YACC} ${YFLAGS}
# C
.c:
${LINK.c} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.c.o:
${COMPILE.c} ${.IMPSRC}
.c.a:
${COMPILE.c} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.c.ln:
${LINT} ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i ${.IMPSRC}
# C++
.cc .cpp .cxx .C:
${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.cc.o .cpp.o .cxx.o .C.o:
${COMPILE.cc} ${.IMPSRC}
.cc.a .cpp.a .cxx.a .C.a:
${COMPILE.cc} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Fortran/Ratfor
.f:
${LINK.f} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.f.o:
${COMPILE.f} ${.IMPSRC}
.f.a:
${COMPILE.f} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.F:
${LINK.F} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.F.o:
${COMPILE.F} ${.IMPSRC}
.F.a:
${COMPILE.F} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.r:
${LINK.r} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.r.o:
${COMPILE.r} ${.IMPSRC}
.r.a:
${COMPILE.r} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Pascal
.p:
${LINK.p} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.p.o:
${COMPILE.p} ${.IMPSRC}
.p.a:
${COMPILE.p} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Assembly
.s:
${LINK.s} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.s.o:
${COMPILE.s} ${.IMPSRC}
.s.a:
${COMPILE.s} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.S:
${LINK.S} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.S.o:
${COMPILE.S} ${.IMPSRC}
.S.a:
${COMPILE.S} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Lex
.l:
${LEX.l} ${.IMPSRC}
${LINK.c} -o ${.TARGET} lex.yy.c ${LDLIBS} -ll
rm -f lex.yy.c
.l.c:
${LEX.l} ${.IMPSRC}
mv lex.yy.c ${.TARGET}
.l.o:
${LEX.l} ${.IMPSRC}
${COMPILE.c} -o ${.TARGET} lex.yy.c
rm -f lex.yy.c
# Yacc
.y:
${YACC.y} ${.IMPSRC}
${LINK.c} -o ${.TARGET} y.tab.c ${LDLIBS}
rm -f y.tab.c
.y.c:
${YACC.y} ${.IMPSRC}
mv y.tab.c ${.TARGET}
.y.o:
${YACC.y} ${.IMPSRC}
${COMPILE.c} -o ${.TARGET} y.tab.c
rm -f y.tab.c
# Shell
.sh:
rm -f ${.TARGET}
cp ${.IMPSRC} ${.TARGET}

View File

@@ -0,0 +1,193 @@
# $NetBSD: OSF1.sys.mk,v 1.2 2008/01/16 03:05:57 tnn Exp $
# @(#)sys.mk 8.2 (Berkeley) 3/21/94
unix?= We run Unix
OS!= uname -s
.SUFFIXES: .out .a .ln .o .s .S .c .cc .cpp .cxx .C .F .f .r .y .l .cl .p .h
.SUFFIXES: .sh .m4
.LIBS: .a
AR?= ar
ARFLAGS?= rl
RANLIB?= ranlib
AS?= as
AFLAGS?=
COMPILE.s?= ${CC} ${AFLAGS} -c
LINK.s?= ${CC} ${AFLAGS} ${LDFLAGS}
COMPILE.S?= ${CC} ${AFLAGS} ${CPPFLAGS} -c -traditional-cpp
LINK.S?= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
CC?= cc
NOGCCERROR?= # defined
DBG?= -O2
CFLAGS?= ${DBG}
COMPILE.c?= ${CC} ${CFLAGS} ${CPPFLAGS} -c
LINK.c?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
CXX?= cxx
CXXFLAGS?= ${CFLAGS}
COMPILE.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
LINK.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
OBJC?= ${CC}
OBJCFLAGS?= ${CFLAGS}
COMPILE.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c
LINK.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} ${LDFLAGS}
CPP?= ${CC} -E
CPPFLAGS?=
FC?= f77
FFLAGS?= -O
RFLAGS?=
COMPILE.f?= ${FC} ${FFLAGS} -c
LINK.f?= ${FC} ${FFLAGS} ${LDFLAGS}
COMPILE.F?= ${FC} ${FFLAGS} ${CPPFLAGS} -c
LINK.F?= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
COMPILE.r?= ${FC} ${FFLAGS} ${RFLAGS} -c
LINK.r?= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
INSTALL?= ${PREFIX}/bin/install-sh
LEX?= lex
LFLAGS?=
LEX.l?= ${LEX} ${LFLAGS}
LD?= ld
LDFLAGS?=
LINT?= lint
LINTFLAGS?= -chapbxzF
LORDER?= lorder
MAKE?= make
NM?= nm
PC?= pc
PFLAGS?=
COMPILE.p?= ${PC} ${PFLAGS} ${CPPFLAGS} -c
LINK.p?= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
SHELL?= sh
SIZE?= size
TSORT?= tsort
YACC?= yacc
YFLAGS?=
YACC.y?= ${YACC} ${YFLAGS}
# C
.c:
${LINK.c} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.c.o:
${COMPILE.c} ${.IMPSRC}
.c.a:
${COMPILE.c} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.c.ln:
${LINT} ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i ${.IMPSRC}
# C++
.cc .cpp .cxx .C:
${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.cc.o .cpp.o .cxx.o .C.o:
${COMPILE.cc} ${.IMPSRC}
.cc.a .cpp.a .cxx.a .C.a:
${COMPILE.cc} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Fortran/Ratfor
.f:
${LINK.f} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.f.o:
${COMPILE.f} ${.IMPSRC}
.f.a:
${COMPILE.f} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.F:
${LINK.F} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.F.o:
${COMPILE.F} ${.IMPSRC}
.F.a:
${COMPILE.F} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.r:
${LINK.r} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.r.o:
${COMPILE.r} ${.IMPSRC}
.r.a:
${COMPILE.r} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Pascal
.p:
${LINK.p} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.p.o:
${COMPILE.p} ${.IMPSRC}
.p.a:
${COMPILE.p} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Assembly
.s:
${LINK.s} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.s.o:
${COMPILE.s} ${.IMPSRC}
.s.a:
${COMPILE.s} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.S:
${LINK.S} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.S.o:
${COMPILE.S} ${.IMPSRC}
.S.a:
${COMPILE.S} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Lex
.l:
${LEX.l} ${.IMPSRC}
${LINK.c} -o ${.TARGET} lex.yy.c ${LDLIBS} -ll
rm -f lex.yy.c
.l.c:
${LEX.l} ${.IMPSRC}
mv lex.yy.c ${.TARGET}
.l.o:
${LEX.l} ${.IMPSRC}
${COMPILE.c} -o ${.TARGET} lex.yy.c
rm -f lex.yy.c
# Yacc
.y:
${YACC.y} ${.IMPSRC}
${LINK.c} -o ${.TARGET} y.tab.c ${LDLIBS}
rm -f y.tab.c
.y.c:
${YACC.y} ${.IMPSRC}
mv y.tab.c ${.TARGET}
.y.o:
${YACC.y} ${.IMPSRC}
${COMPILE.c} -o ${.TARGET} y.tab.c
rm -f y.tab.c
# Shell
.sh:
rm -f ${.TARGET}
cp ${.IMPSRC} ${.TARGET}

View File

@@ -0,0 +1,181 @@
# $NetBSD: OpenBSD.bsd.man.mk,v 1.2 2012/04/15 13:03:11 obache Exp $
# @(#)bsd.man.mk 8.1 (Berkeley) 6/8/93
.if !target(__initialized__)
__initialized__:
.if exists(${.CURDIR}/../Makefile.inc)
.include "${.CURDIR}/../Makefile.inc"
.endif
.include <bsd.own.mk>
.include <bsd.obj.mk>
.include <bsd.depall.mk>
.MAIN: all
.endif
.PHONY: catinstall maninstall catpages manpages catlinks manlinks cleanman html installhtml cleanhtml
.if ${MKMAN} != "no"
realinstall: ${MANINSTALL}
.endif
cleandir: cleanman
HTMLDIR?= ${DESTDIR}/usr/share/man
MANTARGET?= cat
MANDOC?= mandoc -Tascii
.SUFFIXES: .1 .2 .3 .3p .4 .5 .6 .7 .8 .9 \
.cat1 .cat2 .cat3 .cat4 .cat5 .cat6 .cat7 .cat8 .cat9 \
.html1 .html2 .html3 .html4 .html5 .html6 .html7 .html8 .html9
.9.cat9 .8.cat8 .7.cat7 .6.cat6 .5.cat5 .4.cat4 3p.cat3p .3.cat3 .2.cat2 .1.cat1:
@echo "${MANDOC} ${.IMPSRC} > ${.TARGET}"
@${MANDOC} ${.IMPSRC} > ${.TARGET} || \
(rm -f ${.TARGET}; false)
.9.html9 .8.html8 .7.html7 .6.html6 .5.html5 .4.html4 .3p.html3p .3.html3 .2.html2 .1.html1:
@echo "${MANDOC} -Thtml ${.IMPSRC} > ${.TARGET}"
@${MANDOC} -Thtml ${.IMPSRC} > ${.TARGET} || \
(rm -f ${.TARGET}; false)
.if defined(MAN) && !empty(MAN)
MANPAGES= ${MAN}
CATPAGES= ${MANPAGES:C/(.*).([1-9]p?)/\1.cat\2/}
.NOPATH: ${CATPAGES}
.if !defined(NOHTML)
HTMLPAGES= ${MANPAGES:C/(.*).([1-9]p?)/\1.html\2/}
.endif
.endif
MINSTALL= ${INSTALL} ${RENAME} ${PRESERVE} ${COPY} ${INSTPRIV} \
-o ${MANOWN} -g ${MANGRP} -m ${MANMODE}
.if defined(MANZ)
# chown and chmod are done afterward automatically
MCOMPRESS= gzip -cf
MCOMPRESSSUFFIX= .gz
.endif
catinstall: catlinks
maninstall: manlinks
__installpage: .USE
.if defined(MCOMPRESS) && !empty(MCOMPRESS)
@rm -f ${.TARGET}
${MCOMPRESS} ${.ALLSRC} > ${.TARGET}
@chown ${MANOWN}:${MANGRP} ${.TARGET}
@chmod ${MANMODE} ${.TARGET}
.else
@cmp -s ${.ALLSRC} ${.TARGET} > /dev/null 2>&1 || \
(echo "${MINSTALL} ${.ALLSRC} ${.TARGET}" && \
${MINSTALL} ${.ALLSRC} ${.TARGET})
.endif
# Rules for cat'ed man page installation
.if defined(CATPAGES) && !empty(CATPAGES) && ${MKCATPAGES} != "no"
catpages:: ${CATPAGES:@P@${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}@}
.PRECIOUS: ${CATPAGES:@P@${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}@}
.if !defined(UPDATE)
.PHONY: ${CATPAGES:@P@${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}@}
.endif
. for P in ${CATPAGES:O:u}
. if !defined(BUILD) && !make(all) && !make(${P})
${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}: .MADE
. endif
${DESTDIR}${MANDIR}/${P:T:E}${MANSUBDIR}/${P:T:R}.0${MCOMPRESSSUFFIX}: ${P} __installpage
. endfor
.else
catpages::
.endif
# Rules for source page installation
.if defined(MANPAGES) && !empty(MANPAGES)
manpages:: ${MANPAGES:@P@${DESTDIR}${MANDIR}/man${P:T:E}${MANSUBDIR}/${P}${MCOMPRESSSUFFIX}@}
.PRECIOUS: ${MANPAGES:@P@${DESTDIR}${MANDIR}/man${P:T:E}${MANSUBDIR}/${P}${MCOMPRESSSUFFIX}@}
.if !defined(UPDATE)
.PHONY: ${MANPAGES:@P@${DESTDIR}${MANDIR}/man${P:T:E}${MANSUBDIR}/${P}${MCOMPRESSSUFFIX}@}
.endif
. for P in ${MANPAGES:O:u}
${DESTDIR}${MANDIR}/man${P:T:E}${MANSUBDIR}/${P}${MCOMPRESSSUFFIX}: ${P} __installpage
. endfor
.else
manpages::
.endif
.if ${MKCATPAGES} != "no"
catlinks: catpages
.if defined(MLINKS) && !empty(MLINKS)
@set ${MLINKS}; \
while test $$# -ge 2; do \
name=$$1; \
shift; \
dir=${DESTDIR}${MANDIR}/cat$${name##*.}; \
l=$${dir}${MANSUBDIR}/$${name%.*}.0${MCOMPRESSSUFFIX}; \
name=$$1; \
shift; \
dir=${DESTDIR}${MANDIR}/cat$${name##*.}; \
t=$${dir}${MANSUBDIR}/$${name%.*}.0${MCOMPRESSSUFFIX}; \
if test $$l -nt $$t -o ! -f $$t; then \
echo $$t -\> $$l; \
ln -f $$l $$t; \
fi; \
done
.endif
.else
catlinks:
.endif
manlinks: manpages
.if defined(MLINKS) && !empty(MLINKS)
@set ${MLINKS}; \
while test $$# -ge 2; do \
name=$$1; \
shift; \
dir=${DESTDIR}${MANDIR}/man$${name##*.}; \
l=$${dir}${MANSUBDIR}/$${name}${MCOMPRESSSUFFIX}; \
name=$$1; \
shift; \
dir=${DESTDIR}${MANDIR}/man$${name##*.}; \
t=$${dir}${MANSUBDIR}/$${name}${MCOMPRESSSUFFIX}; \
if test $$l -nt $$t -o ! -f $$t; then \
echo $$t -\> $$l; \
ln -f $$l $$t; \
fi; \
done
.endif
# PS rules
ps: ${PSPAGES}
.if defined(HTMLPAGES) && !empty(HTMLPAGES)
.for P in ${HTMLPAGES:O:u}
${HTMLDIR}/${P:T:E}/${P:T:R}.html: ${P}
${MINSTALL} ${.ALLSRC} ${.TARGET}
.endfor
.endif
installhtml: ${HTMLPAGES:@P@${HTMLDIR}/${P:T:E}/${P:T:R}.html@}
cleanhtml:
.if defined(HTMLPAGES) && !empty(HTMLPAGES)
rm -f ${HTMLPAGES}
.endif
.if defined(CATPAGES)
.if ${MKCATPAGES} != "no" && ${MKMAN} != "no"
realall: ${CATPAGES}
.else
realall:
.endif
cleanman:
rm -f ${CATPAGES}
.else
cleanman:
.endif
# Make sure all of the standard targets are defined, even if they do nothing.
clean depend includes lint regress tags:

View File

@@ -0,0 +1,296 @@
# $NetBSD: OpenBSD.bsd.own.mk.in,v 1.3 2008/11/15 13:06:42 schwarz Exp $
.if !defined(_BSD_OWN_MK_)
_BSD_OWN_MK_=1
# XXX On systems with a Berkeley-style make, perhaps we ought to check
# XXX for and source a file other than /etc/mk.conf
.if defined(MAKECONF) && exists(${MAKECONF})
.include "${MAKECONF}"
.elif exists(@SYSCONFDIR@/mk.conf)
.include "@SYSCONFDIR@/mk.conf"
.elif exists(/etc/mk.conf)
.include "/etc/mk.conf"
.endif
# Defining `SKEY' causes support for S/key authentication to be compiled in.
SKEY= yes
# where the system object and source trees are kept; can be configurable
# by the user in case they want them in ~/foosrc and ~/fooobj, for example
BSDSRCDIR?= /usr/src
BSDOBJDIR?= /usr/obj
BINGRP?= wheel
BINOWN?= root
BINMODE?= 555
NONBINMODE?= 444
# Define MANZ to have the man pages compressed (gzip)
#MANZ= 1
MANDIR?= /usr/share/man
MANGRP?= wheel
MANOWN?= root
MANMODE?= ${NONBINMODE}
MANINSTALL?= maninstall catinstall
INFODIR?= /usr/share/info
INFOGRP?= wheel
INFOOWN?= root
INFOMODE?= ${NONBINMODE}
LIBDIR?= /usr/lib
LINTLIBDIR?= /usr/libdata/lint
LIBGRP?= ${BINGRP}
LIBOWN?= ${BINOWN}
LIBMODE?= ${NONBINMODE}
DOCDIR?= /usr/share/doc
HTMLDOCDIR?= /usr/share/doc/html
DOCGRP?= wheel
DOCOWN?= root
DOCMODE?= ${NONBINMODE}
NLSDIR?= /usr/share/nls
NLSGRP?= wheel
NLSOWN?= root
NLSMODE?= ${NONBINMODE}
KMODDIR?= /usr/lkm
KMODGRP?= wheel
KMODOWN?= root
KMODMODE?= ${NONBINMODE}
LOCALEDIR?= /usr/share/locale
LOCALEGRP?= wheel
LOCALEOWN?= root
LOCALEMODE?= ${NONBINMODE}
COPY?= -c
.if defined(UPDATE)
PRESERVE?= -p
.else
PRESERVE?=
.endif
.if defined(UNPRIVILEGED)
INSTPRIV?= -U
.endif
STRIPFLAG?= -s
# Define SYS_INCLUDE to indicate whether you want symbolic links to the system
# source (``symlinks''), or a separate copy (``copies''); (latter useful
# in environments where it's not possible to keep /sys publicly readable)
#SYS_INCLUDE= symlinks
# Profiling and linting is also off on the x86_64 port at the moment.
.if ${MACHINE_ARCH} == "sparc64"
NOPROFILE=1
NOLINT=1
.endif
# The m68000 port is incomplete.
.if ${MACHINE_ARCH} == "m68000"
NOLINT=1
NOPROFILE=1
NOPIC?=1
.endif
# Data-driven table using make variables to control how
# toolchain-dependent targets and shared libraries are built
# for different platforms and object formats.
# OBJECT_FMT: currently either "ELF" or "a.out".
# SHLIB_TYPE: "ELF" or "a.out" or "" to force static libraries.
#
.if ${MACHINE_ARCH} == "alpha" || \
${MACHINE_ARCH} == "powerpc" || \
${MACHINE_ARCH} == "sparc" || \
( ${MACHINE_ARCH} == "i386" && ${OS_VERSION} >= 3.4 )
OBJECT_FMT?=ELF
.else
OBJECT_FMT?=a.out
.endif
# Location of the file that contains the major and minor numbers of the
# version of a shared library. If this file exists a shared library
# will be built by <bsd.lib.mk>.
SHLIB_VERSION_FILE?= ${.CURDIR}/shlib_version
# GNU sources and packages sometimes see architecture names differently.
# This table maps an architecture name to its GNU counterpart.
# Use as so: ${GNU_ARCH.${TARGET_ARCH}} or ${MACHINE_GNU_ARCH}
.ifndef MACHINE_GNU_ARCH
GNU_ARCH.alpha=alpha
GNU_ARCH.arm26=arm
GNU_ARCH.arm32=arm
GNU_ARCH.arm=arm
GNU_ARCH.i386=i386
GNU_ARCH.m68k=m68k
GNU_ARCH.mipseb=mipseb
GNU_ARCH.mipsel=mipsel
GNU_ARCH.ns32k=ns32k
GNU_ARCH.powerpc=powerpc
GNU_ARCH.sh3eb=sh
GNU_ARCH.sh3el=sh
GNU_ARCH.sparc=sparc
GNU_ARCH.sparc64=sparc64
GNU_ARCH.vax=vax
MACHINE_GNU_ARCH=${GNU_ARCH.${MACHINE_ARCH}}
.endif
# CPU model, derived from MACHINE_ARCH
MACHINE_CPU= ${MACHINE_ARCH:C/mipse[bl]/mips/:S/arm26/arm/:S/arm32/arm/:C/sh3e[bl]/sh3/:S/m68000/m68k/}
.if ${MACHINE_ARCH} == "mips"
.BEGIN:
@echo Must set MACHINE_ARCH to one of mipseb or mipsel
@false
.endif
.if ${MACHINE_ARCH} == "sh3"
.BEGIN:
@echo Must set MACHINE_ARCH to one of sh3eb or sh3el
@false
.endif
TARGETS+= all clean cleandir depend dependall includes \
install lint obj regress tags html installhtml cleanhtml
.PHONY: all clean cleandir depend dependall distclean includes \
install lint obj regress tags beforedepend afterdepend \
beforeinstall afterinstall realinstall realdepend realall \
html installhtml cheanhtml
# set NEED_OWN_INSTALL_TARGET, if it's not already set, to yes
# this is used by bsd.pkg.mk to stop "install" being defined
NEED_OWN_INSTALL_TARGET?= yes
.if ${NEED_OWN_INSTALL_TARGET} == "yes"
.if !target(install)
install: .NOTMAIN beforeinstall subdir-install realinstall afterinstall
beforeinstall: .NOTMAIN
subdir-install: .NOTMAIN beforeinstall
realinstall: .NOTMAIN beforeinstall
afterinstall: .NOTMAIN subdir-install realinstall
.endif
all: .NOTMAIN realall subdir-all
subdir-all: .NOTMAIN
realall: .NOTMAIN
depend: .NOTMAIN realdepend subdir-depend
subdir-depend: .NOTMAIN
realdepend: .NOTMAIN
distclean: .NOTMAIN cleandir
.endif
PRINTOBJDIR= printf "xxx: .MAKE\n\t@echo \$${.OBJDIR}\n" | ${MAKE} -B -s -f-
# Define MKxxx variables (which are either yes or no) for users
# to set in /etc/mk.conf and override on the make commandline.
# These should be tested with `== "no"' or `!= "no"'.
# The NOxxx variables should only be used by Makefiles.
#
MKCATPAGES?=yes
.if defined(NODOC)
MKDOC=no
#.elif !defined(MKDOC)
#MKDOC=yes
.else
MKDOC?=yes
.endif
MKINFO?=yes
.if defined(NOLINKLIB)
MKLINKLIB=no
.else
MKLINKLIB?=yes
.endif
.if ${MKLINKLIB} == "no"
MKPICINSTALL=no
MKPROFILE=no
.endif
.if defined(NOLINT)
MKLINT=no
.else
MKLINT?=yes
.endif
.if defined(NOMAN)
MKMAN=no
.else
MKMAN?=yes
.endif
.if ${MKMAN} == "no"
MKCATPAGES=no
.endif
.if defined(NONLS)
MKNLS=no
.else
MKNLS?=yes
.endif
#
# MKOBJDIRS controls whether object dirs are created during "make build".
# MKOBJ controls whether the "make obj" rule does anything.
#
.if defined(NOOBJ)
MKOBJ=no
MKOBJDIRS=no
.else
MKOBJ?=yes
MKOBJDIRS?=no
.endif
.if defined(NOPIC)
MKPIC=no
.else
MKPIC?=yes
.endif
.if defined(NOPICINSTALL)
MKPICINSTALL=no
.else
MKPICINSTALL?=yes
.endif
.if defined(NOPROFILE)
MKPROFILE=no
.else
MKPROFILE?=yes
.endif
.if defined(NOSHARE)
MKSHARE=no
.else
MKSHARE?=yes
.endif
.if ${MKSHARE} == "no"
MKCATPAGES=no
MKDOC=no
MKINFO=no
MKMAN=no
MKNLS=no
.endif
.if defined(NOCRYPTO)
MKCRYPTO=no
.else
MKCRYPTO?=yes
.endif
MKCRYPTO_IDEA?=no
MKCRYPTO_RC5?=no
.if defined(NOKERBEROS) || (${MKCRYPTO} == "no")
MKKERBEROS=no
.else
MKKERBEROS?=yes
.endif
MKSOFTFLOAT?=no
.endif # _BSD_OWN_MK_

View File

@@ -0,0 +1,202 @@
# $NetBSD: OpenBSD.sys.mk,v 1.1.1.1 2006/07/14 23:13:01 jlam Exp $
# @(#)sys.mk 8.2 (Berkeley) 3/21/94
unix?= We run OpenBSD.
.SUFFIXES: .out .a .ln .o .s .S .c .cc .cpp .cxx .C .F .f .r .y .l .cl .p .h
.SUFFIXES: .sh .m4
.LIBS: .a
AR?= ar
ARFLAGS?= rl
RANLIB?= ranlib
AS?= as
AFLAGS?=
.if ${MACHINE_ARCH} == "sparc64"
AFLAGS+= -Wa,-Av9a
.endif
COMPILE.s?= ${CC} ${AFLAGS} -c
LINK.s?= ${CC} ${AFLAGS} ${LDFLAGS}
COMPILE.S?= ${CC} ${AFLAGS} ${CPPFLAGS} -c -traditional-cpp
LINK.S?= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
CC?= cc
.if ${MACHINE_ARCH} == "alpha" || \
${MACHINE_ARCH} == "i386" || \
${MACHINE_ARCH} == "m68k" || \
${MACHINE_ARCH} == "sparc" || \
${MACHINE_ARCH} == "vax"
DBG?= -O2
.else
DBG?= -O
.endif
CFLAGS?= ${DBG}
COMPILE.c?= ${CC} ${CFLAGS} ${CPPFLAGS} -c
LINK.c?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
CXX?= c++
CXXFLAGS?= ${CFLAGS}
COMPILE.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
LINK.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
OBJC?= ${CC}
OBJCFLAGS?= ${CFLAGS}
COMPILE.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c
LINK.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} ${LDFLAGS}
CPP?= cpp
CPPFLAGS?=
FC?= f77
FFLAGS?= -O
RFLAGS?=
COMPILE.f?= ${FC} ${FFLAGS} -c
LINK.f?= ${FC} ${FFLAGS} ${LDFLAGS}
COMPILE.F?= ${FC} ${FFLAGS} ${CPPFLAGS} -c
LINK.F?= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
COMPILE.r?= ${FC} ${FFLAGS} ${RFLAGS} -c
LINK.r?= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
INSTALL?= install
LEX?= lex
LFLAGS?=
LEX.l?= ${LEX} ${LFLAGS}
LD?= ld
LDFLAGS?=
LINT?= lint
LINTFLAGS?= -chapbxzF
LORDER?= lorder
MAKE?= make
NM?= nm
PC?= pc
PFLAGS?=
COMPILE.p?= ${PC} ${PFLAGS} ${CPPFLAGS} -c
LINK.p?= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
SHELL?= sh
SIZE?= size
TSORT?= tsort -q
YACC?= yacc
YFLAGS?=
YACC.y?= ${YACC} ${YFLAGS}
# C
.c:
${LINK.c} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.c.o:
${COMPILE.c} ${.IMPSRC}
.c.a:
${COMPILE.c} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.c.ln:
${LINT} ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i ${.IMPSRC}
# C++
.cc .cpp .cxx .C:
${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.cc.o .cpp.o .cxx.o .C.o:
${COMPILE.cc} ${.IMPSRC}
.cc.a .cpp.a .cxx.a .C.a:
${COMPILE.cc} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Fortran/Ratfor
.f:
${LINK.f} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.f.o:
${COMPILE.f} ${.IMPSRC}
.f.a:
${COMPILE.f} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.F:
${LINK.F} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.F.o:
${COMPILE.F} ${.IMPSRC}
.F.a:
${COMPILE.F} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.r:
${LINK.r} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.r.o:
${COMPILE.r} ${.IMPSRC}
.r.a:
${COMPILE.r} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Pascal
.p:
${LINK.p} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.p.o:
${COMPILE.p} ${.IMPSRC}
.p.a:
${COMPILE.p} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Assembly
.s:
${LINK.s} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.s.o:
${COMPILE.s} ${.IMPSRC}
.s.a:
${COMPILE.s} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.S:
${LINK.S} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.S.o:
${COMPILE.S} ${.IMPSRC}
.S.a:
${COMPILE.S} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Lex
.l:
${LEX.l} ${.IMPSRC}
${LINK.c} -o ${.TARGET} lex.yy.c ${LDLIBS} -ll
rm -f lex.yy.c
.l.c:
${LEX.l} ${.IMPSRC}
mv lex.yy.c ${.TARGET}
.l.o:
${LEX.l} ${.IMPSRC}
${COMPILE.c} -o ${.TARGET} lex.yy.c
rm -f lex.yy.c
# Yacc
.y:
${YACC.y} ${.IMPSRC}
${LINK.c} -o ${.TARGET} y.tab.c ${LDLIBS}
rm -f y.tab.c
.y.c:
${YACC.y} ${.IMPSRC}
mv y.tab.c ${.TARGET}
.y.o:
${YACC.y} ${.IMPSRC}
${COMPILE.c} -o ${.TARGET} y.tab.c
rm -f y.tab.c
# Shell
.sh:
rm -f ${.TARGET}
cp ${.IMPSRC} ${.TARGET}

View File

@@ -0,0 +1,141 @@
# $NetBSD: SunOS.bsd.sys.mk,v 1.1.1.1 2006/07/14 23:13:01 jlam Exp $
#
# Overrides used for NetBSD source tree builds.
.if ${CC:M*gcc*} != ""
.if defined(WARNS)
.if ${WARNS} > 0
CFLAGS+= -Wall -Wstrict-prototypes -Wmissing-prototypes
# XXX Delete -Wuninitialized by default for now -- the compiler doesn't
# XXX always get it right.
CFLAGS+= -Wno-uninitialized
.endif
.if ${WARNS} > 1
CFLAGS+= -Wreturn-type -Wpointer-arith
.endif
.if ${WARNS} > 2
CFLAGS+= -Wcast-qual -Wwrite-strings
.endif
CFLAGS+= -Wswitch -Wshadow
.endif
.if defined(WFORMAT) && defined(FORMAT_AUDIT)
.if ${WFORMAT} > 1
CFLAGS+= -Wnetbsd-format-audit -Wno-format-extra-args
.endif
.endif
.if !defined(NOGCCERROR)
CFLAGS+= -Werror
.endif
CFLAGS+= ${CWARNFLAGS}
.if defined(DESTDIR)
CPPFLAGS+= -nostdinc -idirafter ${DESTDIR}/usr/include
LINTFLAGS+= -d ${DESTDIR}/usr/include
.endif
.if defined(MKSOFTFLOAT) && (${MKSOFTFLOAT} != "no")
COPTS+= -msoft-float
FOPTS+= -msoft-float
.endif
.endif # gcc
.if defined(AUDIT)
CPPFLAGS+= -D__AUDIT__
.endif
# Helpers for cross-compiling
HOST_CC?= cc
HOST_CFLAGS?= -O
HOST_COMPILE.c?=${HOST_CC} ${HOST_CFLAGS} ${HOST_CPPFLAGS} -c
HOST_LINK.c?= ${HOST_CC} ${HOST_CFLAGS} ${HOST_CPPFLAGS} ${HOST_LDFLAGS}
HOST_CPP?= cpp
HOST_CPPFLAGS?=
HOST_LD?= ld
HOST_LDFLAGS?=
OBJCOPY?= objcopy
STRIP?= strip
CONFIG?= config
RPCGEN?= rpcgen
MKLOCALE?= mklocale
.SUFFIXES: .m .o .ln .lo
# Objective C
# (Defined here rather than in <sys.mk> because `.m' is not just
# used for Objective C source)
.m:
${LINK.m} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.m.o:
${COMPILE.m} ${.IMPSRC}
# Host-compiled C objects
.c.lo:
${HOST_COMPILE.c} -o ${.TARGET} ${.IMPSRC}
.if defined(PARALLEL) || defined(LPREFIX)
LPREFIX?=yy
LFLAGS+=-P${LPREFIX}
# Lex
.l:
${LEX.l} -o${.TARGET:R}.${LPREFIX}.c ${.IMPSRC}
${LINK.c} -o ${.TARGET} ${.TARGET:R}.${LPREFIX}.c ${LDLIBS} -ll
rm -f ${.TARGET:R}.${LPREFIX}.c
.l.c:
${LEX.l} -o${.TARGET} ${.IMPSRC}
.l.o:
${LEX.l} -o${.TARGET:R}.${LPREFIX}.c ${.IMPSRC}
${COMPILE.c} -o ${.TARGET} ${.TARGET:R}.${LPREFIX}.c
rm -f ${.TARGET:R}.${LPREFIX}.c
.l.lo:
${LEX.l} -o${.TARGET:R}.${LPREFIX}.c ${.IMPSRC}
${HOST_COMPILE.c} -o ${.TARGET} ${.TARGET:R}.${LPREFIX}.c
rm -f ${.TARGET:R}.${LPREFIX}.c
.endif
# Yacc
.if defined(YHEADER) || defined(YPREFIX)
.if defined(YPREFIX)
YFLAGS+=-p${YPREFIX}
.endif
.if defined(YHEADER)
YFLAGS+=-d
.endif
.y:
${YACC.y} -b ${.TARGET:R} ${.IMPSRC}
${LINK.c} -o ${.TARGET} ${.TARGET:R}.tab.c ${LDLIBS}
rm -f ${.TARGET:R}.tab.c ${.TARGET:R}.tab.h
.y.h: ${.TARGET:R}.c
.y.c:
${YACC.y} -o ${.TARGET} ${.IMPSRC}
.y.o:
${YACC.y} -b ${.TARGET:R} ${.IMPSRC}
${COMPILE.c} -o ${.TARGET} ${.TARGET:R}.tab.c
rm -f ${.TARGET:R}.tab.c ${TARGET:R}.tab.h
.y.lo:
${YACC.y} -b ${.TARGET:R} ${.IMPSRC}
${HOST_COMPILE.c} -o ${.TARGET} ${.TARGET:R}.tab.c
rm -f ${.TARGET:R}.tab.c ${TARGET:R}.tab.h
.elif defined(PARALLEL)
.y:
${YACC.y} -b ${.TARGET:R} ${.IMPSRC}
${LINK.c} -o ${.TARGET} ${.TARGET:R}.tab.c ${LDLIBS}
rm -f ${.TARGET:R}.tab.c
.y.c:
${YACC.y} -o ${.TARGET} ${.IMPSRC}
.y.o:
${YACC.y} -b ${.TARGET:R} ${.IMPSRC}
${COMPILE.c} -o ${.TARGET} ${.TARGET:R}.tab.c
rm -f ${.TARGET:R}.tab.c
.y.lo:
${YACC.y} -b ${.TARGET:R} ${.IMPSRC}
${HOST_COMPILE.c} -o ${.TARGET} ${.TARGET:R}.tab.c
rm -f ${.TARGET:R}.tab.c
.endif

View File

@@ -0,0 +1,217 @@
# $NetBSD: SunOS.sys.mk,v 1.4 2012/02/15 15:30:25 hans Exp $
# NetBSD: sys.mk,v 1.58 2000/08/22 17:38:49 bjh21 Exp
# @(#)sys.mk 8.2 (Berkeley) 3/21/94
unix?= We run Unix.
OS?= SunOS.5
.SUFFIXES: .out .a .ln .o .s .S .c .cc .cpp .cxx .C .F .f .r .y .l .cl .p .h
.SUFFIXES: .sh .m4
.LIBS: .a
AR?= ar
ARFLAGS?= rl
RANLIB?= ranlib
AS?= as
AFLAGS?=
COMPILE.s?= ${CC} ${AFLAGS} -c
LINK.s?= ${CC} ${AFLAGS} ${LDFLAGS}
COMPILE.S?= ${AS} ${AFLAGS} ${CPPFLAGS} -P
LINK.S?= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
# Unless told otherwise, assume GNU CC
CC?= gcc
DBG?= -O
CFLAGS?= ${DBG}
COMPILE.c?= ${CC} ${CFLAGS} ${CPPFLAGS} -c
LINK.c?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
CXX?= g++
CXXFLAGS?= ${CFLAGS}
COMPILE.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
LINK.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
OBJC?= ${CC}
OBJCFLAGS?= ${CFLAGS}
COMPILE.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c
LINK.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} ${LDFLAGS}
# use cpp if using gcc, else use ${CC} -E as gcc -E is broken pr#42624
# if /usr/ucb/lib/cpp is in the path before gnu cpp this could break things
.if !empty(CC:Mgcc)
CPP?= cpp
.else
CPP?= ${CC} -E
.endif
.if defined(NETBSD_COMPATIBLE)
CPPFLAGS?= -I${BSDDIR}/include -D__EXTENSIONS__ -D_XPG4_2 -DSUNOS_5
HOST_CPPFLAGS?= ${CPPFLAGS}
NOLINT=1
.else
CPPFLAGS?=
.endif
FC?= f77
FFLAGS?= -O
RFLAGS?=
COMPILE.f?= ${FC} ${FFLAGS} -c
LINK.f?= ${FC} ${FFLAGS} ${LDFLAGS}
COMPILE.F?= ${FC} ${FFLAGS} ${CPPFLAGS} -c
LINK.F?= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
COMPILE.r?= ${FC} ${FFLAGS} ${RFLAGS} -c
LINK.r?= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
INSTALL?= ${PREFIX}/bin/install-sh
LEX?= lex
LFLAGS?=
LEX.l?= ${LEX} ${LFLAGS}
LD?= ld
LDFLAGS?=
LINT?= lint
LINTFLAGS?= -chapbxzF
LORDER?= lorder
MAKE?= make
NM?= nm
PC?= pc
PFLAGS?=
COMPILE.p?= ${PC} ${PFLAGS} ${CPPFLAGS} -c
LINK.p?= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
SHELL?= sh
SIZE?= size
TSORT?= tsort
YACC?= yacc
YFLAGS?=
YACC.y?= ${YACC} ${YFLAGS}
# C
.c:
${LINK.c} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.c.o:
${COMPILE.c} ${.IMPSRC}
.c.a:
${COMPILE.c} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.c.ln:
${LINT} ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i ${.IMPSRC}
# C++
.cc .cpp .cxx .C:
${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.cc.o .cpp.o .cxx.o .C.o:
${COMPILE.cc} ${.IMPSRC}
.cc.a .cpp.a .cxx.a .C.a:
${COMPILE.cc} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Fortran/Ratfor
.f:
${LINK.f} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.f.o:
${COMPILE.f} ${.IMPSRC}
.f.a:
${COMPILE.f} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.F:
${LINK.F} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.F.o:
${COMPILE.F} ${.IMPSRC}
.F.a:
${COMPILE.F} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.r:
${LINK.r} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.r.o:
${COMPILE.r} ${.IMPSRC}
.r.a:
${COMPILE.r} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Pascal
.p:
${LINK.p} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.p.o:
${COMPILE.p} ${.IMPSRC}
.p.a:
${COMPILE.p} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Assembly
.s:
${LINK.s} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.s.o:
${COMPILE.s} ${.IMPSRC}
.s.a:
${COMPILE.s} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.S:
${LINK.S} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.S.o:
${COMPILE.S} ${.IMPSRC}
.S.a:
${COMPILE.S} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Lex
.l:
${LEX.l} ${.IMPSRC}
${LINK.c} -o ${.TARGET} lex.yy.c ${LDLIBS} -ll
rm -f lex.yy.c
.l.c:
${LEX.l} ${.IMPSRC}
mv lex.yy.c ${.TARGET}
.l.o:
${LEX.l} ${.IMPSRC}
${COMPILE.c} -o ${.TARGET} lex.yy.c
rm -f lex.yy.c
# Yacc
.y:
${YACC.y} ${.IMPSRC}
${LINK.c} -o ${.TARGET} y.tab.c ${LDLIBS}
rm -f y.tab.c
.y.c:
${YACC.y} ${.IMPSRC}
mv y.tab.c ${.TARGET}
.y.o:
${YACC.y} ${.IMPSRC}
${COMPILE.c} -o ${.TARGET} y.tab.c
rm -f y.tab.c
# Shell
.sh:
rm -f ${.TARGET}
cp ${.IMPSRC} ${.TARGET}
# override the definitions in bsd.own.mk for Solaris
BINGRP?= root
MANGRP?= root
INFOGRP?= root
DOCGRP?= root
NLSGRP?= root
KMODGRP?= root
LOCALEGRP?= root

View File

@@ -0,0 +1,195 @@
# $NetBSD: UnixWare.sys.mk,v 1.2 2006/11/11 18:24:52 jschauma Exp $
# NetBSD: SunOS.sys.mk,v 1.1.1.1 2004/03/11 13:04:00 grant Exp
# NetBSD: sys.mk,v 1.58 2000/08/22 17:38:49 bjh21 Exp
# @(#)sys.mk 8.2 (Berkeley) 3/21/94
unix?= We run Unix.
OS= UnixWare
.SUFFIXES: .out .a .ln .o .s .S .c .cc .cpp .cxx .C .F .f .r .y .l .cl .p .h
.SUFFIXES: .sh .m4
.LIBS: .a
AR?= ar
ARFLAGS?= rl
RANLIB?= ranlib
AS?= as
AFLAGS?=
COMPILE.s?= ${CC} ${AFLAGS} -c
LINK.s?= ${CC} ${AFLAGS} ${LDFLAGS}
COMPILE.S?= ${CC} ${AFLAGS} ${CPPFLAGS} -c -traditional-cpp
LINK.S?= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
CC?= gcc
DBG?= -O2
# gcc on Unixware has no internal macro to identify the system
CFLAGS?= -DUNIXWARE ${DBG}
COMPILE.c?= ${CC} ${CFLAGS} ${CPPFLAGS} -c
LINK.c?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
CXX?= g++
CXXFLAGS?= -DUNIXWARE ${CFLAGS}
COMPILE.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
LINK.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
OBJC?= ${CC}
OBJCFLAGS?= ${CFLAGS}
COMPILE.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c
LINK.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} ${LDFLAGS}
CPP?= cpp
CPPFLAGS?= -DUNIXWARE
FC?= g77
FFLAGS?= -O
RFLAGS?=
COMPILE.f?= ${FC} ${FFLAGS} -c
LINK.f?= ${FC} ${FFLAGS} ${LDFLAGS}
COMPILE.F?= ${FC} ${FFLAGS} ${CPPFLAGS} -c
LINK.F?= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
COMPILE.r?= ${FC} ${FFLAGS} ${RFLAGS} -c
LINK.r?= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
INSTALL?= /usr/ucb/install
LEX?= lex
LFLAGS?=
LEX.l?= ${LEX} ${LFLAGS}
LD?= ld
LDFLAGS?=
LINT?= lint
LINTFLAGS?= -chapbxzF
LORDER?= lorder
MAKE?= bmake
NM?= nm
PC?= pc
PFLAGS?=
COMPILE.p?= ${PC} ${PFLAGS} ${CPPFLAGS} -c
LINK.p?= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
SHELL?= sh
SIZE?= size
TSORT?= tsort
YACC?= yacc
YFLAGS?=
YACC.y?= ${YACC} ${YFLAGS}
# C
.c:
${LINK.c} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.c.o:
${COMPILE.c} ${.IMPSRC}
.c.a:
${COMPILE.c} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.c.ln:
${LINT} ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i ${.IMPSRC}
# C++
.cc .cpp .cxx .C:
${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.cc.o .cpp.o .cxx.o .C.o:
${COMPILE.cc} ${.IMPSRC}
.cc.a .cpp.a .cxx.a .C.a:
${COMPILE.cc} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Fortran/Ratfor
.f:
${LINK.f} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.f.o:
${COMPILE.f} ${.IMPSRC}
.f.a:
${COMPILE.f} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.F:
${LINK.F} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.F.o:
${COMPILE.F} ${.IMPSRC}
.F.a:
${COMPILE.F} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.r:
${LINK.r} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.r.o:
${COMPILE.r} ${.IMPSRC}
.r.a:
${COMPILE.r} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Pascal
.p:
${LINK.p} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.p.o:
${COMPILE.p} ${.IMPSRC}
.p.a:
${COMPILE.p} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Assembly
.s:
${LINK.s} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.s.o:
${COMPILE.s} ${.IMPSRC}
.s.a:
${COMPILE.s} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.S:
${LINK.S} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.S.o:
${COMPILE.S} ${.IMPSRC}
.S.a:
${COMPILE.S} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Lex
.l:
${LEX.l} ${.IMPSRC}
${LINK.c} -o ${.TARGET} lex.yy.c ${LDLIBS} -ll
rm -f lex.yy.c
.l.c:
${LEX.l} ${.IMPSRC}
mv lex.yy.c ${.TARGET}
.l.o:
${LEX.l} ${.IMPSRC}
${COMPILE.c} -o ${.TARGET} lex.yy.c
rm -f lex.yy.c
# Yacc
.y:
${YACC.y} ${.IMPSRC}
${LINK.c} -o ${.TARGET} y.tab.c ${LDLIBS}
rm -f y.tab.c
.y.c:
${YACC.y} ${.IMPSRC}
mv y.tab.c ${.TARGET}
.y.o:
${YACC.y} ${.IMPSRC}
${COMPILE.c} -o ${.TARGET} y.tab.c
rm -f y.tab.c
# Shell
.sh:
rm -f ${.TARGET}
cp ${.IMPSRC} ${.TARGET}

View File

@@ -0,0 +1,327 @@
# $NetBSD: bsd.own.mk.in,v 1.4 2012/03/05 07:26:37 sbd Exp $
.if !defined(_BSD_OWN_MK_)
_BSD_OWN_MK_=1
.if defined(MAKECONF) && exists(${MAKECONF})
.include "${MAKECONF}"
.elif exists(@SYSCONFDIR@/mk.conf)
.include "@SYSCONFDIR@/mk.conf"
.elif exists(/etc/mk.conf)
.include "/etc/mk.conf"
.endif
# Defining `SKEY' causes support for S/key authentication to be compiled in.
SKEY= yes
# where the system object and source trees are kept; can be configurable
# by the user in case they want them in ~/foosrc and ~/fooobj, for example
BSDSRCDIR?= /usr/src
BSDOBJDIR?= /usr/obj
BINGRP?= @ROOT_GROUP@
BINOWN?= @ROOT_USER@
BINMODE?= 555
NONBINMODE?= 444
# Define MANZ to have the man pages compressed (gzip)
#MANZ= 1
MANDIR?= /usr/share/man
MANGRP?= @ROOT_GROUP@
MANOWN?= @ROOT_USER@
MANMODE?= ${NONBINMODE}
MANINSTALL?= ${_MANINSTALL}
INFODIR?= /usr/share/info
INFOGRP?= @ROOT_GROUP@
INFOOWN?= @ROOT_USER@
INFOMODE?= ${NONBINMODE}
LIBDIR?= /usr/lib
LINTLIBDIR?= /usr/libdata/lint
LIBGRP?= ${BINGRP}
LIBOWN?= ${BINOWN}
LIBMODE?= ${NONBINMODE}
DOCDIR?= /usr/share/doc
HTMLDOCDIR?= /usr/share/doc/html
DOCGRP?= @ROOT_GROUP@
DOCOWN?= @ROOT_USER@
DOCMODE?= ${NONBINMODE}
NLSDIR?= /usr/share/nls
NLSGRP?= @ROOT_GROUP@
NLSOWN?= @ROOT_USER@
NLSMODE?= ${NONBINMODE}
KMODDIR?= /usr/lkm
KMODGRP?= @ROOT_GROUP@
KMODOWN?= @ROOT_USER@
KMODMODE?= ${NONBINMODE}
LOCALEDIR?= /usr/share/locale
LOCALEGRP?= @ROOT_GROUP@
LOCALEOWN?= @ROOT_USER@
LOCALEMODE?= ${NONBINMODE}
COPY?= -c
.if defined(UPDATE)
PRESERVE?= -p
.else
PRESERVE?=
.endif
.if defined(UNPRIVILEGED)
INSTPRIV?= -U
.endif
STRIPFLAG?= -s
# Define SYS_INCLUDE to indicate whether you want symbolic links to the system
# source (``symlinks''), or a separate copy (``copies''); (latter useful
# in environments where it's not possible to keep /sys publicly readable)
#SYS_INCLUDE= symlinks
# The sh3 port is incomplete.
.if ${MACHINE_ARCH} == "sh3eb" || ${MACHINE_ARCH} == "sh3el"
NOLINT=1
NOPROFILE=1
OBJECT_FMT?=COFF
NOPIC?=1
.endif
# The sparc64 port is incomplete.
# Profiling and linting is also off on the x86_64 port at the moment.
.if ${MACHINE_ARCH} == "sparc64" || ${MACHINE_ARCH} == "x86_64"
NOPROFILE=1
NOLINT=1
.endif
# The m68000 port is incomplete.
.if ${MACHINE_ARCH} == "m68000"
NOLINT=1
NOPROFILE=1
NOPIC?=1
.endif
# Data-driven table using make variables to control how
# toolchain-dependent targets and shared libraries are built
# for different platforms and object formats.
# OBJECT_FMT: currently either "ELF" or "a.out".
# SHLIB_TYPE: "ELF" or "a.out" or "" to force static libraries.
#
.if ${MACHINE_ARCH} == "alpha" || \
${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb" || \
${MACHINE_ARCH} == "powerpc" || \
${MACHINE_ARCH} == "sparc" || \
${MACHINE_ARCH} == "sparc64" || \
${MACHINE_ARCH} == "x86_64" || \
${MACHINE_ARCH} == "i386" || \
${MACHINE_ARCH} == "m68000" || \
${MACHINE_ARCH} == "arm" || \
${MACHINE} == "next68k" || \
${MACHINE} == "sun3" || \
${MACHINE} == "mvme68k" || \
${MACHINE} == "hp300" || \
${MACHINE} == "news68k" || \
${MACHINE} == "arm26"
OBJECT_FMT?=ELF
.else
OBJECT_FMT?=a.out
.endif
# Location of the file that contains the major and minor numbers of the
# version of a shared library. If this file exists a shared library
# will be built by <bsd.lib.mk>.
SHLIB_VERSION_FILE?= ${.CURDIR}/shlib_version
# GNU sources and packages sometimes see architecture names differently.
# This table maps an architecture name to its GNU counterpart.
# Use as so: ${GNU_ARCH.${TARGET_ARCH}} or ${MACHINE_GNU_ARCH}
.ifndef MACHINE_GNU_ARCH
GNU_ARCH.alpha=alpha
GNU_ARCH.arm26=arm
GNU_ARCH.arm32=arm
GNU_ARCH.arm=arm
GNU_ARCH.i386=i386
GNU_ARCH.m68k=m68k
GNU_ARCH.mipseb=mipseb
GNU_ARCH.mipsel=mipsel
GNU_ARCH.ns32k=ns32k
GNU_ARCH.powerpc=powerpc
GNU_ARCH.sh3eb=sh
GNU_ARCH.sh3el=sh
GNU_ARCH.sparc=sparc
GNU_ARCH.sparc64=sparc64
GNU_ARCH.vax=vax
MACHINE_GNU_ARCH=${GNU_ARCH.${MACHINE_ARCH}}
.endif
# In order to identify NetBSD to GNU packages, we sometimes need
# an "elf" tag for historically a.out platforms.
.if ${OBJECT_FMT} == "ELF" && \
(${MACHINE_ARCH} == "arm" || \
${MACHINE_ARCH} == "i386" || \
${MACHINE_ARCH} == "m68k" || \
${MACHINE_ARCH} == "sparc" || \
${MACHINE_ARCH} == "vax")
MACHINE_GNU_PLATFORM?= netbsdelf
.else
MACHINE_GNU_PLATFORM?= netbsd
.endif
# CPU model, derived from MACHINE_ARCH
MACHINE_CPU= ${MACHINE_ARCH:C/mipse[bl]/mips/:S/arm26/arm/:S/arm32/arm/:C/sh3e[bl]/sh3/:S/m68000/m68k/}
.if ${MACHINE_ARCH} == "mips"
.BEGIN:
@echo Must set MACHINE_ARCH to one of mipseb or mipsel
@false
.endif
.if ${MACHINE_ARCH} == "sh3"
.BEGIN:
@echo Must set MACHINE_ARCH to one of sh3eb or sh3el
@false
.endif
TARGETS+= all clean cleandir depend dependall includes \
install lint obj regress tags html installhtml cleanhtml
.PHONY: all clean cleandir depend dependall distclean includes \
install lint obj regress tags beforedepend afterdepend \
beforeinstall afterinstall realinstall realdepend realall \
html installhtml cheanhtml
# set NEED_OWN_INSTALL_TARGET, if it's not already set, to yes
# this is used by bsd.pkg.mk to stop "install" being defined
NEED_OWN_INSTALL_TARGET?= yes
.if ${NEED_OWN_INSTALL_TARGET} == "yes"
.if !target(install)
install: .NOTMAIN beforeinstall subdir-install realinstall afterinstall
beforeinstall: .NOTMAIN
subdir-install: .NOTMAIN beforeinstall
realinstall: .NOTMAIN beforeinstall
afterinstall: .NOTMAIN subdir-install realinstall
.endif
all: .NOTMAIN realall subdir-all
subdir-all: .NOTMAIN
realall: .NOTMAIN
depend: .NOTMAIN realdepend subdir-depend
subdir-depend: .NOTMAIN
realdepend: .NOTMAIN
distclean: .NOTMAIN cleandir
.endif
PRINTOBJDIR= printf "xxx: .MAKE\n\t@echo \$${.OBJDIR}\n" | ${MAKE} -B -s -f-
# Define MKxxx variables (which are either yes or no) for users
# to set in /etc/mk.conf and override on the make commandline.
# These should be tested with `== "no"' or `!= "no"'.
# The NOxxx variables should only be used by Makefiles.
#
MKCATPAGES?=no
.if defined(NODOC)
MKDOC=no
#.elif !defined(MKDOC)
#MKDOC=yes
.else
MKDOC?=yes
.endif
_MANINSTALL= maninstall
.if ${MKCATPAGES} != "no"
_MANINSTALL+= catinstall
.endif
MKINFO?=yes
.if defined(NOLINKLIB)
MKLINKLIB=no
.else
MKLINKLIB?=yes
.endif
.if ${MKLINKLIB} == "no"
MKPICINSTALL=no
MKPROFILE=no
.endif
MKLINT?=no
.if defined(NOMAN)
MKMAN=no
.else
MKMAN?=yes
.endif
.if ${MKMAN} == "no"
MKCATPAGES=no
.endif
.if defined(NONLS)
MKNLS=no
.else
MKNLS?=yes
.endif
#
# MKOBJDIRS controls whether object dirs are created during "make build".
# MKOBJ controls whether the "make obj" rule does anything.
#
.if defined(NOOBJ)
MKOBJ=no
MKOBJDIRS=no
.else
MKOBJ?=yes
MKOBJDIRS?=no
.endif
.if defined(NOPIC)
MKPIC=no
.else
MKPIC?=yes
.endif
.if defined(NOPICINSTALL)
MKPICINSTALL=no
.else
MKPICINSTALL?=yes
.endif
.if defined(NOPROFILE)
MKPROFILE=no
.else
MKPROFILE?=yes
.endif
.if defined(NOSHARE)
MKSHARE=no
.else
MKSHARE?=yes
.endif
.if ${MKSHARE} == "no"
MKCATPAGES=no
MKDOC=no
MKINFO=no
MKMAN=no
MKNLS=no
.endif
.if defined(NOCRYPTO)
MKCRYPTO=no
.else
MKCRYPTO?=yes
.endif
MKCRYPTO_IDEA?=no
MKCRYPTO_RC5?=no
.if defined(NOKERBEROS) || (${MKCRYPTO} == "no")
MKKERBEROS=no
.else
MKKERBEROS?=yes
.endif
MKSOFTFLOAT?=no
.endif # _BSD_OWN_MK_

View File

@@ -0,0 +1,208 @@
# $NetBSD: sys.mk,v 1.1.1.1 2006/07/14 23:13:01 jlam Exp $
# @(#)sys.mk 8.2 (Berkeley) 3/21/94
unix?= We run Unix
OS!= uname -s
.SUFFIXES: .out .a .ln .o .s .S .c .cc .cpp .cxx .C .F .f .r .y .l .cl .p .h
.SUFFIXES: .sh .m4
.LIBS: .a
AR?= ar
ARFLAGS?= rl
RANLIB?= ranlib
AS?= as
AFLAGS?=
.if ${MACHINE_ARCH} == "sparc64"
AFLAGS+= -Wa,-Av9a
.endif
COMPILE.s?= ${CC} ${AFLAGS} -c
LINK.s?= ${CC} ${AFLAGS} ${LDFLAGS}
COMPILE.S?= ${CC} ${AFLAGS} ${CPPFLAGS} -c -traditional-cpp
LINK.S?= ${CC} ${AFLAGS} ${CPPFLAGS} ${LDFLAGS}
CC?= cc
.if ${MACHINE_ARCH} == "alpha" || \
${MACHINE_ARCH} == "arm" || ${MACHINE_ARCH} == "arm26" || \
${MACHINE_ARCH} == "arm32" || \
${MACHINE_ARCH} == "i386" || \
${MACHINE_ARCH} == "m68k" || \
${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb" || \
${MACHINE_ARCH} == "sparc" || \
${MACHINE_ARCH} == "vax"
DBG?= -O2
.elif ${MACHINE_ARCH} == "x86_64"
DBG?=
.else
DBG?= -O
.endif
CFLAGS?= ${DBG}
COMPILE.c?= ${CC} ${CFLAGS} ${CPPFLAGS} -c
LINK.c?= ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}
CXX?= c++
CXXFLAGS?= ${CFLAGS}
COMPILE.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} -c
LINK.cc?= ${CXX} ${CXXFLAGS} ${CPPFLAGS} ${LDFLAGS}
OBJC?= ${CC}
OBJCFLAGS?= ${CFLAGS}
COMPILE.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} -c
LINK.m?= ${OBJC} ${OBJCFLAGS} ${CPPFLAGS} ${LDFLAGS}
CPP?= cpp
CPPFLAGS?=
FC?= f77
FFLAGS?= -O
RFLAGS?=
COMPILE.f?= ${FC} ${FFLAGS} -c
LINK.f?= ${FC} ${FFLAGS} ${LDFLAGS}
COMPILE.F?= ${FC} ${FFLAGS} ${CPPFLAGS} -c
LINK.F?= ${FC} ${FFLAGS} ${CPPFLAGS} ${LDFLAGS}
COMPILE.r?= ${FC} ${FFLAGS} ${RFLAGS} -c
LINK.r?= ${FC} ${FFLAGS} ${RFLAGS} ${LDFLAGS}
INSTALL?= install
LEX?= lex
LFLAGS?=
LEX.l?= ${LEX} ${LFLAGS}
LD?= ld
LDFLAGS?=
LINT?= lint
LINTFLAGS?= -chapbxzF
LORDER?= lorder
MAKE?= make
NM?= nm
PC?= pc
PFLAGS?=
COMPILE.p?= ${PC} ${PFLAGS} ${CPPFLAGS} -c
LINK.p?= ${PC} ${PFLAGS} ${CPPFLAGS} ${LDFLAGS}
SHELL?= sh
SIZE?= size
TSORT?= tsort -q
YACC?= yacc
YFLAGS?=
YACC.y?= ${YACC} ${YFLAGS}
# C
.c:
${LINK.c} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.c.o:
${COMPILE.c} ${.IMPSRC}
.c.a:
${COMPILE.c} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.c.ln:
${LINT} ${LINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i ${.IMPSRC}
# C++
.cc .cpp .cxx .C:
${LINK.cc} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.cc.o .cpp.o .cxx.o .C.o:
${COMPILE.cc} ${.IMPSRC}
.cc.a .cpp.a .cxx.a .C.a:
${COMPILE.cc} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Fortran/Ratfor
.f:
${LINK.f} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.f.o:
${COMPILE.f} ${.IMPSRC}
.f.a:
${COMPILE.f} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.F:
${LINK.F} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.F.o:
${COMPILE.F} ${.IMPSRC}
.F.a:
${COMPILE.F} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.r:
${LINK.r} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.r.o:
${COMPILE.r} ${.IMPSRC}
.r.a:
${COMPILE.r} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Pascal
.p:
${LINK.p} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.p.o:
${COMPILE.p} ${.IMPSRC}
.p.a:
${COMPILE.p} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Assembly
.s:
${LINK.s} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.s.o:
${COMPILE.s} ${.IMPSRC}
.s.a:
${COMPILE.s} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
.S:
${LINK.S} -o ${.TARGET} ${.IMPSRC} ${LDLIBS}
.S.o:
${COMPILE.S} ${.IMPSRC}
.S.a:
${COMPILE.S} ${.IMPSRC}
${AR} ${ARFLAGS} $@ $*.o
rm -f $*.o
# Lex
.l:
${LEX.l} ${.IMPSRC}
${LINK.c} -o ${.TARGET} lex.yy.c ${LDLIBS} -ll
rm -f lex.yy.c
.l.c:
${LEX.l} ${.IMPSRC}
mv lex.yy.c ${.TARGET}
.l.o:
${LEX.l} ${.IMPSRC}
${COMPILE.c} -o ${.TARGET} lex.yy.c
rm -f lex.yy.c
# Yacc
.y:
${YACC.y} ${.IMPSRC}
${LINK.c} -o ${.TARGET} y.tab.c ${LDLIBS}
rm -f y.tab.c
.y.c:
${YACC.y} ${.IMPSRC}
mv y.tab.c ${.TARGET}
.y.o:
${YACC.y} ${.IMPSRC}
${COMPILE.c} -o ${.TARGET} y.tab.c
rm -f y.tab.c
# Shell
.sh:
rm -f ${.TARGET}
cp ${.IMPSRC} ${.TARGET}

17
pkgtools/cdpack/DESCR Normal file
View File

@@ -0,0 +1,17 @@
cdpack is a small utility for creating ISO 9660 images for
a multi-CD/DVD binary package collection. The utility creates
ISO 9660 images for all the binary packages in a specified
directory.
A choice of two algorithms is available for how the packages
are grouped. The "no duplication" algorithm arranges the
packages so any package on CD/DVD number `n' will have all of
its dependencies on CD/DVD numbers 1 through `n'.
The "no inter-CD/DVD depends" algorithm will place certain
packages on more than one CD/DVD to ensure that each CD/DVD is
self contained (all package dependencies are satisfied within
the single CD/DVD).
The cddist utility in this package is used for creating an archive
set of distfiles.

62
pkgtools/cdpack/Makefile Normal file
View File

@@ -0,0 +1,62 @@
# $NetBSD: Makefile,v 1.31 2012/09/11 23:19:34 asau Exp $
#
DISTNAME= cdpack-1.9
CATEGORIES= pkgtools
MASTER_SITES= # empty
DISTFILES= # empty
MAINTAINER= dmcmahill@NetBSD.org
HOMEPAGE= http://www.NetBSD.org/
COMMENT= Utility to create multi-cd/dvd binary package collections
# for mkisofs
DEPENDS+= cdrtools-[0-9]*:../../sysutils/cdrtools
WRKSRC= ${WRKDIR}
NO_CONFIGURE= yes
USE_TOOLS+= awk:run
USE_TOOLS+= bzcat:run
USE_TOOLS+= expr:run
USE_TOOLS+= gzcat:run
USE_TOOLS+= printf:run
USE_TOOLS+= sort:run
USE_TOOLS+= tar:run
USE_TOOLS+= tsort:run
INSTALLATION_DIRS= bin libexec ${PKGMANDIR}/man1
do-build:
.for f in cdpack cddist
${SED} -e 's;@prefix@;${PREFIX};g' \
-e 's;@progver@;${PKGVERSION};g' \
-e 's;@AWK@;${AWK};g' \
-e 's;@BZCAT@;${BZCAT};g' \
-e 's;@EXPR@;${EXPR};g' \
-e 's;@GZCAT@;${GZCAT};g' \
-e 's;@PRINTF@;${PRINTF};g' \
-e 's;@SORT@;${SORT};g' \
-e 's;@TAR@;${TAR};g' \
-e 's;@TSORT@;${TSORT};g' \
${FILESDIR}/${f}.sh > \
${WRKSRC}/${f}
${CHMOD} 755 ${WRKDIR}/${f}
${SED} -e 's;@AWK@;${AWK};g' \
-e 's;@BZCAT@;${BZCAT};g' \
-e 's;@GZCAT@;${GZCAT};g' \
-e 's;@TAR@;${TAR};g' \
${FILESDIR}/${f}.1 > \
${WRKSRC}/${f}.1
.endfor
${SED} -e 's;@AWK@;${AWK};g' ${FILESDIR}/cdgen.awk > \
${WRKSRC}/cdgen.awk
do-install:
.for f in cdpack cddist
${INSTALL_SCRIPT} ${WRKSRC}/${f} ${DESTDIR}${PREFIX}/bin
${INSTALL_MAN} ${WRKSRC}/${f}.1 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man1
.endfor
${INSTALL_SCRIPT} ${WRKSRC}/cdgen.awk ${DESTDIR}${PREFIX}/libexec
.include "../../mk/bsd.pkg.mk"

6
pkgtools/cdpack/PLIST Normal file
View File

@@ -0,0 +1,6 @@
@comment $NetBSD: PLIST,v 1.3 2008/01/28 23:06:13 dmcmahill Exp $
bin/cddist
bin/cdpack
libexec/cdgen.awk
man/man1/cddist.1
man/man1/cdpack.1

View File

@@ -0,0 +1,34 @@
$NetBSD: TODO,v 1.5 2002/09/20 11:48:12 dmcmahill Exp $
To-Do List for cdpack
---------------------
- extract COMMENT and DESCR to generate a browseable index of all the
packages on the CD set. This would be similar to the README.html's
in pkgsrc, but with some modifications. The changes would be to
list which CD certain pkgs are on. Also, if a DEPENDS is not on the
CD set (due to redistribution restrictions for example), perhaps
list that so the user knows s/he must install the restricted DEPENDS
by hand first.
- come up with some sort of install tool around pkg_add. Perhaps this
could be done using SUSHI. The idea would be to let the user browse
the selection of packages, select some subset of them and then do
a batch install.
- add a -pipe option to pipe the output of mkisofs directly to
cdrecord (or other program) to allow direct writing to CD avoiding
the need for a potentially large amount of disk space for the
generated images.
- add an option to go through pkgsrc and find all the packages
which can't be packaged (NO_PACKAGE or INTERACTIVE) and copy
the distfiles into a single directory. This way you can create
a CD set where you include distfiles for the packages which
couldn't be made into binary pkgs.
- add an options that would search in multiple directories for
binary packages and only pick the most recent versions of any
given package. If an older version is required by some other
pkg, also pick that one up too.

View File

@@ -0,0 +1,154 @@
.\" $NetBSD: cddist.1,v 1.3 2009/05/13 10:43:19 wiz Exp $
.\"
.\" Copyright (c) 2008 Dan McMahill, All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by Dan McMahill
.\" 4. The name of the author may not be used to endorse or promote
.\" products derived from this software without specific prior written
.\" permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY DAN MCMAHILL
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd January 28, 2008
.Dt CDDIST 1
.Os
.Sh NAME
.Nm cddist
.Nd produce multi-CD/DVD distfile archive images
.Sh SYNOPSIS
.Nm
.Op Fl dRVv
.Op Fl dvd
.Op Fl h | Fl Fl help
.Op Fl l Ar logfile
.Op Fl X Ar extras_directory
.Op Fl x Ar common_directory
.Ar distfiles_directory
.Ar image_directory
.Sh DESCRIPTION
The
.Nm
utility produces ISO 9660 image files for
a multiple CD/DVD archive of pkgsrc distfiles.
.Pp
The
.Nm
utility archives all files and directories found in the directory
.Ar distfiles_directory
specified on the command line.
The directory
.Ar cd_image_directory
is used as a staging area and the final ISO 9660 images are left in
that directory.
A file,
.Pa .index ,
which lists the contents of each CD/DVD will be left in the root
directory of each CD/DVD image.
.Bl -tag -width "-x directory "
.It Fl d
Enable debugging by not deleting temporary files at the end of the
run.
These files are left in
.Ev TMPDIR .
.It Fl dvd
Create DVD sized images rather than the default CD-ROM sized images.
.It Fl h
.It Fl Fl help
Displays a short usage message.
.It Fl l Ar logfile
Log the output of
.Ic mkisofs Fl v Fl v
to the file
.Ar logfile .
.It Fl R
Generate a file,
.Pa README.txt ,
which will be placed in the root directory of each CD/DVD image.
This README file contains a small amount of information about the
contents of the CD/DVD set.
.It Fl V
Print the program version number and exit.
.It Fl v
Be verbose.
Currently does not change things much.
.It Fl X Ar directory
Includes the contents of
.Ar directory
on the last CD/DVD in the set.
This is useful for adding
a pkgsrc.tar.gz tarball, i.e. a file which does not
need to be on each CD/DVD.
.It Fl x Ar directory
Includes the contents of
.Ar directory
on each CD/DVD.
This is useful for README files, etc., which you want
to be present on each CD/DVD in the set.
.El
.Sh EXIT STATUS
.Ex -std cddist
.Sh ENVIRONMENT
.Nm
uses the fillowing environment variables if set.
.Bl -tag -width "TMPDIR"
.It Ev AWK
awk implementation to use.
Defaults to
.Dq Pa @AWK@ .
.It Ev TMPDIR
Directory for holding temporary files during the image creation.
Defaults to
.Dq Pa /tmp .
.El
.Sh EXAMPLES
This example takes all of the distfiles found in
.Pa /usr/pkgsrc/distfiles
and creates cd images in
.Pa /u2/images/disk{1,2,...}.iso .
The directories
.Pa /u2/images/disk{1,2,...}
are used to create the ISO 9660 layouts.
.D1 cddist /usr/pkgsrc/distfiles /u2/images
.Pp
To include a common set of files on all CD/DVD's, place them in a
directory,
.Pa /tmp/foo
in this example, and pass in the directory name with the
.Fl x
option.
.Dl cddist -x /tmp/foo /usr/pkgsrc/distfiles /u2/images
.Sh SEE ALSO
.Xr cdpack 1 ,
.Xr mkisofs 1
.Sh HISTORY
The
.Nm
utility first appeared in the
.Nx
packages collection in January, 2008.
.Sh AUTHORS
The
.Nm
utility was written by
.An Dan McMahill
.Aq dmcmahill@NetBSD.org .

533
pkgtools/cdpack/files/cddist.sh Executable file
View File

@@ -0,0 +1,533 @@
#!/bin/sh
# $NetBSD: cddist.sh,v 1.2 2009/02/20 07:50:15 wiz Exp $
#
# Copyright (c) 2008 Dan McMahill, All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. All advertising materials mentioning features or use of this software
# must display the following acknowledgement:
# This product includes software developed by Dan McMahill
# 4. The name of the author may not be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY DAN MCMAHILL
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# $0 = program name
# $2 = distfiles directory (/usr/pkgsrc/distfiles)
# $3 = output directory
prog=cddist
progver=@progver@
TMPDIR=${TMPDIR:-/tmp}
TMP=${TMPDIR}/${prog}.$$
AWK=${AWK:-@AWK@}
EXPR="@EXPR@"
PRINTF="@PRINTF@"
SORT="@SORT@"
sizes=$TMP/sizes
sorted=$TMP/sorted
cdlist=$TMP/cdlist
indexf=$TMP/indexf
readme=$TMP/readme
warnings=$TMP/warnings
rm -fr $TMP
mkdir -m 0700 $TMP
if test $? -ne 0 ; then
echo "Could not create temporary directory $TMP"
exit 1
fi
touch $exclude
usage(){
cat << EOF
$prog - generates ISO9660 images for a multi-CD/DVD pkgsrc distfiles archive
Usage: $prog [-dRVv] [-dvd] [-h|--help] [-l logfile]
[-X dir] [-x dir] distfiles_directory cdimage_directory
Example: $prog /usr/pkgsrc/packages/distfiles /images/distfiles
Please refer to the manual page for complete documentation."
EOF
echo " "
}
clean_and_exit(){
if test $# -ge 1 ; then
rc=$1
else
rc=0
fi
if [ "x$DEBUG" = "xno" ]; then
rm -fr $TMP
else
echo "Debugging output left in $TMP"
fi
exit $rc
}
# return the full path name from a path which may
# be a full path name or a relative path name
fullpath(){
local x
x=$1
case $x in
/*) # do nothing, its an absolute path
;;
*) x=`pwd`/$x
;;
esac
echo $x
}
ADD_README=no
DEBUG=no
VERBOSE=no
VERSION=no
USE_XTRA=no
USE_OTHERS=no
mkisofslog=/dev/null
DVD=no
while
test -n "$1"
do
case "$1"
in
# enable debugging
-d) DEBUG=yes
shift
;;
# make a DVD sized image
-dvd) DVD=yes
shift
;;
# help
-h|--help) usage
exit 0
;;
# log file for the output of mkisofs -v -v
-l) mkisofslog=$2
shift 2
;;
# automatically generate a README.txt file for each CD-ROM
-R) ADD_README=yes
shift
;;
# be verbose
-v) VERBOSE=yes
shift
;;
# display version
-V) VERSION=yes
shift
;;
# extra directory to go on each CD.
-x) extra=$2
USE_XTRA=yes
shift 2
;;
# extra directory to go on only 1 CD (pkgsrc.tar.gz for example)
-X) others=$2
USE_OTHERS=yes
shift 2
;;
-*) echo "$prog: ERROR: $s is not a valid option"
usage
clean_and_exit 1
;;
*) ARGS="$ARGS $1"
shift
;;
esac
done
if [ $VERSION = "yes" ]; then
echo "$prog-$progver"
clean_and_exit 0
fi
set -- $ARGS
if [ $# -ne 2 ]; then
echo "$prog: wrong number of arguments"
usage
clean_and_exit 1
fi
distfiles=$1
cddir=$2
if [ "$VERBOSE" = "yes" ]; then
echo "Verbose output is on"
if [ "$DVD" = "yes" ]; then
echo "A DVD sized image will be created"
else
echo "A CD-ROM sized image will be created"
fi
fi
#
# Make sure all required directories and files exist
#
if [ ! -d $distfiles ]; then
echo "$prog: packages directory \"$distfiles\" does not exist"
usage
clean_and_exit 1
else
distfiles=`fullpath $distfiles`
fi
if [ ! -d $cddir ]; then
echo "$prog: cd image directory \"$cddir\" does not exist"
usage
clean_and_exit 1
else
cddir=`fullpath $cddir`
fi
if [ "$USE_XTRA" = "yes" -a ! -d $extra ]; then
echo "$prog: extra directory \"$extra\" specified with -x does not exist"
usage
clean_and_exit 1
fi
if [ "$USE_XTRA" = "yes" ]; then
extra=`fullpath $extra`
XTRA_SIZE=`du -sk $extra | ${AWK} '{print $1 * 1024}'`
if [ "$VERBOSE" = "yes" ]; then
echo "Extra directory full path name is \"$extra\". It contains $XTRA_SIZE bytes."
fi
else
XTRA_SIZE=0
fi
if [ "$USE_OTHERS" = "yes" -a ! -d $others ]; then
echo "$prog: other files directory \"$others\" specified with -X does not exist"
usage
clean_and_exit 1
fi
if [ "$USE_OTHERS" = "yes" ]; then
others=`fullpath $others`
OTHER_SIZE=`du -sk $others | ${AWK} '{print $1 * 1024}'`
if [ "$VERBOSE" = "yes" ]; then
echo "Other files directory full path name is \"$others\". It contains $OTHER_SIZE bytes."
fi
else
OTHER_SIZE=0
fi
echo " "
echo "$prog starting: `date`"
echo " "
find_size() {
d=$1
if test $# -eq 1 ; then
sz=0
else
sz=$2
fi
test "$VERBOSE" = "yes" && echo "find_size $d $sz" >/dev/stderr
szf=0
if test -f $d ; then
szf=`wc -c $d | ${AWK} '{print $1}'`
elif test -d $d ; then
for f in $d/* ; do
szf=`find_size $f $szf`
done
else
echo "WARNING: I do not know what to do with" >/dev/stderr
echo " $d">/dev/stderr
echo "which is neither a file nor a directory" >/dev/stderr
fi
tot=`${EXPR} $sz + $szf`
test "$VERBOSE" = "yes" && echo " return $tot" >/dev/stderr
echo "$tot"
}
ndist=0
echo "Extracting sizes for the distfiles ..."
rm -f $sizes
here="`pwd`"
cd $distfiles
for d in *
do
case $d in
CVS)
echo "Skip CVS directory"
;;
*)
sz=`find_size $d`
echo "$d $sz" >> $sizes
ndist=`${EXPR} $ndist + 1`
esac
done
cd "$here"
echo " "
echo "Finished extracting sizes for $ndist distfiles"
echo " "
#
# sort the distfiles alphabetically
#
${SORT} $sizes > $sorted
#
# Create directories for each image and populate the directories
# with symlinks that will be resolved when we actually create the
# ISO image
#
if [ "$DVD" = "yes" ]; then
what="DVD"
space=" "
capacity=4300000000
else
what="CD-ROM"
space=""
capacity=700000000
fi
new_image() {
cdn=`${EXPR} $cdn + 1`
dest=$cddir/disk$cdn
mkdir -p $dest/distfiles
echo "disk$cdn" >> $cdlist
cds=${XTRA_SIZE}
}
cdn=0
new_image
cds=`${EXPR} $cds + ${OTHER_SIZE}`
cat $sorted | while read f s ; do
newsize=`${EXPR} $cds + $s`
# use awk instead of test because we overflow the 32 bit
# signed values used by test when we're using a DVD image
full=`echo "$newsize $capacity" | \
${AWK} '{if($1 > $2) {print "yes"} else {print "no"}}'`
if test "$full" = "no" ; then
echo "Add $f to image #$cdn to increase the size to $newsize"
cds=$newsize
ln -sf $distfiles/$f $dest/distfiles/$f
else
new_image
cds=`${EXPR} $cds + $s`
echo "Add $f to new image #$cdn with starting size $s"
ln -sf $distfiles/$f $dest/distfiles/$f
fi
done
#
# Generate a README
#
cat <<EOF > $readme
This is @DISKNAME@ of a @NDISKS@-disk ${what} collection
containing an archive of distfiles used by the NetBSD
pkgsrc system.
For information on the NetBSD package collection, please visit
the NetBSD pkgsrc homepage at
http://www.pkgsrc.org
For more information about the NetBSD project, please visit the
project's homepage at
http://www.NetBSD.org
Please do not distribute this ${what} set unless you have verified
that the individual licenses of all the distfiles allows you to.
It is anticipated that the primary use of this ${what} set is
not for distribution, but rather for archiving. Some licenses
require that if you distribute a binary package that you are willing
to provide sources on request. By archiving the distfiles, you are
ensuring that you are able to fulfill such a request.
EOF
#
# cdpack Comment
#
cat <<EOF >> $readme
This file, along with the ${what} layout was created using the
cddist program which is available as part of the cdpack package
in the NetBSD packages collection at
ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/cdpack/
EOF
#
# Generate an index file which lists the contents of each CD.
#
echo "Creating Disk Index File"
show_files() {
d="$1"
path=
if test -d "$d" ; then
for fs in $d/* ; do
show_files $fs
done
else
${PRINTF} "%-60s %s\n" $d $cdname >> $indexf
fi
}
numdisks=0
for cdname in `cat ${cdlist}`
do
if [ "$VERBOSE" = "yes" ]; then
echo "Creating index for $cdname"
fi
cd ${cddir}/${cdname}/distfiles && for d in *
do
show_files $d
done
numdisks=`${EXPR} ${numdisks} + 1`
done
mv $indexf ${indexf}.tmp
${SORT} ${indexf}.tmp > $indexf
#
# Populate the cd's with the index file and readme
# actually copy these over since the originals will
# be deleted from their temporary directories
#
# Also make symlinks to the stuff in the extra directory
# specified with the -x flag.
#
if [ "$VERBOSE" = "yes" ]; then
echo "Copying .index file to the image directories."
fi
ncds=0
for cdname in `cat $cdlist`
do
if [ -f $indexf ]; then
(cd ${cddir}/${cdname} && cp $indexf .index)
fi
if [ "$ADD_README" = "yes" ]; then
if [ "$VERBOSE" = "yes" ]; then
echo "Copying README.txt file"
fi
(cd ${cddir}/${cdname} && sed -e "s/@DISKNAME@/$cdname/g" \
-e "s/@NDISKS@/${numdisks}/g" \
< $readme > README.txt)
fi
if [ $USE_XTRA = "yes" ]; then
for f in $extra/*
do
(cd ${cddir}/${cdname} && ln -sf $f)
done
fi
ncds=`${EXPR} $ncds + 1`
done
if [ "$USE_OTHERS" = "yes" ]; then
if [ "$VERBOSE" = "yes" ]; then
echo "Creating symlinks from $others (specified with -X) to ${cddir}/${cdname}"
fi
cdname=`tail -1 $cdlist`
for f in $others/*
do
(cd ${cddir}/${cdname} && ln -sf $f)
done
fi
#
# Create the ISO Images
#
volid=DistDisk
#mkisofs_flags="-f -l -r -J -allow-leading-dots -volset-size $ncds -V $volid "
mkisofs_flags="-v -v -f -l -r -J -allow-leading-dots "
echo "Creating the ISO images"
cdn=1
for cdname in `cat $cdlist`
do
echo "----------- $cdname ----------"
#mkisofs_flags2=" -volset-ID $cdname -volset-seqno $cdn "
mkisofs_flags2=" -V ${volid}$cdn "
echo "( cd ${cddir} && mkisofs $mkisofs_flags $mkisofs_flags2 -o ${cdname}.iso $cdname >> $mkisofslog 2>&1)"
( cd ${cddir} && mkisofs $mkisofs_flags $mkisofs_flags2 -o ${cdname}.iso $cdname >> $mkisofslog 2>&1)
if [ $? != 0 ]; then
echo "mkisofs failed"
clean_and_exit 1
fi
cdn=`${EXPR} $cdn + 1`
done
echo "ISO Images are available in $cddir"
if [ -f $warnings ]; then
echo "There were warnings generated:"
cat $warnings
fi
cat <<EOF
-----------------------------------------------------------------
* Please note: This ${what} set may contain files which may ${space}*
* not be redistributed. Before you distribute this set you *
* must verify that you will not violate any licenses with this *
* ${what} set. ${space}*
-----------------------------------------------------------------
$prog finished: `date`
EOF
clean_and_exit 0

556
pkgtools/cdpack/files/cdgen.awk Executable file
View File

@@ -0,0 +1,556 @@
#!@AWK@ -f
# $NetBSD: cdgen.awk,v 1.7 2009/02/20 05:16:51 dmcmahill Exp $
#
# Copyright (c) 2001, 2002, 2003, 2005, 2009 Dan McMahill, All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. All advertising materials mentioning features or use of this software
# must display the following acknowledgement:
# This product includes software developed by Dan McMahill
# 4. The name of the author may not be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY DAN MCMAHILL
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
BEGIN {
# all of the PKG_SUFX values which are currently allowed. This is hardcoded into
# pkg_create(1) and friends.
allsf[1] = ".tgz";
allsf[2] = ".tbz";
# ARGV[0] = program name
# ARGV[1] = packages directory (/usr/pkgsrc/packages/All)
# ARGV[2] = output directory
# ARGV[3] = Depends tree file. Has packages in tsort(1) input format.
# ARGV[4] = Exclude file. Packages listed here are excluded.
# ARGV[5] = Depends order file. Has packages in tsort(1) output format.
# ARGV[6] = CD list. This script leaves a list of the CD directories in this file
# ARGV[7] = dup flag. "dup=yes" for package duplication, "dup=no" for no duplication.
# ARGV[8] = verbose flag. "verbose=yes" for verbose output
# ARGV[9] = xtra_size. How many kB are needed per CD for common files
reqnum = 12;
if (ARGC != reqnum){
printf("cdgen.awk: wrong number of arguments (got %d, wanted %d)\n", ARGC, reqnum);
usage();
exit(1);
}
prog = "cdgen.awk";
packages = ARGV[1];
cddir = ARGV[2];
deptree = ARGV[3];
exclude = ARGV[4];
order = ARGV[5];
cdlist = ARGV[6];
xtra_size= ARGV[10];
other_size= ARGV[11];
if (ARGV[7] ~ "dup=yes"){
dup=1;
}
else{
dup=0;
}
if (ARGV[8] ~ "verbose=yes"){
verbose=1;
}
if (ARGV[9] ~ "dvd=yes"){
dvd=1;
}
else{
dvd=0;
}
#
# Make sure all required directories and files exist
#
cmd="test -d " packages ;
if(system(cmd) != 0){
printf("%s: packages directory \"%s\" does not exist\n",prog,packages);
usage();
exit(1);
}
cmd="test -d " cddir ;
if(system(cmd) != 0){
printf("%s: cd image directory \"%s\" does not exist\n",prog,cddir);
usage();
exit(1);
}
cmd="test -f " deptree ;
if(system(cmd) != 0){
printf("%s: dependstree file \"%s\" does not exist\n",prog,deptree);
usage();
exit(1);
}
cmd="test -f " exclude ;
if(system(cmd) != 0){
printf("%s: exclude file \"%s\" does not exist\n",prog,exclude);
usage();
exit(1);
}
cmd="test -f " order ;
if(system(cmd) != 0){
printf("%s: build order file \"%s\" does not exist\n",prog,order);
usage();
exit(1);
}
"date" | getline now;
printf("%s starting %28s\n",prog,now);
#
# Read in the build order. This gives the list of all possible
# packages (note that some may actually not be available as binary
# packages). The order is such that a package earlier in the list
# will never depend on a package lower on the list.
#
printf("Reading the depends order from \"%s\".\n",order);
n=1;
while(getline < order > 0){
pkgorder[n] = $1;
n++;
}
close(order);
npkgs = n-1;
printf("%d packages to go on CD-ROM/DVD!\n",npkgs);
#
# Read in the list of excluded packages
#
printf("Reading list of packages to be excluded\n");
while(getline < exclude > 0){
excludes[$1] = 1 ;
}
close(exclude);
#
# Read in the depends tree and flatten it.
#
printf("Reading depends tree\n");
while(getline < deptree > 0){
if ($2 in topdepends)
topdepends[$2] = topdepends[$2] " " $1 " " ;
else
topdepends[$2] = " " $1 " " ;
}
close(deptree);
# Now recurse the tree to give a flattened depends list for each pkg
printf("Flattening depends tree\n");
for (toppkg in topdepends){
find_all_depends(toppkg);
}
#
# Next get the sizes of each of the binary pacakges if they
# exist. For those which don't exist, make a note of that.
# getsize() returns size in kB if the file exists, 0 otherwise.
#
printf("Loading binary package sizes\n");
nonzero=0;
totsize=0;
for (n in pkgorder){
pkgsize[pkgorder[n]] = getsize(pkgorder[n]);
if(pkgsize[pkgorder[n]] > 0){
nonzero++;
}
else{
printf("WARNING: binary package \"%s\" has zero size\n",pkgorder[n]);
if(!verbose) {
verbose = 1;
getsize(pkgorder[n]);
verbose = 0;
}
}
totsize = totsize + pkgsize[pkgorder[n]];
}
printf("%d binary packages are available (%g Mb)!\n",nonzero,totsize/1024);
#
# Now we need to figure out which binary packages go on each
# CD. The way we'll do this is start taking packages in the order
# specified by 'pkgorder' until the first CD is full, then move
# to the second, etc. This way, we never have to reinsert a CD
# while installing pkgs.
#
printf("Figuring out which packages go on each CD/DVD\n");
# maximum kB for binary pkgs per CD.
if( dvd )
maxcd = 1024 * 4300;
else
maxcd = 1024 * 620;
if( verbose ) printf("Maximum image size = %g Mb\n", maxcd/1024);
#
# no package duplication
#
if (!dup){
cdn=1;
pkgn=0;
cdtot[cdn]=xtra_size;
cdpkgs[cdn]=0;
for (n=1; n<=npkgs ; n=n+1){
if (verbose) printf("Processing: %s\n",pkgorder[n]);
if (pkgorder[n] in excludes) {
if (verbose) printf("Skipping excluded package: %s\n",pkgorder[n]);
}
else {
# only process the package if it exists.
if (pkgsize[pkgorder[n]] > 0){
if (cdtot[cdn] < (maxcd-pkgsize[pkgorder[n]]) ){
cdtot[cdn] = cdtot[cdn] +pkgsize[pkgorder[n]];
cdcontents[cdn":"pkgorder[n]] = 1;
pkgn = pkgn + 1;
}
else{
# the CD is full
printf("disk number %d is full (%g Mb)\n",cdn,
cdtot[cdn]/1024);
cdpkgs[cdn] = pkgn;
# increment the CD counter
cdn = cdn + 1;
pkgn = 1;
cdtot[cdn] = xtra_size + pkgsize[pkgorder[n]];
cdcontents[cdn":"pkgorder[n]] = 1;
}
}
}
}
cdpkgs[cdn] = pkgn;
# see if the extra files will fit on the last CD
if ( (cdtot[cdn] + other_size) < maxcd ){
printf("disk number %d is partially full (%g Mb)\n",cdn,
cdtot[cdn]/1024);
}
else{
printf("disk number %d is full (%g Mb)\n",cdn,
cdtot[cdn]/1024);
cdn = cdn + 1;
cdtot[cdn] = other_size;
cdpkgs[cdn] = 0;
printf("disk number %d is partially full (%g Mb)\n",cdn,
cdtot[cdn]/1024);
}
}
#
# We will duplicate some packages to eliminate inter-CD dependencies.
#
else{
cdn=1;
pkgn=0;
# initialize the size count for the current CD with the extras that we
# are putting on all CD's
cdtot[cdn]=xtra_size;
cdpkgs[cdn]=0;
n=npkgs;
while (n > 0){
if (verbose) printf("Begin processing %s\n",pkgorder[n]);
if ( !pkg_done[pkgorder[n]]){
size_needed = pkgsize[pkgorder[n]];
deps_needed = 0;
split(alldepends[pkgorder[n]],pkgdeps);
for (dep in pkgdeps){
if (verbose) printf(" Examining dependency: %s\n",pkgdeps[dep]);
if (pkgdeps[dep] in excludes) {
if (verbose) printf(" Skipping excluded dependency in count: %s\n",pkgdeps[dep]);
}
else {
if(!cdcontents[cdn":"pkgdeps[dep]]){
size_needed = size_needed + pkgsize[pkgdeps[dep]];
deps_needed++;
}
}
}
if (cdtot[cdn] + size_needed < maxcd){
if (verbose) printf(" Processing %s\n",pkgorder[n]);
if (pkgorder[n] in excludes) {
if (verbose) printf(" Skipping excluded package in packing: %s\n",pkgorder[n]);
}
else {
cdcontents[cdn":"pkgorder[n]] = 1;
}
pkg_done[pkgorder[n]] = 1;
if (verbose) printf(" Marked %s as processed\n",pkgorder[n]);
for (dep in pkgdeps){
if (pkgdeps[dep] in excludes) {
if (verbose) printf(" Skipping excluded dependency in packing: %s\n",pkgdeps[dep]);
}
else {
cdcontents[cdn":"pkgdeps[dep]] = 1;
pkg_done[pkgdeps[dep]] = 1;
if (verbose) printf(" Marked dependency pkg %s as processed\n",pkgdeps[dep]);
}
}
cdtot[cdn] = cdtot[cdn] + size_needed;
if (pkgorder[n] in excludes) {
# don't include this one in the count if its excluded
if (verbose) printf(" Added %d dependencies to the image\n",deps_needed);
pkgn = pkgn + deps_needed;
}
else {
if (verbose) printf(" Added %s plus %d dependencies to the image\n",pkgorder[n],deps_needed);
pkgn = pkgn + 1 + deps_needed;
}
n--;
}
else{
# the CD is full
printf("disk number %d is full (%g Mb)\n",cdn,
cdtot[cdn]/1024);
cdpkgs[cdn] = pkgn;
cdn++;
cdtot[cdn] = xtra_size;
pkgn = 0;
}
}
else{
# we've already done this pkg
if (verbose) printf(" %s has already been processed\n",pkgorder[n]);
n--;
}
}
cdpkgs[cdn] = pkgn;
# see if the extra files will fit on the last CD
if ( (cdtot[cdn] + other_size) < maxcd ){
printf("disk number %d is partially full (%g Mb)\n",cdn,
cdtot[cdn]/1024);
}
else{
printf("disk number %d is full (%g Mb)\n",cdn,
cdtot[cdn]/1024);
cdn = cdn + 1;
cdtot[cdn] = other_size;
cdpkgs[cdn] = 0;
printf("disk number %d is partially full (%g Mb)\n",cdn,
cdtot[cdn]/1024);
}
}
# remember how many cd's there are
ncd=cdn;
# print some stats
tot_ex=0;
for (ex in excludes){
tot_ex++;
}
if (dup){
tot_cdpkgs=0;
for (cdn=1; cdn<=ncd; cdn=cdn+1){
tot_cdpkgs = tot_cdpkgs + cdpkgs[cdn];
}
printf("CD/DVD images with package duplication resulted in %d packages total\n",tot_cdpkgs);
printf("This is an increase of %d over the base %d packages\n",tot_cdpkgs-(npkgs-tot_ex),npkgs-tot_ex);
}
printf("%d packages out of %d have been excluded due to redistribution restrictions\n",tot_ex,npkgs);
#
# Next, create a subdirectory for each CD and populate the directory
# with links to the actual binary pkgs
#
printf("Creating subdirectories for each CD/DVD and populating it with links\n");
printf("to the binary packages and other required files.\n");
for (cdn=1; cdn<=ncd; cdn=cdn+1){
printf("----------- CD/DVD #%d ----------\n",cdn);
printf(" %3d binary packages\n",cdpkgs[cdn]);
outdir=cddir "/disk" cdn "/packages/All";
cmd="test -d " outdir;
if(system(cmd) == 0){
printf("%10s: output dir \"%s\" already exists.\n",prog,outdir);
printf("%10s please remove it.\n","");
exit(1);
}
# create output directory
cmd = "mkdir -p " outdir;
do_system(cmd);
# populate it with the symlinks to the binary packages
for (n=1; n<=npkgs; n++){
if (cdcontents[cdn":"pkgorder[n]]){
for(i in allsf) {
cmd="test -f " packages "/" pkgorder[n] allsf[i];
if( (r = system(cmd)) == 0){
cmd = "cd " outdir " && ln -s " packages "/" ;
cmd = cmd pkgorder[n] allsf[i];
do_system(cmd);
}
}
}
}
# add it to the cd list
printf("disk%d\n", cdn) > cdlist ;
}
close(cdlist);
"date" | getline now;
printf("%s finished on %28s\n",prog,now);
printf("\n");
exit 0
} # BEGIN
# This is a bit of a hack, but in the event that we have both a
# foo-1.3.tgz and a foo-1.3.tbz, we currently take them both.
# I'm not sure how we avoid this. One option is a flag to
# cdpack that says to prefer the .tbz over the .tgz for example.
# To implement that, the cdpack.sh shell script would need some
# updating as well as this function. Grep for ".tgz" in
# pkgsrc/pkgutils/cdpack/files/* and also grep for allsf in this file
function getsize(name,cmd,sz,i,pkgsfx,r){
sz=0;
for(i in allsf) {
pkgsfx=allsf[i];
cmd="test -f " packages "/" name pkgsfx;
if( verbose ) {
printf("getsize(%s): Checking for suffix \"%s\" with:\n", name, pkgsfx);
printf(" %s\n", cmd);
}
if( (r = system(cmd)) == 0){
cmd="du -k " packages "/" name pkgsfx;
cmd | getline ;
close(cmd);
if( verbose ) {
printf(" \"%s\" gave %s\n", cmd, $0);
}
sz=sz + $1;
} else {
if( verbose ) {
printf(" command returned %d\n", r);
}
}
}
return(sz);
}
function do_system(cmd,rv){
rv = system(cmd);
if (rv != 0){
printf("Error: system(\"%s\") returned %d\n",cmd,rv);
exit(1);
}
return(0);
}
#
# show usage
#
function usage(){
printf("\nUsage:\n\n");
printf("%10s -- Create directories for building binary package ISO images\n",
prog,prog);
printf("%10s packages images dependstree order cdlist\n","");
printf("\n");
printf("\n");
}
function find_all_depends(pkg,pkgreg,i,deps){
# if we find the package already has been fully depended
# then return the depends list
if (pkg in alldepends){
# printf("\t%s is already depended.\n",pkg);
return(alldepends[pkg]);
}
# if we find the package listed in its own depends list, then
# return an empty list if we're going down the depends tree.
# When a package lists itself in the depends tree file, it simply
# is a place holder and means the package has no depends. However
# other packages may still depend upon it, so we need to keep looking.
if ( topdepends[pkg]~reg2str(pkg) ){
# printf("\t%s depends on its self.\n",pkg);
alldepends[pkg] = " ";
return(alldepends[pkg]);
}
# otherwise recursively gather depends that each of the depends
# has
pkgreg=reg2str(pkg);
split(topdepends[pkg],deps);
i=1;
alldepends[pkg] = " ";
while ( i in deps ){
# don't add ourselves to the list (a possibility when going up the tree)
if (" "deps[i]" "!~pkgreg){
alldepends[pkg] = alldepends[pkg] " " deps[i] " " find_all_depends(deps[i]);
}
i=i+1;
}
alldepends[pkg] = uniq(alldepends[pkg]);
return(alldepends[pkg]);
}
#
# take a string which has special characters like '+' in it and
# escape them. Also put a space before and after since that's how
# we'll distinguish things like gnome from gnome-libs
#
function reg2str(reg){
gsub(/\+/,"\\\+",reg);
gsub(/\./,"\\\.",reg);
reg = " "reg" ";
return(reg);
}
#
# take the depends lists and uniq them.
#
function uniq(list,deps,i,ulist){
# split out the depends
split(list,deps);
i=1;
ulist = " ";
while (i in deps){
if (ulist !~reg2str(deps[i])){
ulist = ulist deps[i]" ";
}
i++;
}
return(ulist);
}

View File

@@ -0,0 +1,242 @@
.\" $NetBSD: cdpack.1,v 1.15 2009/02/20 07:41:15 wiz Exp $
.\"
.\" Copyright (c) 2001, 2002, 2003, 2005 Dan McMahill, All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by Dan McMahill
.\" 4. The name of the author may not be used to endorse or promote
.\" products derived from this software without specific prior written
.\" permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY DAN MCMAHILL
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd February 20, 2009
.Dt CDPACK 1
.Os
.Sh NAME
.Nm cdpack
.Nd produce multi-CD/DVD binary package images
.Sh SYNOPSIS
.Nm
.Op -dnRVv
.Op -ac | -ec
.Op -af | -ef
.Op -dvd
.Op -h | --help
.Op -l logfile
.Op -m machine_architecture
.Op -o operating_system
.Op -r os_version
.Op -X extras_directory
.Op -x common_directory
.Ar packages_directory
.Ar cd_image_directory
.Sh DESCRIPTION
The
.Nm
utility produces ISO 9660 image files for
a multiple CD/DVD collection of binary packages.
.Pp
The
.Nm
utility extracts the dependency information from the binary
packages in the directory
.Ar packages_directory
specified on the command line.
The dependency information is
used to determine which packages are placed on which CD/DVD.
The directory
.Ar cd_image_directory
is used as a staging area and the final ISO 9660 images are left in
that directory.
A file,
.Pa .index ,
which lists the contents of each CD/DVD will be left in the root
directory of each CD/DVD image.
.Nm
will look for files ending both in
.Pa .tgz
as well as
.Pa .tbz
when scanning the directory
.Ar packages_directory
for binary packages.
.Bl -tag -width "-x directory "
.It Fl ac
Include binary packages marked as
.Dv NO_BIN_ON_CDROM
on the CD/DVD set.
The default is to omit any packages which were marked as
.Dv NO_BIN_ON_CDROM .
This option should
only be used when making a CD/DVD set for personal use and not for
distribution unless you are sure you have not violated any licenses.
.It Fl af
Include binary packages marked as
.Dv NO_BIN_ON_FTP
on the CD/DVD set.
This option is enabled by default.
.It Fl d
Enable debugging by not deleting temporary files at the end of the
run.
These files are left in
.Ev TMPDIR .
.It Fl dvd
Create DVD sized images rather than the default CD-ROM sized images.
.It Fl ec
Exclude packages marked as
.Dv NO_BIN_ON_CDROM
from the CD/DVD set.
This is the default.
.It Fl ef
Exclude packages marked as
.Dv NO_BIN_ON_FTP
from the CD/DVD set.
The default is to allow packages which are
.Dv NO_BIN_ON_FTP .
.It Fl h
.It Fl Fl help
Displays a short usage message.
.It Fl l Ar logfile
Log the output of
.Ic mkisofs Fl v Fl v
to the file
.Ar logfile .
.It Fl m Ar machine_architecture
Specifies
.Ar machine_architecture
as the target architecture for the binary packages in the generated
README file.
.It Fl n
Do not duplicate packages in order to prevent inter-CD/DVD dependencies.
The default without the
.Fl n
option will place a package and all of its dependencies on the same
CD/DVD.
If a particular package is also required by pacakges on other
CD/DVD's, it will be placed there as well.
When the
.Fl n
option is used packages are not duplicated.
This results in slightly smaller ISO 9660 images.
.Nm
places packages which are lower in the dependency tree on lower
numbered CD/DVD's and packages which are higher on the higher numbered
CD/DVD's.
In this fashion, a package on CD/DVD number n
will have all of its dependencies on CD/DVD numbers 1 through n
.It Fl o Ar operating_system
Specifies
.Ar operating_system
as the target operating system for the binary packages in the
generated README file.
.It Fl R
Generate a file,
.Pa README.txt ,
which will be placed in the root directory of each CD/DVD image.
This README file contains a small amount of information about the contents
of the CD/DVD set.
.It Fl r Ar os_version
Specifies
.Ar os_version
as the target operating system version for the binary packages in
the generated README file.
.It Fl V
Print the program version number and exit.
.It Fl v
Be verbose.
Currently does not change things much.
.It Fl X Ar directory
Includes the contents of
.Ar directory
on the last CD/DVD in the set.
This is useful for adding
a pkgsrc.tar.gz tarball, i.e. a file which does not
need to be on each CD/DVD.
.It Fl x Ar directory
Includes the contents of
.Ar directory
on each CD/DVD.
This is useful for README files, etc., which you want
to be present on each CD/DVD in the set.
.Sh EXIT STATUS
.Ex -std cdpack
.Sh ENVIRONMENT
.Nm
uses the fillowing environment variables if set.
.Bl -tag -width "TMPDIR"
.It Ev AWK
awk implementation to use.
Defaults to
.Dq Pa @AWK@ .
.It Ev BZCAT
bzcat implementation to use.
Defaults to
.Dq Pa @BZCAT@ .
.It Ev GZCAT
gzcat implementation to use.
Defaults to
.Dq Pa @GZCAT@ .
.It Ev TMPDIR
Directory for holding temporary files during the image creation.
Defaults to
.Dq Pa /tmp .
.El
.Sh EXAMPLES
This example takes all of the binary packages found in
.Pa /usr/pkgsrc/packages/All
and creates cd images in
.Pa /u2/cdimages/cd{1,2,...}.iso .
The directories
.Pa /u2/cdimages/cd{1,2,...}
are used to create the ISO 9660 layouts.
.D1 cdpack /usr/pkgsrc/packages/All /u2/cdimages
.Pp
To include a common set of files on all CD/DVD's, place them in a
directory,
.Pa /tmp/foo
in this example, and pass in the directory name
with the
.Fl x
option.
.Dl cdpack -x /tmp/foo /usr/pkgsrc/packages/All /u2/cdimages
.Sh SEE ALSO
.Xr cddist 1 ,
.Xr mkisofs 1
.Sh HISTORY
The
.Nm
utility first appeared in the
.Nx
packages collection in April, 2001.
.Sh AUTHORS
.An -nosplit
The
.Nm
utility was written by
.An Dan McMahill
.Aq dmcmahill@NetBSD.org .
The
idea of duplicating packages to eliminate inter-CD/DVD dependencies
came from
.An Todd Vierling
.Aq tv@NetBSD.org .

730
pkgtools/cdpack/files/cdpack.sh Executable file
View File

@@ -0,0 +1,730 @@
#!/bin/sh
# $NetBSD: cdpack.sh,v 1.14 2009/02/20 07:50:15 wiz Exp $
#
# Copyright (c) 2001, 2002, 2003, 2005, 2009 Dan McMahill, All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. All advertising materials mentioning features or use of this software
# must display the following acknowledgement:
# This product includes software developed by Dan McMahill
# 4. The name of the author may not be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY DAN MCMAHILL
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# $0 = program name
# $2 = packages directory (/usr/pkgsrc/packages/All)
# $3 = output directory
prog=cdpack
progver=@progver@
TMPDIR=${TMPDIR:-/tmp}
TMP=${TMPDIR}/${prog}.$$
AWK=${AWK:-@AWK@}
BZCAT=${BZCAT:-@BZCAT@}
EXPR="@EXPR@"
GZCAT=${GZCAT:-@GZCAT@}
SORT="@SORT@"
TAR="${TAR:-@TAR@}"
TSORT="@TSORT@"
depf=$TMP/depf
depf2=$TMP/depf2
deptree=$TMP/deptree
exclude=$TMP/exclude
order=$TMP/order
cdlist=$TMP/cdlist
indexf=$TMP/indexf
readme=$TMP/readme
warnings=$TMP/warnings
restricted=$TMP/restricted
rm -fr $TMP
mkdir $TMP
touch $exclude
usage(){
echo " "
echo "$prog - generates ISO9660 images for a multi-CD/DVD binary package collection"
echo "Usage: $prog [-dnRVv] [-ac | -ec] [-af | -ef] [-dvd] [-h|--help]"
echo " [-l logfile] [-m machine] [-o opsys] [-r release]"
echo " [-X dir] [-x dir] packages_directory cdimage_directory"
echo "Example: $prog /usr/pkgsrc/packages/All /images/netbsd-1.5/alpha"
echo "Please refer to the manual page for complete documentation."
echo " "
}
clean_and_exit(){
if [ "x$DEBUG" = "xno" ]; then
rm -fr $TMP
else
echo "Debugging output left in $TMP"
fi
exit 1
}
# return the full path name from a path which may
# be a full path name or a relative path name
fullpath(){
local x
x=$1
case $x in
/*) # do nothing, its an absolute path
;;
*) x=`pwd`/$x
;;
esac
echo $x
}
ADD_README=no
ARCH=`uname -m`
DEBUG=no
DUP=yes
OS=`uname -s`
RELEASE=`uname -r`
VERBOSE=no
VERSION=no
USE_XTRA=no
USE_OTHERS=no
mkisofslog=/dev/null
ALLOW_NO_BIN_ON_CDROM=no
ALLOW_NO_BIN_ON_FTP=yes
DVD=no
while
test -n "$1"
do
case "$1"
in
# allow NO_BIN_ON_CDROM packages
-ac) ALLOW_NO_BIN_ON_CDROM=yes
shift
;;
# allow NO_BIN_ON_FTP packages
-af) ALLOW_NO_BIN_ON_FTP=yes
shift
;;
# enable debugging
-d) DEBUG=yes
shift
;;
# make a DVD sized image
-dvd) DVD=yes
shift
;;
# exclude NO_BIN_ON_CDROM packages
-ec) ALLOW_NO_BIN_ON_CDROM=no
shift
;;
# exclude NO_BIN_ON_FTP packages
-ef) ALLOW_NO_BIN_ON_FTP=no
shift
;;
# help
-h|--help) usage
exit 0
;;
# log file for the output of mkisofs -v -v
-l) mkisofslog=$2
shift 2
;;
# target machine architecture for these packages
-m) ARCH=$2
shift 2
;;
# do not duplicate packages to avoid inter-CD dependencies
-n) DUP=no
shift
;;
# target os for these packages
-o) OS=$2
shift 2
;;
# target os version for these packages
-r) RELEASE=$2
shift 2
;;
# automatically generate a README.txt file for each CD-ROM
-R) ADD_README=yes
shift
;;
# be verbose
-v) VERBOSE=yes
shift
;;
# display version
-V) VERSION=yes
shift
;;
# extra directory to go on each CD.
-x) extra=$2
USE_XTRA=yes
shift 2
;;
# extra directory to go on only 1 CD (pkgsrc.tar.gz for example)
-X) others=$2
USE_OTHERS=yes
shift 2
;;
-*) echo "$prog: ERROR: $s is not a valid option"
usage
clean_and_exit
;;
*) ARGS="$ARGS $1"
shift
;;
esac
done
if [ $VERSION = "yes" ]; then
echo "$prog-$progver"
rm -fr $TMP
exit 0
fi
set -- $ARGS
if [ $# -ne 2 ]; then
echo "$prog: wrong number of arguments"
usage
clean_and_exit
fi
packages=$1
cddir=$2
if [ "$VERBOSE" = "yes" ]; then
echo "Verbose output is on"
if [ "$ALLOW_NO_BIN_ON_CDROM" = "yes" ]; then
echo "NO_BIN_ON_CDROM Packages will be included in the images"
else
echo "NO_BIN_ON_CDROM Packages will be excluded in the images"
fi
if [ "$ALLOW_NO_BIN_ON_FTP" = "yes" ]; then
echo "NO_BIN_ON_FTP Packages will be included in the images"
else
echo "NO_BIN_ON_FTP Packages will be excluded in the images"
fi
if [ "$DVD" = "yes" ]; then
echo "A DVD sized image will be created"
else
echo "A CD-ROM sized image will be created"
fi
cat << EOF
The following tools will be used:
AWK = ${AWK}
BZCAT = ${BZCAT}
EXPR = ${EXPR}
GZCAT = ${GZCAT}
SORT = ${SORT}
TAR = ${TAR}
TSORT = ${TSORT}
EOF
fi
#
# Make sure all required directories and files exist
#
if [ ! -d $packages ]; then
echo "$prog: packages directory \"$packages\" does not exist"
usage
clean_and_exit
else
packages=`fullpath $packages`
fi
if [ ! -d $cddir ]; then
echo "$prog: cd image directory \"$cddir\" does not exist"
usage
clean_and_exit
else
cddir=`fullpath $cddir`
fi
if [ "$USE_XTRA" = "yes" -a ! -d $extra ]; then
echo "$prog: extra directory \"$extra\" specified with -x does not exist"
usage
clean_and_exit
fi
if [ "$USE_XTRA" = "yes" ]; then
extra=`fullpath $extra`
XTRA_SIZE=`du -sk $extra | ${AWK} '{print $1}'`
if [ "$VERBOSE" = "yes" ]; then
echo "Extra directory full path name is \"$extra\". It contains $XTRA_SIZE kB."
fi
else
XTRA_SIZE=0
fi
if [ "$USE_OTHERS" = "yes" -a ! -d $others ]; then
echo "$prog: other files directory \"$others\" specified with -X does not exist"
usage
clean_and_exit
fi
if [ "$USE_OTHERS" = "yes" ]; then
others=`fullpath $others`
OTHER_SIZE=`du -sk $others | ${AWK} '{print $1}'`
if [ "$VERBOSE" = "yes" ]; then
echo "Other files directory full path name is \"$others\". It contains $OTHER_SIZE kB."
fi
else
OTHER_SIZE=0
fi
echo " "
echo "$prog starting: `date`"
echo " "
#
# go through all the binary packages and extract their run depends and
# also any package conflicts.
#
# $deptree = this file contains a tsort(1) run depends tree using
# binary package names.
#
npkgs=0
echo "Extracting all dependency information for the binary packages..."
for pkg in $packages/*
do
case $pkg in
# this allows foo.tgz to have a foo.txt containing some readme info
# about the file to exist without throwing off cdpack.
*.txt)
continue
;;
*.tbz)
pkg_sufx=.tbz
ZCAT=${BZCAT}
;;
*.tgz)
pkg_sufx=.tgz
ZCAT=${GZCAT}
;;
esac
if [ -f $pkg ]; then
# extract the packge name
pkgname=`basename $pkg $pkg_sufx`
# extract the packing list
cat $pkg | (cd $TMP; $ZCAT - | ${TAR} --fast-read -xf - +BUILD_INFO +CONTENTS)
# extract the depends
deps=`${AWK} '/^@pkgdep/ {printf("%s ",$2)}' $TMP/+CONTENTS`
# extract any conflicts
cfls=`${AWK} '/^@pkgcfl/ {printf("%s ",$2)}' $TMP/+CONTENTS`
# check to see if we're allowed to add this package to the CD set
NO_BIN_ON_CDROM=`${AWK} -F "=" '/NO_BIN_ON_CDROM/ {print $2}' $TMP/+BUILD_INFO`
if [ ! -z "$NO_BIN_ON_CDROM" ]; then
if [ "$ALLOW_NO_BIN_ON_CDROM" = "no" ]; then
echo "EXCLUDED $pkgname: NO_BIN_ON_CDROM=$NO_BIN_ON_CDROM" >> $restricted
if [ "$VERBOSE" = "yes" ]; then
echo "Excluding $pkg because NO_BIN_ON_CDROM=$NO_BIN_ON_CDROM"
echo "$pkgname" >> $exclude
fi
else
echo "INCLUDED $pkgname: NO_BIN_ON_CDROM=$NO_BIN_ON_CDROM" >> $restricted
fi
fi
NO_BIN_ON_FTP=`${AWK} -F "=" '/NO_BIN_ON_FTP/ {print $2}' $TMP/+BUILD_INFO`
if [ ! -z "$NO_BIN_ON_FTP" ]; then
if [ "$ALLOW_NO_BIN_ON_FTP" = "no" ]; then
echo "EXCLUDED $pkgname: NO_BIN_ON_FTP=$NO_BIN_ON_FTP" >> $restricted
if [ "$VERBOSE" = "yes" ]; then
echo "Excluding $pkg because NO_BIN_ON_FTP=$NO_BIN_ON_FTP"
echo "$pkgname" >> $exclude
fi
else
echo "INCLUDED $pkgname: NO_BIN_ON_FTP=$NO_BIN_ON_FTP" >> $restricted
fi
fi
# cleanup
rm $TMP/+CONTENTS $TMP/+BUILD_INFO
# store the results
echo "$pkgname | $deps | $cfls" >> $depf
# also process all of the listed depends with
# 'pkg_admin lsbest' to handle glob patterns
bestdeps=" "
listed=no
if [ ! -z "$deps" ]; then
for dep in $deps
do
best=`/usr/sbin/pkg_admin lsbest "${packages}/${dep}"`
if [ ! -z "$best" ]; then
best=`basename $best .tgz`
best=`basename $best .tbz`
bestdeps=$bestdeps" "$best
echo "$best $pkgname" >> $deptree
listed=yes
else
echo "WARNING: $pkgname depends on \"$dep\" which was not found"
echo "WARNING: $pkgname depends on \"$dep\" which was not found" >> $warnings
fi
done
fi
if [ "$listed" = "no" ]; then
# make sure we add ourselves to the tree if we have no depends or if the
# depends were not found
echo "$pkgname $pkgname" >> $deptree
fi
echo "$pkgname | $bestdeps | $cfls | $pkg_sufx" >> $depf2
npkgs=`${EXPR} $npkgs + 1`
else
# Don't bomb out on 1 package
echo "$prog: warning: $pkg not readable"
fi
done
echo " "
echo "Finished extracting dependencies and conflicts for $npkgs binary packages"
echo " "
#
# sort the packages in dependency order
#
mv $deptree ${deptree}.bak
${SORT} -u ${deptree}.bak > ${deptree}
${TSORT} $deptree > $order
#
# Run the awk program which figures out which packages go on which CD.
# This program also creates subdirectories and populates them with
# links to the actual binary pacakges.
#
# packages = ARGV[1];
# cddir = ARGV[2];
# deptree = ARGV[3];
# exclude = ARGV[4];
# order = ARGV[5];
# cdlist = ARGV[6];
#
if [ "$VERBOSE" = "yes" ]; then
echo "${AWK} -f @prefix@/libexec/cdgen.awk $packages $cddir $deptree $exclude $order $cdlist dup=$DUP verbose=$VERBOSE dvd=$DVD $XTRA_SIZE $OTHER_SIZE"
fi
${AWK} -f @prefix@/libexec/cdgen.awk $packages $cddir $deptree $exclude $order $cdlist dup=$DUP verbose=$VERBOSE dvd=$DVD $XTRA_SIZE $OTHER_SIZE
if [ $? -ne 0 ]; then
echo "$prog: ERROR: cdgen.awk has failed"
clean_and_exit
fi
#
# Generate a README
#
if [ "$DVD" = "yes" ]; then
what="DVD"
space=" "
else
what="CD-ROM"
space=""
fi
cat <<EOF > $readme
This is @DISKNAME@ of a @NDISKS@-disk ${what} collection
containing binary packages for version ${RELEASE} of
the ${OS} operating system running on a ${ARCH} platform.
These binary packages were created with the NetBSD packages
colection (pkgsrc). For information on the NetBSD package
collection, please visit the NetBSD pkgsrc homepage at
http://www.pkgsrc.org
For more information about the NetBSD project, please visit the
project's homepage at
http://www.NetBSD.org
EOF
if [ "$DUP" = "yes" ]; then
cat <<EOF >> $readme
The packages on this ${what} have been arranged to eliminate all
inter-${what} dependencies. In other words, each package on this
${what} should have all of its dependencies (if they are allowed
to be provided on a ${what}) present on the same ${what}.
Installation of an individual package on this ${what} should not
require any swapping of media. Some packages may be duplicated on
multiple ${what}s.
EOF
else
cat <<EOF >> $readme
The packages on this ${what} have been arranged by order of their
dependencies across the entire @NDISKS@ set of ${what}s. This allows
you to make a single pass through the ${what} set when installing
any group of pacakges provided on the set, or when installing or
loading the entire collection.
EOF
fi
#
# NO_BIN_ON_CDROM Comment
#
if [ "$ALLOW_NO_BIN_ON_CDROM" = "no" ]; then
cat <<EOF >> $readme
All packages with NO_BIN_ON_CDROM set have been excluded from
this ${what} collection.
EOF
else
cat <<EOF >> $readme
This ${what} collection includes packages with NO_BIN_ON_CDROM set.
Please do not violate license agreements by selling this ${what}
without verifying that you are allowed to. A list of these
packages may be found in the ".restricted" file on this ${what}.
EOF
fi
#
# NO_BIN_ON_FTP Comment
#
if [ "$ALLOW_NO_BIN_ON_FTP" = "no" ]; then
cat <<EOF >> $readme
All packages with NO_BIN_ON_FTP set have been excluded from
this ${what} collection.
EOF
else
cat <<EOF >> $readme
This ${what} collection includes packages with NO_BIN_ON_FTP set.
Please do not violate license agreements by placing this image or
its contents on a public FTP site without verifying that you are
allowed to. A list of these packages may be found in the
".restricted" file on this ${what}.
EOF
fi
#
# cdpack Comment
#
cat <<EOF >> $readme
This file, along with the ${what} layout was created using the
cdpack program which is available as part of the NetBSD
packages collection at
ftp://ftp.NetBSD.org/pub/NetBSD/packages/pkgsrc/pkgtools/cdpack/
EOF
#
# Generate an index file which lists the contents of each CD.
#
echo "Creating Disk Index File"
numdisks=0
for cdname in `cat ${cdlist}`
do
#
# cdgen shouldn't have included any restricted pkgs, but
# make 100% sure now!
#
if [ "$VERBOSE" = "yes" ]; then
echo "Removing any leftover restricted packages from $cdname"
fi
for pkg in `cat $exclude`
do
rm -f ${cddir}/${cdname}/packages/*/$pkg
done
if [ "$VERBOSE" = "yes" ]; then
echo "Creating index for $cdname"
fi
for pkg in ${cddir}/${cdname}/packages/All/*
do
echo "`basename $pkg` $cdname" >> $indexf
done
numdisks=`${EXPR} ${numdisks} + 1`
done
mv $indexf ${indexf}.tmp
${SORT} ${indexf}.tmp > $indexf
#
# Populate the cd's with the index file and readme
# actually copy these over since the originals will
# be deleted from their temporary directories
#
# Also make symlinks to the stuff in the extra directory
# specified with the -x flag.
#
if [ "$VERBOSE" = "yes" ]; then
echo "Copying .index and .restricted files to the image directories."
fi
ncds=0
for cdname in `cat $cdlist`
do
if [ -f $indexf ]; then
(cd ${cddir}/${cdname} && cp $indexf .index)
fi
if [ -f $restricted ]; then
(cd ${cddir}/${cdname} && cp $restricted .restricted)
fi
if [ "$ADD_README" = "yes" ]; then
if [ "$VERBOSE" = "yes" ]; then
echo "Copying README.txt file"
fi
(cd ${cddir}/${cdname} && sed -e "s/@DISKNAME@/$cdname/g" \
-e "s/@NDISKS@/${numdisks}/g" \
< $readme > README.txt)
fi
if [ $USE_XTRA = "yes" ]; then
for f in $extra/*
do
(cd ${cddir}/${cdname} && ln -sf $f)
done
fi
ncds=`${EXPR} $ncds + 1`
done
if [ "$USE_OTHERS" = "yes" ]; then
if [ "$VERBOSE" = "yes" ]; then
echo "Creating symlinks from $others (specified with -X) to ${cddir}/${cdname}"
fi
cdname=`tail -1 $cdlist`
for f in $others/*
do
(cd ${cddir}/${cdname} && ln -sf $f)
done
fi
#
# Create the ISO Images
#
volid=PkgsrcDisk
#mkisofs_flags="-f -l -r -J -allow-leading-dots -volset-size $ncds -V $volid "
mkisofs_flags="-v -v -f -l -r -J -allow-leading-dots "
echo "Creating the ISO images"
cdn=1
for cdname in `cat $cdlist`
do
echo "----------- $cdname ----------"
#mkisofs_flags2=" -volset-ID $cdname -volset-seqno $cdn "
mkisofs_flags2=" -V ${volid}$cdn "
echo "( cd ${cddir} && mkisofs $mkisofs_flags $mkisofs_flags2 -o ${cdname}.iso $cdname >> $mkisofslog 2>&1)"
( cd ${cddir} && mkisofs $mkisofs_flags $mkisofs_flags2 -o ${cdname}.iso $cdname >> $mkisofslog 2>&1)
if [ $? != 0 ]; then
echo "mkisofs failed"
clean_and_exit
fi
cdn=`${EXPR} $cdn + 1`
done
echo "ISO Images are available in $cddir"
if [ -f $warnings ]; then
echo "There were warnings generated:"
cat $warnings
fi
echo "-----------------------------------------------------------"
echo "* Please note: This ${what} set was created with ${space}*"
echo "* *"
if [ "$ALLOW_NO_BIN_ON_CDROM" = "no" ]; then
echo "* - NO_BIN_ON_CDROM packages excluded. *"
else
echo "* - NO_BIN_ON_CDROM packages INCLUDED. Please *"
echo "* verify that you will not violate any licenses *"
echo "* with this ${what} set. Refer to the /.restricted ${space}*"
echo "* file which has been placed on each ${what} in the ${space}*"
echo "* set for details. *"
fi
echo "* *"
if [ "$ALLOW_NO_BIN_ON_FTP" = "no" ]; then
echo "* - NO_BIN_ON_FTP packages excluded. *"
else
echo "* - NO_BIN_ON_FTP packages INCLUDED. You should *"
echo "* not make this ${what} set available via FTP as it ${space}*"
echo "* would violate the license on one or more *"
echo "* packages. Refer to the /.restricted file *"
echo "* which has been placed on each ${what} in the ${space}*"
echo "* set for details. *"
fi
echo "* *"
echo "-----------------------------------------------------------"
echo " "
echo "$prog finished: `date`"
echo " "
if [ "x$DEBUG" = "xno" ]; then
rm -fr $TMP
else
echo "Debugging output left in $TMP"
fi
exit 0

View File

@@ -0,0 +1,9 @@
This package attempts to resolve deficiencies in system headers by
providing missing types, definitions and prototypes in shadow headers.
When use of compat_headers has been enabled on a platform, this package will
become a compile-time dependency for every package. It will provide customized
header files that take preference over some system provided ones (that may
not even exist). This happens transparently through use of buildlink3.
To enable use of this package, set FIX_SYSTEM_HEADERS=yes in mk.conf.

View File

@@ -0,0 +1,23 @@
# $NetBSD: Makefile,v 1.8 2013/04/06 03:45:21 rodent Exp $
DISTNAME= compat_headers-0.2
CATEGORIES= pkgtools
MASTER_SITES= # empty
DISTFILES= # empty
MAINTAINER= pkgsrc-users@NetBSD.org
HOMEPAGE= http://www.pkgsrc.org/
COMMENT= Compatibility headers
PREV_PKGPATH= pkgtools/posix_headers
SUPERSEDES= posix_headers-[0-9]*
CHECK_PERMS= no
GNU_CONFIGURE= yes
PLIST_SRC+= ${WRKSRC}/PLIST
do-extract:
cp -R ${FILESDIR} ${WRKSRC}
.include "../../mk/bsd.pkg.mk"

View File

@@ -0,0 +1,13 @@
# $NetBSD: buildlink3.mk,v 1.3 2009/03/20 19:25:13 joerg Exp $
BUILDLINK_TREE+= compat_headers
.if !defined(COMPAT_HEADERS_BUILDLINK3_MK)
COMPAT_HEADERS_BUILDLINK3_MK:=
BUILDLINK_API_DEPENDS.compat_headers+= compat_headers>=0.2
BUILDLINK_PKGSRCDIR.compat_headers?= ../../pkgtools/compat_headers
BUILDLINK_DEPMETHOD.compat_headers?= build
.endif # COMPAT_HEADERS_BUILDLINK3_MK
BUILDLINK_TREE+= -compat_headers

View File

@@ -0,0 +1,69 @@
# $NetBSD: Makefile.in,v 1.3 2008/05/25 18:32:28 tnn Exp $
REPLACE_stdint= @REPLACE_stdint@
REPLACE_inttypes= @REPLACE_inttypes@
REPLACE_resolv= @REPLACE_resolv@
REPLACE_sys_select= @REPLACE_sys_select@
REPLACE_math= @REPLACE_math@
REPLACE_stdlib= @REPLACE_stdlib@
REPLACE_stdarg= @REPLACE_stdarg@
PREFIX= @prefix@
DESTDIR?=
INSTALL= @INSTALL@
all: .PHONY
.if ${REPLACE_stdint} == "yes"
./mkhdr.sh stdint.h < stdint.h.in > stdint.h
.endif
.if ${REPLACE_inttypes} == "yes"
./mkhdr.sh inttypes.h < inttypes.h.in > inttypes.h
.endif
.if ${REPLACE_resolv} == "yes"
./mkhdr.sh resolv.h < resolv.h.in > resolv.h
.endif
.if ${REPLACE_sys_select} == "yes"
./mkhdr.sh sys/select.h < select.h.in > select.h
.endif
.if ${REPLACE_math} == "yes"
./mkhdr.sh math.h < math.h.in > math.h
.endif
.if ${REPLACE_stdlib} == "yes"
./mkhdr.sh stdlib.h < stdlib.h.in > stdlib.h
.endif
.if ${REPLACE_stdarg} == "yes"
./mkhdr.sh stdarg.h < stdarg.h.in > stdarg.h
.endif
install: .PHONY
printf "" > PLIST
${INSTALL} -m 755 -d ${DESTDIR}${PREFIX}/include
.if ${REPLACE_stdint} == "yes"
${INSTALL} -m 644 -c stdint.h ${DESTDIR}${PREFIX}/include
echo include/stdint.h >> PLIST
.endif
.if ${REPLACE_inttypes} == "yes"
${INSTALL} -m 644 -c inttypes.h ${DESTDIR}${PREFIX}/include
echo include/inttypes.h >> PLIST
.endif
.if ${REPLACE_resolv} == "yes"
${INSTALL} -m 644 -c resolv.h ${DESTDIR}${PREFIX}/include
echo include/resolv.h >> PLIST
.endif
.if ${REPLACE_sys_select} == "yes"
${INSTALL} -m 755 -d ${DESTDIR}${PREFIX}/include/sys
${INSTALL} -m 644 select.h ${DESTDIR}${PREFIX}/include/sys
echo include/sys/select.h >> PLIST
.endif
.if ${REPLACE_math} == "yes"
${INSTALL} -m 644 math.h ${DESTDIR}${PREFIX}/include
echo include/math.h >> PLIST
.endif
.if ${REPLACE_stdlib} == "yes"
${INSTALL} -m 644 stdlib.h ${DESTDIR}${PREFIX}/include
echo include/stdlib.h >> PLIST
.endif
.if ${REPLACE_stdarg} == "yes"
${INSTALL} -m 644 stdarg.h ${DESTDIR}${PREFIX}/include
echo include/stdarg.h >> PLIST
.endif

1516
pkgtools/compat_headers/files/config.guess vendored Executable file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,271 @@
/* config.h.in. Generated from configure.in by autoheader. */
/* descr */
#undef CH_ACOSF
/* descr */
#undef CH_ASINF
/* descr */
#undef CH_ATAN2F
/* descr */
#undef CH_ATANF
/* descr */
#undef CH_CEILF
/* descr */
#undef CH_COSF
/* descr */
#undef CH_FLOORF
/* descr */
#undef CH_HAVE_VA_COPY
/* descr */
#undef CH_HPUX
/* descr */
#undef CH_HPUX_MISSING_RES_PROTO
/* descr */
#undef CH_HPUX___STRTOLL
/* descr */
#undef CH_INT16_MAX
/* descr */
#undef CH_INT16_MIN
/* descr */
#undef CH_INT16_T
/* descr */
#undef CH_INT32_MAX
/* descr */
#undef CH_INT32_MIN
/* descr */
#undef CH_INT32_T
/* descr */
#undef CH_INT64_MAX
/* descr */
#undef CH_INT64_MIN
/* descr */
#undef CH_INT64_T
/* descr */
#undef CH_INT8_MAX
/* descr */
#undef CH_INT8_MIN
/* descr */
#undef CH_INT8_T
/* descr */
#undef CH_INT_FAST16_MAX
/* descr */
#undef CH_INT_FAST16_MIN
/* descr */
#undef CH_INT_FAST16_T
/* descr */
#undef CH_INT_FAST32_MAX
/* descr */
#undef CH_INT_FAST32_MIN
/* descr */
#undef CH_INT_FAST32_T
/* descr */
#undef CH_INT_FAST64_MAX
/* descr */
#undef CH_INT_FAST64_MIN
/* descr */
#undef CH_INT_FAST64_T
/* descr */
#undef CH_INT_FAST8_MAX
/* descr */
#undef CH_INT_FAST8_MIN
/* descr */
#undef CH_INT_FAST8_T
/* descr */
#undef CH_INT_LEAST16_MAX
/* descr */
#undef CH_INT_LEAST16_MIN
/* descr */
#undef CH_INT_LEAST16_T
/* descr */
#undef CH_INT_LEAST32_MAX
/* descr */
#undef CH_INT_LEAST32_MIN
/* descr */
#undef CH_INT_LEAST32_T
/* descr */
#undef CH_INT_LEAST64_MAX
/* descr */
#undef CH_INT_LEAST64_MIN
/* descr */
#undef CH_INT_LEAST64_T
/* descr */
#undef CH_INT_LEAST8_MAX
/* descr */
#undef CH_INT_LEAST8_MIN
/* descr */
#undef CH_INT_LEAST8_T
/* descr */
#undef CH_LP64
/* descr */
#undef CH_SINF
/* descr */
#undef CH_SQRTF
/* descr */
#undef CH_TANF
/* descr */
#undef CH_UINT16_MAX
/* descr */
#undef CH_UINT16_T
/* descr */
#undef CH_UINT32_MAX
/* descr */
#undef CH_UINT32_T
/* descr */
#undef CH_UINT64_MAX
/* descr */
#undef CH_UINT64_T
/* descr */
#undef CH_UINT8_MAX
/* descr */
#undef CH_UINT8_T
/* descr */
#undef CH_UINT_FAST16_MAX
/* descr */
#undef CH_UINT_FAST16_T
/* descr */
#undef CH_UINT_FAST32_MAX
/* descr */
#undef CH_UINT_FAST32_T
/* descr */
#undef CH_UINT_FAST64_MAX
/* descr */
#undef CH_UINT_FAST64_T
/* descr */
#undef CH_UINT_FAST8_MAX
/* descr */
#undef CH_UINT_FAST8_T
/* descr */
#undef CH_UINT_LEAST16_MAX
/* descr */
#undef CH_UINT_LEAST16_T
/* descr */
#undef CH_UINT_LEAST32_MAX
/* descr */
#undef CH_UINT_LEAST32_T
/* descr */
#undef CH_UINT_LEAST64_MAX
/* descr */
#undef CH_UINT_LEAST64_T
/* descr */
#undef CH_UINT_LEAST8_MAX
/* descr */
#undef CH_UINT_LEAST8_T
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS

1622
pkgtools/compat_headers/files/config.sub vendored Executable file

File diff suppressed because it is too large Load Diff

9367
pkgtools/compat_headers/files/configure vendored Executable file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,708 @@
dnl $NetBSD: configure.in,v 1.2 2008/05/25 18:32:28 tnn Exp $
AC_PREREQ(2.62)
AC_INIT([compat_headers],[20080523],[tnn@NetBSD.org])
AC_CONFIG_HEADER(config.h)
AC_ARG_PROGRAM
AC_PROG_CC
AC_PROG_INSTALL
AC_SUBST(prefix)
REPLACE_stdint=no
REPLACE_inttypes=no
REPLACE_resolv=no
REPLACE_sys_select=no
REPLACE_stdlib=no
REPLACE_math=no
REPLACE_stdarg=no
AC_SUBST(REPLACE_stdint)
AC_SUBST(REPLACE_inttypes)
AC_SUBST(REPLACE_resolv)
AC_SUBST(REPLACE_sys_select)
AC_SUBST(REPLACE_stdlib)
AC_SUBST(REPLACE_stdarg)
AC_SUBST(REPLACE_math)
AC_DEFINE([CH_LP64], [0], [descr])
AC_DEFINE([CH_HPUX], [0], [descr])
AC_DEFINE([CH_HPUX_MISSING_RES_PROTO], [0], [descr])
AC_DEFINE([CH_HPUX___STRTOLL], [0], [descr])
AC_DEFINE([CH_HAVE_VA_COPY], [0], [descr])
AC_DEFINE([CH_FLOORF], [0], [descr])
AC_DEFINE([CH_CEILF], [0], [descr])
AC_DEFINE([CH_SINF], [0], [descr])
AC_DEFINE([CH_COSF], [0], [descr])
AC_DEFINE([CH_TANF], [0], [descr])
AC_DEFINE([CH_ASINF], [0], [descr])
AC_DEFINE([CH_ACOSF], [0], [descr])
AC_DEFINE([CH_ATANF], [0], [descr])
AC_DEFINE([CH_ATAN2F], [0], [descr])
AC_DEFINE([CH_SQRTF], [0], [descr])
AC_DEFINE([CH_INT8_T], [0], [descr])
AC_DEFINE([CH_UINT8_T], [0], [descr])
AC_DEFINE([CH_INT16_T], [0], [descr])
AC_DEFINE([CH_UINT16_T], [0], [descr])
AC_DEFINE([CH_INT32_T], [0], [descr])
AC_DEFINE([CH_UINT32_T], [0], [descr])
AC_DEFINE([CH_INT64_T], [0], [descr])
AC_DEFINE([CH_UINT64_T], [0], [descr])
AC_DEFINE([CH_INT_LEAST8_T], [0], [descr])
AC_DEFINE([CH_UINT_LEAST8_T], [0], [descr])
AC_DEFINE([CH_INT_LEAST16_T], [0], [descr])
AC_DEFINE([CH_UINT_LEAST16_T], [0], [descr])
AC_DEFINE([CH_INT_LEAST32_T], [0], [descr])
AC_DEFINE([CH_UINT_LEAST32_T], [0], [descr])
AC_DEFINE([CH_INT_LEAST64_T], [0], [descr])
AC_DEFINE([CH_UINT_LEAST64_T], [0], [descr])
AC_DEFINE([CH_INT_FAST8_T], [0], [descr])
AC_DEFINE([CH_UINT_FAST8_T], [0], [descr])
AC_DEFINE([CH_INT_FAST16_T], [0], [descr])
AC_DEFINE([CH_UINT_FAST16_T], [0], [descr])
AC_DEFINE([CH_INT_FAST32_T], [0], [descr])
AC_DEFINE([CH_UINT_FAST32_T], [0], [descr])
AC_DEFINE([CH_INT_FAST64_T], [0], [descr])
AC_DEFINE([CH_UINT_FAST64_T], [0], [descr])
AC_DEFINE([CH_INT8_MIN], [0], [descr])
AC_DEFINE([CH_INT16_MIN], [0], [descr])
AC_DEFINE([CH_INT32_MIN], [0], [descr])
AC_DEFINE([CH_INT64_MIN], [0], [descr])
AC_DEFINE([CH_INT8_MAX], [0], [descr])
AC_DEFINE([CH_INT16_MAX], [0], [descr])
AC_DEFINE([CH_INT32_MAX], [0], [descr])
AC_DEFINE([CH_INT64_MAX], [0], [descr])
AC_DEFINE([CH_UINT8_MAX], [0], [descr])
AC_DEFINE([CH_UINT16_MAX], [0], [descr])
AC_DEFINE([CH_UINT32_MAX], [0], [descr])
AC_DEFINE([CH_UINT64_MAX], [0], [descr])
AC_DEFINE([CH_INT_LEAST8_MIN], [0], [descr])
AC_DEFINE([CH_INT_LEAST16_MIN], [0], [descr])
AC_DEFINE([CH_INT_LEAST32_MIN], [0], [descr])
AC_DEFINE([CH_INT_LEAST64_MIN], [0], [descr])
AC_DEFINE([CH_INT_LEAST8_MAX], [0], [descr])
AC_DEFINE([CH_INT_LEAST16_MAX], [0], [descr])
AC_DEFINE([CH_INT_LEAST32_MAX], [0], [descr])
AC_DEFINE([CH_INT_LEAST64_MAX], [0], [descr])
AC_DEFINE([CH_UINT_LEAST8_MAX], [0], [descr])
AC_DEFINE([CH_UINT_LEAST16_MAX], [0], [descr])
AC_DEFINE([CH_UINT_LEAST32_MAX], [0], [descr])
AC_DEFINE([CH_UINT_LEAST64_MAX], [0], [descr])
AC_DEFINE([CH_INT_FAST8_MIN], [0], [descr])
AC_DEFINE([CH_INT_FAST16_MIN], [0], [descr])
AC_DEFINE([CH_INT_FAST32_MIN], [0], [descr])
AC_DEFINE([CH_INT_FAST64_MIN], [0], [descr])
AC_DEFINE([CH_INT_FAST8_MAX], [0], [descr])
AC_DEFINE([CH_INT_FAST16_MAX], [0], [descr])
AC_DEFINE([CH_INT_FAST32_MAX], [0], [descr])
AC_DEFINE([CH_INT_FAST64_MAX], [0], [descr])
AC_DEFINE([CH_UINT_FAST8_MAX], [0], [descr])
AC_DEFINE([CH_UINT_FAST16_MAX], [0], [descr])
AC_DEFINE([CH_UINT_FAST32_MAX], [0], [descr])
AC_DEFINE([CH_UINT_FAST64_MAX], [0], [descr])
dnl ---
# Replace stdint.h if it doesn't exist
AC_CHECK_HEADER([stdint.h], [:],
REPLACE_stdint=yes
)
# Replace select.h if it doesn't exist
AC_CHECK_HEADER([sys/select.h], [:],
REPLACE_sys_select=yes
)
# Check if LP64
AC_MSG_CHECKING([for LP64])
AC_TRY_RUN([int main(void) {return (sizeof(long) != 8);}],
[AC_DEFINE(CH_LP64) AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)])
#
# Workarounds for HPUX bugs
#
AC_MSG_CHECKING([for HPUX])
AC_TRY_COMPILE([], [#ifndef __hpux
#error
#endif],
[AC_DEFINE(CH_HPUX) AC_MSG_RESULT(yes)]
AC_MSG_CHECKING([for missing res_ prototypes on HPUX])
AC_TRY_COMPILE([#include <resolv.h>
void res_init(void *foo) {}], [],
[AC_DEFINE(CH_HPUX_MISSING_RES_PROTO) AC_MSG_RESULT(yes)
REPLACE_resolv=yes
]
, [AC_MSG_RESULT(no)])
AC_MSG_CHECKING([if __strtoll is needed on HPUX])
AC_TRY_COMPILE([#include <stdlib.h>
void foo(char *a, char **b, int c) {strtoll(a,b,c);}], [],
[AC_DEFINE(CH_HPUX___STRTOLL) AC_MSG_RESULT(yes)
REPLACE_stdlib=yes
]
, [AC_MSG_RESULT(no)])
, [AC_MSG_RESULT(no)])
#
# Check for va_copy
#
# XXX needs to be TRY_RUN
AC_MSG_CHECKING([if we have va_copy])
AC_TRY_RUN([#include <stdarg.h>
void foo(va_list x, va_list y) {va_copy(x, y);}
int main(void) {return 0;}],
[AC_DEFINE(CH_HAVE_VA_COPY) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_stdarg=yes])
#
# Make sure we have float math functions, provide macros otherwise.
#
AC_MSG_CHECKING([for floorf prototype])
AC_TRY_COMPILE([#include <math.h>
void floorf(void *foo) {}], [],
[REPLACE_math=yes
AC_MSG_RESULT(no)],
[AC_DEFINE(CH_FLOORF) AC_MSG_RESULT(yes)])
AC_MSG_CHECKING([for ceilf prototype])
AC_TRY_COMPILE([#include <math.h>
void ceilf(void *foo) {}], [],
[REPLACE_math=yes
AC_MSG_RESULT(no)],
[AC_DEFINE(CH_CEILF) AC_MSG_RESULT(yes)])
AC_MSG_CHECKING([for sinf prototype])
AC_TRY_COMPILE([#include <math.h>
void sinf(void *foo) {}], [],
[REPLACE_math=yes
AC_MSG_RESULT(no)],
[AC_DEFINE(CH_SINF) AC_MSG_RESULT(yes)])
AC_MSG_CHECKING([for cosf prototype])
AC_TRY_COMPILE([#include <math.h>
void cosf(void *foo) {}], [],
[REPLACE_math=yes
AC_MSG_RESULT(no)],
[AC_DEFINE(CH_COSF) AC_MSG_RESULT(yes)])
AC_MSG_CHECKING([for tanf prototype])
AC_TRY_COMPILE([#include <math.h>
void tanf(void *foo) {}], [],
[REPLACE_math=yes
AC_MSG_RESULT(no)],
[AC_DEFINE(CH_TANF) AC_MSG_RESULT(yes)])
AC_MSG_CHECKING([for asinf prototype])
AC_TRY_COMPILE([#include <math.h>
void asinf(void *foo) {}], [],
[REPLACE_math=yes
AC_MSG_RESULT(no)],
[AC_DEFINE(CH_ASINF) AC_MSG_RESULT(yes)])
AC_MSG_CHECKING([for acosf prototype])
AC_TRY_COMPILE([#include <math.h>
void acosf(void *foo) {}], [],
[REPLACE_math=yes
AC_MSG_RESULT(no)],
[AC_DEFINE(CH_ACOSF) AC_MSG_RESULT(yes)])
AC_MSG_CHECKING([for atanf prototype])
AC_TRY_COMPILE([#include <math.h>
void atanf(void *foo) {}], [],
[REPLACE_math=yes
AC_MSG_RESULT(no)],
[AC_DEFINE(CH_ATANF) AC_MSG_RESULT(yes)])
AC_MSG_CHECKING([for atan2f prototype])
AC_TRY_COMPILE([#include <math.h>
void atan2f(void *foo) {}], [],
[REPLACE_math=yes
AC_MSG_RESULT(no)],
[AC_DEFINE(CH_ATAN2F) AC_MSG_RESULT(yes)])
AC_MSG_CHECKING([for sqrtf prototype])
AC_TRY_COMPILE([#include <math.h>
void sqrtf(void *foo) {}], [],
[REPLACE_math=yes
AC_MSG_RESULT(no)],
[AC_DEFINE(CH_SQRTF) AC_MSG_RESULT(yes)])
#
# Provide standard integer types and defs.
#
AC_MSG_CHECKING([for int8_t])
AC_TRY_COMPILE([#include <inttypes.h>], [int8_t x;],
[AC_DEFINE(CH_INT8_T) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
AC_MSG_CHECKING([for uint8_t])
AC_TRY_COMPILE([#include <inttypes.h>], [uint8_t x;],
[AC_DEFINE(CH_UINT8_T) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
AC_MSG_CHECKING([for int16_t])
AC_TRY_COMPILE([#include <inttypes.h>], [int16_t x;],
[AC_DEFINE(CH_INT16_T) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
AC_MSG_CHECKING([for uint16_t])
AC_TRY_COMPILE([#include <inttypes.h>], [uint16_t x;],
[AC_DEFINE(CH_UINT16_T) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
AC_MSG_CHECKING([for int32_t])
AC_TRY_COMPILE([#include <inttypes.h>], [int32_t x;],
[AC_DEFINE(CH_INT32_T) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
AC_MSG_CHECKING([for uint32_t])
AC_TRY_COMPILE([#include <inttypes.h>], [uint32_t x;],
[AC_DEFINE(CH_UINT32_T) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
AC_MSG_CHECKING([for int64_t])
AC_TRY_COMPILE([#include <inttypes.h>], [int64_t x;],
[AC_DEFINE(CH_INT64_T) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
AC_MSG_CHECKING([for uint64_t])
AC_TRY_COMPILE([#include <inttypes.h>], [uint64_t x;],
[AC_DEFINE(CH_UINT64_T) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
dnl ---
AC_MSG_CHECKING([for int_least8_t])
AC_TRY_COMPILE([#include <inttypes.h>], [int_least8_t x;],
[AC_DEFINE(CH_INT_LEAST8_T) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
AC_MSG_CHECKING([for uint_least8_t])
AC_TRY_COMPILE([#include <inttypes.h>], [uint_least8_t x;],
[AC_DEFINE(CH_UINT_LEAST8_T) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
AC_MSG_CHECKING([for int_least16_t])
AC_TRY_COMPILE([#include <inttypes.h>], [int_least16_t x;],
[AC_DEFINE(CH_INT_LEAST16_T) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
AC_MSG_CHECKING([for uint_least16_t])
AC_TRY_COMPILE([#include <inttypes.h>], [uint_least16_t x;],
[AC_DEFINE(CH_UINT_LEAST16_T) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
AC_MSG_CHECKING([for int_least32_t])
AC_TRY_COMPILE([#include <inttypes.h>], [int_least32_t x;],
[AC_DEFINE(CH_INT_LEAST32_T) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
AC_MSG_CHECKING([for uint_least32_t])
AC_TRY_COMPILE([#include <inttypes.h>], [uint_least32_t x;],
[AC_DEFINE(CH_UINT_LEAST32_T) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
AC_MSG_CHECKING([for int_least64_t])
AC_TRY_COMPILE([#include <inttypes.h>], [int_least64_t x;],
[AC_DEFINE(CH_INT_LEAST64_T) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
AC_MSG_CHECKING([for uint_least64_t])
AC_TRY_COMPILE([#include <inttypes.h>], [uint_least64_t x;],
[AC_DEFINE(CH_UINT_LEAST64_T) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
dnl ---
AC_MSG_CHECKING([for int_fast8_t])
AC_TRY_COMPILE([#include <inttypes.h>], [int_fast8_t x;],
[AC_DEFINE(CH_INT_FAST8_T) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
AC_MSG_CHECKING([for uint_fast8_t])
AC_TRY_COMPILE([#include <inttypes.h>], [uint_fast8_t x;],
[AC_DEFINE(CH_UINT_FAST8_T) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
AC_MSG_CHECKING([for int_fast16_t])
AC_TRY_COMPILE([#include <inttypes.h>], [int_fast16_t x;],
[AC_DEFINE(CH_INT_FAST16_T) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
AC_MSG_CHECKING([for uint_fast16_t])
AC_TRY_COMPILE([#include <inttypes.h>], [uint_fast16_t x;],
[AC_DEFINE(CH_UINT_FAST16_T) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
AC_MSG_CHECKING([for int_fast32_t])
AC_TRY_COMPILE([#include <inttypes.h>], [int_fast32_t x;],
[AC_DEFINE(CH_INT_FAST32_T) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
AC_MSG_CHECKING([for uint_fast32_t])
AC_TRY_COMPILE([#include <inttypes.h>], [uint_fast32_t x;],
[AC_DEFINE(CH_UINT_FAST32_T) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
AC_MSG_CHECKING([for int_fast64_t])
AC_TRY_COMPILE([#include <inttypes.h>], [int_fast64_t x;],
[AC_DEFINE(CH_INT_FAST64_T) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
AC_MSG_CHECKING([for uint_fast64_t])
AC_TRY_COMPILE([#include <inttypes.h>], [uint_fast64_t x;],
[AC_DEFINE(CH_UINT_FAST64_T) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
dnl ---
AC_MSG_CHECKING([for INT8_MIN])
AC_TRY_COMPILE([#include <inttypes.h>], [#ifndef INT8_MIN
#error
#endif],
[AC_DEFINE(CH_INT8_MIN) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
AC_MSG_CHECKING([for INT16_MIN])
AC_TRY_COMPILE([#include <inttypes.h>], [#ifndef INT16_MIN
#error
#endif],
[AC_DEFINE(CH_INT16_MIN) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
AC_MSG_CHECKING([for INT32_MIN])
AC_TRY_COMPILE([#include <inttypes.h>], [#ifndef INT32_MIN
#error
#endif],
[AC_DEFINE(CH_INT32_MIN) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
AC_MSG_CHECKING([for INT64_MIN])
AC_TRY_COMPILE([#include <inttypes.h>], [#ifndef INT64_MIN
#error
#endif],
[AC_DEFINE(CH_INT64_MIN) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
dnl ---
AC_MSG_CHECKING([for INT8_MAX])
AC_TRY_COMPILE([#include <inttypes.h>], [#ifndef INT8_MAX
#error
#endif],
[AC_DEFINE(CH_INT8_MAX) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
AC_MSG_CHECKING([for INT16_MAX])
AC_TRY_COMPILE([#include <inttypes.h>], [#ifndef INT16_MAX
#error
#endif],
[AC_DEFINE(CH_INT16_MAX) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
AC_MSG_CHECKING([for INT32_MAX])
AC_TRY_COMPILE([#include <inttypes.h>], [#ifndef INT32_MAX
#error
#endif],
[AC_DEFINE(CH_INT32_MAX) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
AC_MSG_CHECKING([for INT64_MAX])
AC_TRY_COMPILE([#include <inttypes.h>], [#ifndef INT64_MAX
#error
#endif],
[AC_DEFINE(CH_INT64_MAX) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
dnl ---
AC_MSG_CHECKING([for UINT8_MAX])
AC_TRY_COMPILE([#include <inttypes.h>], [#ifndef UINT8_MAX
#error
#endif],
[AC_DEFINE(CH_UINT8_MAX) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
AC_MSG_CHECKING([for UINT16_MAX])
AC_TRY_COMPILE([#include <inttypes.h>], [#ifndef UINT16_MAX
#error
#endif],
[AC_DEFINE(CH_UINT16_MAX) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
AC_MSG_CHECKING([for UINT32_MAX])
AC_TRY_COMPILE([#include <inttypes.h>], [#ifndef UINT32_MAX
#error
#endif],
[AC_DEFINE(CH_UINT32_MAX) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
AC_MSG_CHECKING([for UINT64_MAX])
AC_TRY_COMPILE([#include <inttypes.h>], [#ifndef UINT64_MAX
#error
#endif],
[AC_DEFINE(CH_UINT64_MAX) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
dnl ---
AC_MSG_CHECKING([for INT_LEAST8_MIN])
AC_TRY_COMPILE([#include <inttypes.h>], [#ifndef INT_LEAST8_MIN
#error
#endif],
[AC_DEFINE(CH_INT_LEAST8_MIN) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
AC_MSG_CHECKING([for INT_LEAST16_MIN])
AC_TRY_COMPILE([#include <inttypes.h>], [#ifndef INT_LEAST16_MIN
#error
#endif],
[AC_DEFINE(CH_INT_LEAST16_MIN) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
AC_MSG_CHECKING([for INT_LEAST32_MIN])
AC_TRY_COMPILE([#include <inttypes.h>], [#ifndef INT_LEAST32_MIN
#error
#endif],
[AC_DEFINE(CH_INT_LEAST32_MIN) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
AC_MSG_CHECKING([for INT_LEAST64_MIN])
AC_TRY_COMPILE([#include <inttypes.h>], [#ifndef INT_LEAST64_MIN
#error
#endif],
[AC_DEFINE(CH_INT_LEAST64_MIN) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
dnl ---
AC_MSG_CHECKING([for INT_LEAST8_MAX])
AC_TRY_COMPILE([#include <inttypes.h>], [#ifndef INT_LEAST8_MAX
#error
#endif],
[AC_DEFINE(CH_INT_LEAST8_MAX) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
AC_MSG_CHECKING([for INT_LEAST16_MAX])
AC_TRY_COMPILE([#include <inttypes.h>], [#ifndef INT_LEAST16_MAX
#error
#endif],
[AC_DEFINE(CH_INT_LEAST16_MAX) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
AC_MSG_CHECKING([for INT_LEAST32_MAX])
AC_TRY_COMPILE([#include <inttypes.h>], [#ifndef INT_LEAST32_MAX
#error
#endif],
[AC_DEFINE(CH_INT_LEAST32_MAX) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
AC_MSG_CHECKING([for INT_LEAST64_MAX])
AC_TRY_COMPILE([#include <inttypes.h>], [#ifndef INT_LEAST64_MAX
#error
#endif],
[AC_DEFINE(CH_INT_LEAST64_MAX) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
dnl ---
AC_MSG_CHECKING([for UINT_LEAST8_MAX])
AC_TRY_COMPILE([#include <inttypes.h>], [#ifndef UINT_LEAST8_MAX
#error
#endif],
[AC_DEFINE(CH_UINT_LEAST8_MAX) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
AC_MSG_CHECKING([for UINT_LEAST16_MAX])
AC_TRY_COMPILE([#include <inttypes.h>], [#ifndef UINT_LEAST16_MAX
#error
#endif],
[AC_DEFINE(CH_UINT_LEAST16_MAX) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
AC_MSG_CHECKING([for UINT_LEAST32_MAX])
AC_TRY_COMPILE([#include <inttypes.h>], [#ifndef UINT_LEAST32_MAX
#error
#endif],
[AC_DEFINE(CH_UINT_LEAST32_MAX) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
AC_MSG_CHECKING([for UINT_LEAST64_MAX])
AC_TRY_COMPILE([#include <inttypes.h>], [#ifndef UINT_LEAST64_MAX
#error
#endif],
[AC_DEFINE(CH_UINT_LEAST64_MAX) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
dnl ---
AC_MSG_CHECKING([for INT_FAST8_MIN])
AC_TRY_COMPILE([#include <inttypes.h>], [#ifndef INT_FAST8_MIN
#error
#endif],
[AC_DEFINE(CH_INT_FAST8_MIN) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
AC_MSG_CHECKING([for INT_FAST16_MIN])
AC_TRY_COMPILE([#include <inttypes.h>], [#ifndef INT_FAST16_MIN
#error
#endif],
[AC_DEFINE(CH_INT_FAST16_MIN) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
AC_MSG_CHECKING([for INT_FAST32_MIN])
AC_TRY_COMPILE([#include <inttypes.h>], [#ifndef INT_FAST32_MIN
#error
#endif],
[AC_DEFINE(CH_INT_FAST32_MIN) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
AC_MSG_CHECKING([for INT_FAST64_MIN])
AC_TRY_COMPILE([#include <inttypes.h>], [#ifndef INT_FAST64_MIN
#error
#endif],
[AC_DEFINE(CH_INT_FAST64_MIN) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
dnl ---
AC_MSG_CHECKING([for INT_FAST8_MAX])
AC_TRY_COMPILE([#include <inttypes.h>], [#ifndef INT_FAST8_MAX
#error
#endif],
[AC_DEFINE(CH_INT_FAST8_MAX) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
AC_MSG_CHECKING([for INT_FAST16_MAX])
AC_TRY_COMPILE([#include <inttypes.h>], [#ifndef INT_FAST16_MAX
#error
#endif],
[AC_DEFINE(CH_INT_FAST16_MAX) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
AC_MSG_CHECKING([for INT_FAST32_MAX])
AC_TRY_COMPILE([#include <inttypes.h>], [#ifndef INT_FAST32_MAX
#error
#endif],
[AC_DEFINE(CH_INT_FAST32_MAX) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
AC_MSG_CHECKING([for INT_FAST64_MAX])
AC_TRY_COMPILE([#include <inttypes.h>], [#ifndef INT_FAST64_MAX
#error
#endif],
[AC_DEFINE(CH_INT_FAST64_MAX) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
dnl ---
AC_MSG_CHECKING([for UINT_FAST8_MAX])
AC_TRY_COMPILE([#include <inttypes.h>], [#ifndef UINT_FAST8_MAX
#error
#endif],
[AC_DEFINE(CH_UINT_FAST8_MAX) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
AC_MSG_CHECKING([for UINT_FAST16_MAX])
AC_TRY_COMPILE([#include <inttypes.h>], [#ifndef UINT_FAST16_MAX
#error
#endif],
[AC_DEFINE(CH_UINT_FAST16_MAX) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
AC_MSG_CHECKING([for UINT_FAST32_MAX])
AC_TRY_COMPILE([#include <inttypes.h>], [#ifndef UINT_FAST32_MAX
#error
#endif],
[AC_DEFINE(CH_UINT_FAST32_MAX) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
AC_MSG_CHECKING([for UINT_FAST64_MAX])
AC_TRY_COMPILE([#include <inttypes.h>], [#ifndef UINT_FAST64_MAX
#error
#endif],
[AC_DEFINE(CH_UINT_FAST64_MAX) AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)
REPLACE_inttypes=yes])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT

View File

@@ -0,0 +1,291 @@
#!/bin/sh
#
# $NetBSD: install-sh,v 1.1.1.1 2008/05/24 03:35:42 tnn Exp $
# This script now also installs multiple files, but might choke on installing
# multiple files with spaces in the file names.
#
# install - install a program, script, or datafile
# This comes from X11R5 (mit/util/scripts/install.sh).
#
# Copyright 1991 by the Massachusetts Institute of Technology
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation, and that the name of M.I.T. not be used in advertising or
# publicity pertaining to distribution of the software without specific,
# written prior permission. M.I.T. makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
awkprog="${AWKPROG-awk}"
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
instcmd="$mvprog"
pathcompchmodcmd="$chmodprog 755"
chmodcmd="$chmodprog 755"
chowncmd=""
chgrpcmd=""
stripcmd=""
stripflags=""
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=""
msrc=""
dst=""
dir_arg=""
suffix=""
suffixfmt=""
while [ x"$1" != x ]; do
case $1 in
-b) suffix=".old"
shift
continue;;
-B) suffixfmt="$2"
shift
shift
continue;;
-c) instcmd="$cpprog"
shift
continue;;
-d) dir_arg=true
shift
continue;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
-s) stripcmd="$stripprog"
shift
continue;;
-S) stripcmd="$stripprog"
stripflags="-S $2 $stripflags"
shift
shift
continue;;
*) if [ x"$msrc" = x ]
then
msrc="$dst"
else
msrc="$msrc $dst"
fi
src="$dst"
dst="$1"
shift
continue;;
esac
done
if [ x"$dir_arg" = x ]
then
dstisfile=""
if [ ! -d "$dst" ]
then
if [ x"$msrc" = x"$src" ]
then
dstisfile=true
else
echo "install: destination is not a directory"
exit 1
fi
fi
else
msrc="$msrc $dst"
fi
if [ x"$msrc" = x ]
then
echo "install: no destination specified"
exit 1
fi
for srcarg in $msrc; do
if [ x"$dir_arg" != x ]; then
dstarg="$srcarg"
else
dstarg="$dst"
# Waiting for this to be detected by the "$instcmd $srcarg $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if [ -f "$srcarg" ]
then
doinst="$instcmd"
elif [ -d "$srcarg" ]
then
echo "install: $srcarg: not a regular file"
exit 1
elif [ "$srcarg" = "/dev/null" ]
then
doinst="$cpprog"
else
echo "install: $srcarg does not exist"
exit 1
fi
# If destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic
if [ -d "$dstarg" ]
then
dstarg="$dstarg"/`basename "$srcarg"`
fi
fi
## this sed command emulates the dirname command
dstdir=`echo "$dstarg" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# this part is taken from Noah Friedman's mkinstalldirs script
# Skip lots of stat calls in the usual case.
if [ ! -d "$dstdir" ]; then
defaultIFS='
'
IFS="${IFS-${defaultIFS}}"
oIFS="${IFS}"
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS="${oIFS}"
pathcomp=''
while [ $# -ne 0 ] ; do
pathcomp="${pathcomp}${1}"
shift
if [ ! -d "${pathcomp}" ] ;
then
$doit $mkdirprog "${pathcomp}"
if [ x"$chowncmd" != x ]; then $doit $chowncmd "${pathcomp}"; else true ; fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "${pathcomp}"; else true ; fi &&
if [ x"$pathcompchmodcmd" != x ]; then $doit $pathcompchmodcmd "${pathcomp}"; else true ; fi
else
true
fi
pathcomp="${pathcomp}/"
done
fi
if [ x"$dir_arg" != x ]
then
if [ -d "$dstarg" ]; then
true
else
$doit $mkdirprog "$dstarg" &&
if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dstarg"; else true ; fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dstarg"; else true ; fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dstarg"; else true ; fi
fi
else
if [ x"$dstisfile" = x ]
then
file=$srcarg
else
file=$dst
fi
dstfile=`basename "$file"`
dstfinal="$dstdir/$dstfile"
# Make a temp file name in the proper directory.
dsttmp=$dstdir/#inst.$$#
# Make a backup file name in the proper directory.
case x$suffixfmt in
*%*) suffix=`echo x |
$awkprog -v bname="$dstfinal" -v fmt="$suffixfmt" '
{ cnt = 0;
do {
sfx = sprintf(fmt, cnt++);
name = bname sfx;
} while (system("test -f " name) == 0);
print sfx; }' -`;;
x) ;;
*) suffix="$suffixfmt";;
esac
dstbackup="$dstfinal$suffix"
# Move or copy the file name to the temp name
$doit $doinst $srcarg "$dsttmp" &&
trap "rm -f ${dsttmp}" 0 &&
# and set any options; do chmod last to preserve setuid bits
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $instcmd $src $dsttmp" command.
if [ x"$chowncmd" != x ]; then $doit $chowncmd "$dsttmp"; else true;fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd "$dsttmp"; else true;fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $stripflags "$dsttmp"; else true;fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd "$dsttmp"; else true;fi &&
# Now rename the file to the real destination.
if [ x"$suffix" != x ] && [ -f "$dstfinal" ]
then
$doit $mvcmd "$dstfinal" "$dstbackup"
else
$doit $rmcmd -f "$dstfinal"
fi &&
$doit $mvcmd "$dsttmp" "$dstfinal"
fi
done &&
exit 0

View File

@@ -0,0 +1,229 @@
#include "config.h"
@include "@real_header@"
@ifndef _COMPAT_INTTYPES_H_
@define _COMPAT_INTTYPES_H_
#if CH_INT8_T < 1
typedef char int8_t;
#endif
#if CH_UINT8_T < 1
typedef unsigned char uint8_t;
#endif
#if CH_INT16_T < 1
typedef short int16_t;
#endif
#if CH_UINT16_T < 1
typedef unsigned short uint16_t;
#endif
#if CH_INT32_T < 1
typedef int int32_t;
#endif
#if CH_UINT32_T < 1
typedef unsigned int uint32_t;
#endif
#if CH_INT64_T < 1
#if CH_LP64 > 0
typedef long int64_t;
#else
typedef long long int64_t;
#endif
#endif
#if CH_UINT64_T < 1
#if CH_LP64 > 0
typedef unsigned long uint64_t;
#else
typedef unsigned long long uint64_t;
#endif
#endif
#if CH_INT_LEAST8_T < 1
typedef int8_t int_least8_t;
#endif
#if CH_UINT_LEAST8_T < 1
typedef uint8_t uint_least8_t;
#endif
#if CH_INT_LEAST16_T < 1
typedef int16_t int_least16_t;
#endif
#if CH_UINT_LEAST16_T < 1
typedef uint16_t uint_least16_t;
#endif
#if CH_INT_LEAST32_T < 1
typedef int32_t int_least32_t;
#endif
#if CH_UINT_LEAST32_T < 1
typedef uint32_t uint_least32_t;
#endif
#if CH_INT_LEAST64_T < 1
typedef int64_t int_least64_t;
#endif
#if CH_UINT_LEAST64_T < 1
typedef uint64_t uint_least64_t;
#endif
#if CH_INT_FAST8_T < 1
typedef int8_t int_fast8_t;
#endif
#if CH_UINT_FAST8_T < 1
typedef uint8_t uint_fast8_t;
#endif
#if CH_INT_FAST16_T < 1
typedef int16_t int_fast16_t;
#endif
#if CH_UINT_FAST16_T < 1
typedef uint16_t uint_fast16_t;
#endif
#if CH_INT_FAST32_T < 1
typedef int32_t int_fast32_t;
#endif
#if CH_UINT_FAST32_T < 1
typedef uint32_t uint_fast32_t;
#endif
#if CH_INT_FAST64_T < 1
typedef int64_t int_fast64_t;
#endif
#if CH_UINT_FAST64_T < 1
typedef uint64_t uint_fast64_t;
#endif
#if CH_INT8_MIN < 1
@define INT8_MIN (-0x80)
#endif
#if CH_INT16_MIN < 1
@define INT16_MIN (-0x8000)
#endif
#if CH_INT32_MIN < 1
@define INT32_MIN (-0x80000000)
#endif
#if CH_INT64_MIN < 1
#if CH_LP64 > 0
@define INT64_MIN (-0x8000000000000000L)
#else
@define INT64_MIN (-0x8000000000000000LL)
#endif
#endif
#if CH_INT8_MAX < 1
@define INT8_MAX 0x7f
#endif
#if CH_INT16_MAX < 1
@define INT16_MAX 0x7fff
#endif
#if CH_INT32_MAX < 1
@define INT32_MAX 0x7fffffff
#endif
#if CH_INT64_MAX < 1
#if CH_LP64 > 0
@define INT64_MAX 0x7fffffffffffffffL
#else
@define INT64_MAX 0x7fffffffffffffffLL
#endif
#endif
#if CH_UINT8_MAX < 1
@define UINT8_MAX 0xff
#endif
#if CH_UINT16_MAX < 1
@define UINT16_MAX 0xffff
#endif
#if CH_UINT32_MAX < 1
@define UINT32_MAX 0xffffffffU
#endif
#if CH_UINT64_MAX < 1
#if CH_LP64 > 0
@define UINT64_MAX 0xffffffffffffffffUL
#else
@define UINT64_MAX 0xffffffffffffffffULL
#endif
#endif
#if CH_INT_LEAST8_MIN < 1
@define INT_LEAST8_MIN (-0x80)
#endif
#if CH_INT_LEAST16_MIN < 1
@define INT_LEAST16_MIN (-0x8000)
#endif
#if CH_INT_LEAST32_MIN < 1
@define INT_LEAST32_MIN (-0x80000000)
#endif
#if CH_INT_LEAST64_MIN < 1
#if CH_LP64 > 0
@define INT_LEAST64_MIN (-0x8000000000000000L)
#else
@define INT_LEAST64_MIN (-0x8000000000000000LL)
#endif
#endif
#if CH_INT_LEAST8_MAX < 1
@define INT_LEAST8_MAX 0x7f
#endif
#if CH_INT_LEAST16_MAX < 1
@define INT_LEAST16_MAX 0x7fff
#endif
#if CH_INT_LEAST32_MAX < 1
@define INT_LEAST32_MAX 0x7fffffff
#endif
#if CH_INT_LEAST64_MAX < 1
#if CH_LP64 > 0
@define INT_LEAST64_MAX 0x7fffffffffffffffL
#else
@define INT_LEAST64_MAX 0x7fffffffffffffffLL
#endif
#endif
#if CH_UINT_LEAST8_MAX < 1
@define UINT_LEAST8_MAX 0xff
#endif
#if CH_UINT_LEAST16_MAX < 1
@define UINT_LEAST16_MAX 0xffff
#endif
#if CH_UINT_LEAST32_MAX < 1
@define UINT_LEAST32_MAX 0xffffffffU
#endif
#if CH_UINT_LEAST64_MAX < 1
#if CH_LP64 > 0
@define UINT_LEAST64_MAX 0xffffffffffffffffUL
#else
@define UINT_LEAST64_MAX 0xffffffffffffffffULL
#endif
#endif
#if CH_INT_FAST8_MIN < 1
@define INT_FAST8_MIN (-0x80)
#endif
#if CH_INT_FAST16_MIN < 1
@define INT_FAST16_MIN (-0x8000)
#endif
#if CH_INT_FAST32_MIN < 1
@define INT_FAST32_MIN (-0x80000000)
#endif
#if CH_INT_FAST64_MIN < 1
#if CH_LP64 > 0
@define INT_FAST64_MIN (-0x8000000000000000L)
#else
@define INT_FAST64_MIN (-0x8000000000000000LL)
#endif
#endif
#if CH_INT_FAST8_MAX < 1
@define INT_FAST8_MAX 0x7f
#endif
#if CH_INT_FAST16_MAX < 1
@define INT_FAST16_MAX 0x7fff
#endif
#if CH_INT_FAST32_MAX < 1
@define INT_FAST32_MAX 0x7fffffff
#endif
#if CH_INT_FAST64_MAX < 1
#if CH_LP64 > 0
@define INT_FAST64_MAX 0x7fffffffffffffffL
#else
@define INT_FAST64_MAX 0x7fffffffffffffffLL
#endif
#endif
#if CH_UINT_FAST8_MAX < 1
@define UINT_FAST8_MAX 0xff
#endif
#if CH_UINT_FAST16_MAX < 1
@define UINT_FAST16_MAX 0xffff
#endif
#if CH_UINT_FAST32_MAX < 1
@define UINT_FAST32_MAX 0xffffffffU
#endif
#if CH_UINT_FAST64_MAX < 1
#if CH_LP64 > 0
@define UINT_FAST64_MAX 0xffffffffffffffffUL
#else
@define UINT_FAST64_MAX 0xffffffffffffffffULL
#endif
#endif
@endif /* _COMPAT_INTTYPES_H_ */

View File

@@ -0,0 +1,35 @@
#include "config.h"
@include "@real_header@"
@ifndef _COMPAT_MATH_H_
@define _COMPAT_MATH_H_
#if CH_FLOORF < 1
@define floorf(x) ((float)floor (x))
#endif
#if CH_CEILF < 1
@define ceilf(x) ((float)ceil (x))
#endif
#if CH_SINF < 1
@define sinf(x) ((float)sin (x))
#endif
#if CH_COSF < 1
@define cosf(x) ((float)cos (x))
#endif
#if CH_TANF < 1
@define tanf(x) ((float)tan (x))
#endif
#if CH_ASINF < 1
@define asinf(x) ((float)asin (x))
#endif
#if CH_ACOSF < 1
@define acosf(x) ((float)acos (x))
#endif
#if CH_ATANF < 1
@define atanf(x) ((float)atan (x))
#endif
#if CH_ATAN2F < 1
@define atan2f(x,y) ((float)atan2 (x, y))
#endif
#if CH_SQRTF < 1
@define sqrtf(x) ((float)sqrt (y))
#endif
@endif /* _COMPAT_MATH_H_ */

Some files were not shown because too many files have changed in this diff Show More