changeset 47:b694b3fa68d1

- Uniformly calculate MB_OF_MEMORY for BSD using sysctl -n and awk. - Make an exception for the maximum amount of memory the build will use for OpenBSD (due to mmap based malloc and W^X, only 1 gig of VM is available for malloc + anon private mmap).
author kurt
date Tue, 20 Jan 2009 19:16:44 -0500
parents 10646cc7348c
children c15ebbe94f71
files make/common/shared/Platform.gmk
diffstat 1 files changed, 10 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/make/common/shared/Platform.gmk	Wed Jan 14 16:58:04 2009 -0500
+++ b/make/common/shared/Platform.gmk	Tue Jan 20 19:16:44 2009 -0500
@@ -329,11 +329,7 @@
   #    a fully built workspace.
   REQUIRED_FREE_SPACE=1500000
   # How much RAM does this machine have:
-  ifeq ($(OS_VENDOR), OpenBSD)
-    MB_OF_MEMORY=$(shell perl -e 'printf "%d", `sysctl hw.physmem | cut -d'=' -f2` / 1048576' )
-  else
-    MB_OF_MEMORY=$(shell sysctl hw.physmem | awk '{print int($$NF / 1048576); }' )
-  endif
+  MB_OF_MEMORY=$(shell sysctl -n hw.physmem | awk '{print int($$NF / 1048576); }' )
 endif
 
 # Windows with and without CYGWIN will be slightly different
@@ -447,7 +443,14 @@
 #    build machines and adjustments will be made to prevent excessing
 #    system swapping during the build.
 #    If we don't know, assume 512. Subtract 128 from MB for VM MAX.
-#    Don't set VM max over 1024-128=896.
+#    Don't set VM max over 1024-128=896, except on OpenBSD where
+#    736 is the max.
+ifeq ($(OS_VENDOR), OpenBSD)
+  ABS_MAX_MEMORY := "736"
+else
+  ABS_MAX_MEMORY := "896"
+endif
+
 ifneq ($(MB_OF_MEMORY),)
   LOW_MEMORY_MACHINE := $(shell \
     if [ $(MB_OF_MEMORY) -le 512 ] ; then \
@@ -459,7 +462,7 @@
     if [ $(MB_OF_MEMORY) -le 1024 ] ; then \
       expr $(MB_OF_MEMORY) '-' 128 ; \
     else \
-      echo "896"; \
+      echo $(ABS_MAX_MEMORY); \
     fi)
   MIN_VM_MEMORY := $(shell \
     if [ $(MAX_VM_MEMORY) -le 128 ] ; then \