Reviewers: Yang,

Message:
Yang: PTAL.

Paweł: Happy?

Description:
Add "native" target to Makefile for the benefit of Linux distros


TEST=make native; make native.check; make native.clean


Please review this at http://codereview.chromium.org/7891045/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M Makefile
  M build/standalone.gypi
  M tools/test-wrapper-gypbuild.py


Index: Makefile
diff --git a/Makefile b/Makefile
index a7b27317a3ad37d026b5f611ed55cc7dadcc4880..ab4fe646875a077e67db8cf0aa108977c46e9055 100644
--- a/Makefile
+++ b/Makefile
@@ -78,6 +78,7 @@ endif
 # - any arch listed in ARCHES (see below)
 # - any mode listed in MODES
 # - every combination <arch>.<mode>, e.g. "ia32.release"
+# - "native": current host's architecture, release mode
 # - any of the above with .check appended, e.g. "ia32.release.check"
 # - default (no target specified): build all ARCHES and MODES
 # - "check": build all targets and run all tests
@@ -103,7 +104,7 @@ CHECKS = $(addsuffix .check,$(BUILDS))
 # File where previously used GYPFLAGS are stored.
 ENVFILE = $(OUTDIR)/environment

-.PHONY: all check clean dependencies $(ENVFILE).new \
+.PHONY: all check clean dependencies $(ENVFILE).new native \
$(ARCHES) $(MODES) $(BUILDS) $(CHECKS) $(addsuffix .clean,$(ARCHES)) \
         $(addsuffix .check,$(MODES)) $(addsuffix .check,$(ARCHES))

@@ -124,6 +125,11 @@ $(BUILDS): $(OUTDIR)/Makefile-$$(basename $$@)
                             python -c "print raw_input().capitalize()") \
                 builddir="$(shell pwd)/$(OUTDIR)/$@"

+native: $(OUTDIR)/Makefile-native
+       @$(MAKE) -C "$(OUTDIR)" -f Makefile-native \
+                CXX="$(CXX)" LINK="$(LINK)" BUILDTYPE=Release \
+                builddir="$(shell pwd)/$(OUTDIR)/$@"
+
 # Test targets.
 check: all
        @tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR)
@@ -140,6 +146,10 @@ $(CHECKS): $$(basename $$@)
        @tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR) \
            --arch-and-mode=$(basename $@)

+native.check: native
+       @tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR)/native \
+           --arch-and-mode=.
+
# Clean targets. You can clean each architecture individually, or everything.
 $(addsuffix .clean,$(ARCHES)):
        rm -f $(OUTDIR)/Makefile-$(basename $@)
@@ -147,7 +157,12 @@ $(addsuffix .clean,$(ARCHES)):
        rm -rf $(OUTDIR)/$(basename $@).debug
        find $(OUTDIR) -regex '.*\(host\|target\)-$(basename $@)\.mk' -delete

-clean: $(addsuffix .clean,$(ARCHES))
+native.clean:
+       rm -f $(OUTDIR)/Makefile-native
+       rm -rf $(OUTDIR)/native
+       find $(OUTDIR) -regex '.*\(host\|target\)-native\.mk' -delete
+
+clean: $(addsuffix .clean,$(ARCHES)) native.clean

 # GYP file generation targets.
 $(OUTDIR)/Makefile-ia32: $(GYPFILES) $(ENVFILE)
@@ -165,6 +180,10 @@ $(OUTDIR)/Makefile-arm: $(GYPFILES) $(ENVFILE)
                      -Ibuild/standalone.gypi --depth=. -Ibuild/armu.gypi \
                      -S-arm $(GYPFLAGS)

+$(OUTDIR)/Makefile-native: $(GYPFILES) $(ENVFILE)
+       build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \
+                     -Ibuild/standalone.gypi --depth=. -S-native $(GYPFLAGS)
+
# Replaces the old with the new environment file if they're different, which
 # will trigger GYP to regenerate Makefiles.
 $(ENVFILE): $(ENVFILE).new
Index: build/standalone.gypi
diff --git a/build/standalone.gypi b/build/standalone.gypi
index cb5e1330397b4cc3ffe134ad2e5df1dd134e8a29..cdece8c57cb8f997c6d6d11549fb32dc83d0271b 100644
--- a/build/standalone.gypi
+++ b/build/standalone.gypi
@@ -35,20 +35,24 @@
     'msvs_multi_core_compile%': '1',
     'variables': {
       'variables': {
-        'conditions': [
-          [ 'OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
- # This handles the Linux platforms we generally deal with. Anything - # else gets passed through, which probably won't work very well; such
-            # hosts should pass an explicit target_arch to gyp.
-            'host_arch%':
- '<!(uname -m | sed -e "s/i.86/ia32/;s/x86_64/x64/;s/amd64/x64/;s/arm.*/arm/")',
-          }, {  # OS!="linux" and OS!="freebsd" and OS!="openbsd"
-            'host_arch%': 'ia32',
-          }],
-        ],
+        'variables': {
+          'conditions': [
+            [ 'OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
+ # This handles the Linux platforms we generally deal with. Anything + # else gets passed through, which probably won't work very well; such
+              # hosts should pass an explicit target_arch to gyp.
+              'host_arch%':
+ '<!(uname -m | sed -e "s/i.86/ia32/;s/x86_64/x64/;s/amd64/x64/;s/arm.*/arm/")',
+            }, {  # OS!="linux" and OS!="freebsd" and OS!="openbsd"
+              'host_arch%': 'ia32',
+            }],
+          ],
+        },
+        'host_arch%': '<(host_arch)',
+        'target_arch%': '<(host_arch)',
       },
       'host_arch%': '<(host_arch)',
-      'target_arch%': '<(host_arch)',
+      'target_arch%': '<(target_arch)',
       'v8_target_arch%': '<(target_arch)',
     },
     'host_arch%': '<(host_arch)',
Index: tools/test-wrapper-gypbuild.py
diff --git a/tools/test-wrapper-gypbuild.py b/tools/test-wrapper-gypbuild.py
index ad5449a4046862d8c3ae2910eeded766857e9739..51ff791d35a5d9f30991c724871d3476f63c61d5 100755
--- a/tools/test-wrapper-gypbuild.py
+++ b/tools/test-wrapper-gypbuild.py
@@ -131,16 +131,20 @@ def BuildOptions():


 def ProcessOptions(options):
-  if options.arch_and_mode != None and options.arch_and_mode != "":
-    tokens = options.arch_and_mode.split(".")
-    options.arch = tokens[0]
-    options.mode = tokens[1]
-  options.mode = options.mode.split(',')
+  if options.arch_and_mode == ".":
+    options.arch = []
+    options.mode = []
+  else:
+    if options.arch_and_mode != None and options.arch_and_mode != "":
+      tokens = options.arch_and_mode.split(".")
+      options.arch = tokens[0]
+      options.mode = tokens[1]
+    options.mode = options.mode.split(',')
+    options.arch = options.arch.split(',')
   for mode in options.mode:
     if not mode in ['debug', 'release']:
       print "Unknown mode %s" % mode
       return False
-  options.arch = options.arch.split(',')
   for arch in options.arch:
     if not arch in ['ia32', 'x64', 'arm']:
       print "Unknown architecture %s" % arch
@@ -232,6 +236,18 @@ def Main():
                                env=env)
       returncodes += child.wait()

+  if len(options.mode) == 0 and len(options.arch) == 0:
+    print ">>> running tests"
+    shellpath = workspace + '/' + options.outdir
+    env['LD_LIBRARY_PATH'] = shellpath + '/lib.target'
+    shell = shellpath + '/d8'
+    child = subprocess.Popen(' '.join(args_for_children +
+                                      ['--shell=' + shell]),
+                             shell=True,
+                             cwd=workspace,
+                             env=env)
+    returncodes = child.wait()
+
   return returncodes




--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to