mkimage-profiles/sub.in/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

36 lines
876 B
Makefile

# step 3: copy the needed subprofiles to $(BUILDDIR)
ifeq (,$(BUILDDIR))
$(error BUILDDIR not defined)
endif
include $(BUILDDIR)/distcfg.mk
# if the subprofile is specified in src/dst notation,
# take src/ and put it as dst/ (for stage2 variants)
# NB: rootfs may come in first
all:
@for sub in $(SUBPROFILES); do \
src="$${sub%@*}" && \
dst="$${sub#*@}" && \
neq="$${src#$$dst}" && \
dstdir=""$(BUILDDIR)/$$dst/"" && \
if [ -d "$$dstdir" ]; then \
action="complemented"; \
else \
action="initialized"; \
fi; \
rsync -qa "$$src/" "$(BUILDDIR)/$$dst/" && \
mp-commit "$(BUILDDIR)/$$dst/" \
"$$dst subprofile $$action$${neq:+ (using $$src)}"; \
done
clean:
@for sub in $(SUBPROFILES); do \
dst="${sub#*@}" && \
if [ -n "$$dst" -a -n "$(BUILDDIR)" ]; then \
rm -r "$(BUILDDIR)/$$dst" && \
mkdir -p "$(BUILDDIR)/$$dst"; \
fi; \
done