76f45d7f2e77e7c83fe9c26e8ab9506ba1c58a08
[profile/ivi/qtjsbackend.git] / src / 3rdparty / v8 / Makefile
1 # Copyright 2011 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
29 # Variable default definitions. Override them by exporting them in your shell.
30 CXX ?= "g++"  # For distcc: export CXX="distcc g++"
31 LINK ?= "g++"
32 OUTDIR ?= out
33 TESTJOBS ?= -j16
34 GYPFLAGS ?=
35 TESTFLAGS ?=
36
37 # Special build flags. Use them like this: "make library=shared"
38
39 # library=shared || component=shared_library
40 ifeq ($(library), shared)
41   GYPFLAGS += -Dcomponent=shared_library
42 endif
43 ifdef component
44   GYPFLAGS += -Dcomponent=$(component)
45 endif
46 # console=readline
47 ifdef console
48   GYPFLAGS += -Dconsole=$(console)
49 endif
50 # disassembler=on
51 ifeq ($(disassembler), on)
52   GYPFLAGS += -Dv8_enable_disassembler=1
53 endif
54 # objectprint=on
55 ifeq ($(objectprint), on)
56   GYPFLAGS += -Dv8_object_print=1
57 endif
58 # snapshot=off
59 ifeq ($(snapshot), off)
60   GYPFLAGS += -Dv8_use_snapshot='false'
61 endif
62 # gdbjit=on
63 ifeq ($(gdbjit), on)
64   GYPFLAGS += -Dv8_enable_gdbjit=1
65 endif
66 # liveobjectlist=on
67 ifeq ($(liveobjectlist), on)
68   GYPFLAGS += -Dv8_use_liveobjectlist=true
69 endif
70 # vfp3=off
71 ifeq ($(vfp3), off)
72   GYPFLAGS += -Dv8_can_use_vfp_instructions=false
73 else
74   GYPFLAGS += -Dv8_can_use_vfp_instructions=true
75 endif
76 # soname_version=1.2.3
77 ifdef soname_version
78   GYPFLAGS += -Dsoname_version=$(soname_version)
79 endif
80 # werror=no
81 ifeq ($(werror), no)
82   GYPFLAGS += -Dwerror=''
83 endif
84 # presubmit=no
85 ifeq ($(presubmit), no)
86   TESTFLAGS += --no-presubmit
87 endif
88
89 # ----------------- available targets: --------------------
90 # - "dependencies": pulls in external dependencies (currently: GYP)
91 # - any arch listed in ARCHES (see below)
92 # - any mode listed in MODES
93 # - every combination <arch>.<mode>, e.g. "ia32.release"
94 # - "native": current host's architecture, release mode
95 # - any of the above with .check appended, e.g. "ia32.release.check"
96 # - default (no target specified): build all ARCHES and MODES
97 # - "check": build all targets and run all tests
98 # - "<arch>.clean" for any <arch> in ARCHES
99 # - "clean": clean all ARCHES
100
101 # ----------------- internal stuff ------------------------
102
103 # Architectures and modes to be compiled. Consider these to be internal
104 # variables, don't override them (use the targets instead).
105 ARCHES = ia32 x64 arm
106 MODES = release debug
107
108 # List of files that trigger Makefile regeneration:
109 GYPFILES = build/all.gyp build/common.gypi build/standalone.gypi \
110            preparser/preparser.gyp samples/samples.gyp src/d8.gyp \
111            test/cctest/cctest.gyp tools/gyp/v8.gyp
112
113 # Generates all combinations of ARCHES and MODES, e.g. "ia32.release".
114 BUILDS = $(foreach mode,$(MODES),$(addsuffix .$(mode),$(ARCHES)))
115 # Generates corresponding test targets, e.g. "ia32.release.check".
116 CHECKS = $(addsuffix .check,$(BUILDS))
117 # File where previously used GYPFLAGS are stored.
118 ENVFILE = $(OUTDIR)/environment
119
120 .PHONY: all check clean dependencies $(ENVFILE).new native \
121         $(ARCHES) $(MODES) $(BUILDS) $(CHECKS) $(addsuffix .clean,$(ARCHES)) \
122         $(addsuffix .check,$(MODES)) $(addsuffix .check,$(ARCHES))
123
124 # Target definitions. "all" is the default.
125 all: $(MODES)
126
127 # Compile targets. MODES and ARCHES are convenience targets.
128 .SECONDEXPANSION:
129 $(MODES): $(addsuffix .$$@,$(ARCHES))
130
131 $(ARCHES): $(addprefix $$@.,$(MODES))
132
133 # Defines how to build a particular target (e.g. ia32.release).
134 $(BUILDS): $(OUTDIR)/Makefile-$$(basename $$@)
135         @$(MAKE) -C "$(OUTDIR)" -f Makefile-$(basename $@) \
136                  CXX="$(CXX)" LINK="$(LINK)" \
137                  BUILDTYPE=$(shell echo $(subst .,,$(suffix $@)) | \
138                              python -c "print raw_input().capitalize()") \
139                  builddir="$(shell pwd)/$(OUTDIR)/$@"
140
141 native: $(OUTDIR)/Makefile-native
142         @$(MAKE) -C "$(OUTDIR)" -f Makefile-native \
143                  CXX="$(CXX)" LINK="$(LINK)" BUILDTYPE=Release \
144                  builddir="$(shell pwd)/$(OUTDIR)/$@"
145
146 # Test targets.
147 check: all
148         @tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR) \
149             $(TESTFLAGS)
150
151 $(addsuffix .check,$(MODES)): $$(basename $$@)
152         @tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR) \
153             --mode=$(basename $@) $(TESTFLAGS)
154
155 $(addsuffix .check,$(ARCHES)): $$(basename $$@)
156         @tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR) \
157             --arch=$(basename $@) $(TESTFLAGS)
158
159 $(CHECKS): $$(basename $$@)
160         @tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR) \
161             --arch-and-mode=$(basename $@) $(TESTFLAGS)
162
163 native.check: native
164         @tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR)/native \
165             --arch-and-mode=. $(TESTFLAGS)
166
167 # Clean targets. You can clean each architecture individually, or everything.
168 $(addsuffix .clean,$(ARCHES)):
169         rm -f $(OUTDIR)/Makefile-$(basename $@)
170         rm -rf $(OUTDIR)/$(basename $@).release
171         rm -rf $(OUTDIR)/$(basename $@).debug
172         find $(OUTDIR) -regex '.*\(host\|target\)-$(basename $@)\.mk' -delete
173
174 native.clean:
175         rm -f $(OUTDIR)/Makefile-native
176         rm -rf $(OUTDIR)/native
177         find $(OUTDIR) -regex '.*\(host\|target\)-native\.mk' -delete
178
179 clean: $(addsuffix .clean,$(ARCHES)) native.clean
180
181 # GYP file generation targets.
182 $(OUTDIR)/Makefile-ia32: $(GYPFILES) $(ENVFILE)
183         build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \
184                       -Ibuild/standalone.gypi --depth=. -Dtarget_arch=ia32 \
185                       -S-ia32 $(GYPFLAGS)
186
187 $(OUTDIR)/Makefile-x64: $(GYPFILES) $(ENVFILE)
188         build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \
189                       -Ibuild/standalone.gypi --depth=. -Dtarget_arch=x64 \
190                       -S-x64 $(GYPFLAGS)
191
192 $(OUTDIR)/Makefile-arm: $(GYPFILES) $(ENVFILE)
193         build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \
194                       -Ibuild/standalone.gypi --depth=. -Ibuild/armu.gypi \
195                       -S-arm $(GYPFLAGS)
196
197 $(OUTDIR)/Makefile-native: $(GYPFILES) $(ENVFILE)
198         build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \
199                       -Ibuild/standalone.gypi --depth=. -S-native $(GYPFLAGS)
200
201 # Replaces the old with the new environment file if they're different, which
202 # will trigger GYP to regenerate Makefiles.
203 $(ENVFILE): $(ENVFILE).new
204         @if test -r $(ENVFILE) && cmp $(ENVFILE).new $(ENVFILE) >/dev/null; \
205             then rm $(ENVFILE).new; \
206             else mv $(ENVFILE).new $(ENVFILE); fi
207
208 # Stores current GYPFLAGS in a file.
209 $(ENVFILE).new:
210         @mkdir -p $(OUTDIR); echo "GYPFLAGS=$(GYPFLAGS)" > $(ENVFILE).new;
211
212 # Dependencies.
213 dependencies:
214         svn checkout --force http://gyp.googlecode.com/svn/trunk build/gyp \
215             --revision 1026