Don't include bsd.own.mk from sys.mk, this makes it impossible

to use ``.if defined()'' inside bsd.own.mk to test for defines
in individual makefiles.  For example, setting DEBUG_FLAGS in
Makefile didn't take the desired effect on the STRIP assignment.

Added bsd.init.mk (like in NetBSD) that handles the inclusion
of ../Makefile.inc and bsd.own.mk from all bsd.*.mk files that
"build something".

Back out bsd.own.mk,v 1.15: moved OBJFORMAT initialization back
to sys.mk (several source tree makefiles want to check it early)
and removed MACHINE_ARCH initialization (it's hard to see from
looking at the commitlogs what the problem was at the time, but
now it serves no purpose).

Prohibit the direct inclusion of bsd.man.mk and bsd.libnames.mk.

Protect bsd.obj.mk from repetitive inclusion.  Prohibiting the
direct inclusion of bsd.obj.mk might be a good idea too.
This commit is contained in:
Ruslan Ermilov 2002-04-17 13:49:29 +00:00
parent d57e28adb2
commit 2bdaf7e81c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=94940
14 changed files with 47 additions and 73 deletions

View File

@ -14,12 +14,7 @@
#
# [incomplete]
.if !target(__initialized__)
__initialized__:
.if exists(${.CURDIR}/../Makefile.inc)
.include "${.CURDIR}/../Makefile.inc"
.endif
.endif
.include <bsd.init.mk>
PRINTERDEVICE?= ascii
@ -87,7 +82,6 @@ COMPAT?= -C
.PATH: ${.CURDIR} ${SRCDIR}
.MAIN: all
all: ${DFILE}
.if !target(print)

View File

@ -22,13 +22,7 @@
# install:
# Install formated output.
.if !target(__initialized__)
__initialized__:
.if exists(${.CURDIR}/../Makefile.inc)
.include "${.CURDIR}/../Makefile.inc"
.endif
.endif
.include <bsd.init.mk>
# Use SGMLOPTS to pass extra flags to sgmlfmt(1).
VOLUME?= ${.CURDIR:T}
@ -45,7 +39,6 @@ CLEANFILES+=${_docs}
.docb.html .sgml.html: ${SRCS}
${SGMLFMT} -d docbook -f html ${SGMLOPTS} ${.IMPSRC}
.MAIN: all
all: ${_docs}
install:

View File

@ -78,12 +78,7 @@
#
# bsd.obj.mk: cleandir and obj
.if !target(__initialized__)
__initialized__:
.if exists(${.CURDIR}/../Makefile.inc)
.include "${.CURDIR}/../Makefile.inc"
.endif
.endif
.include <bsd.init.mk>
MAKEINFO?= makeinfo
MAKEINFOFLAGS+= --no-split # simplify some things, e.g., compression
@ -100,8 +95,6 @@ TEX?= tex
DVIPS?= dvips
DVIPS2ASCII?= dvips2ascii
.MAIN: all
.SUFFIXES: ${ICOMPRESS_EXT} .info .texi .texinfo .dvi .ps .latin1 .html
.texi.info .texinfo.info:

14
share/mk/bsd.init.mk Normal file
View File

@ -0,0 +1,14 @@
# $FreeBSD$
# The include file <bsd.init.mk> includes ../Makefile.inc and
# <bsd.own.mk>; this is used at the top of all <bsd.*.mk> files
# that actually "build something".
.if !target(__<bsd.init.mk>__)
__<bsd.init.mk>__:
.if exists(${.CURDIR}/../Makefile.inc)
.include "${.CURDIR}/../Makefile.inc"
.endif
.include <bsd.own.mk>
.MAIN: all
.endif !target(__<bsd.init.mk>__)

View File

@ -2,12 +2,7 @@
# $FreeBSD$
#
.if !target(__initialized__)
__initialized__:
.if exists(${.CURDIR}/../Makefile.inc)
.include "${.CURDIR}/../Makefile.inc"
.endif
.endif
.include <bsd.init.mk>
.if exists(${.CURDIR}/shlib_version)
SHLIB_MAJOR != . ${.CURDIR}/shlib_version ; echo $$major
@ -49,8 +44,6 @@ STRIP?= -s
.include <bsd.libnames.mk>
.endif
.MAIN: all
# prefer .s to a .c, add .po, remove stuff not used in the BSD libraries
# .So used for PIC object files
.SUFFIXES:

View File

@ -4,6 +4,10 @@
# Other include files (e.g. bsd.prog.mk, bsd.lib.mk) include this
# file where necessary.
.if !target(__<bsd.init.mk>__)
.error bsd.libnames.mk cannot be included directly.
.endif
LIBCRT0?= ${DESTDIR}${LIBDIR}/crt0.o
LIBALIAS?= ${DESTDIR}${LIBDIR}/libalias.a

View File

@ -49,6 +49,10 @@
# Install the manual pages and their links.
#
.if !target(__<bsd.init.mk>__)
.error bsd.man.mk cannot be included directly.
.endif
MINSTALL= ${INSTALL} ${COPY} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE}
CATDIR= ${MANDIR:H:S/$/\/cat/}

View File

@ -29,6 +29,8 @@
#
# bsd.obj.mk: cleandir and obj
.include <bsd.init.mk>
GENCAT?= gencat -new
NLSDIR?= ${SHAREDIR}/nls
@ -39,8 +41,6 @@ NLSOWN?= ${SHAREOWN}
NLS?=
NLSLINKS=
.MAIN: all
.SUFFIXES: .cat .msg
.msg.cat:

View File

@ -43,6 +43,10 @@
# create build directory.
#
.if !target(__<bsd.obj.mk>__)
__<bsd.obj.mk>__:
.include <bsd.own.mk>
.if defined(MAKEOBJDIRPREFIX)
CANONICALOBJDIR:=${MAKEOBJDIRPREFIX}${.CURDIR}
.else
@ -174,3 +178,5 @@ _SUBDIR: .USE
${MAKE} ${.TARGET:S/realinstall/install/} DIRPRFX=${DIRPRFX}$$entry/); \
done
.endif
.endif !target(__<bsd.obj.mk>__)

View File

@ -124,22 +124,6 @@
#
# INCLUDEDIR Base path for standard C include files [/usr/include]
# This is only here for bootstrapping and is not officially exported
# from here. It has normally already been defined in sys.mk.
MACHINE_ARCH?= i386
#
# The build tools are indirected by /usr/bin/objformat which determines the
# object format from the OBJFORMAT environment variable and if this is not
# defined, it reads /etc/objformat.
#
.if exists(/etc/objformat) && !defined(OBJFORMAT)
.include "/etc/objformat"
.endif
# Default executable format
OBJFORMAT?= elf
# Binaries
BINOWN?= root
BINGRP?= wheel

View File

@ -1,12 +1,7 @@
# from: @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91
# $FreeBSD$
.if !target(__initialized__)
__initialized__:
.if exists(${.CURDIR}/../Makefile.inc)
.include "${.CURDIR}/../Makefile.inc"
.endif
.endif
.include <bsd.init.mk>
.SUFFIXES: .out .o .c .cc .cpp .cxx .C .m .y .l .s .S
@ -78,7 +73,6 @@ MAN1= ${MAN}
.endif
.endif
.MAIN: all
all: objwarn ${PROG} ${SCRIPTS} ${FILES}
.if !defined(NOMAN)
all: all-man

View File

@ -50,13 +50,7 @@
# bsd.obj.mk: clean, cleandir, obj
#
.if !target(__initialized__)
__initialized__:
.if exists(${.CURDIR}/../Makefile.inc)
.include "${.CURDIR}/../Makefile.inc"
.endif
.endif
.include <bsd.init.mk>
# FORMATS indicates which output formats will be generated. See
# the sgmlfmt(1) man page for a list of valid formats.
@ -110,7 +104,6 @@ strip: ${_strip}
.endif
.MAIN: all
all: ${_docs}
# If FORMATS is empty, do nothing

View File

@ -29,14 +29,7 @@
# obj, objlink, realinstall, regress, tags
#
.if !target(__initialized__)
__initialized__:
.if exists(${.CURDIR}/../Makefile.inc)
.include "${.CURDIR}/../Makefile.inc"
.endif
.endif
.MAIN: all
.include <bsd.init.mk>
_SUBDIRUSE: .USE
@for entry in ${SUBDIR}; do \

View File

@ -259,5 +259,14 @@ __MAKE_CONF?=/etc/make.conf
.include </etc/make.conf.local>
.endif
#
# The build tools are indirected by /usr/bin/objformat which determines the
# object format from the OBJFORMAT environment variable and if this is not
# defined, it reads /etc/objformat.
#
.if exists(/etc/objformat) && !defined(OBJFORMAT)
.include "/etc/objformat"
.endif
.include <bsd.own.mk>
# Default executable format
OBJFORMAT?= elf