main.mk: target refactoring
The issue with the original hasty code that stuck around was that it bluntly ignored any ifdef/ifeq constructs due to an obvious reason of being essentially a grep, not a makefile interpreter. It's now fixed so that e.g. arch-specific targets won't pop up for no good reason. Thanks ldv@ for discussion and a reminder about the dump mode (make -p).
This commit is contained in:
parent
a18295f223
commit
768df7e9e9
19
main.mk
19
main.mk
@ -40,14 +40,17 @@ $(shell mkdir -p $(IMAGEDIR))
|
|||||||
IMAGEDIR := $(wildcard $(IMAGEDIR))
|
IMAGEDIR := $(wildcard $(IMAGEDIR))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# FIXME: this is buggy since *.mk can expose parts conditionally
|
# conf.d/*.mk can expose parts conditionally (e.g. DEBUG-only bits)
|
||||||
# (e.g. test.mk does DEBUG-only bits) and these will fail
|
targets = $(shell \
|
||||||
DISTRO_TARGETS := $(shell sed -n 's,^\(distro/[^:.]\+\):.*$$,\1,p' \
|
for i in conf.d/*.mk; do \
|
||||||
lib/distro.mk $(wildcard conf.d/*.mk) | sort -u)
|
make IMAGE_CLASS=$(1) -s -r -p -f $$i 2>/dev/null; \
|
||||||
VE_TARGETS := $(shell sed -n 's,^\(ve/[^:.]\+\):.*$$,\1,p' \
|
done \
|
||||||
lib/ve.mk $(wildcard conf.d/*.mk) | sort -u)
|
| sed -rn 's,^($(1)/[^.:]+):.*,\1,p' \
|
||||||
VM_TARGETS := $(shell sed -n 's,^\(vm/[^:.]\+\):.*$$,\1,p' \
|
| sort -u)
|
||||||
lib/vm.mk $(wildcard conf.d/*.mk) | sort -u)
|
|
||||||
|
DISTRO_TARGETS := $(call targets,distro)
|
||||||
|
VE_TARGETS := $(call targets,ve)
|
||||||
|
VM_TARGETS := $(call targets,vm)
|
||||||
DISTROS := $(call addsuffices,$(DISTRO_EXTS),$(DISTRO_TARGETS))
|
DISTROS := $(call addsuffices,$(DISTRO_EXTS),$(DISTRO_TARGETS))
|
||||||
VES := $(call addsuffices,$(VE_EXTS),$(VE_TARGETS))
|
VES := $(call addsuffices,$(VE_EXTS),$(VE_TARGETS))
|
||||||
VMS := $(call addsuffices,$(VM_EXTS),$(VM_TARGETS))
|
VMS := $(call addsuffices,$(VM_EXTS),$(VM_TARGETS))
|
||||||
|
Loading…
Reference in New Issue
Block a user