freebsd-dev/usr.bin/make/Makefile
Hartmut Brandt d98bc4ce72 Put variable assignments from the command line into the MAKEFLAGS
variable as required by POSIX. This causes such variables to be
pushed into all sub-makes called by the make (except when the MAKEFLAGS
variable is explicitely changed in the sub-make's environment).
This makes them also mostly un-overrideable in sub-makes except on the
sub-make's command line. Therefor specifying 'make CC=icc' will cause
icc to be used as C compiler in all sub-makes no matter what the Makefiles
itself try to do to the CC variable.

This patch also corrects the handling of the MFLAGS variable. MFLAGS
contains all the command line flags but not the command line variable
assignments. The evaluation of the .MFLAGS or .MAKEFLAGS target now
changes both MFLAGS and MAKEFLAGS (they used to change MAKEFLAGS only).
Makefiles can use MFLAGS for their own purposes given that they do not
except MFLAGS to be undefined at the beginning and that they don't evaluate
.MFLAGS or .MAKEFLAGS. MFLAGS should be removed for POSIX compliance,
but it is unfortunately heavily used by the X makefiles.

This has been extensively tested by port builds (thanks to portmgr), new
worlds and kernels.

PR:		standards/57295 (1st part above)
Submitted by:	James E. Flemer <jflemer@alum.rpi.edu>
Approved by:	portmgr
Obtained from:	NetBSD (1st part above)
MFC after:	4 weeks
2004-08-03 18:56:31 +00:00

45 lines
1.3 KiB
Makefile

# @(#)Makefile 5.2 (Berkeley) 12/28/90
# $Id: Makefile,v 1.6 1994/06/30 05:33:39 cgd Exp $
# $FreeBSD$
PROG= make
CFLAGS+=-I${.CURDIR}
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 util.c var.c var_modify.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
.PATH: ${.CURDIR}/lst.lib
NOSHARED?= YES
CFLAGS+=-DMAKE_VERSION=\"5200408030\"
.if defined(_UPGRADING)
CFLAGS+=-D__FBSDID=__RCSID
.endif
# XXX: kernel currently broken
# CFLAGS+=-DUSE_KQUEUE
main.o: ${MAKEFILE}
# Set the shell which make(1) uses. Bourne is the default, but a decent
# Korn shell works fine, and much faster. Using the C shell for this
# will almost certainly break everything, but it's Unix tradition to
# allow you to shoot yourself in the foot if you want to :-)
MAKE_SHELL?= sh
.if ${MAKE_SHELL} == "csh"
CFLAGS+= -DDEFSHELL=0
.elif ${MAKE_SHELL} == "sh"
CFLAGS+= -DDEFSHELL=1
.elif ${MAKE_SHELL} == "ksh"
CFLAGS+= -DDEFSHELL=2
.else
.error "MAKE_SHELL must be set to one of \"csh\", \"sh\" or \"ksh\"."
.endif
.include <bsd.prog.mk>