diff --git a/share/mk/bsd.doc.mk b/share/mk/bsd.doc.mk index 287a57afe565..baac64b687ec 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 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 0e5df47b4d2d..7e2ce761edfe 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 # 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 f02749da3762..b800e89b615a 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 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 000000000000..ff6517ce1609 --- /dev/null +++ b/share/mk/bsd.init.mk @@ -0,0 +1,14 @@ +# $FreeBSD$ + +# The include file includes ../Makefile.inc and +# ; this is used at the top of all files +# that actually "build something". + +.if !target(____) +____: +.if exists(${.CURDIR}/../Makefile.inc) +.include "${.CURDIR}/../Makefile.inc" +.endif +.include +.MAIN: all +.endif !target(____) diff --git a/share/mk/bsd.lib.mk b/share/mk/bsd.lib.mk index 692cb9150cdc..9b4525ebf011 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 .if exists(${.CURDIR}/shlib_version) SHLIB_MAJOR != . ${.CURDIR}/shlib_version ; echo $$major @@ -49,8 +44,6 @@ STRIP?= -s .include .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 2b863e74e5d1..9e1ba2471f97 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(____) +.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 4255915eeacb..b63f61153b89 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(____) +.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 346ee74711dd..6d91d0be4962 100644 --- a/share/mk/bsd.nls.mk +++ b/share/mk/bsd.nls.mk @@ -29,6 +29,8 @@ # # bsd.obj.mk: cleandir and obj +.include + 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 79ac5167220d..cb1d79498530 100644 --- a/share/mk/bsd.obj.mk +++ b/share/mk/bsd.obj.mk @@ -43,6 +43,10 @@ # create build directory. # +.if !target(____) +____: +.include + .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(____) diff --git a/share/mk/bsd.own.mk b/share/mk/bsd.own.mk index 02256e5a4330..f713e763b042 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 883159c56363..9d55834cd3e5 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 .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 33548701ccda..1b7a88450b60 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 # 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 f169f0a806b6..9f2b89000838 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 _SUBDIRUSE: .USE @for entry in ${SUBDIR}; do \ diff --git a/share/mk/sys.mk b/share/mk/sys.mk index 89ef00c8669c..030c852b3d98 100644 --- a/share/mk/sys.mk +++ b/share/mk/sys.mk @@ -259,5 +259,14 @@ __MAKE_CONF?=/etc/make.conf .include .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 +# Default executable format +OBJFORMAT?= elf