1 |
# -*- Mode: makefile -*- |
2 |
# |
3 |
# ***** BEGIN LICENSE BLOCK ***** |
4 |
# Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
5 |
# |
6 |
# The contents of this file are subject to the Mozilla Public License Version |
7 |
# 1.1 (the "License"); you may not use this file except in compliance with |
8 |
# the License. You may obtain a copy of the License at |
9 |
# http://www.mozilla.org/MPL/ |
10 |
# |
11 |
# Software distributed under the License is distributed on an "AS IS" basis, |
12 |
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
13 |
# for the specific language governing rights and limitations under the |
14 |
# License. |
15 |
# |
16 |
# The Original Code is Mozilla Communicator client code, released |
17 |
# March 31, 1998. |
18 |
# |
19 |
# The Initial Developer of the Original Code is |
20 |
# Netscape Communications Corporation. |
21 |
# Portions created by the Initial Developer are Copyright (C) 1998 |
22 |
# the Initial Developer. All Rights Reserved. |
23 |
# |
24 |
# Contributor(s): |
25 |
# |
26 |
# Alternatively, the contents of this file may be used under the terms of |
27 |
# either of the GNU General Public License Version 2 or later (the "GPL"), |
28 |
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), |
29 |
# in which case the provisions of the GPL or the LGPL are applicable instead |
30 |
# of those above. If you wish to allow use of your version of this file only |
31 |
# under the terms of either the GPL or the LGPL, and not to allow others to |
32 |
# use your version of this file under the terms of the MPL, indicate your |
33 |
# decision by deleting the provisions above and replace them with the notice |
34 |
# and other provisions required by the GPL or the LGPL. If you do not delete |
35 |
# the provisions above, a recipient may use your version of this file under |
36 |
# the terms of any one of the MPL, the GPL or the LGPL. |
37 |
# |
38 |
# ***** END LICENSE BLOCK ***** |
39 |
|
40 |
DEPTH = . |
41 |
topsrcdir = @top_srcdir@ |
42 |
srcdir = @srcdir@ |
43 |
|
44 |
run_for_side_effects := $(shell echo "MAKE: $(MAKE)") |
45 |
include $(DEPTH)/config/autoconf.mk |
46 |
|
47 |
DIRS = config |
48 |
|
49 |
ifdef DEHYDRA_PATH |
50 |
DIRS += analysis-tests |
51 |
endif |
52 |
|
53 |
ifdef JS_NATIVE_EDITLINE |
54 |
DIRS += editline |
55 |
endif |
56 |
|
57 |
# editline needs to get built before the shell |
58 |
ifndef JS_DISABLE_SHELL |
59 |
DIRS += shell |
60 |
endif |
61 |
|
62 |
# FIXME: bug 515383 covers getting these working on wince |
63 |
ifndef WINCE |
64 |
ifdef ENABLE_TESTS |
65 |
DIRS += jsapi-tests |
66 |
endif |
67 |
endif |
68 |
|
69 |
ifdef ENABLE_TESTS |
70 |
DIRS += tests |
71 |
endif |
72 |
|
73 |
MODULE = js |
74 |
LIBRARY_NAME = mozjs |
75 |
STATIC_LIBRARY_NAME = js_static |
76 |
GRE_MODULE = 1 |
77 |
|
78 |
LIBS = $(NSPR_LIBS) |
79 |
|
80 |
ifdef GNU_CXX |
81 |
ifdef INTEL_CXX |
82 |
# icc gets special optimize flags |
83 |
ifdef MOZ_PROFILE_GENERATE |
84 |
MODULE_OPTIMIZE_FLAGS = -O0 |
85 |
else |
86 |
MODULE_OPTIMIZE_FLAGS = -O2 -ip |
87 |
#XXX: do we want different INTERP_OPTIMIZER flags here? |
88 |
endif |
89 |
else # not INTEL_CXX |
90 |
MODULE_OPTIMIZE_FLAGS = -O3 -fstrict-aliasing $(MOZ_OPTIMIZE_SIZE_TWEAK) |
91 |
# Special optimization flags for jsinterp.c |
92 |
INTERP_OPTIMIZER = -O3 -fstrict-aliasing |
93 |
endif |
94 |
else # not GNU_CXX |
95 |
ifeq ($(OS_ARCH),SunOS) |
96 |
MODULE_OPTIMIZE_FLAGS = -xO4 |
97 |
endif |
98 |
ifeq ($(OS_ARCH),WINNT) |
99 |
ifdef WINCE |
100 |
# -GL is not supported on windows mobile while we are using the arm-wince-link command |
101 |
MODULE_OPTIMIZE_FLAGS = -O2 |
102 |
else |
103 |
MODULE_OPTIMIZE_FLAGS = -O2 -GL |
104 |
endif |
105 |
endif |
106 |
endif |
107 |
|
108 |
|
109 |
ifeq (,$(filter-out WINNT WINCE,$(OS_ARCH))) |
110 |
LIBRARY_NAME = js$(MOZ_BITS)$(VERSION_NUMBER) |
111 |
endif |
112 |
|
113 |
# JavaScript must be built shared, even for static builds, as it is used by |
114 |
# other modules which are always built shared. Failure to do so results in |
115 |
# the js code getting copied into xpinstall and jsd as well as mozilla-bin, |
116 |
# and then the static data cells used for locking no longer work. |
117 |
# |
118 |
# In fact, we now build both a static and a shared library, as the |
119 |
# JS shell would like to link to the static library. |
120 |
|
121 |
FORCE_SHARED_LIB = 1 |
122 |
FORCE_STATIC_LIB = 1 |
123 |
|
124 |
VPATH = $(srcdir) |
125 |
|
126 |
CPPSRCS = \ |
127 |
jsapi.cpp \ |
128 |
jsarena.cpp \ |
129 |
jsarray.cpp \ |
130 |
jsatom.cpp \ |
131 |
jsbool.cpp \ |
132 |
jscntxt.cpp \ |
133 |
jsdate.cpp \ |
134 |
jsdbgapi.cpp \ |
135 |
jsdhash.cpp \ |
136 |
jsdtoa.cpp \ |
137 |
jsemit.cpp \ |
138 |
jsexn.cpp \ |
139 |
jsfun.cpp \ |
140 |
jsgc.cpp \ |
141 |
jshash.cpp \ |
142 |
jsinterp.cpp \ |
143 |
jsinvoke.cpp \ |
144 |
jsiter.cpp \ |
145 |
jslock.cpp \ |
146 |
jslog2.cpp \ |
147 |
jsmath.cpp \ |
148 |
jsnum.cpp \ |
149 |
jsobj.cpp \ |
150 |
json.cpp \ |
151 |
jsopcode.cpp \ |
152 |
jsparse.cpp \ |
153 |
jsprf.cpp \ |
154 |
jsregexp.cpp \ |
155 |
jsscan.cpp \ |
156 |
jsscope.cpp \ |
157 |
jsscript.cpp \ |
158 |
jsstr.cpp \ |
159 |
jstask.cpp \ |
160 |
jsutil.cpp \ |
161 |
jsxdrapi.cpp \ |
162 |
jsxml.cpp \ |
163 |
prmjtime.cpp \ |
164 |
$(NULL) |
165 |
|
166 |
ifdef HAVE_DTRACE |
167 |
CPPSRCS += \ |
168 |
jsdtracef.cpp |
169 |
endif |
170 |
|
171 |
INSTALLED_HEADERS = \ |
172 |
js-config.h \ |
173 |
jsautocfg.h \ |
174 |
$(CURDIR)/jsautokw.h \ |
175 |
js.msg \ |
176 |
jsapi.h \ |
177 |
jsarray.h \ |
178 |
jsarena.h \ |
179 |
jsatom.h \ |
180 |
jsbit.h \ |
181 |
jsbool.h \ |
182 |
jsclist.h \ |
183 |
jscntxt.h \ |
184 |
jscompat.h \ |
185 |
jsdate.h \ |
186 |
jsdbgapi.h \ |
187 |
jsdhash.h \ |
188 |
jsdtoa.h \ |
189 |
jsemit.h \ |
190 |
jsfun.h \ |
191 |
jsgc.h \ |
192 |
jshash.h \ |
193 |
jsinterp.h \ |
194 |
jsinttypes.h \ |
195 |
jsiter.h \ |
196 |
jslock.h \ |
197 |
jslong.h \ |
198 |
jsmath.h \ |
199 |
jsnum.h \ |
200 |
jsobj.h \ |
201 |
jsobjinlines.h \ |
202 |
json.h \ |
203 |
jsopcode.tbl \ |
204 |
jsopcode.h \ |
205 |
jsotypes.h \ |
206 |
jsparse.h \ |
207 |
jsprf.h \ |
208 |
jsproto.tbl \ |
209 |
jsprvtd.h \ |
210 |
jspubtd.h \ |
211 |
jsregexp.h \ |
212 |
jsscan.h \ |
213 |
jsscope.h \ |
214 |
jsscript.h \ |
215 |
jsscriptinlines.h \ |
216 |
jsstaticcheck.h \ |
217 |
jsstr.h \ |
218 |
jstask.h \ |
219 |
jstracer.h \ |
220 |
jstypes.h \ |
221 |
jsutil.h \ |
222 |
jsversion.h \ |
223 |
jsxdrapi.h \ |
224 |
jsxml.h \ |
225 |
$(NULL) |
226 |
|
227 |
ifdef ENABLE_JIT |
228 |
VPATH += $(srcdir)/nanojit |
229 |
|
230 |
INSTALLED_HEADERS += \ |
231 |
jsbuiltins.h \ |
232 |
Assembler.h \ |
233 |
Allocator.h \ |
234 |
CodeAlloc.h \ |
235 |
Containers.h \ |
236 |
LIR.h \ |
237 |
avmplus.h \ |
238 |
Fragmento.h \ |
239 |
Native.h \ |
240 |
Native$(NANOJIT_ARCH).h \ |
241 |
RegAlloc.h \ |
242 |
nanojit.h \ |
243 |
$(NULL) |
244 |
|
245 |
CPPSRCS += \ |
246 |
jstracer.cpp \ |
247 |
Assembler.cpp \ |
248 |
Allocator.cpp \ |
249 |
CodeAlloc.cpp \ |
250 |
Containers.cpp \ |
251 |
Fragmento.cpp \ |
252 |
LIR.cpp \ |
253 |
RegAlloc.cpp \ |
254 |
avmplus.cpp \ |
255 |
Native$(NANOJIT_ARCH).cpp \ |
256 |
jsbuiltins.cpp \ |
257 |
$(NULL) |
258 |
|
259 |
ifdef WINCE |
260 |
# don't need -c |
261 |
AS_DASH_C_FLAG = |
262 |
ASFLAGS += -arch 6 |
263 |
ASFILES += jswince.asm |
264 |
endif |
265 |
|
266 |
endif # ENABLE_JIT |
267 |
|
268 |
ifdef HAVE_DTRACE |
269 |
INSTALLED_HEADERS += \ |
270 |
jsdtracef.h \ |
271 |
$(CURDIR)/javascript-trace.h \ |
272 |
$(NULL) |
273 |
endif |
274 |
|
275 |
ifeq (,$(filter-out WINNT WINCE,$(OS_ARCH))) |
276 |
INSTALLED_HEADERS += jscpucfg.h |
277 |
endif |
278 |
|
279 |
EXPORTS = $(INSTALLED_HEADERS) |
280 |
|
281 |
JS_SAFE_ARENA = 1 |
282 |
|
283 |
DASH_R = -r |
284 |
|
285 |
ifneq (,$(filter OS2 WINCE WINNT,$(OS_ARCH))) |
286 |
SDK_LIBRARY = $(IMPORT_LIBRARY) |
287 |
else |
288 |
SDK_LIBRARY = $(SHARED_LIBRARY) |
289 |
endif |
290 |
|
291 |
include $(topsrcdir)/config/config.mk |
292 |
|
293 |
EXTRA_DSO_LDOPTS += $(NSPR_LIBS) |
294 |
|
295 |
ifdef MOZ_MEMORY |
296 |
ifeq ($(OS_ARCH),SunOS) |
297 |
EXTRA_DSO_LDOPTS += $(call EXPAND_LIBNAME_PATH,jemalloc,$(DIST)/lib) |
298 |
endif |
299 |
endif |
300 |
|
301 |
ifndef BUILD_OPT |
302 |
MOCHAFILE = 1 |
303 |
endif |
304 |
|
305 |
ifdef MOZ_OJI |
306 |
ifndef NSBUILDROOT |
307 |
JSJAVA_STUBHEADERS = \ |
308 |
-I$(topsrcdir)/sun-java/include/_gen \ |
309 |
-I$(topsrcdir)/sun-java/netscape/javascript/_jri \ |
310 |
-I$(topsrcdir)/sun-java/netscape/security/_jri |
311 |
else |
312 |
JSJAVA_STUBHEADERS = -I$(JRI_GEN_DIR) -I$(JDK_GEN_DIR) |
313 |
endif |
314 |
|
315 |
JSJAVA_CFLAGS = \ |
316 |
-I$(topsrcdir)/sun-java/md-include \ |
317 |
-I$(topsrcdir)/sun-java/include \ |
318 |
$(JSJAVA_STUBHEADERS) |
319 |
endif |
320 |
|
321 |
# Define keyword generator before rules.mk, see bug 323979 comment 50 |
322 |
|
323 |
HOST_SIMPLE_PROGRAMS += host_jskwgen$(HOST_BIN_SUFFIX) |
324 |
GARBAGE += jsautokw.h host_jskwgen$(HOST_BIN_SUFFIX) |
325 |
|
326 |
HOST_SIMPLE_PROGRAMS += host_jsoplengen$(HOST_BIN_SUFFIX) |
327 |
GARBAGE += jsautooplen.h host_jsoplengen$(HOST_BIN_SUFFIX) |
328 |
|
329 |
USE_HOST_CXX = 1 |
330 |
|
331 |
ifdef HAVE_DTRACE |
332 |
ifneq ($(OS_ARCH),Darwin) |
333 |
DTRACE_PROBE_OBJ = $(LIBRARY_NAME)-dtrace.$(OBJ_SUFFIX) |
334 |
endif |
335 |
MOZILLA_DTRACE_SRC = $(srcdir)/javascript-trace.d |
336 |
endif |
337 |
|
338 |
default:: |
339 |
|
340 |
ifneq (,$(CROSS_COMPILE)$(filter-out WINNT OS2,$(OS_ARCH))) |
341 |
ifneq (,$(filter-out SYMBIAN WINCE,$(OS_ARCH))) |
342 |
# nsinstall doesn't get built until we enter config/ in the exports phase, |
343 |
# so we'll have to manually ensure it gets built here if we want to use |
344 |
# $(EXPORTS) |
345 |
export:: config/nsinstall$(HOST_BIN_SUFFIX) |
346 |
$(PUBLIC) $(SDK_PUBLIC): config/nsinstall$(HOST_BIN_SUFFIX) |
347 |
|
348 |
config/nsinstall$(HOST_BIN_SUFFIX): $(srcdir)/config/nsinstall.c $(srcdir)/config/pathsub.c |
349 |
$(MAKE) -C config/ nsinstall$(HOST_BIN_SUFFIX) |
350 |
endif |
351 |
endif |
352 |
|
353 |
include $(topsrcdir)/config/rules.mk |
354 |
|
355 |
ifdef MOZ_SYNC_BUILD_FILES |
356 |
# Because the SpiderMonkey can be distributed and built independently |
357 |
# of the Mozilla source tree, it contains its own copies of many of |
358 |
# the files used by the top-level Mozilla build process, from the |
359 |
# 'config' and 'build' subtrees. |
360 |
# |
361 |
# To make it simpler to keep the copies in sync, we follow the policy |
362 |
# that the SpiderMonkey copies must always be exact copies of those in |
363 |
# the containing Mozilla tree. If you've made a change in one, it |
364 |
# belongs in the other as well. If the change isn't right for both |
365 |
# places, then that's something to bring up with the other developers. |
366 |
# |
367 |
# Some files are reasonable to diverge; for example, |
368 |
# js/config/autoconf.mk.in doesn't need most of the stuff in |
369 |
# config/autoconf.mk.in. |
370 |
check-sync-dirs = $(PYTHON) $(srcdir)/config/check-sync-dirs.py |
371 |
check:: |
372 |
$(check-sync-dirs) $(srcdir)/config $(MOZ_SYNC_BUILD_FILES)/config |
373 |
$(check-sync-dirs) $(srcdir)/build $(MOZ_SYNC_BUILD_FILES)/build |
374 |
|
375 |
check-valgrind:: |
376 |
$(check-sync-dirs) $(srcdir)/config $(MOZ_SYNC_BUILD_FILES)/config |
377 |
$(check-sync-dirs) $(srcdir)/build $(MOZ_SYNC_BUILD_FILES)/build |
378 |
endif |
379 |
|
380 |
ifdef ENABLE_JIT |
381 |
check:: |
382 |
$(wildcard $(RUN_TEST_PROGRAM)) $(PYTHON) -u $(srcdir)/trace-test/trace-test.py \ |
383 |
--no-slow --no-progress --tinderbox $(DIST)/bin/js$(BIN_SUFFIX) |
384 |
|
385 |
check-valgrind:: |
386 |
$(wildcard $(RUN_TEST_PROGRAM)) $(PYTHON) -u $(srcdir)/trace-test/trace-test.py \ |
387 |
--valgrind --no-slow --no-progress --tinderbox $(DIST)/bin/js$(BIN_SUFFIX) |
388 |
endif |
389 |
|
390 |
DIST_GARBAGE = config.cache config.log config.status \ |
391 |
config/myrules.mk config/myconfig.mk \ |
392 |
unallmakefiles js-config js-config.h js-confdefs.h |
393 |
|
394 |
distclean:: |
395 |
cat unallmakefiles | $(XARGS) rm -f |
396 |
rm -f $(DIST_GARBAGE) |
397 |
|
398 |
# our build system doesn't handle subdir srcs very gracefully today |
399 |
export:: |
400 |
mkdir -p nanojit |
401 |
|
402 |
DEFINES += -DEXPORT_JS_API |
403 |
|
404 |
INCLUDES += -I$(srcdir) |
405 |
|
406 |
GARBAGE += jscpucfg.o jsautocfg.h jsautocfg.tmp jscpucfg |
407 |
|
408 |
ifneq (,$(CROSS_COMPILE)$(filter-out WINNT,$(OS_ARCH))) |
409 |
TARGETS += jscpucfg$(HOST_BIN_SUFFIX) |
410 |
endif |
411 |
|
412 |
ifdef JS_SAFE_ARENA |
413 |
DEFINES += -DJS_USE_SAFE_ARENA |
414 |
endif |
415 |
|
416 |
ifdef JS_THREADSAFE |
417 |
DEFINES += -DJS_THREADSAFE |
418 |
endif |
419 |
|
420 |
ifdef JS_NO_THIN_LOCKS |
421 |
DEFINES += -DJS_USE_ONLY_NSPR_LOCKS |
422 |
endif |
423 |
|
424 |
ifdef JS_VERSION |
425 |
DEFINES += -DJS_VERSION=$(JS_VERSION) |
426 |
endif |
427 |
|
428 |
ifneq ($(findstring -L,$(NSPR_LIBS)),) |
429 |
NSPR_STATIC_PATH = $(subst -L,,$(findstring -L,$(NSPR_LIBS))) |
430 |
else |
431 |
NSPR_STATIC_PATH = $(DIST)/lib |
432 |
endif |
433 |
|
434 |
ifdef MOZ_SHARK |
435 |
CFLAGS += -F/System/Library/PrivateFrameworks |
436 |
CXXFLAGS += -F/System/Library/PrivateFrameworks |
437 |
LDFLAGS += -F/System/Library/PrivateFrameworks -framework CHUD |
438 |
endif |
439 |
|
440 |
ifdef MOZ_VTUNE |
441 |
CXXFLAGS += -IC:/Program\ Files/Intel/VTune/Analyzer/Include |
442 |
EXTRA_DSO_LDOPTS += C:/Program\ Files/Intel/VTune/Analyzer/Lib/VtuneApi.lib |
443 |
LIBS += C:/Program\ Files/Intel/VTune/Analyzer/Lib/VtuneApi.lib |
444 |
endif |
445 |
|
446 |
# BeOS and HP-UX do not require the extra linking of "-lm" |
447 |
ifeq (,$(filter BeOS HP-UX WINNT WINCE OpenVMS,$(OS_ARCH))) |
448 |
EXTRA_LIBS += -lm |
449 |
endif |
450 |
|
451 |
# Prevent floating point errors caused by VC++ optimizations |
452 |
ifeq ($(OS_ARCH)_$(GNU_CC),WINNT_) |
453 |
ifeq (,$(filter-out 1200 1300 1310,$(_MSC_VER))) |
454 |
CFLAGS += -Op |
455 |
else |
456 |
CFLAGS += -fp:precise |
457 |
endif |
458 |
endif # WINNT |
459 |
|
460 |
ifeq ($(OS_ARCH),FreeBSD) |
461 |
EXTRA_LIBS += -pthread |
462 |
endif |
463 |
ifeq ($(OS_ARCH),IRIX) |
464 |
ifdef USE_N32 |
465 |
DASH_R += -n32 |
466 |
endif |
467 |
endif |
468 |
ifeq ($(OS_ARCH),Linux) |
469 |
EXTRA_LIBS += -ldl |
470 |
endif |
471 |
ifeq ($(OS_ARCH),OSF1) |
472 |
EXTRA_LIBS += -lc_r |
473 |
endif |
474 |
ifeq ($(OS_ARCH),SunOS) |
475 |
ifeq ($(TARGET_CPU),sparc) |
476 |
|
477 |
ifdef GNU_CC |
478 |
CFLAGS += -mcpu=v9 |
479 |
CXXFLAGS += -mcpu=v9 |
480 |
else |
481 |
ASFLAGS += -xarch=v8plus -P -L -D_ASM -D__STDC__=0 -K PIC |
482 |
endif # GNU_CC |
483 |
|
484 |
endif |
485 |
ifeq ($(OS_RELEASE),4.1) |
486 |
EXTRA_LIBS += -ldl -lnsl |
487 |
else |
488 |
EXTRA_LIBS += -lposix4 -ldl -lnsl -lsocket |
489 |
endif |
490 |
endif |
491 |
|
492 |
ifdef MOZ_MEMORY |
493 |
ifeq ($(OS_ARCH),Darwin) |
494 |
LDFLAGS += -ljemalloc |
495 |
endif |
496 |
endif |
497 |
|
498 |
# Sun Studio x86 has an optimization bug with LIR.cpp, use -xO2 instead. |
499 |
ifeq ($(OS_ARCH),SunOS) |
500 |
ifeq (86,$(findstring 86,$(OS_TEST))) |
501 |
ifndef GNU_CC |
502 |
LIR.o: LIR.cpp Makefile.in |
503 |
$(REPORT_BUILD) |
504 |
@$(MAKE_DEPS_AUTO_CXX) |
505 |
$(CXX) -o $@ -c $(patsubst -xO%,-xO2,$(COMPILE_CFLAGS)) $< |
506 |
endif |
507 |
endif |
508 |
endif |
509 |
|
510 |
# Allow building jsinterp.c with special optimization flags |
511 |
ifdef INTERP_OPTIMIZER |
512 |
jsinterp.$(OBJ_SUFFIX): MODULE_OPTIMIZE_FLAGS=$(INTERP_OPTIMIZER) |
513 |
endif |
514 |
|
515 |
ifeq ($(OS_ARCH),IRIX) |
516 |
ifndef GNU_CC |
517 |
_COMPILE_CFLAGS = $(patsubst -O%,-O1,$(COMPILE_CFLAGS)) |
518 |
jsapi.o jsxdrapi.o jsarena.o jsarray.o jsatom.o jsemit.o jsfun.o jsinterp.o jsregexp.o jsparse.o jsopcode.o jsscript.o: %.o: %.cpp Makefile.in |
519 |
$(REPORT_BUILD) |
520 |
@$(MAKE_DEPS_AUTO_CXX) |
521 |
$(CXX) -o $@ -c $(_COMPILE_CFLAGS) $< |
522 |
endif |
523 |
endif |
524 |
|
525 |
# An AIX Optimization bug causes PR_dtoa() & JS_dtoa to produce wrong result. |
526 |
# This suppresses optimization for this single compilation unit. |
527 |
ifeq ($(OS_ARCH),AIX) |
528 |
jsatom.o: jsatom.cpp Makefile.in |
529 |
$(REPORT_BUILD) |
530 |
@$(MAKE_DEPS_AUTO_CXX) |
531 |
$(CXX) -o $@ -c $(filter-out $(MOZ_OPTIMIZE_FLAGS), $(COMPILE_CFLAGS)) $< |
532 |
jsdtoa.o: jsdtoa.cpp Makefile.in |
533 |
$(REPORT_BUILD) |
534 |
@$(MAKE_DEPS_AUTO_CXX) |
535 |
$(CXX) -o $@ -c $(filter-out $(MOZ_OPTIMIZE_FLAGS), $(COMPILE_CFLAGS)) $< |
536 |
endif |
537 |
|
538 |
export:: jsautocfg.h |
539 |
|
540 |
ifeq (,$(CROSS_COMPILE)$(GNU_CC)$(filter-out WINNT,$(OS_ARCH))) |
541 |
jsautocfg.h: |
542 |
touch $@ |
543 |
else |
544 |
ifeq ($(OS_ARCH),WINCE) |
545 |
jsautocfg.h: |
546 |
touch $@ |
547 |
else |
548 |
jsautocfg.h: jscpucfg$(HOST_BIN_SUFFIX) |
549 |
@rm -f $@ jsautocfg.tmp |
550 |
./jscpucfg > jsautocfg.tmp |
551 |
mv jsautocfg.tmp $@ |
552 |
endif |
553 |
endif |
554 |
|
555 |
# jscpucfg is a strange target |
556 |
# Needs to be built with the host compiler but needs to include |
557 |
# the mdcpucfg for the target so it needs the appropriate target defines |
558 |
ifdef HOST_NSPR_MDCPUCFG |
559 |
HOST_CXX := $(HOST_CXX) -DMDCPUCFG=$(TARGET_NSPR_MDCPUCFG) |
560 |
HOST_CXXFLAGS := $(patsubst -DXP_%,,$(HOST_CXXFLAGS)) |
561 |
endif |
562 |
|
563 |
ifdef CROSS_COMPILE |
564 |
# jscpucfg needs to know when it's supposed to produce a config for the target |
565 |
JSCPUCFG_DEFINES = $(ACDEFINES) |
566 |
endif |
567 |
|
568 |
ifeq ($(OS_ARCH),QNX) |
569 |
ifneq ($(OS_TARGET),NTO) |
570 |
# QNX's compiler apparently can't build a binary directly from a source file. |
571 |
jscpucfg.o: jscpucfg.cpp Makefile.in |
572 |
$(HOST_CXX) $(HOST_CXXFLAGS) -c $(JSCPUCFG_DEFINES) $(DEFINES) $(NSPR_CFLAGS) -o $@ $< |
573 |
|
574 |
jscpucfg: jscpucfg.o |
575 |
$(HOST_CXX) $(HOST_CXXFLAGS) $(JSCPUCFG_DEFINES) $(DEFINES) -o $@ $< |
576 |
endif |
577 |
else |
578 |
ifeq ($(OS_ARCH),WINCE) |
579 |
jscpucfg$(HOST_BIN_SUFFIX): |
580 |
echo no need to build jscpucfg $< |
581 |
else |
582 |
jscpucfg$(HOST_BIN_SUFFIX): jscpucfg.cpp Makefile.in |
583 |
$(HOST_CXX) $(HOST_CXXFLAGS) $(JSCPUCFG_DEFINES) $(DEFINES) $(NSPR_CFLAGS) $(HOST_OUTOPTION)$@ $< |
584 |
endif |
585 |
endif |
586 |
|
587 |
# Compute the linker flags that programs linking against SpiderMonkey should |
588 |
# pass to get SpiderMonkey and its dependencies, beyond just the -L and -l |
589 |
# for the SpiderMonkey library itself. |
590 |
# - EXTRA_DSO_LDOPTS includes the NSPR -L and -l flags. |
591 |
# - OS_LIBS includes libraries selected by the configure script. |
592 |
# - EXTRA_LIBS includes libraries selected by this Makefile. |
593 |
JS_CONFIG_LIBS=$(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) |
594 |
|
595 |
# The configure script invokes this rule explicitly at configure time! |
596 |
# It's important that js-config be ready by the time we're done |
597 |
# configuring, because we may be running other configure scripts that |
598 |
# would like to run js-config themselves, before js is built. |
599 |
# |
600 |
# This file and rules.mk go through a certain amount of work to decide |
601 |
# which libraries to build, what to name them, and what flags to pass |
602 |
# when linking them (and thus what flags its own clients must pass). |
603 |
# All this information needs to go into the js-config script. To |
604 |
# avoid trying to re-compute all that in the configure script, we just |
605 |
# have the configure script generate this Makefile, and then invoke |
606 |
# this rule. |
607 |
at=@ |
608 |
js-config: js-config.in Makefile $(DEPTH)/config/autoconf.mk $(topsrcdir)/config/config.mk $(topsrcdir)/config/rules.mk |
609 |
rm -f js-config.tmp |
610 |
sed < $< > js-config.tmp \ |
611 |
-e 's|$(at)prefix$(at)|$(prefix)|' \ |
612 |
-e 's|$(at)exec_prefix$(at)|$(exec_prefix)|' \ |
613 |
-e 's|$(at)includedir$(at)|$(includedir)|' \ |
614 |
-e 's|$(at)libdir$(at)|$(libdir)|' \ |
615 |
-e 's|$(at)MOZILLA_VERSION$(at)|$(MOZILLA_VERSION)|' \ |
616 |
-e 's|$(at)LIBRARY_NAME$(at)|$(LIBRARY_NAME)|' \ |
617 |
-e 's|$(at)NSPR_CFLAGS$(at)|$(NSPR_CFLAGS)|' \ |
618 |
-e 's|$(at)JS_CONFIG_LIBS$(at)|$(JS_CONFIG_LIBS)|' \ |
619 |
-e 's|$(at)MOZ_JS_LIBS$(at)|$(MOZ_JS_LIBS)|' \ |
620 |
&& mv js-config.tmp $@ && chmod +x $@ |
621 |
|
622 |
SCRIPTS = js-config |
623 |
SDK_BINARY = js-config |
624 |
|
625 |
install:: $(INSTALLED_HEADERS) |
626 |
$(SYSINSTALL) $^ $(DESTDIR)$(includedir)/$(MODULE) |
627 |
|
628 |
install:: $(SCRIPTS) |
629 |
$(SYSINSTALL) $^ $(DESTDIR)$(bindir) |
630 |
|
631 |
install:: $(LIBRARY) $(SHARED_LIBRARY) $(IMPORT_LIBRARY) |
632 |
ifneq (,$(LIBRARY)) |
633 |
$(SYSINSTALL) $(LIBRARY) $(DESTDIR)$(libdir) |
634 |
endif |
635 |
ifneq (,$(SHARED_LIBRARY)) |
636 |
$(SYSINSTALL) $(SHARED_LIBRARY) $(DESTDIR)$(libdir) |
637 |
endif |
638 |
ifneq (,$(IMPORT_LIBRARY)) |
639 |
$(SYSINSTALL) $(IMPORT_LIBRARY) $(DESTDIR)$(libdir) |
640 |
endif |
641 |
|
642 |
# Extra dependancies and rules for auto-generated headers |
643 |
host_jskwgen.$(OBJ_SUFFIX): jsversion.h jskeyword.tbl |
644 |
|
645 |
# Use CURDIR to avoid finding a jsautokw.h in the source tree (from a |
646 |
# previous build?) via VPATH when we're building in a separate tree. |
647 |
$(CURDIR)/jsautokw.h: host_jskwgen$(HOST_BIN_SUFFIX) |
648 |
./host_jskwgen$(HOST_BIN_SUFFIX) $@ |
649 |
|
650 |
host_jsoplengen.$(OBJ_SUFFIX): jsopcode.tbl |
651 |
|
652 |
# Use CURDIR to avoid finding a jsautooplen.h in the source tree (from |
653 |
# a previous build?) via VPATH when we're building in a separate tree. |
654 |
$(CURDIR)/jsautooplen.h: host_jsoplengen$(HOST_BIN_SUFFIX) |
655 |
./host_jsoplengen$(HOST_BIN_SUFFIX) $@ |
656 |
|
657 |
# Force auto-header generation before compiling any source that may use them |
658 |
$(CPPSRCS:%.cpp=%.$(OBJ_SUFFIX)): $(CURDIR)/jsautokw.h $(CURDIR)/jsautooplen.h |
659 |
|
660 |
ifdef HAVE_DTRACE |
661 |
$(CURDIR)/javascript-trace.h: $(srcdir)/javascript-trace.d |
662 |
dtrace -h -s $(srcdir)/javascript-trace.d -o javascript-trace.h.in |
663 |
sed 's/if _DTRACE_VERSION/ifdef INCLUDE_MOZILLA_DTRACE/' \ |
664 |
javascript-trace.h.in > javascript-trace.h |
665 |
|
666 |
# We can't automatically generate dependencies on auto-generated headers; |
667 |
# we have to list them explicitly. |
668 |
$(addsuffix .$(OBJ_SUFFIX),jsdtracef jsinterp jsobj): $(CURDIR)/javascript-trace.h |
669 |
endif |
670 |
|
671 |
ifdef GNU_CC |
672 |
ifndef CROSS_COMPILE |
673 |
# If we don't have run-mozilla.sh *and* we're linking against NSPR, we don't |
674 |
# know how to run the JS binary. Oh well |
675 |
|
676 |
imacro_asm.js: imacro_asm.js.in jsopcode.tbl |
677 |
$(CC) -c -x c -E -P -I$(srcdir) $< > $@ |
678 |
|
679 |
GARBAGE += imacros.c.tmp imacro_asm.js |
680 |
|
681 |
ifneq (,$(wildcard $(RUN_TEST_PROGRAM))$(if $(NSPR_LIBS),,1)) |
682 |
libs:: imacro_asm.js $(srcdir)/imacros.jsasm |
683 |
$(wildcard $(RUN_TEST_PROGRAM)) $(DIST)/bin/js$(BIN_SUFFIX) $< $(srcdir)/imacros.jsasm > imacros.c.tmp |
684 |
@cmp -s imacros.c.tmp $(srcdir)/imacros.c.out || \ |
685 |
(echo "imacros.c.out is out of date. Run 'make update-imacros' to copy it to your source tree."; diff -U 4 $(srcdir)/imacros.c.out imacros.c.out; exit 1) |
686 |
@echo "imacros.c.out is up to date" |
687 |
|
688 |
update-imacros: imacros.c.tmp |
689 |
cp $< $(srcdir)/imacros.c.out |
690 |
|
691 |
.PHONY: update-imacros |
692 |
endif |
693 |
endif |
694 |
endif |