head	1.45;
access;
symbols
	netbsd-11-0-RC4:1.44
	netbsd-11-0-RC3:1.44
	netbsd-11-0-RC2:1.44
	netbsd-11-0-RC1:1.44
	perseant-exfatfs-base-20250801:1.44
	netbsd-11:1.44.0.4
	netbsd-11-base:1.44
	netbsd-10-1-RELEASE:1.40
	perseant-exfatfs-base-20240630:1.44
	perseant-exfatfs:1.44.0.2
	perseant-exfatfs-base:1.44
	netbsd-8-3-RELEASE:1.40
	netbsd-9-4-RELEASE:1.40
	netbsd-10-0-RELEASE:1.40
	netbsd-10-0-RC6:1.40
	netbsd-10-0-RC5:1.40
	netbsd-10-0-RC4:1.40
	netbsd-10-0-RC3:1.40
	netbsd-10-0-RC2:1.40
	netbsd-10-0-RC1:1.40
	netbsd-10:1.40.0.22
	netbsd-10-base:1.40
	netbsd-9-3-RELEASE:1.40
	cjep_sun2x-base1:1.40
	cjep_sun2x:1.40.0.20
	cjep_sun2x-base:1.40
	cjep_staticlib_x-base1:1.40
	netbsd-9-2-RELEASE:1.40
	cjep_staticlib_x:1.40.0.18
	cjep_staticlib_x-base:1.40
	netbsd-9-1-RELEASE:1.40
	phil-wifi-20200421:1.40
	phil-wifi-20200411:1.40
	is-mlppp:1.40.0.16
	is-mlppp-base:1.40
	phil-wifi-20200406:1.40
	netbsd-8-2-RELEASE:1.40
	netbsd-9-0-RELEASE:1.40
	netbsd-9-0-RC2:1.40
	netbsd-9-0-RC1:1.40
	phil-wifi-20191119:1.40
	netbsd-9:1.40.0.14
	netbsd-9-base:1.40
	phil-wifi-20190609:1.40
	netbsd-8-1-RELEASE:1.40
	netbsd-8-1-RC1:1.40
	pgoyette-compat-merge-20190127:1.40
	pgoyette-compat-20190127:1.40
	pgoyette-compat-20190118:1.40
	pgoyette-compat-1226:1.40
	pgoyette-compat-1126:1.40
	pgoyette-compat-1020:1.40
	pgoyette-compat-0930:1.40
	pgoyette-compat-0906:1.40
	netbsd-7-2-RELEASE:1.37
	pgoyette-compat-0728:1.40
	netbsd-8-0-RELEASE:1.40
	phil-wifi:1.40.0.12
	phil-wifi-base:1.40
	pgoyette-compat-0625:1.40
	netbsd-8-0-RC2:1.40
	pgoyette-compat-0521:1.40
	pgoyette-compat-0502:1.40
	pgoyette-compat-0422:1.40
	netbsd-8-0-RC1:1.40
	pgoyette-compat-0415:1.40
	pgoyette-compat-0407:1.40
	pgoyette-compat-0330:1.40
	pgoyette-compat-0322:1.40
	pgoyette-compat-0315:1.40
	netbsd-7-1-2-RELEASE:1.37
	pgoyette-compat:1.40.0.10
	pgoyette-compat-base:1.40
	netbsd-7-1-1-RELEASE:1.37
	matt-nb8-mediatek:1.40.0.8
	matt-nb8-mediatek-base:1.40
	perseant-stdc-iso10646:1.40.0.6
	perseant-stdc-iso10646-base:1.40
	netbsd-8:1.40.0.4
	netbsd-8-base:1.40
	prg-localcount2-base3:1.40
	prg-localcount2-base2:1.40
	prg-localcount2-base1:1.40
	prg-localcount2:1.40.0.2
	prg-localcount2-base:1.40
	pgoyette-localcount-20170426:1.40
	bouyer-socketcan-base1:1.40
	pgoyette-localcount-20170320:1.40
	netbsd-7-1:1.37.0.8
	netbsd-7-1-RELEASE:1.37
	netbsd-7-1-RC2:1.37
	netbsd-7-nhusb-base-20170116:1.37
	bouyer-socketcan:1.39.0.4
	bouyer-socketcan-base:1.39
	pgoyette-localcount-20170107:1.39
	netbsd-7-1-RC1:1.37
	pgoyette-localcount-20161104:1.39
	netbsd-7-0-2-RELEASE:1.37
	localcount-20160914:1.39
	netbsd-7-nhusb:1.37.0.6
	netbsd-7-nhusb-base:1.37
	pgoyette-localcount-20160806:1.39
	pgoyette-localcount-20160726:1.39
	pgoyette-localcount:1.39.0.2
	pgoyette-localcount-base:1.39
	netbsd-7-0-1-RELEASE:1.37
	netbsd-7-0:1.37.0.4
	netbsd-7-0-RELEASE:1.37
	netbsd-7-0-RC3:1.37
	netbsd-7-0-RC2:1.37
	netbsd-7-0-RC1:1.37
	netbsd-5-2-3-RELEASE:1.30
	netbsd-5-1-5-RELEASE:1.30
	netbsd-6-0-6-RELEASE:1.31
	netbsd-6-1-5-RELEASE:1.31
	netbsd-7:1.37.0.2
	netbsd-7-base:1.37
	yamt-pagecache-base9:1.33
	yamt-pagecache-tag8:1.31
	netbsd-6-1-4-RELEASE:1.31
	netbsd-6-0-5-RELEASE:1.31
	tls-earlyentropy:1.33.0.2
	tls-earlyentropy-base:1.37
	riastradh-xf86-video-intel-2-7-1-pre-2-21-15:1.33
	riastradh-drm2-base3:1.33
	netbsd-6-1-3-RELEASE:1.31
	netbsd-6-0-4-RELEASE:1.31
	netbsd-5-2-2-RELEASE:1.30
	netbsd-5-1-4-RELEASE:1.30
	netbsd-6-1-2-RELEASE:1.31
	netbsd-6-0-3-RELEASE:1.31
	netbsd-5-2-1-RELEASE:1.30
	netbsd-5-1-3-RELEASE:1.30
	netbsd-6-1-1-RELEASE:1.31
	riastradh-drm2-base2:1.32
	riastradh-drm2-base1:1.32
	riastradh-drm2:1.32.0.2
	riastradh-drm2-base:1.32
	netbsd-6-1:1.31.0.22
	netbsd-6-0-2-RELEASE:1.31
	netbsd-6-1-RELEASE:1.31
	khorben-n900:1.31.0.20
	netbsd-6-1-RC4:1.31
	netbsd-6-1-RC3:1.31
	agc-symver:1.31.0.18
	agc-symver-base:1.31
	netbsd-6-1-RC2:1.31
	netbsd-6-1-RC1:1.31
	yamt-pagecache-base8:1.31
	netbsd-5-2:1.30.0.14
	netbsd-6-0-1-RELEASE:1.31
	yamt-pagecache-base7:1.31
	netbsd-5-2-RELEASE:1.30
	netbsd-5-2-RC1:1.30
	matt-nb6-plus-nbase:1.31
	yamt-pagecache-base6:1.31
	netbsd-6-0:1.31.0.14
	netbsd-6-0-RELEASE:1.31
	netbsd-6-0-RC2:1.31
	tls-maxphys:1.31.0.12
	tls-maxphys-base:1.37
	matt-nb6-plus:1.31.0.10
	matt-nb6-plus-base:1.31
	netbsd-6-0-RC1:1.31
	yamt-pagecache-base5:1.31
	yamt-pagecache-base4:1.31
	netbsd-6:1.31.0.8
	netbsd-6-base:1.31
	netbsd-5-1-2-RELEASE:1.30
	netbsd-5-1-1-RELEASE:1.30
	yamt-pagecache-base3:1.31
	yamt-pagecache-base2:1.31
	yamt-pagecache:1.31.0.6
	yamt-pagecache-base:1.31
	cherry-xenmp:1.31.0.4
	cherry-xenmp-base:1.31
	bouyer-quota2-nbase:1.31
	bouyer-quota2:1.31.0.2
	bouyer-quota2-base:1.31
	matt-mips64-premerge-20101231:1.31
	matt-nb5-mips64-premerge-20101231:1.30
	matt-nb5-pq3:1.30.0.12
	matt-nb5-pq3-base:1.30
	netbsd-5-1:1.30.0.10
	netbsd-5-1-RELEASE:1.30
	netbsd-5-1-RC4:1.30
	matt-nb5-mips64-k15:1.30
	netbsd-5-1-RC3:1.30
	netbsd-5-1-RC2:1.30
	netbsd-5-1-RC1:1.30
	netbsd-5-0-2-RELEASE:1.30
	matt-nb5-mips64-premerge-20091211:1.30
	matt-premerge-20091211:1.31
	matt-nb5-mips64-u2-k2-k4-k7-k8-k9:1.30
	matt-nb4-mips64-k7-u2a-k9b:1.30
	matt-nb5-mips64-u1-k1-k5:1.30
	matt-nb5-mips64:1.30.0.8
	netbsd-5-0-1-RELEASE:1.30
	jym-xensuspend-nbase:1.31
	netbsd-5-0:1.30.0.6
	netbsd-5-0-RELEASE:1.30
	netbsd-5-0-RC4:1.30
	netbsd-5-0-RC3:1.30
	netbsd-5-0-RC2:1.30
	jym-xensuspend:1.30.0.4
	jym-xensuspend-base:1.31
	netbsd-5-0-RC1:1.30
	netbsd-5:1.30.0.2
	netbsd-5-base:1.30
	matt-mips64-base2:1.30
	matt-mips64:1.29.0.26
	netbsd-4-0-1-RELEASE:1.29
	wrstuden-revivesa-base-3:1.30
	wrstuden-revivesa-base-2:1.30
	wrstuden-fixsa-newbase:1.29
	wrstuden-revivesa-base-1:1.29
	yamt-pf42-base4:1.29
	yamt-pf42-base3:1.29
	hpcarm-cleanup-nbase:1.29
	yamt-pf42-baseX:1.29
	yamt-pf42-base2:1.29
	wrstuden-revivesa:1.29.0.24
	wrstuden-revivesa-base:1.29
	yamt-pf42:1.29.0.22
	yamt-pf42-base:1.29
	mjf-devfs2:1.29.0.20
	mjf-devfs2-base:1.30
	keiichi-mipv6:1.29.0.18
	keiichi-mipv6-base:1.29
	mjf-devfs:1.29.0.16
	mjf-devfs-base:1.29
	matt-armv6-nbase:1.29
	matt-armv6-prevmlocking:1.29
	wrstuden-fixsa-base-1:1.29
	netbsd-4-0:1.29.0.14
	netbsd-4-0-RELEASE:1.29
	cube-autoconf:1.29.0.12
	cube-autoconf-base:1.29
	netbsd-4-0-RC5:1.29
	netbsd-4-0-RC4:1.29
	netbsd-4-0-RC3:1.29
	netbsd-4-0-RC2:1.29
	netbsd-4-0-RC1:1.29
	matt-armv6:1.29.0.10
	matt-armv6-base:1.29
	matt-mips64-base:1.29
	hpcarm-cleanup:1.29.0.8
	hpcarm-cleanup-base:1.29
	netbsd-3-1-1-RELEASE:1.28
	netbsd-3-0-3-RELEASE:1.28
	wrstuden-fixsa:1.29.0.6
	wrstuden-fixsa-base:1.29
	abandoned-netbsd-4-base:1.29
	abandoned-netbsd-4:1.29.0.2
	netbsd-3-1:1.28.0.6
	netbsd-3-1-RELEASE:1.28
	netbsd-3-0-2-RELEASE:1.28
	netbsd-3-1-RC4:1.28
	netbsd-3-1-RC3:1.28
	netbsd-3-1-RC2:1.28
	netbsd-3-1-RC1:1.28
	netbsd-4:1.29.0.4
	netbsd-4-base:1.29
	netbsd-3-0-1-RELEASE:1.28
	netbsd-3-0:1.28.0.4
	netbsd-3-0-RELEASE:1.28
	netbsd-3-0-RC6:1.28
	netbsd-3-0-RC5:1.28
	netbsd-3-0-RC4:1.28
	netbsd-3-0-RC3:1.28
	netbsd-3-0-RC2:1.28
	netbsd-3-0-RC1:1.28
	netbsd-2-0-3-RELEASE:1.27
	netbsd-2-1:1.27.0.6
	netbsd-2-1-RELEASE:1.27
	netbsd-2-1-RC6:1.27
	netbsd-2-1-RC5:1.27
	netbsd-2-1-RC4:1.27
	netbsd-2-1-RC3:1.27
	netbsd-2-1-RC2:1.27
	netbsd-2-1-RC1:1.27
	netbsd-2-0-2-RELEASE:1.27
	netbsd-3:1.28.0.2
	netbsd-3-base:1.28
	netbsd-2-0-1-RELEASE:1.27
	netbsd-2:1.27.0.4
	netbsd-2-base:1.27
	netbsd-2-0-RELEASE:1.27
	netbsd-2-0-RC5:1.27
	netbsd-2-0-RC4:1.27
	netbsd-2-0-RC3:1.27
	netbsd-2-0-RC2:1.27
	netbsd-2-0-RC1:1.27
	netbsd-2-0:1.27.0.2
	netbsd-2-0-base:1.27
	netbsd-1-6-PATCH002-RELEASE:1.17
	netbsd-1-6-PATCH002:1.17
	netbsd-1-6-PATCH002-RC4:1.17
	netbsd-1-6-PATCH002-RC3:1.17
	netbsd-1-6-PATCH002-RC2:1.17
	netbsd-1-6-PATCH002-RC1:1.17
	netbsd-1-6-PATCH001:1.17
	netbsd-1-6-PATCH001-RELEASE:1.17
	netbsd-1-6-PATCH001-RC3:1.17
	netbsd-1-6-PATCH001-RC2:1.17
	netbsd-1-6-PATCH001-RC1:1.17
	fvdl_fs64_base:1.18
	netbsd-1-6-RELEASE:1.17
	netbsd-1-6-RC3:1.17
	netbsd-1-6-RC2:1.17
	netbsd-1-6-RC1:1.17
	netbsd-1-6:1.17.0.2
	netbsd-1-6-base:1.17;
locks; strict;
comment	@# @;


1.45
date	2026.03.01.15.16.56;	author christos;	state Exp;
branches;
next	1.44;
commitid	oXkEAlrZKwF9IhwG;

1.44
date	2024.05.17.21.31.10;	author christos;	state Exp;
branches;
next	1.43;
commitid	i5TAOhIGrJrNLoaF;

1.43
date	2024.05.17.19.54.28;	author christos;	state Exp;
branches;
next	1.42;
commitid	DmowbCmwJyxIeoaF;

1.42
date	2024.05.16.15.46.42;	author christos;	state Exp;
branches;
next	1.41;
commitid	biTUDsY6uPnFTeaF;

1.41
date	2024.03.20.00.31.54;	author christos;	state Exp;
branches;
next	1.40;
commitid	OlTMHRxeIGUoFP2F;

1.40
date	2017.02.11.03.07.06;	author christos;	state Exp;
branches;
next	1.39;
commitid	RQbVHlgh5ObhUtFz;

1.39
date	2015.12.20.22.47.59;	author christos;	state Exp;
branches
	1.39.2.1
	1.39.4.1;
next	1.38;
commitid	F57SH8XFE1FnUJNy;

1.38
date	2014.08.12.11.48.22;	author martin;	state Exp;
branches;
next	1.37;
commitid	OYXv08mtYChwa4Mx;

1.37
date	2014.08.06.11.41.18;	author apb;	state Exp;
branches;
next	1.36;
commitid	Ol7sBBEcKbd5kiLx;

1.36
date	2014.08.06.10.41.13;	author apb;	state Exp;
branches;
next	1.35;
commitid	yXLEusO7IYvnYhLx;

1.35
date	2014.08.05.15.43.50;	author apb;	state Exp;
branches;
next	1.34;
commitid	PNMySzwsx3H6HbLx;

1.34
date	2014.08.05.15.40.58;	author apb;	state Exp;
branches;
next	1.33;
commitid	1Qp6Y0KwxUnrGbLx;

1.33
date	2014.01.27.08.18.07;	author apb;	state Exp;
branches
	1.33.2.1;
next	1.32;
commitid	wwPlzP7Kwl0vkJmx;

1.32
date	2013.05.24.21.34.19;	author christos;	state Exp;
branches;
next	1.31;
commitid	WgCOHyVNm6UhIVQw;

1.31
date	2009.04.03.22.36.35;	author perry;	state Exp;
branches
	1.31.6.1
	1.31.12.1;
next	1.30;

1.30
date	2008.06.23.02.16.53;	author matt;	state Exp;
branches
	1.30.4.1;
next	1.29;

1.29
date	2005.06.27.19.10.32;	author dbj;	state Exp;
branches
	1.29.20.1
	1.29.24.1;
next	1.28;

1.28
date	2004.05.04.02.52.05;	author lukem;	state Exp;
branches;
next	1.27;

1.27
date	2003.10.26.07.25.33;	author lukem;	state Exp;
branches;
next	1.26;

1.26
date	2003.10.03.02.46.52;	author lukem;	state Exp;
branches;
next	1.25;

1.25
date	2003.07.10.10.34.04;	author lukem;	state Exp;
branches;
next	1.24;

1.24
date	2003.05.09.12.20.04;	author dsl;	state Exp;
branches;
next	1.23;

1.23
date	2003.04.02.10.39.19;	author fvdl;	state Exp;
branches;
next	1.22;

1.22
date	2003.03.25.23.07.29;	author lukem;	state Exp;
branches;
next	1.21;

1.21
date	2003.03.25.18.37.59;	author imp;	state Exp;
branches;
next	1.20;

1.20
date	2003.03.11.07.18.38;	author lukem;	state Exp;
branches;
next	1.19;

1.19
date	2003.01.03.15.34.32;	author lukem;	state Exp;
branches;
next	1.18;

1.18
date	2002.12.21.15.54.48;	author lukem;	state Exp;
branches;
next	1.17;

1.17
date	2002.05.09.09.21.25;	author lukem;	state Exp;
branches;
next	1.16;

1.16
date	2002.05.07.14.27.25;	author lukem;	state Exp;
branches;
next	1.15;

1.15
date	2002.05.07.03.34.17;	author lukem;	state Exp;
branches;
next	1.14;

1.14
date	2002.05.07.02.40.55;	author lukem;	state Exp;
branches;
next	1.13;

1.13
date	2002.05.03.14.21.44;	author lukem;	state Exp;
branches;
next	1.12;

1.12
date	2002.05.02.18.32.45;	author bjh21;	state Exp;
branches;
next	1.11;

1.11
date	2002.05.02.18.02.30;	author lukem;	state Exp;
branches;
next	1.10;

1.10
date	2002.05.02.13.05.49;	author lukem;	state Exp;
branches;
next	1.9;

1.9
date	2002.04.26.15.50.27;	author lukem;	state Exp;
branches;
next	1.8;

1.8
date	2002.04.12.04.50.01;	author lukem;	state Exp;
branches;
next	1.7;

1.7
date	2002.04.12.01.59.45;	author lukem;	state Exp;
branches;
next	1.6;

1.6
date	2002.03.14.22.26.09;	author lukem;	state Exp;
branches;
next	1.5;

1.5
date	2002.03.14.01.07.27;	author lukem;	state Exp;
branches;
next	1.4;

1.4
date	2002.02.08.02.18.53;	author lukem;	state Exp;
branches;
next	1.3;

1.3
date	2002.02.07.11.39.17;	author lukem;	state Exp;
branches;
next	1.2;

1.2
date	2002.02.05.23.29.43;	author lukem;	state Exp;
branches;
next	1.1;

1.1
date	2002.02.03.15.24.43;	author lukem;	state Exp;
branches;
next	;

1.39.2.1
date	2017.03.20.06.52.04;	author pgoyette;	state Exp;
branches;
next	;
commitid	jjw7cAwgyKq7RfKz;

1.39.4.1
date	2017.04.21.16.51.08;	author bouyer;	state Exp;
branches;
next	;
commitid	dUG7nkTKALCadqOz;

1.33.2.1
date	2014.08.10.06.47.57;	author tls;	state Exp;
branches;
next	;
commitid	IkL6EwFPM07DzMLx;

1.31.6.1
date	2014.05.22.12.01.27;	author yamt;	state Exp;
branches;
next	;
commitid	yqlfOuaAhYmASwBx;

1.31.12.1
date	2013.06.23.06.26.17;	author tls;	state Exp;
branches;
next	1.31.12.2;
commitid	OnlO1cBgtQRcIHUw;

1.31.12.2
date	2014.08.19.23.45.38;	author tls;	state Exp;
branches;
next	;
commitid	jTnpym9Qu0o4R1Nx;

1.30.4.1
date	2009.05.13.19.17.41;	author jym;	state Exp;
branches;
next	;

1.29.20.1
date	2008.06.29.08.25.12;	author mjf;	state Exp;
branches;
next	1.29.20.2;

1.29.20.2
date	2008.10.05.20.10.15;	author mjf;	state dead;
branches;
next	;

1.29.24.1
date	2008.09.18.04.41.09;	author wrstuden;	state Exp;
branches;
next	;


desc
@@


1.45
log
@add $GETRAMDISKSIZE
@
text
@#	$NetBSD: Makefile.image,v 1.44 2024/05/17 21:31:10 christos Exp $
#
# Makefile snippet to build a tree from the provided lists,
# and make an ffs file system image from that tree
#
# Required variables:
#	NETBSDSRCDIR	top level of src tree (set by <bsd.own.mk>)
#	LISTS		list file(s) to use
#	IMAGEDEPENDS	depends for ${IMAGE}
#	IMAGEENDIAN	endianness of ${IMAGE}
#	IMAGESIZE	size of ${IMAGE}
#	MTREECONF	mtree specfiles to use to build a master specfile
#
# Optional variables:
#	IMAGE		name of target image
#	IMAGEPREBUILD	additional operations to run pre image creation
#	IMAGEPOSTBUILD	operation to run on ${IMAGE} ${.TARGET} after its built
#			(if this returns non zero, ${.TARGET} is removed)
#	IMAGERUNTIME	files/directories to copy from $DESTDIR onto the image
#	IMAGESPECEXTRA	files/directories to add to the spec
#	CRUNCHBIN	name of crunchgen(1)ed binary
#	DESTDIR		destination directory
#	MAKEFS_FLAGS	extra options to ${TOOL_MAKEFS}
#	PARSELISTENV	environment variables to set for parselist.awk
#	WORKDIR		directory to build image in to 
#	IMAGETAR	tar.gz file to create containing ${IMAGE}'s contents
#
#	IMAGE_RELEASEDIR	where to install ${IMAGE}.gz
#	IMAGETAR_RELEASEDIR	where to install ${IMAGETAR}
#

.if !defined(_MAKEFILE_IMAGE_)
_MAKEFILE_IMAGE_=1


WORKDIR?=	work
WORKSPEC?=	work.spec
WORKBUILT?=	work.built
CUROBJDIR!=     cd ${.CURDIR} && ${PRINTOBJDIR}

.include "${DISTRIBDIR}/common/Makefile.parselist"

PARSELISTENV+=	TARGETDIR=${.OBJDIR}/${WORKDIR:Q}

.if ${MKREPRO_TIMESTAMP:Uno} != "no"
MAKEFS_TIMESTAMP=-T "${MKREPRO_TIMESTAMP}"
PAX_TIMESTAMP=--timestamp "${MKREPRO_TIMESTAMP}"
GZIP_N_FLAG=-n
.endif
MAKESPEC=	${HOST_SH} ${NETBSDSRCDIR}/etc/makespec
GETRAMDISKSIZE=	${HOST_SH} ${NETBSDSRCDIR}/etc/getramdisksize -a ${MACHINE} -s ${NETBSDSRCDIR}

.if ${MAKEVERBOSE} >= 2 
PAX_v?= -v
.else   
PAX_v?= 
.endif  


GZIP_FLAGS= -9 ${GZIP_N_FLAG}

.if !target(${WORKBUILT})					# {
${WORKBUILT}: ${IMAGEDEPENDS} ${WORKSPEC} ${PARSELISTDEP} ${LISTS}
#	There is a .PHONY ${CRUNCHBIN}, so check if out of date by hand
#	Default to `.' if ${CRUNCHBIN} isn't set, to always force a rebuild.
	[ "${.OODATE}" = ${CRUNCHBIN:U.} -a -f ${WORKBUILT} -a ${WORKBUILT} -nt ${CRUNCHBIN:U.} ]  || { \
	${_MKSHMSG} "  build " ${.CURDIR:T}/${WORKDIR}; \
	rm -rf ${WORKDIR} ${WORKBUILT}; \
	mkdir -m 755 ${WORKDIR} &&  \
	${TOOL_MTREE} -def ${WORKSPEC} -p ${WORKDIR}/ -UW && \
	${PARSELIST} -v mode=populate ${LISTS} | \
	${HOST_SH} -e ${POPULATE_DEBUG} \
	&& touch ${WORKBUILT} ; \
	}

CLEANFILES+=	${WORKBUILT}

clean cleandir distclean: cleanfsimage

.PHONY: cleanfsimage

cleanfsimage:
	-rm -rf ${WORKDIR} ${WORKBUILT}

.endif	# ! target (${WORKBUILT})				# }

.if !target(${WORKSPEC})					# {
${WORKSPEC}: ${MTREECONF} ${LISTS} ${PARSELISTDEP}
	${_MKTARGET_CREATE}
	-rm -f ${.TARGET} ${.TARGET}.tmp
	( for i in ${MTREECONF}; do	\
		echo "# --" ; \
		echo "# entries from: $$i" ; \
		echo "#" ; \
		cat $$i ;		\
		echo "/unset all" ;	\
	done ) >> ${.TARGET}.tmp
	${PARSELIST} -v mode=mtree ${LISTS} >> ${.TARGET}.tmp \
	&& mv ${.TARGET}.tmp ${.TARGET}

CLEANFILES+=	${WORKSPEC} ${WORKSPEC}.tmp
.endif	# ! target (${WORKSPEC})				# }

.if defined(IMAGE)						# {
IMGMAKEFSOPTIONS?= -o bsize=4096,fsize=512
${IMAGE}: ${WORKBUILT}
.if defined(IMAGEPREBUILD)
	${IMAGEPREBUILD}
.endif
	if [ "X${IMAGERUNTIME}" != "X" ]; then				\
		release_destdir=${CUROBJDIR}/${WORKDIR};		\
		cd ${DESTDIR};						\
		for imge in ${IMAGERUNTIME};				\
		do							\
			${TOOL_PAX} ${PAX_TIMESTAMP} -rw -pp ${PAX_v}	\
				$${imge} $$release_destdir;		\
		done;							\
		cd "${CUROBJDIR}";					\
	fi
	for i in ${IMAGESPECEXTRA}; do 					\
		if [ -n "$$i" ] && [ -e ${WORKDIR}/$$i ]; then 		\
		    ${MAKESPEC} -d ${WORKDIR} $$i >> ${WORKSPEC}; 	\
		fi; 							\
	done
	[ "${.OODATE}" = ${WORKBUILT} -a -f ${IMAGE} -a ! ${IMAGE} -ot ${WORKBUILT} ]  || { \
	${_MKSHMSG_CREATE} ${.CURDIR:T}/${.TARGET}; \
	rm -f ${.TARGET} ${.TARGET}.tmp; \
	${TOOL_MAKEFS} -t ffs -B ${IMAGEENDIAN} -s ${IMAGESIZE} -F ${WORKSPEC} \
	    -xx ${MAKEFS_TIMESTAMP} -N ${NETBSDSRCDIR}/etc ${IMGMAKEFSOPTIONS} \
	    -o optimization=space,minfree=0 \
	    ${MAKEFS_FLAGS} ${.TARGET}.tmp ${WORKDIR} \
	&& mv -f ${.TARGET}.tmp ${.TARGET}; \
	}
.if defined(IMAGEPOSTBUILD)
	${IMAGEPOSTBUILD} || { rm -f ${.TARGET} ; false; }
.endif

.PHONY: fsimage
fsimage: ${IMAGE}

${IMAGE}.gz: ${IMAGE}
	${_MKTARGET_CREATE}
	-rm -f ${.TARGET}
	${TOOL_GZIP} ${GZIP_FLAGS} -c ${.ALLSRC} > ${.TARGET}

realall: ${IMAGE}

.if defined(IMAGE_RELEASEDIR)
release:: check_RELEASEDIR .WAIT ${IMAGE}.gz
	${RELEASE_INSTALL} ${IMAGE}.gz \
	    ${RELEASEDIR}/${RELEASEMACHINEDIR}/${IMAGE_RELEASEDIR}
.endif

CLEANFILES+=	${IMAGE} ${IMAGE}.gz ${IMAGE}.tmp
.endif	# ! defined(IMAGE)					# }


.if defined(IMAGETAR)						# {
${IMAGETAR}: ${WORKBUILT} ${WORKSPEC} ${IMAGEDEPENDS}
	${_MKTARGET_CREATE}
	( cd ${WORKDIR}; \
	  GZIP=${GZIP_FLAGS:Q} \
	  ${TOOL_PAX} ${PAX_TIMESTAMP} --use-compress-program=${TOOL_GZIP:Q} \
	      -ON ${NETBSDSRCDIR}/etc -wdM <${.OBJDIR}/${WORKSPEC} \
	) > ${.TARGET}.tmp \
	&& mv ${.TARGET}.tmp ${.TARGET}

realall: ${IMAGETAR}

CLEANFILES+=	${IMAGETAR} ${IMAGETAR}.tmp

.if defined(IMAGETAR_RELEASEDIR)
release:: check_RELEASEDIR .WAIT ${IMAGETAR}
	${RELEASE_INSTALL} ${IMAGETAR} \
	    ${RELEASEDIR}/${RELEASEMACHINEDIR}/${IMAGETAR_RELEASEDIR}
.endif

.endif	# ! defined(IMAGETAR)					# }


.endif	# _MAKEFILE_IMAGE_
@


1.44
log
@use IMAGESPECEXTRA to include libdata and don't include IMAGERUNTIME
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.image,v 1.43 2024/05/17 19:54:28 christos Exp $
d51 1
@


1.43
log
@Add IMAGERUNTIME and IMAGESPECEXTRA variables
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.image,v 1.42 2024/05/16 15:46:42 christos Exp $
d110 1
a110 2
		release_destdir=${WORKDIR};				\
		cd $$release_destdir;					\
d119 1
a119 1
	for i in ${IMAGERUNTIME} ${IMAGESPECEXTRA}; do 			\
@


1.42
log
@Apply the -xx treatment to the rest of the ffs makefs invocations.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.image,v 1.41 2024/03/20 00:31:54 christos Exp $
d19 2
d39 1
d50 8
d109 16
@


1.41
log
@Fix reproducible builds (Jan-Benedict Glaw)
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.image,v 1.40 2017/02/11 03:07:06 christos Exp $
d102 1
a102 1
	    ${MAKEFS_TIMESTAMP} -N ${NETBSDSRCDIR}/etc ${IMGMAKEFSOPTIONS} \
@


1.40
log
@more MKREPRO_TIMESTAMP fixes (for pax/tar generated files)
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.image,v 1.39 2015/12/20 22:47:59 christos Exp $
a41 2
GZIP_FLAGS= -9 ${GZIP_N_FLAG}

d45 1
d48 2
@


1.39
log
@Add MKREPRO_TIMESTAMP support to the makefs invocation.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.image,v 1.38 2014/08/12 11:48:22 martin Exp $
d46 1
d135 1
a135 1
	  ${TOOL_PAX} --use-compress-program=${TOOL_GZIP:Q} \
@


1.39.4.1
log
@Sync with HEAD
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.image,v 1.40 2017/02/11 03:07:06 christos Exp $
a45 1
PAX_TIMESTAMP=--timestamp "${MKREPRO_TIMESTAMP}"
d134 1
a134 1
	  ${TOOL_PAX} ${PAX_TIMESTAMP} --use-compress-program=${TOOL_GZIP:Q} \
@


1.39.2.1
log
@Sync with HEAD
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.image,v 1.40 2017/02/11 03:07:06 christos Exp $
a45 1
PAX_TIMESTAMP=--timestamp "${MKREPRO_TIMESTAMP}"
d134 1
a134 1
	  ${TOOL_PAX} ${PAX_TIMESTAMP} --use-compress-program=${TOOL_GZIP:Q} \
@


1.38
log
@Add a IMAGEPREBUILD option for makefiles to ovveride (e.g. to additionally
add files to the staging directory)
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.image,v 1.37 2014/08/06 11:41:18 apb Exp $
d44 4
d100 1
a100 1
	    -N ${NETBSDSRCDIR}/etc ${IMGMAKEFSOPTIONS} \
@


1.37
log
@To make pax use ${TOOL_GZIP}, we need to pass "--use-compress-program
${TOOL_GZIP}" on the command line, and refrain from passing "-z".  If
passed "-z", pax will use plain "gzip", ignoring --use-compress-program.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.image,v 1.36 2014/08/06 10:41:13 apb Exp $
d16 1
d89 3
@


1.36
log
@Introduce and use GZIP_FLAGS variable.

The previous use of GZIP="-9 ${GZIP_N_FLAG}" happened to work, but
the new use of GZIP=${GZIP_FLAGS:Q} is safer.

For consistency, also use GZIP_FLAGS elesehere in this file.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.image,v 1.35 2014/08/05 15:43:50 apb Exp $
d126 2
a127 1
	  ${TOOL_PAX} -ON ${NETBSDSRCDIR}/etc -wdzM <${.OBJDIR}/${WORKSPEC} \
@


1.35
log
@Pass GZIP="-9 ${GZIP_N_FLAG}" instead of GZIP=-9n
in the environmentto commands that invoke ${TOOL_GZIP}.
This will allow them to use -nT instead of just -n with pigz.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.image,v 1.34 2014/08/05 15:40:58 apb Exp $
d41 1
d107 1
a107 1
	${TOOL_GZIP_N} -9c ${.ALLSRC} > ${.TARGET}
d125 1
a125 1
	  GZIP="-9 ${GZIP_N_FLAG}" \
@


1.34
log
@Use ${TOOL_GZIP_N} instead of ${TOOL_GZIP} -n, and similarly
use ${TOOL_GZIP_N} -9 instead of ${TOOL_GZIP} -9n, etc.

This will pass -nT instead of just -n if the gzip program is
actually pigz.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.image,v 1.33 2014/01/27 08:18:07 apb Exp $
d124 2
a125 1
	  GZIP=-9n ${TOOL_PAX} -ON ${NETBSDSRCDIR}/etc -wdzM <${.OBJDIR}/${WORKSPEC} \
@


1.33
log
@Use ${TOOL_GZIP} instead of just gzip in all Makefiles
outside */dist/* subdirectories.

When USE_PIGZGZIP=yes, bsd.own.mk sets TOOL_GZIP=${TOOL_PIGZ},
so there's no need to test USE_PIGZGZIP in these Makefiles.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.image,v 1.32 2013/05/24 21:34:19 christos Exp $
d106 1
a106 1
	${TOOL_GZIP} -9nc ${.ALLSRC} > ${.TARGET}
@


1.33.2.1
log
@Rebase.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.image,v 1.37 2014/08/06 11:41:18 apb Exp $
a40 1
GZIP_FLAGS= -9 ${GZIP_N_FLAG}
d106 1
a106 1
	${TOOL_GZIP} ${GZIP_FLAGS} -c ${.ALLSRC} > ${.TARGET}
d124 1
a124 3
	  GZIP=${GZIP_FLAGS:Q} \
	  ${TOOL_PAX} --use-compress-program=${TOOL_GZIP:Q} \
	      -ON ${NETBSDSRCDIR}/etc -wdM <${.OBJDIR}/${WORKSPEC} \
@


1.32
log
@Add IMGMAKEFSOPTIONS like in the bootimage Makefile
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.image,v 1.31 2009/04/03 22:36:35 perry Exp $
d106 1
a106 1
	gzip -9nc ${.ALLSRC} > ${.TARGET}
@


1.31
log
@Consistently use gzip with the -n flag so dates are not embedded.

Not tested on all platforms.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.image,v 1.30 2008/06/23 02:16:53 matt Exp $
d85 1
d91 1
a91 1
	    -N ${NETBSDSRCDIR}/etc -o bsize=4096,fsize=512 \
@


1.31.6.1
log
@sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs.  ("Protocol error: too many arguments")
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.image,v 1.31 2009/04/03 22:36:35 perry Exp $
a84 1
IMGMAKEFSOPTIONS?= -o bsize=4096,fsize=512
d90 1
a90 1
	    -N ${NETBSDSRCDIR}/etc ${IMGMAKEFSOPTIONS} \
d105 1
a105 1
	${TOOL_GZIP} -9nc ${.ALLSRC} > ${.TARGET}
@


1.31.12.1
log
@resync from head
@
text
@d1 1
a1 1
#	$NetBSD$
a84 1
IMGMAKEFSOPTIONS?= -o bsize=4096,fsize=512
d90 1
a90 1
	    -N ${NETBSDSRCDIR}/etc ${IMGMAKEFSOPTIONS} \
@


1.31.12.2
log
@Rebase to HEAD as of a few days ago.
@
text
@a40 1
GZIP_FLAGS= -9 ${GZIP_N_FLAG}
d106 1
a106 1
	${TOOL_GZIP} ${GZIP_FLAGS} -c ${.ALLSRC} > ${.TARGET}
d124 1
a124 3
	  GZIP=${GZIP_FLAGS:Q} \
	  ${TOOL_PAX} --use-compress-program=${TOOL_GZIP:Q} \
	      -ON ${NETBSDSRCDIR}/etc -wdM <${.OBJDIR}/${WORKSPEC} \
@


1.30
log
@Change remaining instances of ${RELEASEDIR}/${MACHINES} to
${RELEASEDIR}/${RELEASEMACHINEDIR}
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.image,v 1.29 2005/06/27 19:10:32 dbj Exp $
d105 1
a105 1
	gzip -9c ${.ALLSRC} > ${.TARGET}
d123 1
a123 1
	  GZIP=-9 ${TOOL_PAX} -ON ${NETBSDSRCDIR}/etc -wdzM <${.OBJDIR}/${WORKSPEC} \
@


1.30.4.1
log
@Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.image,v 1.31 2009/04/03 22:36:35 perry Exp $
d105 1
a105 1
	gzip -9nc ${.ALLSRC} > ${.TARGET}
d123 1
a123 1
	  GZIP=-9n ${TOOL_PAX} -ON ${NETBSDSRCDIR}/etc -wdzM <${.OBJDIR}/${WORKSPEC} \
@


1.29
log
@add "fsimage" phony target to rebuild image.
delete the ${WORKBUILT} tag on cleanfsimage so it
will get properly rebuilt
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.image,v 1.28 2004/05/04 02:52:05 lukem Exp $
d112 1
a112 1
	    ${RELEASEDIR}/${MACHINE}/${IMAGE_RELEASEDIR}
d134 1
a134 1
	    ${RELEASEDIR}/${MACHINE}/${IMAGETAR_RELEASEDIR}
@


1.29.24.1
log
@Sync with wrstuden-revivesa-base-2.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.image,v 1.29 2005/06/27 19:10:32 dbj Exp $
d112 1
a112 1
	    ${RELEASEDIR}/${RELEASEMACHINEDIR}/${IMAGE_RELEASEDIR}
d134 1
a134 1
	    ${RELEASEDIR}/${RELEASEMACHINEDIR}/${IMAGETAR_RELEASEDIR}
@


1.29.20.1
log
@Sync with HEAD.
@
text
@d1 1
a1 1
#	$NetBSD$
d112 1
a112 1
	    ${RELEASEDIR}/${RELEASEMACHINEDIR}/${IMAGE_RELEASEDIR}
d134 1
a134 1
	    ${RELEASEDIR}/${RELEASEMACHINEDIR}/${IMAGETAR_RELEASEDIR}
@


1.29.20.2
log
@Sync with HEAD.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.image,v 1.29.20.1 2008/06/29 08:25:12 mjf Exp $
@


1.28
log
@MAKEVERBOSE support
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.image,v 1.27 2003/10/26 07:25:33 lukem Exp $
d63 1
a63 1
	-rm -rf ${WORKDIR}
d99 3
@


1.27
log
@Use ${HOST_SH} instead of `sh'.

If necessary, pull in <bsd.sys.mk> to get the definition of HOST_SH;
Makefiles that pull in one of (most of) <bsd.*.mk> will get this anyway.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.image,v 1.26 2003/10/03 02:46:52 lukem Exp $
d47 1
a47 1
	echo "Building tree into ${WORKDIR}"; \
d69 1
d72 3
d87 1
a87 1
	echo "Creating image into ${.TARGET}..."; \
d100 1
d118 1
@


1.26
log
@Allow ${CRUNCHBIN} to be optional by defaulting to "." when doing the
"${.OODATE}" check.
Problem noticed in a build that uses Makefile.image but not Makefile.crunch.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.image,v 1.25 2003/07/10 10:34:04 lukem Exp $
d52 1
a52 1
	sh -e ${POPULATE_DEBUG} \
@


1.25
log
@Rename a large chunk of the make(1) variables which refer to a
program/tool from "FOO" to "TOOL_FOO".  The new variables are:
	TOOL_ASN1_COMPILE  TOOL_CAP_MKDB  TOOL_CAT  TOOL_CKSUM  TOOL_COMPILE_ET
	TOOL_CONFIG  TOOL_CRUNCHGEN  TOOL_CTAGS  TOOL_DB  TOOL_EQN  TOOL_FGEN
	TOOL_GENCAT  TOOL_GROFF  TOOL_HEXDUMP  TOOL_INDXBIB  TOOL_INSTALLBOOT
	TOOL_INSTALL_INFO  TOOL_M4  TOOL_MAKEFS  TOOL_MAKEINFO  TOOL_MAKEWHATIS
	TOOL_MDSETIMAGE  TOOL_MENUC  TOOL_MKCSMAPPER  TOOL_MKESDB
	TOOL_MKLOCALE  TOOL_MKMAGIC  TOOL_MKTEMP  TOOL_MSGC  TOOL_MTREE
	TOOL_PAX  TOOL_PIC  TOOL_PREPMKBOOTIMAGE  TOOL_PWD_MKDB  TOOL_REFER
	TOOL_ROFF_ASCII  TOOL_ROFF_DVI  TOOL_ROFF_HTML  TOOL_ROFF_PS
	TOOL_ROFF_RAW  TOOL_RPCGEN  TOOL_SOELIM  TOOL_SUNLABEL  TOOL_TBL
	TOOL_UUDECODE  TOOL_VGRIND  TOOL_ZIC

For each, provide default in <bsd.sys.mk> of the form:
	TOOL_FOO?=	foo
and for the ${USETOOLS}=="yes" case in <bsd.own.mk>, provide override:
	TOOL_FOO=	${TOOLDIR}/bin/${_TOOL_PREFIX}foo

Document all of these in bsd.README.

This cleans up a chunk of potential (and actual) namespace collision
within our build infrastructure, as well as improves consistency in
the share/mk documentation and provision of appropriate defaults for
each of these variables.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.image,v 1.24 2003/05/09 12:20:04 dsl Exp $
a7 1
#	CRUNCHBIN	name of crunchgen(1)ed binary
d18 1
d44 3
a46 2
	@@# There is a .PHONY ${CRUNCHBIN}, so check if out of date by hand
	[ "${.OODATE}" = ${CRUNCHBIN} -a -f ${WORKBUILT} -a ${WORKBUILT} -nt ${CRUNCHBIN} ]  || { \
@


1.24
log
@Force ramdiskbin.mk to be run to update the crunched binary.
Explicitly check times on built targets so to stop make rebuilding
the later targets.
nbmake in src/distrib/i386/floppies/ramdisk-big (etc) will now
pick up changes to source files that make the crunched binary.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.image,v 1.23 2003/04/02 10:39:19 fvdl Exp $
d20 1
a20 1
#	MAKEFS_FLAGS	extra options to ${MAKEFS}
d49 1
a49 1
	${MTREE} -def ${WORKSPEC} -p ${WORKDIR}/ -UW && \
d84 1
a84 1
	${MAKEFS} -t ffs -B ${IMAGEENDIAN} -s ${IMAGESIZE} -F ${WORKSPEC} \
d113 1
a113 1
	  GZIP=-9 ${PAX} -ON ${NETBSDSRCDIR}/etc -wdzM <${.OBJDIR}/${WORKSPEC} \
@


1.23
log
@Add support for UFS2. UFS2 is an enhanced FFS, adding support for
64 bit block pointers, extended attribute storage, and a few
other things.

This commit does not yet include the code to manipulate the extended
storage (for e.g. ACLs), this will be done later.

Originally written by Kirk McKusick and Network Associates Laboratories for
FreeBSD.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.image,v 1.22 2003/03/25 23:07:29 lukem Exp $
d44 6
a49 4
	@@echo "Building tree into ${WORKDIR}"
	-rm -rf ${WORKDIR} ${WORKBUILT}
	mkdir -m 755 ${WORKDIR}
	${MTREE} -def ${WORKSPEC} -p ${WORKDIR}/ -UW
d52 2
a53 1
	&& touch ${WORKBUILT}
d80 4
a83 3
${IMAGE}: ${WORKBUILT} ${WORKSPEC} ${IMAGEDEPENDS}
	@@echo "Creating image into ${.TARGET}..."
	-rm -f ${.TARGET} ${.TARGET}.tmp
d88 2
a89 1
	&& mv -f ${.TARGET}.tmp ${.TARGET}
@


1.22
log
@Add MAKE to PARSELISTENV, and specifically set MAKE=${MAKE} in
list.sysinst.
(Better fix to previous, but thanks to Warner for committing a
fix which then prodded me to improve it :)
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.image,v 1.21 2003/03/25 18:37:59 imp Exp $
d82 1
a82 1
	    -o optimization=space,minfree=0,nsectors=1,ntracks=128 \
@


1.21
log
@Fix cross building case where the host is not a NetBSD host.  We need
to set MAKE for the subshell that's used to populate the work tree.
It needs to be the the correct make (in the cross build case: nbmake +
args) so that when makeobsolete is run it can pickup this value.
Otherwise makeobsolete defaults to the host's make is used which might
not understand some of NetBSD make's constructs.

This fixes, mostly, the build of NetBSD/hpcmips on a FreeBSD-current
system.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.image,v 1.19 2003/01/03 15:34:32 lukem Exp $
d49 1
a49 1
	MAKE=${MAKE} sh -e ${POPULATE_DEBUG} \
@


1.20
log
@add multiple-include protection.
clean up some comments.
@
text
@d48 2
a49 1
	${PARSELIST} -v mode=populate ${LISTS} | sh -e ${POPULATE_DEBUG} \
@


1.19
log
@Install release files under "${RELEASEDIR}/${MACHINE}/..." instead of
"${RELEASEDIR}/...".

${RELEASEDIR} is never cleaned , and ${RELEASEDIR}/${MACHINE} is only
cleaned if UPDATE is not defined.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.image,v 1.18 2002/12/21 15:54:48 lukem Exp $
a5 2

#
d29 4
d122 3
@


1.18
log
@Invoke ${PAX} with '-O' so that various errors don't hang the make
or the command with an interactive question.  (This also prevents
weird problems if a directory element of '-f path' is missing and
'make -j N' is being used).
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.image,v 1.17 2002/05/09 09:21:25 lukem Exp $
d94 2
a95 1
	${RELEASE_INSTALL} ${IMAGE}.gz ${RELEASEDIR}/${IMAGE_RELEASEDIR}
d115 2
a116 1
	${RELEASE_INSTALL} ${IMAGETAR} ${RELEASEDIR}/${IMAGETAR_RELEASEDIR}
@


1.17
log
@only provide targets for ${WORKSPEC} and ${WORKBUILT} if non are provided.
this allows custom specfiles to be generated or custom WORKDIRS to be used,
whilst still allowing use of IMAGE or IMAGETAR rules.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.image,v 1.16 2002/05/07 14:27:25 lukem Exp $
d104 1
a104 1
	  GZIP=-9 ${PAX} -N ${NETBSDSRCDIR}/etc -wdzM < ${.OBJDIR}/${WORKSPEC} \
@


1.16
log
@keep ${IMAGE} around even after building (optional) ${IMAGE}.gz
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.image,v 1.15 2002/05/07 03:34:17 lukem Exp $
d40 1
d49 12
d70 2
a71 1
CLEANFILES+=	${WORKBUILT} ${WORKSPEC} ${WORKSPEC}.tmp
d98 1
a98 1
.endif	# IMAGE							# }
d117 1
a117 9
.endif	# IMAGETAR						# }


clean cleandir distclean: cleanfsimage

.PHONY: cleanfsimage

cleanfsimage:
	-rm -rf ${WORKDIR}
@


1.15
log
@Use release:: instead of release: when multiple release targets may exist
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.image,v 1.14 2002/05/07 02:40:55 lukem Exp $
d73 2
a74 1
	gzip -9f ${IMAGE}
@


1.14
log
@install correct item with IMAGETAR_RELEASEDIR release target
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.image,v 1.13 2002/05/03 14:21:44 lukem Exp $
d78 1
a78 1
release: check_RELEASEDIR .WAIT ${IMAGE}.gz
d98 1
a98 1
release: check_RELEASEDIR .WAIT ${IMAGETAR}
@


1.13
log
@revert previous; all includers of Makefile.image should set MTREECONF
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.image,v 1.11 2002/05/02 18:02:30 lukem Exp $
d98 2
a99 2
release: check_RELEASEDIR .WAIT ${IMAGE}.gz
	${RELEASE_INSTALL} ${IMAGE}.gz ${RELEASEDIR}/${IMAGETAR_RELEASEDIR}
@


1.12
log
@When doing a shell "for" loop over a potentially-empty list, assign the list
to a shell variable and iterate over that.  This is necessary for some POSIX
shells.
@
text
@d50 1
a50 2
	( mtreeconf="${MTREECONF}";	\
	for i in $${mtreeconf}; do	\
@


1.11
log
@yet another distrib overhaul:
- move guts of distrib/Makefile.inc to distrib/common/Makefile.distrib
  (fixes problem caused by implicit include of ../Makefile.inc in certain
  submake conditions triggered by makefiles not yet in tree)
- removed mkdir of ${RELEASEDIR}/*;  rely upon "snap_pre" target of
  etc/Makefile to create all the release directories
- renamed RELINSTALL to RELEASE_INSTALL
- renamed FLOPPYINSTDIR to FLOPPY_RELEASEDIR
- renamed MDSETDIR to MDSET_RELEASEDIR
- removed ITARGET
- move release target from top level to appropriate subdirectory
- ensure release target has correct depends
- replace miniroot's IMAGE_MD_POST with common/Makefile.image IMAGEPOSTBUILD
- Makefile.image: add realall: ${IMAGE}
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.image,v 1.10 2002/05/02 13:05:49 lukem Exp $
d50 2
a51 1
	( for i in ${MTREECONF}; do	\
@


1.10
log
@allow IMAGE to be optional (and don't create rule for ${IMAGE}: if
it's not defined)
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.image,v 1.9 2002/04/26 15:50:27 lukem Exp $
d19 2
d27 3
d68 13
d82 2
a83 2
CLEANFILES+=	${IMAGE} ${IMAGE}.tmp
.endif								# }
a86 1

d93 2
d96 7
a102 1
.endif								# }
@


1.9
log
@replace _SRC_TOP_ with NETBSDSRCDIR, since the latter is the "public" version
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.image,v 1.8 2002/04/12 04:50:01 lukem Exp $
a11 1
#	IMAGE		name of target image
d18 1
d52 3
d64 2
a65 1
CLEANFILES+=	${IMAGE} ${IMAGE}.tmp ${WORKBUILT} ${WORKSPEC} ${WORKSPEC}.tmp
@


1.8
log
@support optional IMAGETAR; if defined, build a tar.gz file named {IMAGETAR}
which contains the same contents as ${IMAGE}.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.image,v 1.7 2002/04/12 01:59:45 lukem Exp $
d9 1
a9 1
#	_SRC_TOP_	top level of src tree (set by <bsd.own.mk>)
d56 1
a56 1
	    -N ${_SRC_TOP_}/etc -o bsize=4096,fsize=512 \
d68 1
a68 1
	    GZIP=-9 ${PAX} -N ${_SRC_TOP_}/etc -wdzM < ${.OBJDIR}/${WORKSPEC} \
@


1.7
log
@move default PARSELISTENV and related goop into separate Makefile.parselist,
and add DISTRIBDIR to PARSELISTENV.
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.image,v 1.6 2002/03/14 22:26:09 lukem Exp $
d23 1
d62 13
@


1.6
log
@parselist.awk
- improve comments
- provide a general purpose variable replacement; replace contents of ${FOO}
  with ENVIRON["FOO"].
- deprecate @@MACHINE@@ and @@MACHINE_ARCH@@ in favour of using ${MACHINE}
  and ${MACHINE_ARCH} instead
- add errx() function; like err(), but doesn't print the line number
- invoke this script with various variables defined via PARSELISTENV

*/Makefile*
- use PARSELISTENV instead of POPULATEENV, and add variables like DESTDIR
- other minor tweaks

*/list*
- replace @@MACHINE@@ with ${MACHINE}
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.image,v 1.5 2002/03/14 01:07:27 lukem Exp $
d29 1
a29 8
PARSELISTENV+=	_SRC_TOP_=${_SRC_TOP_:Q} \
		CRUNCHBIN=${CRUNCHBIN:Q} \
		CURDIR=${.CURDIR:Q} \
		DESTDIR=${DESTDIR:Q} \
		MACHINE=${MACHINE:Q} \
		MACHINE_ARCH=${MACHINE_ARCH:Q} \
		OBJDIR=${.OBJDIR:Q} \
		TARGETDIR=${.OBJDIR}/${WORKDIR:Q}
d31 1
a31 1
_PARSELIST=	${_SRC_TOP_}/distrib/common/parselist.awk
d34 1
a34 1
${WORKBUILT}: ${IMAGEDEPENDS} ${WORKSPEC} ${_PARSELIST} ${LISTS}
d39 1
a39 2
	${PARSELISTENV} awk -f ${_PARSELIST} -v mode=populate \
	    ${LISTS} | sh -e ${POPULATE_DEBUG} \
d42 1
a42 1
${WORKSPEC}: ${MTREECONF} ${LISTS} ${_PARSELIST}
d48 1
a48 2
	${PARSELISTENV} awk -f ${_PARSELIST} -v mode=mtree \
	    ${LISTS} >> ${.TARGET}.tmp \
@


1.5
log
@cosmetic tweaks: sort some variable lists, improve descriptions, [...]
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.image,v 1.4 2002/02/08 02:18:53 lukem Exp $
d21 1
a21 2
#	POPULATEENV	environment variables to pass to the output of
#			parselist.awk -v mode=populate
d29 1
a29 2
POPULATEENV+=	_SRC_TOP_=${_SRC_TOP_:Q} \
		DESTDIR=${DESTDIR:Q} \
d32 3
d36 1
a36 1
		TARGDIR=${.OBJDIR}/${WORKDIR:Q}
d46 2
a47 3
	awk -f ${_PARSELIST} -v mode=populate \
	    MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE_ARCH} \
	    ${LISTS} | ${POPULATEENV} sh -e \
d56 1
a56 2
	awk -f ${_PARSELIST} -v mode=mtree \
	    MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE_ARCH} \
@


1.4
log
@- cleanup image device creation: add Makefile.makedev & list.makedev,
  remove dist/*, now that they're not needed.
  if MAKEDEVTARGETS is set, use MAKEDEV.wrapper and makedev2spec.awk to
  create an mtree specfile containing the devices that would be made with
  "etc/etc.${MACHINE}/MAKEDEV $MAKEDEVTARGETS".
  otherwise, copy etc/etc.${MACHINE}/MAKEDEV to dev/MAKEDEV (via list.makedev)
- add mtree.common; contains directories used by all images, and optional
  entries for dist/*
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.image,v 1.3 2002/02/07 11:39:17 lukem Exp $
d19 1
d32 1
d35 1
a35 2
		TARGDIR=${.OBJDIR}/${WORKDIR:Q} \
		CRUNCHBIN=${CRUNCHBIN:Q}
@


1.3
log
@- improve error checking
- add support for passing variables to parselist.awk that are used to replace
  text in each line of the lists.  currently supported strings:
	text		variable
	----		--------
	@@MACHINE_ARCH@@	MACHINE_ARCH
	@@MACHINE@@	MACHINE
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.image,v 1.2 2002/02/05 23:29:43 lukem Exp $
a22 1
#
@


1.2
log
@- allow ${MTREECONF} to contain multiple files, and build ${WORKSPEC} up by
  catting these together with "/unset all" between each file.
- when populating the tree (${WORKBUILT} rule), depend upon ${WORKSPEC}
  rather than ${MTREECONF}
- support ${MAKEFS_FLAGS} as optional flags for ${MAKEFS}
- use CLEANFILES to remove files
@
text
@d1 1
a1 1
#	$NetBSD: Makefile.image,v 1.1 2002/02/03 15:24:43 lukem Exp $
d45 3
a47 1
	awk -f ${_PARSELIST} -v mode=populate ${LISTS} | ${POPULATEENV} sh -e \
d56 3
a58 1
	awk -f ${_PARSELIST} -v mode=mtree ${LISTS} >> ${.TARGET}.tmp \
d61 1
a61 1
${IMAGE}: ${WORKBUILT} ${WORKSPEC} ${IMAGEDEPENDS} ${_PARSELIST} ${LISTS}
@


1.1
log
@distrib/common - shared files for building distribution media, initially
comprising of:

    Makefile.crunch
	build a crunchgen(1)ed binary from the provided lists

    Makefile.image
	build a tree from the provided lists, and
	build an ffs file system image from that tree using makefs(8),
	without requiring root privileges

    parselist.awk
	parse list files generating different output:
		crunchgen config
		mtree specfile
		sh commands to populate a tree
@
text
@d1 1
a1 1
#	$NetBSD$
d16 1
a16 1
#	MTREECONF	mtree specfile to use
d19 1
a29 2
_PARSELIST=	${_SRC_TOP_}/distrib/common/parselist.awk

d37 2
d40 1
a40 1
${WORKBUILT}: ${IMAGEDEPENDS} ${MTREECONF} ${_PARSELIST} ${LISTS}
d44 1
a44 1
	${MTREE} -def ${MTREECONF} -p ${WORKDIR}/ -UW
d50 4
a53 2
	cp ${MTREECONF} ${.TARGET}.tmp
	echo "/unset mode" >> ${.TARGET}.tmp
d63 1
a63 1
	    ${.TARGET}.tmp ${WORKDIR} \
d66 1
a72 1
	-rm -rf ${IMAGE} ${IMAGE}.tmp ${WORKBUILT} ${WORKSPEC} ${WORKSPEC}.tmp
@

