mkimage-profiles/pkg.in/lists/Makefile

57 lines
1.7 KiB
Makefile
Raw Normal View History

# step 3: copy package lists referenced in distro configuration
# (and only those!) over to $(BUILDDIR)
ifndef BUILDDIR
$(error BUILDDIR not defined)
endif
include $(BUILDDIR)/distcfg.mk
SUFFIX := pkg/lists
TARGET := $(BUILDDIR)/$(SUFFIX)
all: $(TARGET) $(GLOBAL_DEBUG)
@# env | sort -u | grep _LISTS | xargs cp
@$(foreach V, \
$(filter %_LISTS,$(sort $(.VARIABLES))), \
$(if $(filter environment% file,$(origin $V)),\
$(shell cp --parents -at $(TARGET) \
-- $(value $V))))
@# construct .base packagelist for alterator-pkg
@{ \
echo "## generated by pkg.in/lists/Makefile"; \
if [ -n "$(BRANDING)" ]; then \
echo "branding-$(BRANDING)-release"; \
fi; \
if [ -n "$(SYSTEM_PACKAGES)" ]; then \
echo -e "\n## SYSTEM_PACKAGES\n$(SYSTEM_PACKAGES)"; \
fi; \
if [ -n "$(COMMON_PACKAGES)" ]; then \
echo -e "\n## COMMON_PACKAGES\n$(COMMON_PACKAGES)"; \
fi; \
if [ -n "$(BASE_PACKAGES)" ]; then \
echo -e "\n## BASE_PACKAGES\n$(BASE_PACKAGES)"; \
fi; \
if [ -n "$(BASE_LISTS)" ]; then \
echo -e "\n## BASE_LISTS"; cat $(BASE_LISTS); \
fi; \
} | sed -re '/^[^[:space:]#]/ s/[[:space:]]+/\n/g' >$(TARGET)/.base
@if [ -n "$(MAIN_GROUPS)" ]; then \
cp -at $(TARGET) -- $(MAIN_GROUPS); \
fi
@if type -t git >&/dev/null; then \
cd $(TARGET) && \
git add . && \
git commit -qam "requested $(SUFFIX) copied over"; \
fi
# do beforehand as foreach gets expanded before recipe execution
$(TARGET):
@mkdir -p $(TARGET)
# figure out *_LISTS variables and print them out nicely
debug:
@echo -e $(foreach V, \
$(filter %_LISTS,$(sort $(.VARIABLES))), \
$(if $(filter environment% file,$(origin $V)),\
$(shell echo '\\n"**"' $V: $(value $V)))) '\n'