mkimage-profiles/pkg.in/groups/Makefile
Anton Midyukov 41b065336f check conditions of make for equality of variables with an empty value
check conditions of  make  for equality of variables with an empty value
instead of check definition.
A defined but empty variable under all these conditions results errors.
2022-12-30 19:39:43 +07:00

52 lines
1.3 KiB
Makefile

# step 3: copy package groups referenced in distro configuration
# (and only those!) over to $(BUILDDIR)
ifeq (,$(BUILDDIR))
check all: check-parents check-echo check-pkglists; @:
check-parents:
@find -name "*.directory" \
| xargs -r -- sed -rn 's,^X-Alterator-Parent=(.*)$$,\1,p' \
| sort -u \
| while read group; do \
if ! [ -f "$$group.directory" ]; then \
echo "** Error: missing parent group referenced in:"; \
grep -rl "=$$group$$" $$(find -name "*.directory"); \
fi >&2; \
done
check-echo:
@echo
check-pkglists:
@find -name "*.directory" \
| xargs -r -- sed -rn 's,^X-Alterator-PackageList=(.*)$$,\1,p' \
| sort -u \
| while read list; do \
if ! [ -f "../lists/$$list" ]; then \
echo "** Error: missing pkglist $$list referenced:"; \
grep -rl "=$$list$$" $$(find -name "*.directory"); \
fi >&2; \
done
else
include $(BUILDDIR)/distcfg.mk
SUFFIX := pkg/groups
TARGET := $(BUILDDIR)/$(SUFFIX)
all: $(GLOBAL_DEBUG)
@if [ -n "$(THE_GROUPS)$(MAIN_GROUPS)" ]; then \
mkdir -p $(TARGET) && \
cp --parents -at $(TARGET) -- \
$(addsuffix .directory,$(THE_GROUPS) $(MAIN_GROUPS)); \
mp-commit "$(TARGET)" "requested $(SUFFIX) copied over"; \
fi
debug:
@echo "** THE_GROUPS: $(THE_GROUPS)"
@echo "** MAIN_GROUPS: $(MAIN_GROUPS)"
endif