Home | History | Annotate | Download | only in v8
      1 # Copyright 2012 the V8 project authors. All rights reserved.
      2 # Redistribution and use in source and binary forms, with or without
      3 # modification, are permitted provided that the following conditions are
      4 # met:
      5 #
      6 #     * Redistributions of source code must retain the above copyright
      7 #       notice, this list of conditions and the following disclaimer.
      8 #     * Redistributions in binary form must reproduce the above
      9 #       copyright notice, this list of conditions and the following
     10 #       disclaimer in the documentation and/or other materials provided
     11 #       with the distribution.
     12 #     * Neither the name of Google Inc. nor the names of its
     13 #       contributors may be used to endorse or promote products derived
     14 #       from this software without specific prior written permission.
     15 #
     16 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     17 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     18 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     19 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     20 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     21 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     22 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     23 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     24 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     27 
     28 # Those definitions should be consistent with the main Makefile
     29 ANDROID_ARCHES = android_ia32 android_x64 android_arm android_arm64 \
     30 		 android_mipsel android_x87
     31 MODES = release debug
     32 
     33 # Generates all combinations of ANDROID ARCHES and MODES,
     34 # e.g. "android_ia32.release" or "android_arm.release"
     35 ANDROID_BUILDS = $(foreach mode,$(MODES), \
     36                    $(addsuffix .$(mode),$(ANDROID_ARCHES)))
     37 
     38 ifeq ($(ARCH), android_arm)
     39   DEFINES  = target_arch=arm v8_target_arch=arm
     40 else ifeq ($(ARCH), android_arm64)
     41   DEFINES  = target_arch=arm64 v8_target_arch=arm64
     42 else ifeq ($(ARCH), android_mipsel)
     43   DEFINES  = target_arch=mipsel v8_target_arch=mipsel
     44 else ifeq ($(ARCH), android_ia32)
     45   DEFINES = target_arch=ia32 v8_target_arch=ia32
     46 else ifeq ($(ARCH), android_x64)
     47   DEFINES = target_arch=x64 v8_target_arch=x64
     48 else ifeq ($(ARCH), android_x87)
     49   DEFINES = target_arch=ia32 v8_target_arch=x87
     50 else
     51   $(error Target architecture "${ARCH}" is not supported)
     52 endif
     53 
     54 # Common flags.
     55 DEFINES += OS=android
     56 
     57 .SECONDEXPANSION:
     58 $(ANDROID_BUILDS): $(OUTDIR)/Makefile.$$@
     59 	@$(MAKE) -C "$(OUTDIR)" -f Makefile.$@ \
     60 	          BUILDTYPE=$(shell echo $(subst .,,$(suffix $@)) | \
     61 	                      python -c "print raw_input().capitalize()") \
     62 	          builddir="$(shell pwd)/$(OUTDIR)/$@"
     63 
     64 # Android GYP file generation targets.
     65 ANDROID_MAKEFILES = $(addprefix $(OUTDIR)/Makefile.,$(ANDROID_BUILDS))
     66 $(ANDROID_MAKEFILES):
     67 	GYP_GENERATORS=make-android \
     68 	GYP_DEFINES="${DEFINES}" \
     69 	PYTHONPATH="$(shell pwd)/tools/generate_shim_headers:$(shell pwd)/gypfiles:$(PYTHONPATH)" \
     70 	tools/gyp/gyp --generator-output="${OUTDIR}" gypfiles/all.gyp \
     71 	              -Igypfiles/standalone.gypi --depth=. \
     72 	              -S$(suffix $(basename $@))$(suffix $@) ${GYPFLAGS}
     73