1 # -*- Mode: makefile -*-
4 # ***** BEGIN LICENSE BLOCK *****
5 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
7 # The contents of this file are subject to the Mozilla Public License Version
8 # 1.1 (the "License"); you may not use this file except in compliance with
9 # the License. You may obtain a copy of the License at
10 # http://www.mozilla.org/MPL/
12 # Software distributed under the License is distributed on an "AS IS" basis,
13 # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14 # for the specific language governing rights and limitations under the
17 # The Original Code is Mozilla Communicator client code, released
20 # The Initial Developer of the Original Code is
21 # Netscape Communications Corporation.
22 # Portions created by the Initial Developer are Copyright (C) 1998
23 # the Initial Developer. All Rights Reserved.
26 # Michael Ang <mang@subcarrier.org>
27 # Kevin Buhr <buhr@stat.wisc.edu>
29 # Alternatively, the contents of this file may be used under the terms of
30 # either of the GNU General Public License Version 2 or later (the "GPL"),
31 # or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
32 # in which case the provisions of the GPL or the LGPL are applicable instead
33 # of those above. If you wish to allow use of your version of this file only
34 # under the terms of either the GPL or the LGPL, and not to allow others to
35 # use your version of this file under the terms of the MPL, indicate your
36 # decision by deleting the provisions above and replace them with the notice
37 # and other provisions required by the GPL or the LGPL. If you do not delete
38 # the provisions above, a recipient may use your version of this file under
39 # the terms of any one of the MPL, the GPL or the LGPL.
41 # ***** END LICENSE BLOCK *****
44 # JSRef GNUmake makefile.
46 # Note: dependency rules are missing for some files (some
47 # .h, all .msg, etc.) Re-make clean if in doubt.
58 $(warning NANOJIT_ARCH not defined in config/$(OS_CONFIG).mk, JIT disabled)
61 $(warning disabling JIT per build specification)
68 DEFINES += -DJS_TRACER
69 DEFINES += -DFEATURE_NANOJIT
78 DEFINES += -DNARCISSUS
81 # Look in OBJDIR to find jsautocfg.h and jsautokw.h
82 INCLUDES += -I. -I$(OBJDIR)
85 DEFINES += -DJS_THREADSAFE
86 INCLUDES += -I$(DIST)/include/nspr
88 OTHER_LIBS += $(DIST)/lib/libnspr$(NSPR_LIBSUFFIX).lib
90 OTHER_LIBS += -L$(DIST)/lib -lnspr$(NSPR_LIBSUFFIX)
94 ifdef JS_NO_THIN_LOCKS
95 DEFINES += -DJS_USE_ONLY_NSPR_LOCKS
98 ifdef JS_HAS_FILE_OBJECT
99 DEFINES += -DJS_HAS_FILE_OBJECT
104 # XCFLAGS may be set in the environment or on the gmake command line
106 #CFLAGS += -DDEBUG -DDEBUG_brendan -DJS_ARENAMETER -DJS_HASHMETER -DJS_DUMP_PROPTREE_STATS -DJS_DUMP_SCOPE_METERS -DJS_SCOPE_DEPTH_METER -DJS_BASIC_STATS
107 CFLAGS += $(OPTIMIZER) $(OS_CFLAGS) $(DEFINES) $(INCLUDES) $(XCFLAGS)
108 INTERP_CFLAGS += $(INTERP_OPTIMIZER) $(OS_CFLAGS) $(DEFINES) $(INCLUDES) $(XCFLAGS) $(INTERP_XCFLAGS)
109 BUILTINS_CFLAGS += $(BUILTINS_OPTIMIZER) $(OS_CFLAGS) $(DEFINES) $(INCLUDES) $(XCFLAGS) $(BUILTINS_XCFLAGS)
111 LDFLAGS = $(XLDFLAGS)
112 LDFLAGS += $(OS_LDFLAGS)
115 DEFINES += -DMOZ_SHARK
116 CFLAGS += -F/System/Library/PrivateFrameworks
117 LDFLAGS += -F/System/Library/PrivateFrameworks -framework CHUD
120 DEFINES += -DMOZ_CALLGRIND
123 DEFINES += -DMOZ_VTUNE
124 CXXFLAGS += -IC:/Program\ Files/Intel/VTune/Analyzer/Include
125 OTHER_LIBS += C:/Program\ Files/Intel/VTune/Analyzer/Lib/VtuneApi.lib
132 # Prevent floating point errors caused by VC++ optimizations
133 ifeq ($(OS_ARCH),WINNT)
134 _MSC_VER = $(shell $(CXX) 2>&1 | sed -n 's/.*Compiler Version \([0-9]*\)\.\([0-9]*\).*/\1\2/p')
135 ifeq (,$(filter-out 1200 1300 1310,$(_MSC_VER)))
138 CFLAGS += -fp:precise
143 # Server-related changes :
150 # Line editing support.
151 # Define JS_READLINE or JS_EDITLINE to enable line editing in the
152 # js command-line interpreter.
155 # For those platforms with the readline library installed.
156 DEFINES += -DEDITLINE
157 PROG_LIBS += -lreadline -ltermcap
160 # Use the editline library, built locally.
162 DEFINES += -DEDITLINE
163 PROG_LIBS += $(OBJDIR)/editline/libedit.a
168 PURE_CFLAGS = -DXP_UNIX $(OPTIMIZER) $(PURE_OS_CFLAGS) $(DEFINES) \
169 $(INCLUDES) $(XCFLAGS)
216 nanojit/Assembler.h \
218 nanojit/Native$(NANOJIT_ARCH).h \
221 nanojit/Fragmento.h \
225 nanojit/TraceTreeDrawer.h \
256 OTHER_HFILES += builtins.tbl
259 ifndef PREBUILT_CPUCFG
260 OTHER_HFILES += $(OBJDIR)/jsautocfg.h
262 OTHER_HFILES += $(OBJDIR)/jsautokw.h
264 HFILES = $(JS_HFILES) $(API_HFILES) $(OTHER_HFILES)
310 nanojit/Assembler.cpp \
311 nanojit/Fragmento.cpp \
313 nanojit/Native$(NANOJIT_ARCH).cpp \
314 nanojit/RegAlloc.cpp \
315 nanojit/avmplus.cpp \
319 JS_CPPFILES += nanojit/TraceTreeDrawer.cpp
333 ifdef JS_HAS_FILE_OBJECT
334 JS_CPPFILES += jsfile.cpp
335 JS_HFILES += jsfile.h
338 LIB_CPPFILES = $(JS_CPPFILES)
339 LIB_ASFILES := $(wildcard *_$(OS_ARCH).s)
340 PROG_CPPFILES = js.cpp
343 LIBRARY = $(OBJDIR)/js32.lib
344 SHARED_LIBRARY = $(OBJDIR)/js32.dll
345 PROGRAM = $(OBJDIR)/js.exe
347 LIBRARY = $(OBJDIR)/libjs.a
348 SHARED_LIBRARY = $(OBJDIR)/libjs.$(SO_SUFFIX)
349 PROGRAM = $(OBJDIR)/js
358 cd ../../config; $(MAKE) OBJDIR=$(OBJDIR) OBJDIR_NAME=$(OBJDIR)
361 # Automatic header generation
364 AUTO_HEADERS = $(OBJDIR)/jsautokw.h $(OBJDIR)/jsautooplen.h
366 $(OBJDIR)/jsautokw.h: jskeyword.tbl
368 $(OBJDIR)/jsautooplen.h: jsopcode.tbl
370 GARBAGE += $(AUTO_HEADERS)
371 GARBAGE += $(AUTO_HEADERS:$(OBJDIR)/jsauto%.h=$(OBJDIR)/js%gen$(HOST_BIN_SUFFIX))
375 GARBAGE += $(AUTO_HEADERS:$(OBJDIR)/jsauto%.h=$(OBJDIR)/js%gen.obj)
377 $(AUTO_HEADERS): $(OBJDIR)/jsauto%.h: js%gen.cpp
379 $(CXX) -Fo$(OBJDIR)/ -c $(CFLAGS) $<
380 link.exe -out:"$(OBJDIR)/js$*gen$(HOST_BIN_SUFFIX)" $(EXE_LINK_FLAGS) $(OBJDIR)/js$*gen.obj
381 $(OBJDIR)/js$*gen$(HOST_BIN_SUFFIX) $@
384 GARBAGE += $(AUTO_HEADERS:$(OBJDIR)/jsauto%.h=$(OBJDIR)/js%gen.d)
385 $(AUTO_HEADERS): $(OBJDIR)/jsauto%.h: js%gen.cpp
387 $(CXX) -o $(OBJDIR)/js$*gen$(HOST_BIN_SUFFIX) $(CFLAGS) $(LDFLAGS) $<
388 $(OBJDIR)/js$*gen$(HOST_BIN_SUFFIX) $@
392 # force creation of autoheaders before compiling any source that may use them
393 $(LIB_OBJS) : $(AUTO_HEADERS)
396 # JS shell executable
400 $(PROGRAM): $(PROG_OBJS) $(LIBRARY)
401 link.exe -out:"$@" $(EXE_LINK_FLAGS) $^
403 $(PROGRAM): $(PROG_OBJS) $(LIBRARY)
404 $(CXX) -o $@ $(CFLAGS) $(PROG_OBJS) $(LIBRARY) $(LDFLAGS) $(OTHER_LIBS) \
408 $(PROGRAM).pure: $(PROG_OBJS) $(LIBRARY)
409 purify $(PUREFLAGS) \
410 $(CXX) -o $@ $(PURE_OS_CFLAGS) $(PROG_OBJS) $(LIBRARY) $(LDFLAGS) \
411 $(OTHER_LIBS) $(PROG_LIBS)
413 ifndef PREBUILT_CPUCFG
414 $(filter-out jscpucfg.h $(OBJDIR)/jsautocfg.h, $(HFILES)) $(CPPFILES): $(OBJDIR)/jsautocfg.h
416 $(OBJDIR)/jsautocfg.h: $(OBJDIR)/jscpucfg
418 $(OBJDIR)/jscpucfg > $@
420 $(OBJDIR)/jscpucfg: $(OBJDIR)/jscpucfg.o
421 $(CXX) $(OS_LDFLAGS) -o $@ $(OBJDIR)/jscpucfg.o
423 GARBAGE += $(OBJDIR)/jsautocfg.h $(OBJDIR)/jscpucfg \
424 $(OBJDIR)/jscpucfg.o $(OBJDIR)/jscpucfg.d
427 # Automatic make dependencies files
428 DEPENDENCIES = $(CPPFILES:%.cpp=$(OBJDIR)/%.d)
431 # Hardwire dependencies for some files
439 $(OBJDIR)/jsinvoke.$(OBJ): jsinterp.h jsinterp.cpp
440 $(OBJDIR)/jsinvoke.obj : jsinterp.h jsinterp.cpp
442 -include $(DEPENDENCIES)
445 TARFILES = files `cat files`
449 $(CXX) -C -E $(CFLAGS) $< > $*.i