Commit 69d5133a authored by Michael Shigorin's avatar Michael Shigorin

image.in/vars.mk: dump distcfg variables nicely

distcfg.mk is nice for tracing the variable values' build-up, but it's more useful to have a look at the final result sometimes. So here it is, logged for each build and callable by hand.
parent 7f555ed7
При отладке сборки конфигурации или самого дистрибутива
могут оказаться полезными следующие средства:
- build/distcfg.mk
+ формируется автоматически в процессе построения конфигурации;
+ содержит трассировочную информацию (откуда что взялось);
+ этот файл применяется как авторитетный конфигурационный
- build/build.log
+ подробность зависит от значения переменной DEBUG,
которую можно передать при запуске make (см. variables.txt);
+ содержит коммит, из которого происходит сборка, и признак
"грязности" рабочего каталога при наличии модификаций после
этого коммита;
+ содержит список конфигурационных переменных и их конечных значений,
созданный на основании distcfg.mk (см. тж. build/vars.mk)
Общая информация по отладке сборки профилей mkimage:
http://www.altlinux.org/Mkimage/debug
# dump interesting variables' effective values;
# based on http://stackoverflow.com/questions/7117978
SPAM := $(.VARIABLES)
-include distcfg.mk
HAM := $(.VARIABLES)
.PHONY: dump-vars
dump-vars:
$(foreach v, \
$(filter-out $(SPAM) SPAM,$(sort $(HAM))), \
$(info $(v) = $($(v))))
@:
# this makefile is designed to be included in toplevel one # this makefile is designed to be included in toplevel one
SYMLINK = build
# this could have come from environment; # this could have come from environment;
# if not, can be symlinked if r/w, or made anew # if not, can be symlinked if r/w, or made anew
# NB: immediate assignment matters # NB: immediate assignment matters
ifndef BUILDDIR ifndef BUILDDIR
BUILDDIR := $(shell [ -s build ] \ BUILDDIR := $(shell [ -s "$(SYMLINK)" ] \
&& realpath build \ && realpath "$(SYMLINK)" \
|| bin/mktmpdir mkimage-profiles.build) || bin/mktmpdir mkimage-profiles.build)
endif endif
...@@ -16,8 +18,8 @@ export BUILDDIR NO_CACHE ...@@ -16,8 +18,8 @@ export BUILDDIR NO_CACHE
# holds a postprocessor; shell test executes in particular situation # holds a postprocessor; shell test executes in particular situation
# NB: not exported, for toplevel use only # NB: not exported, for toplevel use only
SHORTEN = $(shell [ "$(DEBUG)" != 2 -a -s build ] \ SHORTEN = $(shell [ "$(DEBUG)" != 2 -a -s "$(SYMLINK)" ] \
&& echo "| sed 's,$(BUILDDIR),build,'") && echo "| sed 's,$(BUILDDIR),$(SYMLINK),'")
# step 1: initialize the off-tree mkimage profile (BUILDDIR) # step 1: initialize the off-tree mkimage profile (BUILDDIR)
profile/init: distclean profile/init: distclean
...@@ -28,23 +30,30 @@ profile/init: distclean ...@@ -28,23 +30,30 @@ profile/init: distclean
git show-ref --head -d -s -- HEAD && \ git show-ref --head -d -s -- HEAD && \
git status -s && \ git status -s && \
echo; \ echo; \
} 2>/dev/null >> "$(BUILDLOG)" } $(LOG)
@mkdir "$(BUILDDIR)"/.mki # mkimage toplevel marker @mkdir "$(BUILDDIR)"/.mki # mkimage toplevel marker
@type -t git >&/dev/null && \ @type -t git >&/dev/null && \
cd $(BUILDDIR) && \ cd $(BUILDDIR) && \
git init -q && \ git init -q && \
git add . && \ git add . && \
git commit -qam 'distribution profile initialized' git commit -qam 'distribution profile initialized'
@rm -f build && \ @rm -f "$(SYMLINK)" && \
if [ -w . ]; then \ if [ -w . ]; then \
ln -sf "$(BUILDDIR)" build && \ ln -sf "$(BUILDDIR)" "$(SYMLINK)" && \
echo "build/"; \ echo "$(SYMLINK)/"; \
else \ else \
echo "$(BUILDDIR)/"; \ echo "$(BUILDDIR)/"; \
fi fi
# requires already formed distcfg.mk for useful output
profile/dump-vars:
@if [ -s "$(SYMLINK)" ]; then \
$(MAKE) --no-print-directory -C "$(SYMLINK)/" -f vars.mk; \
echo; \
fi $(LOG)
# step 3 entry point: copy the needed parts into BUILDDIR # step 3 entry point: copy the needed parts into BUILDDIR
profile/populate: profile/init distro/.rc profile/populate: profile/init distro/.rc profile/dump-vars
@for dir in sub.in features.in pkg.in; do \ @for dir in sub.in features.in pkg.in; do \
$(MAKE) -C $$dir $(LOG); \ $(MAKE) -C $$dir $(LOG); \
done done
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment