Makefile: presume a distro by default

When ve/ support was introduced, a simple "make icewm.iso"
had to turn into the more elaborate "make distro/icewm.iso".
This latter one involves several keystrokes more, which is
not even (environ)mentally friendly.

This was supposed to get fixed somewhere down the road with
a fallback but the elegance of IMAGE_* setup waterfall barred
me from tweaking IMAGE_TARGET at once (and the downstream fixup
would imply re-tweaking the consequent variables as well which
is blatantly anti-mkimage-profilic being a brute fork).

OTOH testing for a "directory" part of the goal is going to
either deadlock on IMAGE_CLASS or duplicate its assignment.

So now when I've had enough typing an extra "distro/",
I'm going to just bite the bullet and tweak IMAGE_TARGET
with a test duplicating IMAGE_CLASS assignment indeed
(testing for e.g. "/" results in a different test,
which would be worse yet).

Please suggest a more elegant solution if you invent one!
This commit is contained in:
Michael Shigorin 2011-11-21 13:42:59 +02:00
parent b52ff4ef91
commit 10b9e293b0

View File

@ -10,7 +10,10 @@ MKIMAGE_PROFILES = $(dir $(lastword $(MAKEFILE_LIST)))
# only process the first target (inter-target cleanup is tricky)
IMAGE_TARGET := $(firstword $(MAKECMDGOALS))# distro/server-base.iso
IMAGE_CONF := $(basename $(MAKECMDGOALS))# distro/server-base
ifeq (./,$(dir $(IMAGE_TARGET)))# convenience fallback
IMAGE_TARGET := distro/$(IMAGE_TARGET)# for omitted "distro/"
endif
IMAGE_CONF := $(basename $(IMAGE_TARGET))# distro/server-base
IMAGE_CLASS := $(dir $(IMAGE_TARGET))# distro/ (let's fix it)
IMAGE_CLASS := $(IMAGE_CLASS:%/=%)# distro
IMAGE_FILE := $(notdir $(IMAGE_TARGET))# server-base.iso
@ -35,13 +38,7 @@ VES := $(call addsuffices,$(VE_EXTS),$(VE_TARGETS))
IMAGES := $(DISTROS) $(VES)
.PHONY: $(IMAGES) $(DISTRO_TARGETS) $(VE_TARGETS)
help:
@echo '** available distribution targets:'
@echo $(DISTROS) | fmt -sw"$$((COLUMNS>>1))" | column -t
@echo
@echo '** available virtual environment targets:'
@echo $(VES) | fmt -sw"$$((COLUMNS>>1))" | column -t
.DEFAULT: help
### suboptimal but at least clear, reliable and convenient
all:
@ -63,6 +60,16 @@ $(IMAGES): debug \
config/pack/$(IMAGE_TYPE) \
build; @:
# convenience shortcut
$(DISTROS:distro/%=%): %: distro/%
help:
@echo '** available distribution targets:'
@echo $(DISTROS) | fmt -sw"$$((COLUMNS>>1))" | column -t
@echo
@echo '** available virtual environment targets:'
@echo $(VES) | fmt -sw"$$((COLUMNS>>1))" | column -t
debug:
ifeq (2,$(DEBUG))
@$(foreach v,\