mkimage-profiles/functions.mk
Michael Shigorin d93989a3ff initial logging subsystem
Now we don't dump all the gory details onto thee
but rather log them handsomely and present only
the most important details by default; use DEBUG=1
and/or BUILDLOG=/path/to/file to tweak.

Also introduced IMAGEDIR and IMAGENAME.

The rest:
- ovz-smp is no more
- base-l10n pkglist (suggested by Alexander Kuprin)
- clean.mk:
  + fixed an oversight: the test result erroneously applied
    only to the first command of several ones that should be
    run iff build/ is a symlink
  + drop implicit rules (it's no C code)
- Makefile: more reasonable iso names
- image.in/Makefile: .disk/date too
2011-11-04 16:15:29 +02:00

45 lines
1.3 KiB
Makefile

# NB: don"t use ANY quotes ('/") for put()/add()/set() arguments!
# shell will get confused by ' or args get spammed with "
# pay attention to the context functions get called in:
# e.g. features.in/syslinux/config.mk introduces conditionals
# this one adds whatever is given as an argument
put = $(and $(1),$(put_body))
define put_body
{ $(log_body); \
printf '%s\n' '$(1)' >> "$(CONFIG)"; }
endef
# these three take two args
# add() just appends an additive rule...
add = $(and $(1),$(2),$(add_body))
define add_body
{ $(log_body); \
printf '%s += %s\n' '$(1)' '$(2)' >> "$(CONFIG)"; }
endef
# ...set() comments out any previous definition
# and then appends an assigning rule...
set = $(and $(1),$(2),$(set_body))
define set_body
{ $(log_body); \
subst 's|^$(1)[ ]*[+?]*=.*$$|#& # overridden by $@|' "$(CONFIG)"; \
printf '%s = %s\n' '$(1)' '$(2)' >> "$(CONFIG)"; }
endef
# try() appends a conditionally-assigning rule
try = $(and $(1),$(2),$(try_body))
define try_body
{ $(log_body); \
printf '%s ?= %s\n' '$(1)' '$(2)' >> "$(CONFIG)"; }
endef
# if the rule being executed isn't logged yet, log it
define log_body
{ grep -q '^# $@$$' "$(CONFIG)" || printf '# %s\n' '$@' >> "$(CONFIG)"; }
endef
# convert tag list into a list of relative package list paths
tags = $(and $(strip $(1)),$(addprefix tagged/,$(shell echo "$(1)" | bin/tags2lists pkg.in/lists/tagged)))