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
14 changed files with 47 additions and 73 deletions
+1 -7
View File
@@ -14,12 +14,7 @@
# #
# [incomplete] # [incomplete]
.if !target(__initialized__) .include <bsd.init.mk>
__initialized__:
.if exists(${.CURDIR}/../Makefile.inc)
.include "${.CURDIR}/../Makefile.inc"
.endif
.endif
PRINTERDEVICE?= ascii PRINTERDEVICE?= ascii
@@ -87,7 +82,6 @@ COMPAT?= -C
.PATH: ${.CURDIR} ${SRCDIR} .PATH: ${.CURDIR} ${SRCDIR}
.MAIN: all
all: ${DFILE} all: ${DFILE}
.if !target(print) .if !target(print)
+1 -8
View File
@@ -22,13 +22,7 @@
# install: # install:
# Install formated output. # Install formated output.
.include <bsd.init.mk>
.if !target(__initialized__)
__initialized__:
.if exists(${.CURDIR}/../Makefile.inc)
.include "${.CURDIR}/../Makefile.inc"
.endif
.endif
# Use SGMLOPTS to pass extra flags to sgmlfmt(1). # Use SGMLOPTS to pass extra flags to sgmlfmt(1).
VOLUME?= ${.CURDIR:T} VOLUME?= ${.CURDIR:T}
@@ -45,7 +39,6 @@ CLEANFILES+=${_docs}
.docb.html .sgml.html: ${SRCS} .docb.html .sgml.html: ${SRCS}
${SGMLFMT} -d docbook -f html ${SGMLOPTS} ${.IMPSRC} ${SGMLFMT} -d docbook -f html ${SGMLOPTS} ${.IMPSRC}
.MAIN: all
all: ${_docs} all: ${_docs}
install: install:
+1 -8
View File
@@ -78,12 +78,7 @@
# #
# bsd.obj.mk: cleandir and obj # bsd.obj.mk: cleandir and obj
.if !target(__initialized__) .include <bsd.init.mk>
__initialized__:
.if exists(${.CURDIR}/../Makefile.inc)
.include "${.CURDIR}/../Makefile.inc"
.endif
.endif
MAKEINFO?= makeinfo MAKEINFO?= makeinfo
MAKEINFOFLAGS+= --no-split # simplify some things, e.g., compression MAKEINFOFLAGS+= --no-split # simplify some things, e.g., compression
@@ -100,8 +95,6 @@ TEX?= tex
DVIPS?= dvips DVIPS?= dvips
DVIPS2ASCII?= dvips2ascii DVIPS2ASCII?= dvips2ascii
.MAIN: all
.SUFFIXES: ${ICOMPRESS_EXT} .info .texi .texinfo .dvi .ps .latin1 .html .SUFFIXES: ${ICOMPRESS_EXT} .info .texi .texinfo .dvi .ps .latin1 .html
.texi.info .texinfo.info: .texi.info .texinfo.info:
+14
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>__)
+1 -8
View File
@@ -2,12 +2,7 @@
# $FreeBSD$ # $FreeBSD$
# #
.if !target(__initialized__) .include <bsd.init.mk>
__initialized__:
.if exists(${.CURDIR}/../Makefile.inc)
.include "${.CURDIR}/../Makefile.inc"
.endif
.endif
.if exists(${.CURDIR}/shlib_version) .if exists(${.CURDIR}/shlib_version)
SHLIB_MAJOR != . ${.CURDIR}/shlib_version ; echo $$major SHLIB_MAJOR != . ${.CURDIR}/shlib_version ; echo $$major
@@ -49,8 +44,6 @@ STRIP?= -s
.include <bsd.libnames.mk> .include <bsd.libnames.mk>
.endif .endif
.MAIN: all
# prefer .s to a .c, add .po, remove stuff not used in the BSD libraries # prefer .s to a .c, add .po, remove stuff not used in the BSD libraries
# .So used for PIC object files # .So used for PIC object files
.SUFFIXES: .SUFFIXES:
+4
View File
@@ -4,6 +4,10 @@
# Other include files (e.g. bsd.prog.mk, bsd.lib.mk) include this # Other include files (e.g. bsd.prog.mk, bsd.lib.mk) include this
# file where necessary. # file where necessary.
.if !target(__<bsd.init.mk>__)
.error bsd.libnames.mk cannot be included directly.
.endif
LIBCRT0?= ${DESTDIR}${LIBDIR}/crt0.o LIBCRT0?= ${DESTDIR}${LIBDIR}/crt0.o
LIBALIAS?= ${DESTDIR}${LIBDIR}/libalias.a LIBALIAS?= ${DESTDIR}${LIBDIR}/libalias.a
+4
View File
@@ -49,6 +49,10 @@
# Install the manual pages and their links. # 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} MINSTALL= ${INSTALL} ${COPY} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE}
CATDIR= ${MANDIR:H:S/$/\/cat/} CATDIR= ${MANDIR:H:S/$/\/cat/}
+2 -2
View File
@@ -29,6 +29,8 @@
# #
# bsd.obj.mk: cleandir and obj # bsd.obj.mk: cleandir and obj
.include <bsd.init.mk>
GENCAT?= gencat -new GENCAT?= gencat -new
NLSDIR?= ${SHAREDIR}/nls NLSDIR?= ${SHAREDIR}/nls
@@ -39,8 +41,6 @@ NLSOWN?= ${SHAREOWN}
NLS?= NLS?=
NLSLINKS= NLSLINKS=
.MAIN: all
.SUFFIXES: .cat .msg .SUFFIXES: .cat .msg
.msg.cat: .msg.cat:
+6
View File
@@ -43,6 +43,10 @@
# create build directory. # create build directory.
# #
.if !target(__<bsd.obj.mk>__)
__<bsd.obj.mk>__:
.include <bsd.own.mk>
.if defined(MAKEOBJDIRPREFIX) .if defined(MAKEOBJDIRPREFIX)
CANONICALOBJDIR:=${MAKEOBJDIRPREFIX}${.CURDIR} CANONICALOBJDIR:=${MAKEOBJDIRPREFIX}${.CURDIR}
.else .else
@@ -174,3 +178,5 @@ _SUBDIR: .USE
${MAKE} ${.TARGET:S/realinstall/install/} DIRPRFX=${DIRPRFX}$$entry/); \ ${MAKE} ${.TARGET:S/realinstall/install/} DIRPRFX=${DIRPRFX}$$entry/); \
done done
.endif .endif
.endif !target(__<bsd.obj.mk>__)
-16
View File
@@ -124,22 +124,6 @@
# #
# INCLUDEDIR Base path for standard C include files [/usr/include] # 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 # Binaries
BINOWN?= root BINOWN?= root
BINGRP?= wheel BINGRP?= wheel
+1 -7
View File
@@ -1,12 +1,7 @@
# from: @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91 # from: @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91
# $FreeBSD$ # $FreeBSD$
.if !target(__initialized__) .include <bsd.init.mk>
__initialized__:
.if exists(${.CURDIR}/../Makefile.inc)
.include "${.CURDIR}/../Makefile.inc"
.endif
.endif
.SUFFIXES: .out .o .c .cc .cpp .cxx .C .m .y .l .s .S .SUFFIXES: .out .o .c .cc .cpp .cxx .C .m .y .l .s .S
@@ -78,7 +73,6 @@ MAN1= ${MAN}
.endif .endif
.endif .endif
.MAIN: all
all: objwarn ${PROG} ${SCRIPTS} ${FILES} all: objwarn ${PROG} ${SCRIPTS} ${FILES}
.if !defined(NOMAN) .if !defined(NOMAN)
all: all-man all: all-man
+1 -8
View File
@@ -50,13 +50,7 @@
# bsd.obj.mk: clean, cleandir, obj # bsd.obj.mk: clean, cleandir, obj
# #
.include <bsd.init.mk>
.if !target(__initialized__)
__initialized__:
.if exists(${.CURDIR}/../Makefile.inc)
.include "${.CURDIR}/../Makefile.inc"
.endif
.endif
# FORMATS indicates which output formats will be generated. See # FORMATS indicates which output formats will be generated. See
# the sgmlfmt(1) man page for a list of valid formats. # the sgmlfmt(1) man page for a list of valid formats.
@@ -110,7 +104,6 @@ strip: ${_strip}
.endif .endif
.MAIN: all
all: ${_docs} all: ${_docs}
# If FORMATS is empty, do nothing # If FORMATS is empty, do nothing
+1 -8
View File
@@ -29,14 +29,7 @@
# obj, objlink, realinstall, regress, tags # obj, objlink, realinstall, regress, tags
# #
.if !target(__initialized__) .include <bsd.init.mk>
__initialized__:
.if exists(${.CURDIR}/../Makefile.inc)
.include "${.CURDIR}/../Makefile.inc"
.endif
.endif
.MAIN: all
_SUBDIRUSE: .USE _SUBDIRUSE: .USE
@for entry in ${SUBDIR}; do \ @for entry in ${SUBDIR}; do \
+10 -1
View File
@@ -259,5 +259,14 @@ __MAKE_CONF?=/etc/make.conf
.include </etc/make.conf.local> .include </etc/make.conf.local>
.endif .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