Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 Jun 2002 13:06:54 +0200
From:      Cyrille Lefevre <cyrille.lefevre@laposte.net>
To:        Riccardo Torrini <riccardo@torrini.org>
Cc:        freebsd-current@FreeBSD.ORG
Subject:   Re: Add a Makefile.user on /usr/src and /usr/ports
Message-ID:  <20020607110654.GA28015@gits.dyndns.org>
In-Reply-To: <XFMail.20020607002509.riccardo@torrini.org>
References:  <XFMail.20020607002509.riccardo@torrini.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--pf9I7BMVVzbSWLtt
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Fri, Jun 07, 2002 at 12:25:09AM +0200, Riccardo Torrini wrote:
> To support fancy user and they own targets would be nice an
> infrastructure that check and (if it exist) include a file
> (named Makefile.user or .local or similar) with personal
> targets either under /usr/src than /usr/ports.
> 
> This can save a lot of typing building various things (for
> example timing build phase or saving logs) only migrating
> this file from a machine to another.

maybe the attached Makefile may help you in the process.
I use it for months to build everything.

Cyrille.
-- 
Cyrille Lefevre                 mailto:cyrille.lefevre@laposte.net

--pf9I7BMVVzbSWLtt
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=Makefile

#!/usr/bin/make -f
#
# @(#) etc:Makefile 1.6 (cyrille.lefevre@laposte.net) Wed Jun  5 23:08:17 CEST 2002
#
# Copyright (c) 2000-2002 Cyrille Lefevre. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY _DIRECT, IN_DIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.

# TODO : rel target and maybe dump target
# make release RELEASETAG=RELENG_4 CHROOT_DIR=/disk1/release/root \
# LOCAL_PATCHES=/disk1/release/patches LOCAL_SCRIPT=/disk1/release/script \
# NOPORTS=YES NODOC=YES NOSRC=YES # NOSHARED=YES RELEASENOUPDATE=YES
# ftp://current.jp.FreeBSD.org/pub/FreeBSD/snapshots/i386/ISO-IMAGES/

.MAKEARGS: .dl

# Custom
#

NCVS?=		true
RELENG?=	-r RELENG_4
CUSTOM?=	CUSTOM
GENERIC?=	GENERIC
DEBUG?=		-g
JOBS?=		-j4
NOJOBS?=	-B
# NOEXEC?=	-n
AT?=		@
FORCE_LBA?=	# --force-lba # -> CHS ?

# Commands
#

CHFLAGS?=	chflags
CONFIG?=	config
CP?=		cp
CPIO?=		cpio
CVS?=		cvs
CVS_ARGS?=
CAP_MKDB?=	cap_mkdb
DATE?=		date
DISKLABEL?=	disklabel
DISKLABEL_ARGS?=	-wB
DISKLABEL_TYPE?=	fd1440
ECHO?=		echo
FIND?=		find
GREP?=		grep
GREP_ARGS?=	-B 2
GRUB?=		grub
GRUB?=		--batch
GRUB_INSTALL?=	grub-install
GRUB_INSTALL_ARGS?=	${FORCE_LBA}
KGZIP?=		kgzip
MAKE?=		make
MAKE_ARGS?=
MAKEDEV?=	MAKEDEV
MAKEDEV_ARGS?=	all
MAKEDEV_LOCAL?=	MAKEDEV.local
MAKEDEV_LOCAL_ARGS?=	all
MERGEMASTER?=	mergemaster
MERGEMASTER_ARGS?=	-svia -vir # -s
MK_DIR?=		mkdir -p
MOUNT?=		mount
MV?=		mv
NEWALIASES?=	newaliases
NEWFS?=		newfs
NEWFS_ARGS?=	-m 5 -o space
PKGDB?=		pkgdb
PKGDB_ARGS?=	-u
PORTSDB?=	portsdb
PORTSDB_ARGS?=	-u
PWD_MKDB?=	pwd_mkdb
RM?=		rm
SLEEP?=		sleep
SH?=		sh
TEE?=		tee
TEE_ARGS?=
TR?=		tr
TOUCH?=		touch
UMOUNT?=	umount
ZZZ?=		zzz

# Directories
#

OBJ_DIR?=	/usr/obj
SRC_DIR?=	/usr/src
SHDOC_DIR?=	${SRC_DIR}/share/doc
SYSINSTALL_DIR?=	${SRC_DIR}/release/sysinstall
KERNCONF_DIR?=	${SRC_DIR}/sys/${MACHINE_ARCH}/conf
KERNBUILD_DIR?=	${SRC_DIR}/sys/compile
KERNMOD_DIR?=	${SRC_DIR}/sys/modules
DEV_DIR?=	/dev
MAIL_DIR?=	/etc/mail
DOC_DIR?=	/usr/doc
DOC_ARGS?=	Makefile README share ${DOC_LANG}
WEB_DIR?=	/usr/www
WEB_ARGS?=	www/Makefile www/Makefile.inc www/share www/tools www/en
PORTS_DIR?=	/usr/ports

# Files
#

KERNEL?=	kernel
LOGIN_CONF?=	/etc/login.conf
MASTER_PASSWD?=	/etc/master.passwd
FSTAB?=		/etc/fstab

# Boot
#

BOOT_DIR?=	/boot
GRUB_DIR?=	${BOOT_DIR}/grub
ALTBOOT_DEV?=	/dev/ad0s3
ALTBOOT_DIR?=	/grub
FLOP_DEV?=	/dev/fd0
FLOP_DIR?=	/flop
BOOT_FILES?=	boot0 mbr \
		${FLOP_FILES:N*.map:Nstage*} ${SPLASH_FILES:%=splash/%}
FLOP_FILES?=	boot[12] defaults/loader.conf \
		grub/device.map grub/menu.lst ${GRUB_FILES:N*1_5:%=grub/%} \
		loader loader.4th loader.help loader.rc support.4th \
		kernel.conf loader.conf loader.conf.local
# GRUBXXX?=	/usr/local/share/grub/${MACHINE_ARCH}-freebsd
GRUB_FILES?=	e2fs_stage1_5 fat_stage1_5 ffs_stage1_5 \
		minix_stage1_5 reiserfs_stage1_5 stage[12]
SPLASH_FILES?=	chuck_nebula.bmp daemon_640.bmp \
		dual_chuck-40.bmp saturn_1_640.bmp

# Alt
#

ALT_DIR?=	# /disk0
ALT_FILES?=	dev/MAKEDEV* etc boot root/.profile root/.kshrc root/.kshdirsrc
LOADER_CONF_LOCAL?=	${BOOT_DIR}/loader.conf.local

# Make
#

.if !defined(NOW)
NOW!=		${DATE} +%Y%m%d%H%M
.endif

DO-MAKE?=	${MAKE} -k -f ${.CURDIR}/Makefile
FAKE-NOEXEC?=	${NOEXEC:M-n:S/-n/exit;/g}
FAKE-CVSUP?=	${AT}${FAKE-MAKE:S|-make|-cvsup|}
REAL-CVSUP?=	${FAKE-CVSUP:S|fake-|real-|} ${NOEXEC}
CVSUP_ARGS?=	
FAKE-CVS?=	${AT}${FAKE-MAKE:S|-make|-update|}
REAL-CVS?=	${FAKE-CVS:S|fake-|real-|} ${NOEXEC}
FAKE-MAKE?=	${AT}${DO-MAKE} DO-TARGET=${.TARGET} fake-make
REAL-MAKE?=	${FAKE-MAKE:S|fake-|real-|} ${NOEXEC}
PASS-ARGS?=	CVSUP_ARGS="${CVSUP_ARGS}" CVS_ARGS="${CVS_ARGS}" \
		MAKE_ARGS="${MAKE_ARGS}" TEE_ARGS="${TEE_ARGS}" \
		_DIR="${_DIR}" TARGET="${TARGET}" NOW="${NOW}" \
		CUSTOM="${CUSTOM}" GENERIC="${GENERIC}" KERNCONF="${KERNCONF}"
# TARGET?=	

# Log
#

LOG_DIR?=	/var/log/make
LOGPRE?=	${_DIR:S|/|_|g}${SUB_DIR:S|/|_|g}_
.if defined(TARGET) && !empty(TARGET)
_TARGET=	${TARGET:S|real-||}
.else
_TARGET=	${.TARGET:S|real-||}
.endif
LOGFILE?=	${LOG_DIR}/${LOGPRE}${_TARGET}.log
BEGFILE?=	${LOG_DIR}/.${LOGPRE}${_TARGET}.begin
ENDFILE?=	${LOG_DIR}/.${LOGPRE}${_TARGET}.end

# Mount
#

BOOT_MOUNTED=	.${GRUB_DIR:S|/|_|g}
.if defined(ALT_DIR) && !empty(ALT_DIR)
ALT_MOUNTED=	.${ALT_DIR:S|/|_|g}
ALT=		alt
.else
ALT=
.endif

# Targets
#

OLDWAY=		gen sys
NEWWAY=		kern
CURWAY=		${OLDWAY}

MAIN=	some
SRCS=	src ${CURWAY} mod doc www etc ${ALT} ports
PROG=	all least most some cvsup update build install clean ${ALT}

# Main
#

.MAIN: ${MAIN}

.PHONY: ${SRCS} ${.TARGET:S|$|-all|g}
${SRCS}: ${.TARGET:S|$|-all|g}

.PHONY: ${PROG} ${SRCS:S|$|-${.TARGET}|g}
${PROG}: ${SRCS:S|$|-${.TARGET}|g}

# Usage
#

.PHONY: help usage
help usage:
	@${ECHO} "usage: ${MAKE} [category[-target]]... [variable=value]..."
	@${ECHO} "       ${MAKE} [[category-]target]... [variable=value]..."
	@${ECHO} ""
	@${ECHO} "categories: ${SRCS}"
	@${ECHO} "targets: ${PROG}"
	@${ECHO} "variables: NCVS RELENG CUSTOM GENERIC ALT_DIR DEBUG JOBS" \
		 "NOJOBS NOEXEC AT"
	@${ECHO} ""
	@${ECHO} "defaults: ${MAKE} ${MAIN} NCVS=\"${NCVS}\"" \
		 "RELENG=\"${RELENG}\" \\"
	@${ECHO} "          CUSTOM=\"${CUSTOM}\" GENERIC=\"${GENERIC}\"" \
		 "ALT_DIR=\"${ALT_DIR}\" \\"
	@${ECHO} "          DEBUG=\"${DEBUG}\" JOBS=\"${JOBS}\"" \
		 "NOJOBS=\"${NOJOBS}\" NOEXEC=\"${NOEXEC}\" AT=\"${AT}\""

# Boot

.PHONY: boot flop grub
boot:
	[ -d ${ALTBOOT_DIR} ] || ${MK_DIR} ${ALTBOOT_DIR}
	if ${MOUNT} | ${GREP} -q ${ALTBOOT_DIR}; then \
		${TOUCH} ${BOOT_MOUNTED}; \
	else \
		${MOUNT} ${ALTBOOT_DEV}a ${ALTBOOT_DIR}; \
	fi
	-${GRUB_INSTALL} ${GRUB_INSTALL_ARGS} \
		--mount-point=${ALTBOOT_DIR} ${ALTBOOT_DEV}
	cd ${BOOT_DIR} && ${FIND} ${BOOT_FILES} | \
		${CPIO} -pdm ${ALTBOOT_DIR}${BOOT_DIR} 2>&1 | ${GREP} -v newer
	if [ -f ${ALTBOOT_DIR}/${KERNEL} ]; then \
		${CHFLAGS} noschg ${ALTBOOT_DIR}/${KERNEL}; \
	fi
	${CP} -p /${KERNEL} ${ALTBOOT_DIR}/${KERNEL}
	if [ -f ${ALTBOOT_DIR}/${KERNEL}.${GENERIC} ]; then \
		${CHFLAGS} noschg ${ALTBOOT_DIR}/${KERNEL}.${GENERIC}; \
	fi
	${CP} -p /${KERNEL}.${GENERIC} ${ALTBOOT_DIR}/${KERNEL}.${GENERIC}
	if [ -f ${BOOT_MOUNTED} ]; then \
                ${RM} -f ${BOOT_MOUNTED} ; \
	else \
		${UMOUNT} ${ALTBOOT_DIR}; \
	fi
flop:
	${DISKLABEL} ${DISKLABEL_ARGS} ${FLOP_DEV} ${DISKLABEL_TYPE}
	${NEWFS} ${NEWFS_ARGS} ${FLOP_DEV}c
	[ -d ${FLOP_DIR} ] || ${MK_DIR} ${FLOP_DIR}
	${MOUNT} ${FLOP_DEV}c ${FLOP_DIR}
	${MK_DIR} ${FLOP_DIR}${GRUB_DIR}
	cd ${BOOT_DIR} && ${FIND} ${FLOP_FILES} | \
		${CPIO} -pdm ${FLOP_DIR}${BOOT_DIR} 2>&1 | ${GREP} -v newer
	${KGZIP} -o ${FLOP_DIR}/${KERNEL} /${KERNEL}
	${UMOUNT} ${FLOP_DIR}
grub: flop
	(echo 'root (fd0)'; \
	 echo 'setup ${FORCE_LBA} (fd0)'; \
	 echo quit) | \
	${GRUB} ${GRUB_ARGS}

# Src
#

src-all: src-least src-most
src-least: src-cvsup src-update
src-some: src-build src-install
src-most: src-update src-some
src-cvsup:
	${FAKE-CVSUP} _DIR=${SRC_DIR} CVSUP_ARGS=${SUPFILE} # src
src-update:
	${FAKE-CVS} _DIR=${SRC_DIR} CVS_ARGS="${RELENG}"
SRC-BUILD= src-build-1 src-build-2 src-build-3 \
	   src-build-4 src-build-5
.PHONY: ${SRC-BUILD}
src-build: ${SRC-BUILD}
src-build-1:
	${FAKE-MAKE} _DIR=${SRC_DIR} TARGET=buildworld \
		MAKE_ARGS="${JOBS}"
src-build-2:
	${FAKE-MAKE} _DIR=${SHDOC_DIR} \
		MAKE_ARGS="${JOBS} PRINTERDEVICE=html"
src-build-3:
	${FAKE-MAKE} _DIR=${SYSINSTALL_DIR} TARGET=obj \
		MAKE_ARGS="${JOBS} MAKEOBJDIRPREFIX=${OBJ_DIR}"
src-build-4:
	${FAKE-MAKE} _DIR=${SYSINSTALL_DIR} TARGET=depend \
		MAKE_ARGS="${JOBS} MAKEOBJDIRPREFIX=${OBJ_DIR}"
src-build-5:
	${FAKE-MAKE} _DIR=${SYSINSTALL_DIR} TARGET=all \
		MAKE_ARGS="${JOBS} MAKEOBJDIRPREFIX=${OBJ_DIR}"
SRC-INSTALL= src-install-1 src-install-2 src-install-3
.PHONY: ${SRC-INSTALL}
src-install: ${SRC-INSTALL}
src-install-1:
	${FAKE-MAKE} _DIR=${SRC_DIR} TARGET=installworld \
		MAKE_ARGS="${NOJOBS}"
src-install-2:
	${FAKE-MAKE} _DIR=${SHDOC_DIR} TARGET=install \
		MAKE_ARGS="${NOJOBS} PRINTERDEVICE=html"
src-install-3:
	${FAKE-MAKE} _DIR=${SYSINSTALL_DIR} TARGET=install \
		MAKE_ARGS="${NOJOBS} MAKEOBJDIRPREFIX=${OBJ_DIR}"
SRC-CLEAN= src-clean-1 src-clean-2 src-clean-3
.PHONY: ${SRC-CLEAN}
src-clean: ${SRC-CLEAN}
src-clean-1:
	${FAKE-MAKE} _DIR=${SRC_DIR} TARGET=clean
src-clean-2:
	${FAKE-MAKE} _DIR=${SHDOC_DIR} TARGET=clean
src-clean-3:
	${FAKE-MAKE} _DIR=${SYSINSTALL_DIR} TARGET=clean \
		MAKE_ARGS="MAKEOBJDIRPREFIX=${OBJ_DIR}"
.if defined(ALT_DIR) && !empty(ALT_DIR)
src-alt: do-mount do-src-alt do-umount
DO-SRC-ALT= do-src-alt-1 do-src-alt-2
.PHONY: ${DO-SRC-ALT}
do-src-alt: ${DO-SRC-ALT}
do-src-alt-1:
	${FAKE-MAKE} _DIR=${SRC_DIR} TARGET=installworld TEE_ARGS=-a \
		MAKE_ARGS="${NOJOBS} DESTDIR=${ALT_DIR}"
do-src-alt-2:
	${FAKE-MAKE} _DIR=${SYSINSTALL_DIR} TARGET=install TEE_ARGS=-a \
		MAKE_ARGS="${NOJOBS} DESTDIR=${ALT_DIR}"
.endif

# Kern
#

kern-all: kern-least kern-most
kern-least: kern-cvsup kern-update
kern-some: kern-build kern-install
kern-most: kern-some
kern-cvsup: src-cvsup
kern-update: src-update
kern-build:
	${FAKE-MAKE} _DIR=${SRC_DIR} TARGET=buildkernel \
		MAKE_ARGS="${JOBS} KERNCONF=\\\"${CUSTOM}\\ ${GENERIC}\\\""
#		DEBUG=${DEBUG}
KERN-INSTALL= kern-install-1 kern-install-2 kern-install-3
.PHONY: ${KERN-INSTALL}
kern-install: ${KERN-INSTALL}
kern-install-1:
	${FAKE-MAKE} _DIR=${SRC_DIR} TARGET=installkernel \
		MAKE_ARGS="${NOJOBS} KERNCONF=${CUSTOM}"
kern-install-2:
	${FAKE-MAKE} _DIR=${SRC_DIR} TARGET=installkernel TEE_ARGS=-a \
		MAKE_ARGS="${NOJOBS} KERNCONF=${GENERIC}"
kern-install-3:
.for kern in ${CUSTOM} ${GENERIC}
	-${FAKE-NOEXEC} ${CHFLAGS} noschg /${kern} /${KERNEL}.${kern}
	-${FAKE-NOEXEC} ${MV} /${kern} /${KERNEL}.${kern}
	-${FAKE-NOEXEC} ${CHFLAGS} schg /${KERNEL}.${kern}
	-${FAKE-NOEXEC} ${CP} -p /${KERNEL}.${kern} /${KERNEL}.${kern}.${NOW}
.endfor
	-${FAKE-NOEXEC} ${CHFLAGS} noschg /${KERNEL}
	${FAKE-NOEXEC} ${CP} -p /${KERNEL}.${CUSTOM} /${KERNEL}
kern-clean:
	${FAKE-NOEXEC} echo "no ${.TARGET} target right now !"
.if defined(ALT_DIR) && !empty(ALT_DIR)
kern-alt: do-mount do-kern-alt do-umount
DO-KERN-ALT= do-kern-alt-1 do-kern-alt-2 do-kern-alt-3 do-kern-alt-4
.PHONY: ${DO-KERN-ALT}
do-kern-alt: ${DO-KERN-ALT}
do-kern-alt-1:
	-${FAKE-NOEXEC} \
		${CHFLAGS} noschg ${ALT_DIR}/${KERNEL} ${ALT_DIR}/${GENERIC}
	-${FAKE-NOEXEC} ${RM} -f ${ALT_DIR}/${KERNEL} ${ALT_DIR}/${GENERIC}
do-kern-alt-2:
	${FAKE-MAKE} _DIR=${SRC_DIR} TARGET=installkernel TEE_ARGS=-a \
		MAKE_ARGS="${NOJOBS} DESTDIR=${ALT_DIR} KERNCONF=${CUSTOM}"
do-kern-alt-3:
	${FAKE-MAKE} _DIR=${SRC_DIR} TARGET=installkernel TEE_ARGS=-a \
		MAKE_ARGS="${NOJOBS} DESTDIR=${ALT_DIR} KERNCONF=${GENERIC}"
do-kern-alt-4:
.for kern in ${CUSTOM} ${GENERIC}
	-${FAKE-NOEXEC} ${CHFLAGS} noschg ${ALT_DIR}/${kern}
.endfor
	-${FAKE-NOEXEC} ${MV} ${ALT_DIR}/${CUSTOM} ${ALT_DIR}/${KERNEL}
	-${FAKE-NOEXEC} \
		${MV} ${ALT_DIR}/${GENERIC} ${ALT_DIR}/${KERNEL}.${GENERIC}
	${FAKE-NOEXEC} \
		${CHFLAGS} schg ${ALT_DIR}/${KERNEL} \
				${ALT_DIR}/${KERNEL}.${GENERIC}
.endif

# Gen
#

gen-all: gen-least gen-most
gen-least: gen-cvsup gen-update
gen-some: gen-build gen-install
gen-most: gen-some
gen-cvsup: src-cvsup
gen-update: src-update
GEN-BUILD= gen-build-1 gen-build-2 gen-build-3
.PHONY: ${GEN-BUILD}
gen-build: ${GEN-BUILD}
gen-build-1:
	${FAKE-NOEXEC} cd ${KERNCONF_DIR} && ${CONFIG} ${GENERIC}
gen-build-2:
	${FAKE-MAKE} _DIR=${KERNBUILD_DIR}/${GENERIC} TARGET=depend \
		MAKE_ARGS="${JOBS} KERNEL=${KERNEL}.${GENERIC} DEBUG=${DEBUG}"
gen-build-3:
	${FAKE-MAKE} _DIR=${KERNBUILD_DIR}/${GENERIC} TARGET=all \
		MAKE_ARGS="${JOBS} KERNEL=${KERNEL}.${GENERIC} DEBUG=${DEBUG}"
GEN-INSTALL= gen-install-1 gen-install-2
.PHONY: ${GEN-INSTALL}
gen-install: ${GEN-INSTALL}
gen-install-1:
	${FAKE-MAKE} _DIR=${KERNBUILD_DIR}/${GENERIC} TARGET=install \
		MAKE_ARGS="${NOJOBS} KERNEL=${KERNEL}.${GENERIC}"
gen-install-2:
	${FAKE-NOEXEC} \
		${CP} -p /${KERNEL}.${GENERIC} /${KERNEL}.${GENERIC}.${NOW}
gen-clean:
	${FAKE-MAKE} _DIR=${KERNBUILD_DIR}/${GENERIC} TARGET=clean \
		MAKE_ARGS="KERNEL=${KERNEL}.${GENERIC}"
.if defined(ALT_DIR) && !empty(ALT_DIR)
gen-alt: do-mount do-gen-alt do-umount
DO-GEN-ALT= do-gen-alt-1 do-gen-alt-2 do-gen-alt-3
.PHONY: ${DO-GEN-ALT}
do-gen-alt: ${DO-GEN-ALT}
do-gen-alt-1:
	-${FAKE-NOEXEC} ${RM} -rf ${ALT_DIR}/${KERNEL}.${GENERIC}.old
	-${FAKE-NOEXEC} ${MK_DIR} \
		${ALT_DIR}/${KERNEL}.${GENERIC}.old/${KERNEL}.${GENERIC}
do-gen-alt-2:
	${FAKE-MAKE} _DIR=${KERNBUILD_DIR}/${GENERIC} \
		TARGET=install TEE_ARGS=-a \
		MAKE_ARGS="${NOJOBS} DESTDIR=${ALT_DIR} \
			   KERNEL=${KERNEL}.${GENERIC}"
do-gen-alt-3:
	-${FAKE-NOEXEC} ${RM} -rf ${ALT_DIR}/${KERNEL}.${GENERIC}.old
.endif

# Sys
#

sys-all: sys-least sys-most
sys-least: sys-cvsup sys-update
sys-some: sys-build sys-install
sys-most: sys-some
sys-cvsup: src-cvsup
sys-update: src-update
SYS-BUILD= sys-build-1 sys-build-2 sys-build-3
.PHONY: ${SYS-BUILD}
sys-build: ${SYS-BUILD}
sys-build-1:
	${FAKE-NOEXEC} cd ${KERNCONF_DIR} && ${CONFIG} ${CUSTOM}
sys-build-2:
	${FAKE-MAKE} _DIR=${KERNBUILD_DIR}/${CUSTOM} TARGET=depend \
		MAKE_ARGS="${JOBS} DEBUG=${DEBUG}"
sys-build-3:
	${FAKE-MAKE} _DIR=${KERNBUILD_DIR}/${CUSTOM} TARGET=all \
		MAKE_ARGS="${JOBS} DEBUG=${DEBUG}"
SYS-INSTALL= sys-install-1 sys-install-2
.PHONY: ${SYS-INSTALL}
sys-install: ${SYS-INSTALL}
sys-install-1:
	${FAKE-MAKE} _DIR=${KERNBUILD_DIR}/${CUSTOM} TARGET=install \
		MAKE_ARGS="${NOJOBS}"
sys-install-2:
	${FAKE-NOEXEC} ${MV} /${KERNEL}.old /${KERNEL}.${CUSTOM}.old
	${FAKE-NOEXEC} ${CP} -p /${KERNEL} /${KERNEL}.${CUSTOM}.${NOW}
	-${FAKE-NOEXEC} ${CHFLAGS} noschg /${KERNEL}.${CUSTOM}
	${FAKE-NOEXEC} ${CP} -p /${KERNEL} /${KERNEL}.${CUSTOM}
sys-clean:
	${FAKE-MAKE} _DIR=${KERNBUILD_DIR}/${CUSTOM} TARGET=clean
.if defined(ALT_DIR) && !empty(ALT_DIR)
sys-alt: do-mount do-sys-alt do-umount
DO-SYS-ALT= do-sys-alt-1 do-sys-alt-2 do-sys-alt-3
.PHONY: ${DO-SYS-ALT}
do-sys-alt: ${DO-SYS-ALT}
do-sys-alt-1:
	-${FAKE-NOEXEC} ${RM} -rf ${ALT_DIR}/${KERNEL}.old
	-${FAKE-NOEXEC} ${MK_DIR} ${ALT_DIR}/${KERNEL}.old/${KERNEL}
do-sys-alt-2:
	${FAKE-MAKE} _DIR=${KERNBUILD_DIR}/${CUSTOM} TARGET=install TEE_ARGS=-a \
		MAKE_ARGS=""${NOJOBS} DESTDIR=${ALT_DIR}"
do-sys-alt-3:
	-${FAKE-NOEXEC} ${RM} -rf ${ALT_DIR}/${KERNEL}.old
.endif

# Mod
#

mod-all: mod-least mod-most
mod-least: mod-cvsup mod-update
mod-some: # mod-build mod-install
	${FAKE-NOEXEC} echo "no ${.TARGET} target right now !"
mod-most: mod-some
mod-cvsup: src-cvsup
mod-update: src-update
MOD-BUILD= mod-build-1 mod-build-2 mod-build-3
.PHONY: ${MOD-BUILD}
mod-build: ${MOD-BUILD}
mod-build-1:
	${FAKE-MAKE} _DIR=${KERNMOD_DIR} TARGET=obj \
		MAKE_ARGS="${JOBS} MAKEOBJDIRPREFIX=${OBJ_DIR}"
mod-build-2:
	${FAKE-MAKE} _DIR=${KERNMOD_DIR} TARGET=depend \
		MAKE_ARGS="${JOBS} MAKEOBJDIRPREFIX=${OBJ_DIR}"
mod-build-3:
	${FAKE-MAKE} _DIR=${KERNMOD_DIR} TARGET=all \
		MAKE_ARGS="${JOBS} MAKEOBJDIRPREFIX=${OBJ_DIR}"
mod-install:
	${FAKE-MAKE} _DIR=${KERNMOD_DIR} TARGET=install \
		MAKE_ARGS="${NOJOBS} MAKEOBJDIRPREFIX=${OBJ_DIR}"
mod-clean:
	${FAKE-MAKE} _DIR=${KERNMOD_DIR} TARGET=clean \
		MAKE_ARGS="MAKEOBJDIRPREFIX=${OBJ_DIR}"
.if defined(ALT_DIR) && !empty(ALT_DIR)
mod-alt: do-mount do-mod-alt do-umount
do-mod-alt:
	${FAKE-MAKE} _DIR=${KERNMOD_DIR} TARGET=install TEE_ARGS=-a \
		MAKE_ARGS="${NOJOBS} DESTDIR=${ALT_DIR}"
.endif

# Etc
#

etc-all: etc-least etc-most
etc-least: etc-cvsup etc-update
etc-some: etc-build etc-install
etc-most: etc-some
etc-cvsup: src-cvsup
etc-update: src-update
etc-build:
	${FAKE-NOEXEC} echo "no ${.TARGET} target right now !"
ETC-INSTALL= etc-install-1 etc-install-2
etc-install:
.for args in ${MERGEMASTER_ARGS}
	${FAKE-NOEXEC} ${MERGEMASTER} ${args}
.endfor
# the following targets are used by mergermaster at exit time using mmexitscript
.PHONY: etc-makedev etc-makedev.local etc-sendmail \
	etc-newaliases etc-cap_mkdb etc-pwd_mkdb
etc-makedev:
	${FAKE-NOEXEC} cd ${DEV_DIR} && \
		${SH} ${MAKEDEV} ${MAKEDEV_ARGS}
etc-makedev.local:
	${FAKE-NOEXEC} cd ${DEV_DIR} && \
		${SH} ${MAKEDEV_LOCAL} ${MAKEDEV_LOCAL_ARGS}
etc-sendmail:
	${FAKE-MAKE} _DIR=${MAIL_DIR} TARGET=install \
		MAKE_ARGS="${NOJOBS}"
etc-newaliases:
	${FAKE-NOEXEC} ${NEWALIASES}
etc-cap_mkdb:
	${FAKE-NOEXEC} ${CAP_MKDB} ${LOGIN_CONF}
etc-pwd_mkdb:
	${FAKE-NOEXEC} ${PWD_MKDB} -p ${MASTER_PASSWD}
# end of mergemaster specific targets.
etc-clean:
	${FAKE-NOEXEC} echo "no ${.TARGET} target right now !"
.if defined(ALT_DIR) && !empty(ALT_DIR)
etc-alt: do-mount do-etc-alt do-umount
do-etc-alt:
	${FAKE-NOEXEC} ${TOUCH} ${ALT_DIR}${FSTAB}
	${FAKE-NOEXEC} cd / && \
		${FIND} ${ALT_FILES} -name splash -prune -o -print | \
		${CPIO} -pdm ${ALT_DIR} 2>&1 | ${GREP} -v newer
	${FAKE-NOEXEC} cd ${ALT_DIR}${DEV_DIR} && \
		${SH} ${MAKEDEV} ${MAKEDEV_ARGS}
	${FAKE-NOEXEC} cd ${ALT_DIR}${DEV_DIR} && \
		${SH} ${MAKEDEV_LOCAL} ${MAKEDEV_LOCAL_ARGS}
	${FAKE-NOEXEC} . ${LOADER_CONF_LOCAL} && [ -n "$${bitmap_name}" ] && \
		${ECHO} $${bitmap_name} | \
		${CPIO} -pdm ${ALT_DIR} 2>&1 | ${GREP} -v newer
.endif

# Alt
#

.if defined(ALT_DIR) && !empty(ALT_DIR)
alt-all: alt-least alt-most
alt-least: alt-cvsup alt-update
alt-some: alt-build alt-install
alt-most: alt-some
alt-cvsup: src-cvsup
alt-update: src-update
alt-build: src-build
alt-install: do-mount do-alt-install do-umount
DO-ALT-INSTALL= do-alt-install-1 do-alt-install-2
.PHONY: ${DO-ALT-INSTALL}
do-alt-install: ${DO-ALT-INSTALL}
do-alt-install-1:
	-${FAKE-NOEXEC} ${CHFLAGS} noschg ${ALT_DIR}/${KERNEL} && \
		 ${RM} -rf ${ALT_DIR}/${KERNEL}
	-${FAKE-NOEXEC} ${CHFLAGS} noschg ${ALT_DIR}/${KERNEL}.${GENERIC} && \
		${RM} -rf ${ALT_DIR}/${KERNEL}.${GENERIC}
do-alt-install-2: ${SRCS:S|^|do-|:S|$|-alt|}
alt-clean:
	${FAKE-NOEXEC} echo "no ${.TARGET} target right now !"
alt-alt:
	${FAKE-NOEXEC} echo "no ${.TARGET} target right now !"
do-alt-alt:
	${FAKE-NOEXEC} echo "no ${.TARGET} target right now !"
.endif

# Doc
#

doc-all: doc-least doc-most
doc-least: doc-cvsup doc-update
doc-some:
	${FAKE-NOEXEC} echo "no ${.TARGET} target right now !"
doc-most: doc-update doc-build doc-install
doc-cvsup:
	${FAKE-CVSUP} _DIR=${DOC_DIR} CVSUP_ARGS=${DOCSUPFILE}
doc-update:
	${FAKE-CVS} _DIR=${DOC_DIR} CVS_ARGS="${DOC_ARGS}"
DOC-BUILD= doc-build-1 doc-build-2
.PHONY: ${DOC-BUILD}
doc-build: ${DOC-BUILD}
doc-build-1:
	${FAKE-MAKE} _DIR=${DOC_DIR} TARGET=obj # MAKE_ARGS="${JOBS}"
doc-build-2:
	${FAKE-MAKE} _DIR=${DOC_DIR} TARGET=all # MAKE_ARGS="${JOBS}"
doc-install:
	${FAKE-MAKE} _DIR=${DOC_DIR} TARGET=install MAKE_ARGS="${NOJOBS}"
doc-clean:
	${FAKE-MAKE} _DIR=${DOC_DIR} TARGET=clean
.if defined(ALT_DIR) && !empty(ALT_DIR)
doc-alt:
	${FAKE-NOEXEC} echo "no ${.TARGET} target right now !"
do-doc-alt:
	${FAKE-NOEXEC} echo "no ${.TARGET} target right now !"
.endif

# Www
#

www-all: www-least www-most
www-least: www-cvsup www-update
www-some:
	${FAKE-NOEXEC} echo "no ${.TARGET} target right now !"
www-most: www-update www-build www-install
www-cvsup: doc-cvsup
www-update:
	${FAKE-CVS} _DIR=${WEB_DIR:H} SUB_DIR=${WEB_DIR:S|${WEB_DIR:H}||} \
		CVS_ARGS="${WEB_ARGS}"
WWW-BUILD= www-build-1 www-build-2
.PHONY: ${WWW-BUILD}
www-build: ${WWW-BUILD}
www-build-1:
	${FAKE-MAKE} _DIR=${WEB_DIR} TARGET=obj # MAKE_ARGS="${JOBS}"
www-build-2:
	${FAKE-MAKE} _DIR=${WEB_DIR} TARGET=all # MAKE_ARGS="${JOBS}"
WWW-INSTALL= www-install-1 www-install-2
.PHONY: ${WWW-INSTALL}
www-install: ${WWW-INSTALL}
www-install-1:
	${FAKE-MAKE} _DIR=${WEB_DIR} TARGET=install MAKE_ARGS="${NOJOBS}"
www-install-2:
	${FAKE-MAKE} _DIR=${WEB_DIR}/en TARGET=linbot MAKE_ARGS="${NOJOBS}"
www-clean:
	${FAKE-MAKE} _DIR=${WEB_DIR} TARGET=clean
.if defined(ALT_DIR) && !empty(ALT_DIR)
www-alt:
	${FAKE-NOEXEC} echo "no ${.TARGET} target right now !"
do-www-alt:
	${FAKE-NOEXEC} echo "no ${.TARGET} target right now !"
.endif

# Ports
#

ports-all: ports-least ports-most
ports-least: ports-cvsup ports-update
ports-some: ports-build ports-install
ports-most: ports-update ports-some
ports-cvsup:
	${FAKE-CVSUP} _DIR=${PORTS_DIR} CVSUP_ARGS=${PORTSSUPFILE}
PORTS-UPDATE= ports-update-1 ports-update-2
.PHONY: ${PORTS-UPDATE}
ports-update: ${PORTS-UPDATE}
ports-update-1:
	${FAKE-CVS} _DIR=${PORTS_DIR}
ports-update-2:
	${FAKE-NOEXEC} ${PORTSDB} ${PORTSDB_ARGS}
	${FAKE-NOEXEC} ${PKGDB} ${PKGDB_ARGS}
ports-build:
	${FAKE-NOEXEC} echo "no ${.TARGET} target right now !"
ports-install:
	${FAKE-NOEXEC} echo "no ${.TARGET} target right now !"
ports-clean:
	${FAKE-NOEXEC} echo "no ${.TARGET} target right now !"
.if defined(ALT_DIR) && !empty(ALT_DIR)
ports-alt:
	${FAKE-NOEXEC} echo "no ${.TARGET} target right now !"
do-ports-alt:
	${FAKE-NOEXEC} echo "no ${.TARGET} target right now !"
.endif

# Mount
#

.if defined(ALT_DIR) && !empty(ALT_DIR)
.PHONY: do-mount do-umount
do-mount:
	${FAKE-NOEXEC} ${RM} -f ${ALT_MOUNTED}
	${FAKE-NOEXEC} ${MOUNT} | ${GREP} -q ${ALT_DIR} && \
		${TOUCH} ${ALT_MOUNTED} || ${MOUNT} ${ALT_DIR}
do-umount:
	${FAKE-NOEXEC} if [ -f ${ALT_MOUNTED} ]; then \
		${RM} -f ${ALT_MOUNTED} ; \
	else \
		${UMOUNT} ${ALT_DIR} ; \
		${SLEEP} 5 ; ${ZZZ} ; \
	fi
.endif

# Make
#

.PHONY: fake-cvsup fake-update fake-make real-cvsup real-update real-make
# the reason of the use of an intermediate make level is if you
# put some stuff in /etc/make.conf which depends on the current
# directory. what it is done, of course :)
fake-cvsup fake-update fake-make:
	${AT}cd ${_DIR} && ${DO-MAKE} ${DO-TARGET} \
		FAKE-CVSUP="${REAL-CVSUP}" \
		FAKE-CVS="${REAL-CVS}" \
		FAKE-MAKE="${REAL-MAKE}" \
		${PASS-ARGS}
real-cvsup:
	-@file=$$(${ECHO} ${LOGFILE} | ${TR} ' ' _); \
	cd ${_DIR} && [ -f $${file} ] && \
	case "${TEE_ARGS}" in *-a*) ;; *) ${MV} -f $${file} $${file}.old ;; esac
	-@file=$$(${ECHO} ${BEGFILE} | ${TR} ' ' _); \
	cd ${_DIR} && \
		case "${TEE_ARGS}" in *-a*) ;; *) ${TOUCH} $${file} ;; esac
	file=$$(${ECHO} ${LOGFILE} | ${TR} ' ' _); \
	cd ${_DIR} && ${SUP} ${SUPFLAGS} ${CVSUP_ARGS} 2>&1 | \
		${TEE} ${TEE_ARGS} $${file}
	-@file=$$(${ECHO} ${ENDFILE} | ${TR} ' ' _); \
	cd ${_DIR} && \
		case "${TEE_ARGS}" in *-a*) ;; *) ${TOUCH} $${file} ;; esac
.if defined(NCVS)
real-update:
	-@file=$$(${ECHO} ${LOGFILE} | ${TR} ' ' _); \
	cd ${_DIR} && [ -f $${file} ] && \
	case "${TEE_ARGS}" in *-a*) ;; *) ${MV} -f $${file} $${file}.old ;; esac
	-@file=$$(${ECHO} ${BEGFILE} | ${TR} ' ' _); \
	cd ${_DIR} && \
		case "${TEE_ARGS}" in *-a*) ;; *) ${TOUCH} $${file} ;; esac
	file=$$(${ECHO} ${LOGFILE} | ${TR} ' ' _); \
	cd ${_DIR} && ${CVS} update ${CVS_ARGS} 2>&1 | \
		${TEE} ${TEE_ARGS} $${file}
	-@file=$$(${ECHO} ${ENDFILE} | ${TR} ' ' _); \
	cd ${_DIR} && \
		case "${TEE_ARGS}" in *-a*) ;; *) ${TOUCH} $${file} ;; esac
.else
real-update:
.endif
real-make:
	-@file=$$(${ECHO} ${LOGFILE} | ${TR} ' ' _); \
	cd ${_DIR} && [ -f $${file} ] && \
	case "${TEE_ARGS}" in *-a*) ;; *) ${MV} -f $${file} $${file}.old ;; esac
	-@file=$$(${ECHO} ${BEGFILE} | ${TR} ' ' _); \
	cd ${_DIR} && \
		case "${TEE_ARGS}" in *-a*) ;; *) ${TOUCH} $${file} ;; esac
	file=$$(${ECHO} ${LOGFILE} | ${TR} ' ' _); \
	cd ${_DIR} && ${MAKE} -k ${MAKE_ARGS} ${TARGET} 2>&1 | \
		${TEE} ${TEE_ARGS} $${file}
	-@file=$$(${ECHO} ${ENDFILE} | ${TR} ' ' _); \
	cd ${_DIR} && \
		case "${TEE_ARGS}" in *-a*) ;; *) ${TOUCH} $${file} ;; esac
#	-@file=$$(${ECHO} ${LOGFILE} | ${TR} ' ' _); \
#	cd ${_DIR} && ${GREP} ${GREP_ARGS} Error $${file}

# eof

--pf9I7BMVVzbSWLtt--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020607110654.GA28015>