diff --git a/pkg.in/lists/Makefile b/pkg.in/lists/Makefile index bdfcbaed..7bf48348 100644 --- a/pkg.in/lists/Makefile +++ b/pkg.in/lists/Makefile @@ -24,32 +24,20 @@ all: $(TARGET) $(GLOBAL_DEBUG) $(DOTBASE) $(shell cp --parents -at $(TARGET) \ -- $(value $V)))) -### FIXME: move to iterator/static pattern rule +# args: name, suffix, command +define dump-THEM +if [ -n "$($(1)_$(2))" ]; then echo -e "\n## $(1)_$(2)"; $(3) $($(1)_$(2)); fi; +endef + +dump-PACKAGES = $(call dump-THEM,$(1),PACKAGES,echo) +dump-LISTS = $(call dump-THEM,$(1),LISTS,cat) + dot-base: @# 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 "$(THE_PACKAGES)" ]; then \ - echo -e "\n## THE_PACKAGES\n$(THE_PACKAGES)"; \ - fi; \ - if [ -n "$(BASE_PACKAGES)" ]; then \ - echo -e "\n## BASE_PACKAGES\n$(BASE_PACKAGES)"; \ - fi; \ - if [ -n "$(THE_LISTS)" ]; then \ - echo -e "\n## THE_LISTS"; cat $(THE_LISTS); \ - fi; \ - if [ -n "$(BASE_LISTS)" ]; then \ - echo -e "\n## BASE_LISTS"; cat $(BASE_LISTS); \ - fi; \ + $(foreach p,SYSTEM COMMON THE BASE,$(call dump-PACKAGES,$(p))) \ + $(foreach l,THE BASE,$(call dump-LISTS,$(l))) \ } | sed -re '/^[^[:space:]#]/ s/[[:space:]]+/\n/g' >$(TARGET)/.base @if [ -n "$(THE_GROUPS)$(MAIN_GROUPS)" ]; then \ cp -at $(TARGET) -- $(THE_GROUPS) $(MAIN_GROUPS); \