]> git.saurik.com Git - apt.git/blobdiff - buildlib/defaults.mak
Shared libaries only for linux
[apt.git] / buildlib / defaults.mak
index d04b67ffaf4ab74598abc4345d6f176d7110cf7c..47f297cdf1ddb704535f2b07140dc7cbc3b50c90 100644 (file)
@@ -40,11 +40,25 @@ BUILD_POSSIBLE := $(BASE) $(BASE)/build-$(shell uname -m) $(BASE)/build
 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)
@@ -134,3 +148,17 @@ else
   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