]> git.saurik.com Git - apt.git/blobdiff - buildlib/defaults.mak
s/make/$(MAKE)/
[apt.git] / buildlib / defaults.mak
index 3e145f673f1cc99071ffa7226df41fb6b35c3d29..6e504390cf84110da590404bf01a041060ab966f 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)
@@ -65,6 +79,8 @@ PROGRAM_H = $(BASE)/buildlib/program.mak
 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
@@ -86,7 +102,6 @@ SUBDIRS+=
 HEADER_TARGETDIRS+=
 
 # Options
-include $(BUILD)/environment.mak
 CPPFLAGS+= -I$(INCLUDE)
 LDFLAGS+= -L$(LIB)
 
@@ -135,6 +150,7 @@ else
  endif
 endif  
 
+# Automatic -j support
 ifeq ($(NUM_PROCS),1)
   PARALLEL_RUN=no
 endif
@@ -142,8 +158,8 @@ endif
 ifndef PARALLEL_RUN
  PARALLEL_RUN=yes
  .EXPORT: PARALLEL_RUN
+ # handle recursion
  ifneq ($(NUM_PROCS),)
-# handle recursion
   MAKEFLAGS += -j $(NUM_PROCS)
  endif
 endif