OLD | NEW |
1 # Copyright 2011 the V8 project authors. All rights reserved. | 1 # Copyright 2011 the V8 project authors. All rights reserved. |
2 # Redistribution and use in source and binary forms, with or without | 2 # Redistribution and use in source and binary forms, with or without |
3 # modification, are permitted provided that the following conditions are | 3 # modification, are permitted provided that the following conditions are |
4 # met: | 4 # met: |
5 # | 5 # |
6 # * Redistributions of source code must retain the above copyright | 6 # * Redistributions of source code must retain the above copyright |
7 # notice, this list of conditions and the following disclaimer. | 7 # notice, this list of conditions and the following disclaimer. |
8 # * Redistributions in binary form must reproduce the above | 8 # * Redistributions in binary form must reproduce the above |
9 # copyright notice, this list of conditions and the following | 9 # copyright notice, this list of conditions and the following |
10 # disclaimer in the documentation and/or other materials provided | 10 # disclaimer in the documentation and/or other materials provided |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 # soname_version=1.2.3 | 71 # soname_version=1.2.3 |
72 ifdef soname_version | 72 ifdef soname_version |
73 GYPFLAGS += -Dsoname_version=$(soname_version) | 73 GYPFLAGS += -Dsoname_version=$(soname_version) |
74 endif | 74 endif |
75 | 75 |
76 # ----------------- available targets: -------------------- | 76 # ----------------- available targets: -------------------- |
77 # - "dependencies": pulls in external dependencies (currently: GYP) | 77 # - "dependencies": pulls in external dependencies (currently: GYP) |
78 # - any arch listed in ARCHES (see below) | 78 # - any arch listed in ARCHES (see below) |
79 # - any mode listed in MODES | 79 # - any mode listed in MODES |
80 # - every combination <arch>.<mode>, e.g. "ia32.release" | 80 # - every combination <arch>.<mode>, e.g. "ia32.release" |
| 81 # - "native": current host's architecture, release mode |
81 # - any of the above with .check appended, e.g. "ia32.release.check" | 82 # - any of the above with .check appended, e.g. "ia32.release.check" |
82 # - default (no target specified): build all ARCHES and MODES | 83 # - default (no target specified): build all ARCHES and MODES |
83 # - "check": build all targets and run all tests | 84 # - "check": build all targets and run all tests |
84 # - "<arch>.clean" for any <arch> in ARCHES | 85 # - "<arch>.clean" for any <arch> in ARCHES |
85 # - "clean": clean all ARCHES | 86 # - "clean": clean all ARCHES |
86 | 87 |
87 # ----------------- internal stuff ------------------------ | 88 # ----------------- internal stuff ------------------------ |
88 | 89 |
89 # Architectures and modes to be compiled. Consider these to be internal | 90 # Architectures and modes to be compiled. Consider these to be internal |
90 # variables, don't override them (use the targets instead). | 91 # variables, don't override them (use the targets instead). |
91 ARCHES = ia32 x64 arm | 92 ARCHES = ia32 x64 arm |
92 MODES = release debug | 93 MODES = release debug |
93 | 94 |
94 # List of files that trigger Makefile regeneration: | 95 # List of files that trigger Makefile regeneration: |
95 GYPFILES = build/all.gyp build/common.gypi build/standalone.gypi \ | 96 GYPFILES = build/all.gyp build/common.gypi build/standalone.gypi \ |
96 preparser/preparser.gyp samples/samples.gyp src/d8.gyp \ | 97 preparser/preparser.gyp samples/samples.gyp src/d8.gyp \ |
97 test/cctest/cctest.gyp tools/gyp/v8.gyp | 98 test/cctest/cctest.gyp tools/gyp/v8.gyp |
98 | 99 |
99 # Generates all combinations of ARCHES and MODES, e.g. "ia32.release". | 100 # Generates all combinations of ARCHES and MODES, e.g. "ia32.release". |
100 BUILDS = $(foreach mode,$(MODES),$(addsuffix .$(mode),$(ARCHES))) | 101 BUILDS = $(foreach mode,$(MODES),$(addsuffix .$(mode),$(ARCHES))) |
101 # Generates corresponding test targets, e.g. "ia32.release.check". | 102 # Generates corresponding test targets, e.g. "ia32.release.check". |
102 CHECKS = $(addsuffix .check,$(BUILDS)) | 103 CHECKS = $(addsuffix .check,$(BUILDS)) |
103 # File where previously used GYPFLAGS are stored. | 104 # File where previously used GYPFLAGS are stored. |
104 ENVFILE = $(OUTDIR)/environment | 105 ENVFILE = $(OUTDIR)/environment |
105 | 106 |
106 .PHONY: all check clean dependencies $(ENVFILE).new \ | 107 .PHONY: all check clean dependencies $(ENVFILE).new native \ |
107 $(ARCHES) $(MODES) $(BUILDS) $(CHECKS) $(addsuffix .clean,$(ARCHES)) \ | 108 $(ARCHES) $(MODES) $(BUILDS) $(CHECKS) $(addsuffix .clean,$(ARCHES)) \ |
108 $(addsuffix .check,$(MODES)) $(addsuffix .check,$(ARCHES)) | 109 $(addsuffix .check,$(MODES)) $(addsuffix .check,$(ARCHES)) |
109 | 110 |
110 # Target definitions. "all" is the default. | 111 # Target definitions. "all" is the default. |
111 all: $(MODES) | 112 all: $(MODES) |
112 | 113 |
113 # Compile targets. MODES and ARCHES are convenience targets. | 114 # Compile targets. MODES and ARCHES are convenience targets. |
114 .SECONDEXPANSION: | 115 .SECONDEXPANSION: |
115 $(MODES): $(addsuffix .$$@,$(ARCHES)) | 116 $(MODES): $(addsuffix .$$@,$(ARCHES)) |
116 | 117 |
117 $(ARCHES): $(addprefix $$@.,$(MODES)) | 118 $(ARCHES): $(addprefix $$@.,$(MODES)) |
118 | 119 |
119 # Defines how to build a particular target (e.g. ia32.release). | 120 # Defines how to build a particular target (e.g. ia32.release). |
120 $(BUILDS): $(OUTDIR)/Makefile-$$(basename $$@) | 121 $(BUILDS): $(OUTDIR)/Makefile-$$(basename $$@) |
121 @$(MAKE) -C "$(OUTDIR)" -f Makefile-$(basename $@) \ | 122 @$(MAKE) -C "$(OUTDIR)" -f Makefile-$(basename $@) \ |
122 CXX="$(CXX)" LINK="$(LINK)" \ | 123 CXX="$(CXX)" LINK="$(LINK)" \ |
123 BUILDTYPE=$(shell echo $(subst .,,$(suffix $@)) | \ | 124 BUILDTYPE=$(shell echo $(subst .,,$(suffix $@)) | \ |
124 python -c "print raw_input().capitalize()") \ | 125 python -c "print raw_input().capitalize()") \ |
125 builddir="$(shell pwd)/$(OUTDIR)/$@" | 126 builddir="$(shell pwd)/$(OUTDIR)/$@" |
126 | 127 |
| 128 native: $(OUTDIR)/Makefile-native |
| 129 @$(MAKE) -C "$(OUTDIR)" -f Makefile-native \ |
| 130 CXX="$(CXX)" LINK="$(LINK)" BUILDTYPE=Release \ |
| 131 builddir="$(shell pwd)/$(OUTDIR)/$@" |
| 132 |
127 # Test targets. | 133 # Test targets. |
128 check: all | 134 check: all |
129 @tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR) | 135 @tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR) |
130 | 136 |
131 $(addsuffix .check,$(MODES)): $$(basename $$@) | 137 $(addsuffix .check,$(MODES)): $$(basename $$@) |
132 @tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR) \ | 138 @tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR) \ |
133 --mode=$(basename $@) | 139 --mode=$(basename $@) |
134 | 140 |
135 $(addsuffix .check,$(ARCHES)): $$(basename $$@) | 141 $(addsuffix .check,$(ARCHES)): $$(basename $$@) |
136 @tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR) \ | 142 @tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR) \ |
137 --arch=$(basename $@) | 143 --arch=$(basename $@) |
138 | 144 |
139 $(CHECKS): $$(basename $$@) | 145 $(CHECKS): $$(basename $$@) |
140 @tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR) \ | 146 @tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR) \ |
141 --arch-and-mode=$(basename $@) | 147 --arch-and-mode=$(basename $@) |
142 | 148 |
| 149 native.check: native |
| 150 @tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR)/native \ |
| 151 --arch-and-mode=. |
| 152 |
143 # Clean targets. You can clean each architecture individually, or everything. | 153 # Clean targets. You can clean each architecture individually, or everything. |
144 $(addsuffix .clean,$(ARCHES)): | 154 $(addsuffix .clean,$(ARCHES)): |
145 rm -f $(OUTDIR)/Makefile-$(basename $@) | 155 rm -f $(OUTDIR)/Makefile-$(basename $@) |
146 rm -rf $(OUTDIR)/$(basename $@).release | 156 rm -rf $(OUTDIR)/$(basename $@).release |
147 rm -rf $(OUTDIR)/$(basename $@).debug | 157 rm -rf $(OUTDIR)/$(basename $@).debug |
148 find $(OUTDIR) -regex '.*\(host\|target\)-$(basename $@)\.mk' -delete | 158 find $(OUTDIR) -regex '.*\(host\|target\)-$(basename $@)\.mk' -delete |
149 | 159 |
150 clean: $(addsuffix .clean,$(ARCHES)) | 160 native.clean: |
| 161 » rm -f $(OUTDIR)/Makefile-native |
| 162 » rm -rf $(OUTDIR)/native |
| 163 » find $(OUTDIR) -regex '.*\(host\|target\)-native\.mk' -delete |
| 164 |
| 165 clean: $(addsuffix .clean,$(ARCHES)) native.clean |
151 | 166 |
152 # GYP file generation targets. | 167 # GYP file generation targets. |
153 $(OUTDIR)/Makefile-ia32: $(GYPFILES) $(ENVFILE) | 168 $(OUTDIR)/Makefile-ia32: $(GYPFILES) $(ENVFILE) |
154 build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \ | 169 build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \ |
155 -Ibuild/standalone.gypi --depth=. -Dtarget_arch=ia32 \ | 170 -Ibuild/standalone.gypi --depth=. -Dtarget_arch=ia32 \ |
156 -S-ia32 $(GYPFLAGS) | 171 -S-ia32 $(GYPFLAGS) |
157 | 172 |
158 $(OUTDIR)/Makefile-x64: $(GYPFILES) $(ENVFILE) | 173 $(OUTDIR)/Makefile-x64: $(GYPFILES) $(ENVFILE) |
159 build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \ | 174 build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \ |
160 -Ibuild/standalone.gypi --depth=. -Dtarget_arch=x64 \ | 175 -Ibuild/standalone.gypi --depth=. -Dtarget_arch=x64 \ |
161 -S-x64 $(GYPFLAGS) | 176 -S-x64 $(GYPFLAGS) |
162 | 177 |
163 $(OUTDIR)/Makefile-arm: $(GYPFILES) $(ENVFILE) | 178 $(OUTDIR)/Makefile-arm: $(GYPFILES) $(ENVFILE) |
164 build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \ | 179 build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \ |
165 -Ibuild/standalone.gypi --depth=. -Ibuild/armu.gypi \ | 180 -Ibuild/standalone.gypi --depth=. -Ibuild/armu.gypi \ |
166 -S-arm $(GYPFLAGS) | 181 -S-arm $(GYPFLAGS) |
167 | 182 |
| 183 $(OUTDIR)/Makefile-native: $(GYPFILES) $(ENVFILE) |
| 184 build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \ |
| 185 -Ibuild/standalone.gypi --depth=. -S-native $(GYPFLAGS) |
| 186 |
168 # Replaces the old with the new environment file if they're different, which | 187 # Replaces the old with the new environment file if they're different, which |
169 # will trigger GYP to regenerate Makefiles. | 188 # will trigger GYP to regenerate Makefiles. |
170 $(ENVFILE): $(ENVFILE).new | 189 $(ENVFILE): $(ENVFILE).new |
171 @if test -r $(ENVFILE) && cmp $(ENVFILE).new $(ENVFILE) >/dev/null; \ | 190 @if test -r $(ENVFILE) && cmp $(ENVFILE).new $(ENVFILE) >/dev/null; \ |
172 then rm $(ENVFILE).new; \ | 191 then rm $(ENVFILE).new; \ |
173 else mv $(ENVFILE).new $(ENVFILE); fi | 192 else mv $(ENVFILE).new $(ENVFILE); fi |
174 | 193 |
175 # Stores current GYPFLAGS in a file. | 194 # Stores current GYPFLAGS in a file. |
176 $(ENVFILE).new: | 195 $(ENVFILE).new: |
177 @mkdir -p $(OUTDIR); echo "GYPFLAGS=$(GYPFLAGS)" > $(ENVFILE).new; | 196 @mkdir -p $(OUTDIR); echo "GYPFLAGS=$(GYPFLAGS)" > $(ENVFILE).new; |
178 | 197 |
179 # Dependencies. | 198 # Dependencies. |
180 dependencies: | 199 dependencies: |
181 svn checkout --force http://gyp.googlecode.com/svn/trunk build/gyp \ | 200 svn checkout --force http://gyp.googlecode.com/svn/trunk build/gyp \ |
182 --revision 1026 | 201 --revision 1026 |
OLD | NEW |