mkimage-profiles/lib/build.mk
Michael Shigorin d5a5941f96 official {distro,ve}/* support
This is quite a large-scale change since mkimage-profiles got used to
baking distributions over the last year, and virtual environments are
quite different, so e.g. image.in/Makefile had to be split in two with
the main part of it moved into features.in/iso/lib/.

Short overview:

- features.in/Makefile: lib/ support
  (supporting VE images requires dynamic modifications
  to image.in/Makefile before starting the build;
  the most natural way to achieve that seems to use
  features mechanism along with makefile include dir)

- packaging format related part moved into features.in/pack
  (should be better prepared for diversity either)
- features.in/iso renamed to features.in/build-distro
- features.in/ve  renamed to features.in/build-ve
  + NB: these could not be merged as e.g. features.in/build
    due to completely different script hooks

- lib/image.mk renamed to lib/build.mk
- image, config, log postprocessing moved downstream
- added a sort of a topping in the form of lib/sugar.mk
- assorted style fixups (like ifeq usage)

- clean.mk: reliability fix (the problem was observed by Oleg Ivanov
  and me too but finally it did get the attention quantum)

- reviewed, updated and extended docs
  + QUICKSTART: should be[come] a step-by-step guide
    (thanks Leo-sp50 for prodiving feedback)
2011-11-04 16:54:41 +02:00

37 lines
1.1 KiB
Makefile

# step 4 is kicked off here but actually done by image.in/Makefile
ifndef MKIMAGE_PROFILES
$(error this makefile is designed to be included in toplevel one)
endif
# NB: /usr/bin/{i586,x86_64} are setarch(8) symlinks
export ARCH ?= $(shell arch | sed 's/i686/i586/')
# to be passed into distcfg.mk
IMAGEDIR ?= $(shell [ -d "$$HOME/out" -a -w "$$HOME/out" ] \
&& echo "$$HOME/out" \
|| echo "$(BUILDDIR)/out" )
build: profile/populate
@echo -n "** starting image build"
@if [ -n "$(DEBUG)" ]; then \
echo ": tail -f $(BUILDLOG)" $(SHORTEN); \
else \
echo " (coffee time)"; \
fi
@if time -f "%E %PCPU %Mk" $(ARCH) \
$(MAKE) -C $(BUILDDIR)/ $(LOG); \
then \
echo "** build done (`tail -1 $(BUILDLOG) | cut -f1 -d. \
|| echo "no log"`)"; \
else \
echo "** build failed, see log: $(BUILDLOG)" $(SHORTEN); \
if [ -z "$(DEBUG)" ]; then \
echo " (you might want to re-run with DEBUG=1)"; \
fi; \
tail -100 "$(BUILDLOG)" | egrep "^E:|[Ee]rror|[Ww]arning"; \
df -P $(BUILDDIR) | awk 'END { if ($$4 < 1024) \
{ print "** NB: low space on "$$6" ("$$5" used)"}}'; \
fi