2012-06-08 21:57:36 +00:00
|
|
|
# $NetBSD: Makefile,v 1.56 2012/05/30 21:54:23 sjg Exp $
|
|
|
|
# @(#)Makefile 5.2 (Berkeley) 12/28/90
|
|
|
|
|
2012-07-06 00:03:45 +00:00
|
|
|
# $Id: Makefile.in,v 1.168 2012/07/05 04:10:23 sjg Exp $
|
2012-06-08 21:57:36 +00:00
|
|
|
|
|
|
|
PROG= bmake
|
|
|
|
SRCS= arch.c buf.c compat.c cond.c dir.c for.c hash.c job.c main.c \
|
|
|
|
make.c parse.c str.c suff.c targ.c trace.c var.c util.c
|
|
|
|
SRCS+= strlist.c
|
|
|
|
SRCS+= make_malloc.c
|
|
|
|
SRCS+= lstAppend.c lstAtEnd.c lstAtFront.c lstClose.c lstConcat.c \
|
|
|
|
lstDatum.c lstDeQueue.c lstDestroy.c lstDupl.c lstEnQueue.c \
|
|
|
|
lstFind.c lstFindFrom.c lstFirst.c lstForEach.c lstForEachFrom.c \
|
|
|
|
lstInit.c lstInsert.c lstIsAtEnd.c lstIsEmpty.c lstLast.c \
|
|
|
|
lstMember.c lstNext.c lstOpen.c lstRemove.c lstReplace.c lstSucc.c
|
|
|
|
SRCS += lstPrev.c
|
|
|
|
|
|
|
|
# you can use this Makefile if you have an earlier version of bmake.
|
|
|
|
prefix= @prefix@
|
|
|
|
srcdir= @srcdir@
|
|
|
|
CC?= @CC@
|
|
|
|
|
|
|
|
# Base version on src date
|
2012-07-06 00:03:45 +00:00
|
|
|
MAKE_VERSION= 20120704
|
2012-06-08 21:57:36 +00:00
|
|
|
MACHINE=@machine@
|
|
|
|
MACHINE_ARCH=@machine_arch@
|
|
|
|
DEFAULT_SYS_PATH = @default_sys_path@
|
|
|
|
|
2012-07-06 00:03:45 +00:00
|
|
|
CPPFLAGS+= @CPPFLAGS@
|
|
|
|
CFLAGS+= ${CPPFLAGS}
|
2012-06-08 21:57:36 +00:00
|
|
|
CFLAGS+= -D_PATH_DEFSYSPATH=\"${DEFAULT_SYS_PATH}\"
|
2012-07-06 00:03:45 +00:00
|
|
|
CFLAGS+= -I. -I${srcdir} @DEFS@ ${XDEFS} -DMAKE_NATIVE
|
2012-06-08 21:57:36 +00:00
|
|
|
CFLAGS+= ${CFLAGS_${.TARGET:T}}
|
|
|
|
CFLAGS+= ${COPTS.${.ALLSRC:M*.c:T:u}}
|
|
|
|
COPTS.main.c+= "-DMAKE_VERSION=\"${MAKE_VERSION}\""
|
|
|
|
LDFLAGS= @LDFLAGS@
|
|
|
|
LIBOBJS= @LIBOBJS@
|
|
|
|
LDADD= @LIBS@
|
|
|
|
|
|
|
|
.if !empty(LIBOBJS)
|
|
|
|
SRCS+= ${LIBOBJS:T:.o=.c}
|
|
|
|
.endif
|
|
|
|
|
2012-07-06 00:03:45 +00:00
|
|
|
USE_META = @use_meta@
|
2012-06-25 22:20:51 +00:00
|
|
|
.if ${USE_META} != "no"
|
2012-06-08 21:57:36 +00:00
|
|
|
SRCS+= meta.c
|
|
|
|
CPPFLAGS+= -DUSE_META
|
|
|
|
FILEMON_H ?= @filemon_h@
|
|
|
|
.if exists(${FILEMON_H}) && ${FILEMON_H:T} == "filemon.h"
|
|
|
|
COPTS.meta.c += -DHAVE_FILEMON_H -I${FILEMON_H:H}
|
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.PATH: ${srcdir}
|
|
|
|
.PATH: ${srcdir}/lst.lib
|
|
|
|
|
|
|
|
OS!= uname -s
|
|
|
|
ARCH!= uname -p 2>/dev/null || uname -m
|
|
|
|
|
|
|
|
# list of OS's which are derrived from BSD4.4
|
|
|
|
isBSD44= NetBSD FreeBSD OpenBSD DragonFly
|
|
|
|
|
|
|
|
.if ${OS} == "NetBSD"
|
|
|
|
# Don't set these for anyone else since we don't know what the effect may be.
|
|
|
|
# On FreeBSD WARNS=2 sets a bunch of -W flags that make does not handle.
|
|
|
|
WFORMAT= 1
|
|
|
|
WARNS=4
|
|
|
|
.NOPATH: bmake.cat1
|
|
|
|
.if make(install) && exists(${DESTDIR}/usr/share/doc)
|
|
|
|
SUBDIR= PSD.doc
|
|
|
|
.endif
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.if empty(isBSD44:M${OS})
|
|
|
|
# XXX not sure if we still want this given that configure
|
|
|
|
# lets us force or not the definition of MACHINE.
|
|
|
|
CFLAGS_main.o+= "-DFORCE_MACHINE=\"${MACHINE}\""
|
|
|
|
MANTARGET=cat
|
|
|
|
INSTALL?=${srcdir}/install-sh
|
|
|
|
.if (${MACHINE} == "sun386")
|
|
|
|
# even I don't have one of these anymore :-)
|
|
|
|
CFLAGS+= -DPORTAR
|
|
|
|
.elif (${MACHINE} != "sunos")
|
|
|
|
SRCS+= sigcompat.c
|
|
|
|
CFLAGS+= -DSIGNAL_FLAGS=SA_RESTART
|
|
|
|
.endif
|
|
|
|
.endif
|
2012-07-06 00:03:45 +00:00
|
|
|
.if defined(.PARSEDIR)
|
2012-06-08 21:57:36 +00:00
|
|
|
.if make(obj) || make(clean)
|
|
|
|
SUBDIR+= unit-tests
|
|
|
|
.endif
|
2012-06-25 22:20:51 +00:00
|
|
|
.endif
|
2012-06-08 21:57:36 +00:00
|
|
|
|
|
|
|
# many systems use gcc these days
|
|
|
|
CC_IS_GCC=@GCC@
|
|
|
|
.if ${CC_IS_GCC} == "yes"
|
|
|
|
# problem with gcc3
|
|
|
|
CFLAGS_var.o+= -Wno-cast-qual
|
|
|
|
.endif
|
|
|
|
|
|
|
|
CFLAGS_main.o+= "-D@force_machine@MACHINE=\"${MACHINE}\"" "-DMACHINE_ARCH=\"${MACHINE_ARCH}\""
|
|
|
|
|
|
|
|
EXTRACT_MAN=no
|
|
|
|
|
|
|
|
MAN=${PROG}.1
|
|
|
|
.if (${PROG} != "make")
|
|
|
|
${MAN}: make.1
|
|
|
|
@echo making ${PROG}.1
|
|
|
|
@sed -e 's/^.Nx/NetBSD/' -e '/^.Nm/s/make/${PROG}/' -e '/^.Sh HISTORY/,$$d' ${srcdir}/make.1 > $@
|
|
|
|
@(echo ".Sh HISTORY"; \
|
|
|
|
echo ".Nm"; \
|
|
|
|
echo "is derived from NetBSD"; \
|
|
|
|
echo ".Xr make 1 ."; \
|
|
|
|
echo It uses autoconf to facilitate portability to other platforms.) >> $@
|
|
|
|
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.if !empty(isBSD44:M${OS})
|
|
|
|
.if "${OS}" != "NetBSD"
|
|
|
|
MAN1=${MAN}
|
|
|
|
.endif
|
|
|
|
MANTARGET?=man
|
|
|
|
.endif
|
|
|
|
|
|
|
|
MANTARGET?= cat
|
|
|
|
MANDEST?= ${MANDIR}/${MANTARGET}1
|
|
|
|
|
|
|
|
.if ${MANTARGET} == "cat"
|
|
|
|
_mfromdir=${srcdir}
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.if exists(${srcdir}/../Makefile.inc)
|
|
|
|
.include "${srcdir}/../Makefile.inc"
|
|
|
|
.endif
|
|
|
|
.-include <bsd.prog.mk>
|
|
|
|
# sigh, FreeBSD at least includes bsd.subdir.mk via bsd.obj.mk
|
|
|
|
# so the inclusion below, results in complaints about re-defined
|
|
|
|
# targets. For NetBSD though we need to explicitly include it.
|
2012-07-06 00:03:45 +00:00
|
|
|
.if defined(.PARSEDIR)
|
2012-06-08 21:57:36 +00:00
|
|
|
.if defined(SUBDIR) && !target(${SUBDIR:[1]})
|
|
|
|
.-include <bsd.subdir.mk>
|
|
|
|
.endif
|
2012-06-25 22:20:51 +00:00
|
|
|
.endif
|
2012-06-08 21:57:36 +00:00
|
|
|
|
|
|
|
CPPFLAGS+= -DMAKE_NATIVE
|
|
|
|
COPTS.var.c += -Wno-cast-qual
|
|
|
|
COPTS.job.c += -Wno-format-nonliteral
|
|
|
|
COPTS.parse.c += -Wno-format-nonliteral
|
|
|
|
COPTS.var.c += -Wno-format-nonliteral
|
|
|
|
|
|
|
|
# Force these
|
|
|
|
BINDIR= ${prefix}/bin
|
|
|
|
MANDIR= ${prefix}/man
|
|
|
|
|
|
|
|
arch.o: config.h
|
|
|
|
# make sure that MAKE_VERSION gets updated.
|
|
|
|
main.o: ${SRCS} ${MAKEFILE}
|
|
|
|
|
|
|
|
MK?=${prefix}/share/mk
|
|
|
|
MKSRC?=@mksrc@
|
|
|
|
INSTALL?=${srcdir}/install-sh
|
|
|
|
|
|
|
|
beforeinstall:
|
|
|
|
test -d ${DESTDIR}${BINDIR} || ${INSTALL} -m 775 -d ${DESTDIR}${BINDIR}
|
|
|
|
test -d ${DESTDIR}${MANDEST} || ${INSTALL} -m 775 -d ${DESTDIR}${MANDEST}
|
|
|
|
|
|
|
|
# latest version of *.mk includes an installer.
|
|
|
|
# you should not need to set USE_OS
|
|
|
|
install-mk:
|
|
|
|
.if exists(${MKSRC}/install-mk)
|
|
|
|
test -d ${DESTDIR}${MK} || ${INSTALL} -m 775 -d ${DESTDIR}${MK}
|
|
|
|
${MKSRC}/install-mk -v -m 644 ${DESTDIR}${MK} ${USE_OS}
|
|
|
|
.else
|
|
|
|
@echo need to unpack mk.tar.gz under ${srcdir} or set MKSRC; false
|
|
|
|
.endif
|
|
|
|
|
|
|
|
.ifdef TOOLDIR
|
|
|
|
# this is a native netbsd build,
|
|
|
|
# use libutil rather than the local emalloc etc.
|
|
|
|
CPPFLAGS+= -DUSE_EMALLOC
|
|
|
|
LDADD+=-lutil
|
|
|
|
DPADD+=${LIBUTIL}
|
|
|
|
.endif
|
|
|
|
|
|
|
|
# A simple unit-test driver to help catch regressions
|
|
|
|
accept test:
|
|
|
|
cd ${.CURDIR}/unit-tests && MAKEFLAGS= ${.MAKE} -r -m / TEST_MAKE=${TEST_MAKE:U${.OBJDIR}/${PROG:T}} ${.TARGET}
|