diff --git a/image.in/Makefile b/image.in/Makefile index 54e80332..db174582 100644 --- a/image.in/Makefile +++ b/image.in/Makefile @@ -29,8 +29,11 @@ $(info warning: mkimage-$(MKI_VERSION) is suboptimal, consider upgrading) $(warning consider upgrading mkimage to $(MKI_VER_OPTIMAL) or better) endif +# glob it just in case +IMAGEDIR := $(wildcard $(IMAGEDIR)) + # additional means to reduce havoc in IMAGEDIR -IMAGE_SORTDIR := $(SORTDIR) +IMAGE_SORTDIR := $(wildcard $(SORTDIR)) # reconstruct instead of passing yet another variable IMAGE_OUTDIR := $(IMAGEDIR)$(IMAGE_SORTDIR:%=/%) diff --git a/lib/build.mk b/lib/build.mk index 2bfc806b..fdd0fac4 100644 --- a/lib/build.mk +++ b/lib/build.mk @@ -42,7 +42,7 @@ IMAGEDIR ?= $(shell \ fi; \ ) -LOGDIR ?= $(IMAGEDIR) +LOGDIR ?= $(wildcard $(IMAGEDIR)) # actual build starter # NB: our output MUST go into stderr to escape POSTPROC diff --git a/lib/profile.mk b/lib/profile.mk index c5dbd145..049805cb 100644 --- a/lib/profile.mk +++ b/lib/profile.mk @@ -82,8 +82,8 @@ profile/bare: profile/init } >&2 @$(call try,MKIMAGE_PREFIX,/usr/share/mkimage) @$(call try,GLOBAL_VERBOSE,) - @$(call try,IMAGEDIR,$(IMAGEDIR)) - @$(call try,LOGDIR,$(LOGDIR)) + @$(call try,IMAGEDIR,$(wildcard $(IMAGEDIR))) + @$(call try,LOGDIR,$(wildcard $(LOGDIR))) @$(call try,BRANDING,altlinux-sisyphus) ifeq (,$(REPO:altlinux%=)) @$(call set,IMAGE_INIT_LIST,+branding-$$(BRANDING)-release) diff --git a/main.mk b/main.mk index 94fe2bca..5ddbf46f 100644 --- a/main.mk +++ b/main.mk @@ -34,6 +34,12 @@ include $(sort $(wildcard lib/*.mk)) include conf.d/*.mk include features.in/*/config.mk +# ensure the outdir is created and globbable +ifdef IMAGEDIR +$(shell mkdir -p $(IMAGEDIR)) +IMAGEDIR := $(wildcard $(IMAGEDIR)) +endif + # FIXME: this is buggy since *.mk can expose parts conditionally # (e.g. test.mk does DEBUG-only bits) and these will fail DISTRO_TARGETS := $(shell sed -n 's,^\(distro/[^:.]\+\):.*$$,\1,p' \