2011-10-06 12:46:31 +04:00
# step 4 is kicked off here but actually done by image.in/Makefile
2011-11-21 14:08:33 +04:00
ANSI_OK ?= 1; 32
ANSI_FAIL ?= 1; 31
2011-10-06 12:46:31 +04:00
i f n d e f M K I M A G E _ P R O F I L E S
$( error this makefile is designed to be included in toplevel one )
2011-06-12 19:06:36 +04:00
e n d i f
2011-05-11 23:40:47 +04:00
2011-07-15 01:00:46 +04:00
export ARCH ?= $( shell arch | sed 's/i686/i586/' )
2011-11-04 17:53:06 +04:00
# try not to bog down the system, both CPU and I/O wise
i f d e f N I C E
START := nice $( shell ionice -c3 echo "ionice -c3" 2>/dev/null)
e n d i f
2011-11-04 22:44:25 +04:00
# in kilobytes (a kilometer is 1024 meters, you know)
LOWSPACE = 1024
2011-11-04 17:53:06 +04:00
# it's also nice to know how long and much it takes
START += time -f "%E %PCPU %Mk"
# /usr/bin/{i586,x86_64} are setarch(8) symlinks
START += $( ARCH)
2011-10-06 12:46:31 +04:00
# to be passed into distcfg.mk
IMAGEDIR ?= $( shell [ -d " $$ HOME/out " -a -w " $$ HOME/out " ] \
&& echo " $$ HOME/out " \
|| echo " $( BUILDDIR) /out " )
2010-09-27 23:02:57 +04:00
2011-11-21 14:08:33 +04:00
# poehali
2011-10-06 12:46:31 +04:00
build : profile /populate
2011-12-05 21:13:33 +04:00
@if [ -n " $( CHECK) " ] ; then \
echo " $( TIME) skipping actual image build (CHECK is set) " ; \
exit; \
fi ; \
echo -n " $( TIME) starting image build " ; \
if [ -n " $( DEBUG) " ] ; then \
2011-06-12 22:27:49 +04:00
echo " : tail -f $( BUILDLOG) " $( SHORTEN) ; \
2011-05-11 23:40:47 +04:00
else \
2011-11-04 15:26:31 +04:00
if [ -n " $( ALL) " ] ; then \
echo " [ $( ALL) ] " ; \
else \
echo " (coffee time)" ; \
fi ; \
2011-12-05 21:13:33 +04:00
fi ; \
if $( START) $( MAKE) -C $( BUILDDIR) / $( LOG) ; then \
2011-11-04 22:44:25 +04:00
echo " $( TIME) done (`tail -1 $( BUILDLOG) | cut -f1 -d.`) " ; \
2011-12-08 11:30:06 +04:00
tail -200 " $( BUILDLOG) " $( SHORTEN) \
2011-11-21 14:08:33 +04:00
| GREP_COLOR = " $( ANSI_OK) " \
2011-12-08 11:30:06 +04:00
grep --color= auto '^\*\* image: .*' || :; \
2011-05-11 23:40:47 +04:00
else \
2011-11-04 22:44:25 +04:00
echo " $( TIME) failed, see log: $( BUILDLOG) " $( SHORTEN) ; \
2011-09-14 20:37:29 +04:00
if [ -z " $( DEBUG) " ] ; then \
2011-11-04 15:26:31 +04:00
echo " $( TIME) (you might want to re-run with DEBUG=1) " ; \
2011-05-11 23:40:47 +04:00
fi ; \
2011-11-21 14:08:33 +04:00
tail -200 " $( BUILDLOG) " \
| GREP_COLOR = " $( ANSI_FAIL) " \
2011-12-08 11:30:06 +04:00
egrep --color= auto "^(E:|[Ee]rror|[Ww]arning).*" ; \
2011-11-04 22:44:25 +04:00
df -P $( BUILDDIR) | awk ' END { if ( $$ 4 < $( LOWSPACE) ) \
2011-11-04 15:26:31 +04:00
{ print "NB: low space on " $$ 6" (" $$ 5" used)" } } ' ; \
2011-12-05 21:13:33 +04:00
fi ; \
if [ -n " $( BELL) " ] ; then echo -ne '\a' >& 2; fi