endif
BUILDX:= $(foreach i,$(BUILD_POSSIBLE),$(wildcard $(i)/environment.mak*))
-BUILDX:= $(patsubst %/,%,$(firstword $(dir $(BUILDX))))
ifeq ($(words $(BUILDX)),0)
-error-all:
+
+# Check for a busted wildcard function. We use this function in several
+# places, it must work.
+ifeq ($(words $(wildcard *)),0)
+error-all/environment.mak:
+ echo You have a broken version of GNU Make - upgrade.
+ error-out-and-die
+else
+error-all/environment.mak:
echo Can't find the build directory in $(BUILD_POSSIBLE) -- use BUILD=
+ error-out-and-die
+endif
+
+# Force include below to come to the error target
+BUILDX := error-all
+else
+BUILDX:= $(patsubst %/,%,$(firstword $(dir $(BUILDX))))
endif
override BUILD := $(BUILDX)
COPY_H = $(BASE)/buildlib/copy.mak
YODL_MANPAGE_H = $(BASE)/buildlib/yodl_manpage.mak
+include $(BUILD)/environment.mak
+
ifdef STATICLIBS
LIBRARY_H += $(BASE)/buildlib/staticlibrary.mak
endif
HEADER_TARGETDIRS+=
# Options
-include $(BUILD)/environment.mak
CPPFLAGS+= -I$(INCLUDE)
LDFLAGS+= -L$(LIB)
endef
endif
endif
+
+# Automatic -j support
+ifeq ($(NUM_PROCS),1)
+ PARALLEL_RUN=no
+endif
+
+ifndef PARALLEL_RUN
+ PARALLEL_RUN=yes
+ .EXPORT: PARALLEL_RUN
+ # handle recursion
+ ifneq ($(NUM_PROCS),)
+ MAKEFLAGS += -j $(NUM_PROCS)
+ endif
+endif