summaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2002-04-17 13:49:29 +0000
committerru <ru@FreeBSD.org>2002-04-17 13:49:29 +0000
commitdc24ddd41e8f19486380221cdd30ad699719d0d2 (patch)
tree8ecd5d0c5dac332088910644780304ff8543ee61 /share
parent2bc2f35287a64134db22c35a92872f32781bbb59 (diff)
downloadFreeBSD-src-dc24ddd41e8f19486380221cdd30ad699719d0d2.zip
FreeBSD-src-dc24ddd41e8f19486380221cdd30ad699719d0d2.tar.gz
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.
Diffstat (limited to 'share')
-rw-r--r--share/mk/bsd.doc.mk8
-rw-r--r--share/mk/bsd.docb.mk9
-rw-r--r--share/mk/bsd.info.mk9
-rw-r--r--share/mk/bsd.init.mk14
-rw-r--r--share/mk/bsd.lib.mk9
-rw-r--r--share/mk/bsd.libnames.mk4
-rw-r--r--share/mk/bsd.man.mk4
-rw-r--r--share/mk/bsd.nls.mk4
-rw-r--r--share/mk/bsd.obj.mk6
-rw-r--r--share/mk/bsd.own.mk16
-rw-r--r--share/mk/bsd.prog.mk8
-rw-r--r--share/mk/bsd.sgml.mk9
-rw-r--r--share/mk/bsd.subdir.mk9
-rw-r--r--share/mk/sys.mk11
14 files changed, 47 insertions, 73 deletions
diff --git a/share/mk/bsd.doc.mk b/share/mk/bsd.doc.mk
index 287a57a..baac64b 100644
--- a/share/mk/bsd.doc.mk
+++ b/share/mk/bsd.doc.mk
@@ -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)
diff --git a/share/mk/bsd.docb.mk b/share/mk/bsd.docb.mk
index 0e5df47..7e2ce76 100644
--- a/share/mk/bsd.docb.mk
+++ b/share/mk/bsd.docb.mk
@@ -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:
diff --git a/share/mk/bsd.info.mk b/share/mk/bsd.info.mk
index f02749d..b800e89 100644
--- a/share/mk/bsd.info.mk
+++ b/share/mk/bsd.info.mk
@@ -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:
diff --git a/share/mk/bsd.init.mk b/share/mk/bsd.init.mk
new file mode 100644
index 0000000..ff6517c
--- /dev/null
+++ b/share/mk/bsd.init.mk
@@ -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>__)
diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk
index 692cb91..9b4525e 100644
--- a/share/mk/bsd.lib.mk
+++ b/share/mk/bsd.lib.mk
@@ -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:
diff --git a/share/mk/bsd.libnames.mk b/share/mk/bsd.libnames.mk
index 2b863e7..9e1ba24 100644
--- a/share/mk/bsd.libnames.mk
+++ b/share/mk/bsd.libnames.mk
@@ -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
diff --git a/share/mk/bsd.man.mk b/share/mk/bsd.man.mk
index 4255915..b63f611 100644
--- a/share/mk/bsd.man.mk
+++ b/share/mk/bsd.man.mk
@@ -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/}
diff --git a/share/mk/bsd.nls.mk b/share/mk/bsd.nls.mk
index 346ee74..6d91d0b 100644
--- a/share/mk/bsd.nls.mk
+++ b/share/mk/bsd.nls.mk
@@ -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:
diff --git a/share/mk/bsd.obj.mk b/share/mk/bsd.obj.mk
index 79ac516..cb1d794 100644
--- a/share/mk/bsd.obj.mk
+++ b/share/mk/bsd.obj.mk
@@ -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>__)
diff --git a/share/mk/bsd.own.mk b/share/mk/bsd.own.mk
index 02256e5..f713e76 100644
--- a/share/mk/bsd.own.mk
+++ b/share/mk/bsd.own.mk
@@ -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
diff --git a/share/mk/bsd.prog.mk b/share/mk/bsd.prog.mk
index 883159c..9d55834 100644
--- a/share/mk/bsd.prog.mk
+++ b/share/mk/bsd.prog.mk
@@ -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
diff --git a/share/mk/bsd.sgml.mk b/share/mk/bsd.sgml.mk
index 3354870..1b7a884 100644
--- a/share/mk/bsd.sgml.mk
+++ b/share/mk/bsd.sgml.mk
@@ -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
diff --git a/share/mk/bsd.subdir.mk b/share/mk/bsd.subdir.mk
index f169f0a..9f2b890 100644
--- a/share/mk/bsd.subdir.mk
+++ b/share/mk/bsd.subdir.mk
@@ -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 \
diff --git a/share/mk/sys.mk b/share/mk/sys.mk
index 89ef00c..030c852 100644
--- a/share/mk/sys.mk
+++ b/share/mk/sys.mk
@@ -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
OpenPOWER on IntegriCloud