Changed --enable-jit to --enable-tracejit (bug 545245, r=sayrer).
[mozilla-central.git] / js / src / Makefile.in
blob9a6585ac14c10e5491865fd0f415b0dbebc18fc9
1 # -*- Mode: makefile -*-
3 # ***** BEGIN LICENSE BLOCK *****
4 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
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/
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.
16 # The Original Code is Mozilla Communicator client code, released
17 # March 31, 1998.
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.
24 # Contributor(s):
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.
38 # ***** END LICENSE BLOCK *****
40 DEPTH = .
41 topsrcdir = @top_srcdir@
42 srcdir = @srcdir@
44 run_for_side_effects := $(shell echo "MAKE: $(MAKE)")
45 include $(DEPTH)/config/autoconf.mk
47 DIRS = config
49 ifdef DEHYDRA_PATH
50 DIRS += analysis-tests
51 endif
53 ifdef JS_NATIVE_EDITLINE
54 DIRS += editline
55 endif
57 # editline needs to get built before the shell
58 ifndef JS_DISABLE_SHELL
59 DIRS += shell
60 endif
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
69 ifdef ENABLE_TESTS
70 DIRS += tests
71 endif
73 MODULE = js
74 LIBRARY_NAME = mozjs
75 STATIC_LIBRARY_NAME = js_static
76 GRE_MODULE = 1
78 LIBS = $(NSPR_LIBS)
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
109 # JavaScript must be built shared, even for static builds, as it is used by
110 # other modules which are always built shared. Failure to do so results in
111 # the js code getting copied into xpinstall and jsd as well as mozilla-bin,
112 # and then the static data cells used for locking no longer work.
114 # In fact, we now build both a static and a shared library, as the
115 # JS shell would like to link to the static library.
117 FORCE_SHARED_LIB = 1
118 FORCE_STATIC_LIB = 1
120 VPATH = $(srcdir)
122 CPPSRCS = \
123 jsapi.cpp \
124 jsarena.cpp \
125 jsarray.cpp \
126 jsatom.cpp \
127 jsbool.cpp \
128 jscntxt.cpp \
129 jsdate.cpp \
130 jsdbgapi.cpp \
131 jsdhash.cpp \
132 jsdtoa.cpp \
133 jsemit.cpp \
134 jsexn.cpp \
135 jsfun.cpp \
136 jsgc.cpp \
137 jshash.cpp \
138 jsinterp.cpp \
139 jsinvoke.cpp \
140 jsiter.cpp \
141 jslock.cpp \
142 jslog2.cpp \
143 jsmath.cpp \
144 jsnum.cpp \
145 jsobj.cpp \
146 json.cpp \
147 jsopcode.cpp \
148 jsparse.cpp \
149 jsprf.cpp \
150 jsregexp.cpp \
151 jsscan.cpp \
152 jsscope.cpp \
153 jsscript.cpp \
154 jsstr.cpp \
155 jstask.cpp \
156 jstypedarray.cpp \
157 jsutil.cpp \
158 jsxdrapi.cpp \
159 jsxml.cpp \
160 prmjtime.cpp \
161 $(NULL)
163 ifdef HAVE_DTRACE
164 CPPSRCS += \
165 jsdtracef.cpp
166 endif
168 INSTALLED_HEADERS = \
169 js-config.h \
170 jsautocfg.h \
171 $(CURDIR)/jsautokw.h \
172 js.msg \
173 jsapi.h \
174 jsarray.h \
175 jsarena.h \
176 jsatom.h \
177 jsbit.h \
178 jsbool.h \
179 jsclist.h \
180 jscntxt.h \
181 jscompat.h \
182 jsdate.h \
183 jsdbgapi.h \
184 jsdhash.h \
185 jsdtoa.h \
186 jsemit.h \
187 jsfun.h \
188 jsgc.h \
189 jshash.h \
190 jsinterp.h \
191 jsinttypes.h \
192 jsiter.h \
193 jslock.h \
194 jslong.h \
195 jsmath.h \
196 jsnum.h \
197 jsobj.h \
198 jsobjinlines.h \
199 json.h \
200 jsopcode.tbl \
201 jsopcode.h \
202 jsotypes.h \
203 jsparse.h \
204 jsprf.h \
205 jsproto.tbl \
206 jsprvtd.h \
207 jspubtd.h \
208 jsregexp.h \
209 jsscan.h \
210 jsscope.h \
211 jsscript.h \
212 jsscriptinlines.h \
213 jsstaticcheck.h \
214 jsstr.h \
215 jstask.h \
216 jstracer.h \
217 jstypedarray.h \
218 jstypes.h \
219 jsutil.h \
220 jsvector.h \
221 jstl.h \
222 jsversion.h \
223 jsxdrapi.h \
224 jsxml.h \
225 $(NULL)
227 ifdef ENABLE_TRACEJIT
228 VPATH += $(srcdir)/nanojit
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 VMPI.h \
244 $(NULL)
246 CPPSRCS += \
247 jstracer.cpp \
248 Assembler.cpp \
249 Allocator.cpp \
250 CodeAlloc.cpp \
251 Containers.cpp \
252 Fragmento.cpp \
253 LIR.cpp \
254 RegAlloc.cpp \
255 avmplus.cpp \
256 Native$(NANOJIT_ARCH).cpp \
257 jsbuiltins.cpp \
258 VMPI.cpp \
259 $(NULL)
261 ifdef WINCE
262 # don't need -c
263 AS_DASH_C_FLAG =
264 ASFLAGS += -arch 6
265 ASFILES += jswince.asm
266 endif
268 endif # ENABLE_TRACEJIT
270 ifdef HAVE_DTRACE
271 INSTALLED_HEADERS += \
272 jsdtracef.h \
273 $(CURDIR)/javascript-trace.h \
274 $(NULL)
275 endif
277 ifeq (,$(filter-out WINNT WINCE,$(OS_ARCH)))
278 INSTALLED_HEADERS += jscpucfg.h
279 endif
281 EXPORTS = $(INSTALLED_HEADERS)
283 DASH_R = -r
285 ifneq (,$(filter OS2 WINCE WINNT,$(OS_ARCH)))
286 SDK_LIBRARY = $(IMPORT_LIBRARY)
287 else
288 SDK_LIBRARY = $(SHARED_LIBRARY)
289 endif
291 include $(topsrcdir)/config/config.mk
293 EXTRA_DSO_LDOPTS += $(NSPR_LIBS)
295 ifdef MOZ_MEMORY
296 ifeq ($(OS_ARCH),SunOS)
297 EXTRA_DSO_LDOPTS += $(call EXPAND_LIBNAME_PATH,jemalloc,$(DIST)/lib)
298 endif
299 endif
301 ifndef BUILD_OPT
302 MOCHAFILE = 1
303 endif
305 # Define keyword generator before rules.mk, see bug 323979 comment 50
307 HOST_SIMPLE_PROGRAMS += host_jskwgen$(HOST_BIN_SUFFIX)
308 GARBAGE += jsautokw.h host_jskwgen$(HOST_BIN_SUFFIX)
310 HOST_SIMPLE_PROGRAMS += host_jsoplengen$(HOST_BIN_SUFFIX)
311 GARBAGE += jsautooplen.h host_jsoplengen$(HOST_BIN_SUFFIX)
313 USE_HOST_CXX = 1
315 ifdef HAVE_DTRACE
316 ifneq ($(OS_ARCH),Darwin)
317 DTRACE_PROBE_OBJ = $(LIBRARY_NAME)-dtrace.$(OBJ_SUFFIX)
318 endif
319 MOZILLA_DTRACE_SRC = $(srcdir)/javascript-trace.d
320 endif
322 default::
324 ifneq (,$(CROSS_COMPILE)$(filter-out WINNT OS2,$(OS_ARCH)))
325 ifneq (,$(filter-out SYMBIAN WINCE,$(OS_ARCH)))
326 # nsinstall doesn't get built until we enter config/ in the exports phase,
327 # so we'll have to manually ensure it gets built here if we want to use
328 # $(EXPORTS)
329 export:: config/nsinstall$(HOST_BIN_SUFFIX)
330 $(PUBLIC) $(SDK_PUBLIC): config/nsinstall$(HOST_BIN_SUFFIX)
332 config/nsinstall$(HOST_BIN_SUFFIX): $(srcdir)/config/nsinstall.c $(srcdir)/config/pathsub.c
333 $(MAKE) -C config/ nsinstall$(HOST_BIN_SUFFIX)
334 endif
335 endif
337 include $(topsrcdir)/config/rules.mk
339 ifdef MOZ_SYNC_BUILD_FILES
340 # Because the SpiderMonkey can be distributed and built independently
341 # of the Mozilla source tree, it contains its own copies of many of
342 # the files used by the top-level Mozilla build process, from the
343 # 'config' and 'build' subtrees.
345 # To make it simpler to keep the copies in sync, we follow the policy
346 # that the SpiderMonkey copies must always be exact copies of those in
347 # the containing Mozilla tree. If you've made a change in one, it
348 # belongs in the other as well. If the change isn't right for both
349 # places, then that's something to bring up with the other developers.
351 # Some files are reasonable to diverge; for example,
352 # js/config/autoconf.mk.in doesn't need most of the stuff in
353 # config/autoconf.mk.in.
354 check-sync-dirs = $(PYTHON) $(srcdir)/config/check-sync-dirs.py
355 check::
356 $(check-sync-dirs) $(srcdir)/config $(MOZ_SYNC_BUILD_FILES)/config
357 $(check-sync-dirs) $(srcdir)/build $(MOZ_SYNC_BUILD_FILES)/build
359 check-valgrind::
360 $(check-sync-dirs) $(srcdir)/config $(MOZ_SYNC_BUILD_FILES)/config
361 $(check-sync-dirs) $(srcdir)/build $(MOZ_SYNC_BUILD_FILES)/build
362 endif
364 ifdef ENABLE_TRACEJIT
365 check::
366 $(wildcard $(RUN_TEST_PROGRAM)) $(PYTHON) -u $(srcdir)/trace-test/trace-test.py \
367 --no-slow --no-progress --tinderbox $(DIST)/bin/js$(BIN_SUFFIX)
369 check-valgrind::
370 $(wildcard $(RUN_TEST_PROGRAM)) $(PYTHON) -u $(srcdir)/trace-test/trace-test.py \
371 --valgrind --no-slow --no-progress --tinderbox $(DIST)/bin/js$(BIN_SUFFIX)
372 endif
374 DIST_GARBAGE = config.cache config.log config.status \
375 config/myrules.mk config/myconfig.mk \
376 unallmakefiles js-config js-config.h js-confdefs.h
378 distclean::
379 cat unallmakefiles | $(XARGS) rm -f
380 rm -f $(DIST_GARBAGE)
382 # our build system doesn't handle subdir srcs very gracefully today
383 export::
384 mkdir -p nanojit
386 DEFINES += -DEXPORT_JS_API
388 INCLUDES += -I$(srcdir)
390 GARBAGE += jscpucfg.o jsautocfg.h jsautocfg.tmp jscpucfg
392 ifneq (,$(CROSS_COMPILE)$(filter-out WINNT,$(OS_ARCH)))
393 TARGETS += jscpucfg$(HOST_BIN_SUFFIX)
394 endif
396 ifdef JS_THREADSAFE
397 DEFINES += -DJS_THREADSAFE
398 endif
400 ifdef JS_NO_THIN_LOCKS
401 DEFINES += -DJS_USE_ONLY_NSPR_LOCKS
402 endif
404 ifdef JS_VERSION
405 DEFINES += -DJS_VERSION=$(JS_VERSION)
406 endif
408 ifneq ($(findstring -L,$(NSPR_LIBS)),)
409 NSPR_STATIC_PATH = $(subst -L,,$(findstring -L,$(NSPR_LIBS)))
410 else
411 NSPR_STATIC_PATH = $(DIST)/lib
412 endif
414 ifdef MOZ_SHARK
415 CFLAGS += -F/System/Library/PrivateFrameworks
416 CXXFLAGS += -F/System/Library/PrivateFrameworks
417 LDFLAGS += -F/System/Library/PrivateFrameworks -framework CHUD
418 endif
420 ifdef MOZ_VTUNE
421 CXXFLAGS += -IC:/Program\ Files/Intel/VTune/Analyzer/Include
422 EXTRA_DSO_LDOPTS += C:/Program\ Files/Intel/VTune/Analyzer/Lib/VtuneApi.lib
423 LIBS += C:/Program\ Files/Intel/VTune/Analyzer/Lib/VtuneApi.lib
424 endif
426 # BeOS and HP-UX do not require the extra linking of "-lm"
427 ifeq (,$(filter BeOS HP-UX WINNT WINCE OpenVMS OS2,$(OS_ARCH)))
428 EXTRA_LIBS += -lm
429 endif
431 # Prevent floating point errors caused by VC++ optimizations
432 ifeq ($(OS_ARCH)_$(GNU_CC),WINNT_)
433 ifeq (,$(filter-out 1200 1300 1310,$(_MSC_VER)))
434 CFLAGS += -Op
435 else
436 CFLAGS += -fp:precise
437 endif
438 endif # WINNT
440 ifeq ($(OS_ARCH),FreeBSD)
441 EXTRA_LIBS += -pthread
442 endif
443 ifeq ($(OS_ARCH),IRIX)
444 ifdef USE_N32
445 DASH_R += -n32
446 endif
447 endif
448 ifeq ($(OS_ARCH),Linux)
449 EXTRA_LIBS += -ldl
450 endif
451 ifeq ($(OS_ARCH),OSF1)
452 EXTRA_LIBS += -lc_r
453 endif
454 ifeq ($(OS_ARCH),SunOS)
455 ifeq ($(TARGET_CPU),sparc)
457 ifdef GNU_CC
458 CFLAGS += -mcpu=v9
459 CXXFLAGS += -mcpu=v9
460 endif # GNU_CC
462 endif
463 ifeq ($(OS_RELEASE),4.1)
464 EXTRA_LIBS += -ldl -lnsl
465 else
466 EXTRA_LIBS += -lposix4 -ldl -lnsl -lsocket
467 endif
468 endif
470 ifdef MOZ_MEMORY
471 ifeq ($(OS_ARCH),Darwin)
472 LDFLAGS += -ljemalloc
473 endif
474 endif
476 ifdef SOLARIS_SUNPRO_CXX
477 # Sun Studio SPARC doesn't work well with gcc inline asm, use lock_SunOS_sparc*.il
478 jslock.o: jslock.cpp Makefile.in lock_sparcv8plus.il lock_sparcv9.il
479 $(REPORT_BUILD)
480 @$(MAKE_DEPS_AUTO_CXX)
481 ifeq (sparcv9,$(findstring sparcv9,$(OS_TEST)))
482 $(CXX) -o $@ -c $(COMPILE_CFLAGS) $(srcdir)/lock_sparcv9.il $<
483 else
484 $(CXX) -o $@ -c $(COMPILE_CFLAGS) $(srcdir)/lock_sparcv8plus.il $<
485 endif # sparcv9
486 endif # SOLARIS_SUNPRO_CXX
488 # Allow building jsinterp.c with special optimization flags
489 ifdef INTERP_OPTIMIZER
490 jsinterp.$(OBJ_SUFFIX): MODULE_OPTIMIZE_FLAGS=$(INTERP_OPTIMIZER)
491 endif
493 ifeq ($(OS_ARCH),IRIX)
494 ifndef GNU_CC
495 _COMPILE_CFLAGS = $(patsubst -O%,-O1,$(COMPILE_CFLAGS))
496 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
497 $(REPORT_BUILD)
498 @$(MAKE_DEPS_AUTO_CXX)
499 $(CXX) -o $@ -c $(_COMPILE_CFLAGS) $<
500 endif
501 endif
503 # An AIX Optimization bug causes PR_dtoa() & JS_dtoa to produce wrong result.
504 # This suppresses optimization for this single compilation unit.
505 ifeq ($(OS_ARCH),AIX)
506 jsatom.o: jsatom.cpp Makefile.in
507 $(REPORT_BUILD)
508 @$(MAKE_DEPS_AUTO_CXX)
509 $(CXX) -o $@ -c $(filter-out $(MOZ_OPTIMIZE_FLAGS), $(COMPILE_CFLAGS)) $<
510 jsdtoa.o: jsdtoa.cpp Makefile.in
511 $(REPORT_BUILD)
512 @$(MAKE_DEPS_AUTO_CXX)
513 $(CXX) -o $@ -c $(filter-out $(MOZ_OPTIMIZE_FLAGS), $(COMPILE_CFLAGS)) $<
514 endif
516 export:: jsautocfg.h
518 ifeq (,$(CROSS_COMPILE)$(GNU_CC)$(filter-out WINNT,$(OS_ARCH)))
519 jsautocfg.h:
520 touch $@
521 else
522 ifeq ($(OS_ARCH),WINCE)
523 jsautocfg.h:
524 touch $@
525 else
526 jsautocfg.h: jscpucfg$(HOST_BIN_SUFFIX)
527 @rm -f $@ jsautocfg.tmp
528 ./jscpucfg > jsautocfg.tmp
529 mv jsautocfg.tmp $@
530 endif
531 endif
533 # jscpucfg is a strange target
534 # Needs to be built with the host compiler but needs to include
535 # the mdcpucfg for the target so it needs the appropriate target defines
536 ifdef HOST_NSPR_MDCPUCFG
537 HOST_CXX := $(HOST_CXX) -DMDCPUCFG=$(TARGET_NSPR_MDCPUCFG)
538 HOST_CXXFLAGS := $(patsubst -DXP_%,,$(HOST_CXXFLAGS))
539 endif
541 ifdef CROSS_COMPILE
542 # jscpucfg needs to know when it's supposed to produce a config for the target
543 JSCPUCFG_DEFINES = $(ACDEFINES)
544 endif
546 ifeq ($(OS_ARCH),QNX)
547 ifneq ($(OS_TARGET),NTO)
548 # QNX's compiler apparently can't build a binary directly from a source file.
549 jscpucfg.o: jscpucfg.cpp Makefile.in
550 $(HOST_CXX) $(HOST_CXXFLAGS) -c $(JSCPUCFG_DEFINES) $(DEFINES) $(NSPR_CFLAGS) -o $@ $<
552 jscpucfg: jscpucfg.o
553 $(HOST_CXX) $(HOST_CXXFLAGS) $(JSCPUCFG_DEFINES) $(DEFINES) -o $@ $<
554 endif
555 else
556 ifeq ($(OS_ARCH),WINCE)
557 jscpucfg$(HOST_BIN_SUFFIX):
558 echo no need to build jscpucfg $<
559 else
560 jscpucfg$(HOST_BIN_SUFFIX): jscpucfg.cpp Makefile.in
561 $(HOST_CXX) $(HOST_CXXFLAGS) $(JSCPUCFG_DEFINES) $(DEFINES) $(NSPR_CFLAGS) $(HOST_OUTOPTION)$@ $<
562 endif
563 endif
565 # Compute the linker flags that programs linking against SpiderMonkey should
566 # pass to get SpiderMonkey and its dependencies, beyond just the -L and -l
567 # for the SpiderMonkey library itself.
568 # - EXTRA_DSO_LDOPTS includes the NSPR -L and -l flags.
569 # - OS_LIBS includes libraries selected by the configure script.
570 # - EXTRA_LIBS includes libraries selected by this Makefile.
571 JS_CONFIG_LIBS=$(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS)
573 # The configure script invokes this rule explicitly at configure time!
574 # It's important that js-config be ready by the time we're done
575 # configuring, because we may be running other configure scripts that
576 # would like to run js-config themselves, before js is built.
578 # This file and rules.mk go through a certain amount of work to decide
579 # which libraries to build, what to name them, and what flags to pass
580 # when linking them (and thus what flags its own clients must pass).
581 # All this information needs to go into the js-config script. To
582 # avoid trying to re-compute all that in the configure script, we just
583 # have the configure script generate this Makefile, and then invoke
584 # this rule.
585 at=@
586 js-config: js-config.in Makefile $(DEPTH)/config/autoconf.mk $(topsrcdir)/config/config.mk $(topsrcdir)/config/rules.mk
587 rm -f js-config.tmp
588 sed < $< > js-config.tmp \
589 -e 's|$(at)prefix$(at)|$(prefix)|' \
590 -e 's|$(at)exec_prefix$(at)|$(exec_prefix)|' \
591 -e 's|$(at)includedir$(at)|$(includedir)|' \
592 -e 's|$(at)libdir$(at)|$(libdir)|' \
593 -e 's|$(at)MOZILLA_VERSION$(at)|$(MOZILLA_VERSION)|' \
594 -e 's|$(at)LIBRARY_NAME$(at)|$(LIBRARY_NAME)|' \
595 -e 's|$(at)NSPR_CFLAGS$(at)|$(NSPR_CFLAGS)|' \
596 -e 's|$(at)JS_CONFIG_LIBS$(at)|$(JS_CONFIG_LIBS)|' \
597 -e 's|$(at)MOZ_JS_LIBS$(at)|$(MOZ_JS_LIBS)|' \
598 && mv js-config.tmp $@ && chmod +x $@
600 SCRIPTS = js-config
601 SDK_BINARY = js-config
603 install:: $(INSTALLED_HEADERS)
604 $(SYSINSTALL) $^ $(DESTDIR)$(includedir)/$(MODULE)
606 install:: $(SCRIPTS)
607 $(SYSINSTALL) $^ $(DESTDIR)$(bindir)
609 install:: $(LIBRARY) $(SHARED_LIBRARY) $(IMPORT_LIBRARY)
610 ifneq (,$(LIBRARY))
611 $(SYSINSTALL) $(LIBRARY) $(DESTDIR)$(libdir)
612 endif
613 ifneq (,$(SHARED_LIBRARY))
614 $(SYSINSTALL) $(SHARED_LIBRARY) $(DESTDIR)$(libdir)
615 endif
616 ifneq (,$(IMPORT_LIBRARY))
617 $(SYSINSTALL) $(IMPORT_LIBRARY) $(DESTDIR)$(libdir)
618 endif
620 # Extra dependancies and rules for auto-generated headers
621 host_jskwgen.$(OBJ_SUFFIX): jsversion.h jskeyword.tbl
623 # Use CURDIR to avoid finding a jsautokw.h in the source tree (from a
624 # previous build?) via VPATH when we're building in a separate tree.
625 $(CURDIR)/jsautokw.h: host_jskwgen$(HOST_BIN_SUFFIX)
626 ./host_jskwgen$(HOST_BIN_SUFFIX) $@
628 host_jsoplengen.$(OBJ_SUFFIX): jsopcode.tbl
630 # Use CURDIR to avoid finding a jsautooplen.h in the source tree (from
631 # a previous build?) via VPATH when we're building in a separate tree.
632 $(CURDIR)/jsautooplen.h: host_jsoplengen$(HOST_BIN_SUFFIX)
633 ./host_jsoplengen$(HOST_BIN_SUFFIX) $@
635 # Force auto-header generation before compiling any source that may use them
636 $(CPPSRCS:%.cpp=%.$(OBJ_SUFFIX)): $(CURDIR)/jsautokw.h $(CURDIR)/jsautooplen.h
638 ifdef HAVE_DTRACE
639 $(CURDIR)/javascript-trace.h: $(srcdir)/javascript-trace.d
640 dtrace -h -s $(srcdir)/javascript-trace.d -o javascript-trace.h.in
641 sed 's/if _DTRACE_VERSION/ifdef INCLUDE_MOZILLA_DTRACE/' \
642 javascript-trace.h.in > javascript-trace.h
644 # We can't automatically generate dependencies on auto-generated headers;
645 # we have to list them explicitly.
646 $(addsuffix .$(OBJ_SUFFIX),jsdtracef jsinterp jsobj): $(CURDIR)/javascript-trace.h
647 endif
649 ifdef GNU_CC
650 ifndef CROSS_COMPILE
651 # If we don't have run-mozilla.sh *and* we're linking against NSPR, we don't
652 # know how to run the JS binary. Oh well
654 imacro_asm.js: imacro_asm.js.in jsopcode.tbl
655 $(CC) -c -x c -E -P -I$(srcdir) $< > $@
657 GARBAGE += imacros.c.tmp imacro_asm.js
659 ifneq (,$(wildcard $(RUN_TEST_PROGRAM))$(if $(NSPR_LIBS),,1))
660 libs:: imacro_asm.js $(srcdir)/imacros.jsasm
661 $(wildcard $(RUN_TEST_PROGRAM)) $(DIST)/bin/js$(BIN_SUFFIX) $< $(srcdir)/imacros.jsasm > imacros.c.tmp
662 @cmp -s imacros.c.tmp $(srcdir)/imacros.c.out || \
663 (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)
664 @echo "imacros.c.out is up to date"
666 update-imacros: imacros.c.tmp
667 cp $< $(srcdir)/imacros.c.out
669 # Code for importing the nanojit subtree from its repository.
671 NANOJIT_CENTRAL_REV=$(shell cat $(srcdir)/nanojit-import-rev)
672 NANOJIT_CENTRAL_REPO=http://hg.mozilla.org/projects/nanojit-central
673 NANOJIT_CENTRAL_LOCAL=$(CURDIR)/nanojit-central
674 CUR_REPO=$(srcdir)/../..
676 update-nanojit:
677 rm -Rf $(NANOJIT_CENTRAL_LOCAL) import-splicemap import-revmap
678 hg clone $(NANOJIT_CENTRAL_REPO) $(NANOJIT_CENTRAL_LOCAL)
679 python $(srcdir)/find-child.py \
680 --src=$(NANOJIT_CENTRAL_LOCAL) \
681 --dst=$(CUR_REPO) \
682 --start=$(NANOJIT_CENTRAL_REV) \
683 --filemap=$(srcdir)/nanojit-import-filemap \
684 >import-splicemap
685 hg convert --config convert.hg.saverev=True \
686 --config convert.hg.startrev=`cut -d ' ' -f 1 import-splicemap` \
687 --filemap=$(srcdir)/nanojit-import-filemap \
688 --splicemap=import-splicemap \
689 $(NANOJIT_CENTRAL_LOCAL) \
690 $(CUR_REPO) \
691 import-revmap
692 (cd $(srcdir) && hg up)
693 (cd $(NANOJIT_CENTRAL_LOCAL) && hg log -r tip --template "{node}\n") >$(srcdir)/nanojit-import-rev
694 (cd $(srcdir) && hg commit --message="Update nanojit-import-rev stamp." nanojit-import-rev)
696 .PHONY: update-imacros update-nanojit
697 endif
698 endif
699 endif