Browse Source

[LibOS] Remove PARALLELMFLAGS hack from buildglibc.py

Remove PARALLELMFLAGS replacing logic from buildglibc.py and instead use
$(MAKE) PARALLELMFLAGS="-j `nproc`"
Isaku Yamahata 4 years ago
parent
commit
2a54d1915b
2 changed files with 5 additions and 16 deletions
  1. 1 1
      LibOS/Makefile
  2. 4 15
      LibOS/buildglibc.py

+ 1 - 1
LibOS/Makefile

@@ -43,7 +43,7 @@ ifeq ($(findstring x86_64,$(SYS))$(findstring linux,$(SYS)),x86_64linux)
 
 $(BUILD_DIR)/Build.success: $(BUILD_DIR)/Makefile
 	@echo "Building glibc, may take a while to finish. Warning messages may show up. If this process terminates with failures, see \"$(BUILD_DIR)/build.log\" for more information."
-	($(MAKE) -C $(BUILD_DIR) 2>&1 >> build.log) && touch $@
+	($(MAKE) PARALLELMFLAGS='-j `nproc`' -C $(BUILD_DIR) 2>&1 >> build.log) && touch $@
 #  2>&1 | tee -a build.log)
 
 $(GLIBC_TARGET): $(BUILD_DIR)/Build.success

+ 4 - 15
LibOS/buildglibc.py

@@ -1,12 +1,9 @@
 #!/usr/bin/env python3
 
-import sys, os, string, subprocess, shutil, fileinput, multiprocessing, re, resource
-
-def replaceAll(fd,searchExp,replaceExp):
-    for line in fileinput.input(fd, inplace=1):
-        if searchExp in line:
-            line = line.replace(searchExp,replaceExp)
-        sys.stdout.write(line)
+import os
+import shutil
+import subprocess
+import sys
 
 def prependText(filename, text) :
     data = ""
@@ -108,11 +105,3 @@ if True:
     commandStr = r'CFLAGS="{2}" {3} {0}/configure --prefix={1} {4} | tee configure.out'.format(glibc, installDir, cflags, extra_defs, extra_flags)
     print(commandStr)
     commandOutput = subprocess.call(commandStr, shell=True)
-
-    ##    Enable parallel builds
-    numCPUs = multiprocessing.cpu_count()
-    ##    Don't use up all the cores!
-    numCPUs = numCPUs - 1
-    if numCPUs == 0:
-        numCPUs = 1
-    replaceAll('Makefile', r'# PARALLELMFLAGS = -j4', r'PARALLELMFLAGS = -j{0}'.format(numCPUs))