File: Makefile.ref

package info (click to toggle)
freej 0.10git20100110-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 32,080 kB
  • ctags: 22,705
  • sloc: cpp: 156,254; ansic: 25,531; sh: 13,538; perl: 4,624; makefile: 3,278; python: 2,889; objc: 1,284; asm: 1,125; ruby: 126
file content (483 lines) | stat: -rw-r--r-- 10,934 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
# -*- Mode: makefile -*-
# vim: ft=make
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is Mozilla Communicator client code, released
# March 31, 1998.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#   Michael Ang <mang@subcarrier.org>
#   Kevin Buhr <buhr@stat.wisc.edu>
#
# Alternatively, the contents of this file may be used under the terms of
# either of the GNU General Public License Version 2 or later (the "GPL"),
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****

#
# JSRef GNUmake makefile.
#
# Note: dependency rules are missing for some files (some
#       .h, all .msg, etc.)  Re-make clean if in doubt.
#


DEPTH = .

include config.mk

#NS_USE_NATIVE = 1

ifndef NANOJIT_ARCH
$(warning NANOJIT_ARCH not defined in config/$(OS_CONFIG).mk, JIT disabled)
else
ifdef DISABLE_JIT
$(warning disabling JIT per build specification)
else
ENABLE_JIT=1
endif
endif

ifdef ENABLE_JIT
DEFINES += -DJS_TRACER
DEFINES += -DFEATURE_NANOJIT
INCLUDES += -Inanojit
endif

#ifndef BUILD_OPT
#DEFINES += -Ivprof
#endif

ifdef NARCISSUS
DEFINES += -DNARCISSUS
endif

# Look in OBJDIR to find jsautocfg.h, jsautokw.h, and js-config.h
INCLUDES   += -I. -I$(OBJDIR)

ifdef JS_THREADSAFE
DEFINES += -DJS_THREADSAFE
INCLUDES += -I$(DIST)/include/nspr
ifdef USE_MSVC
OTHER_LIBS += $(DIST)/lib/libnspr$(NSPR_LIBSUFFIX).lib
else
OTHER_LIBS += -L$(DIST)/lib -lnspr$(NSPR_LIBSUFFIX)
endif
endif

ifdef JS_NO_THIN_LOCKS
DEFINES += -DJS_USE_ONLY_NSPR_LOCKS
endif

ifdef JS_HAS_FILE_OBJECT
DEFINES += -DJS_HAS_FILE_OBJECT
endif

ifdef JS_GC_ZEAL
DEFINES += -DJS_GC_ZEAL
endif

#
# XCFLAGS may be set in the environment or on the gmake command line
#
#CFLAGS += -DDEBUG -DDEBUG_brendan -DJS_ARENAMETER -DJS_HASHMETER -DJS_DUMP_PROPTREE_STATS -DJS_DUMP_SCOPE_METERS -DJS_SCOPE_DEPTH_METER -DJS_BASIC_STATS
CFLAGS          += $(OS_CFLAGS) $(DEFINES) $(INCLUDES) $(XCFLAGS)

LDFLAGS		= $(XLDFLAGS)
LDFLAGS += $(OS_LDFLAGS)

ifdef MOZ_SHARK
DEFINES += -DMOZ_SHARK
CFLAGS += -F/System/Library/PrivateFrameworks
LDFLAGS += -F/System/Library/PrivateFrameworks -framework CHUD
endif
ifdef MOZ_CALLGRIND
DEFINES += -DMOZ_CALLGRIND
endif
ifdef MOZ_VTUNE
DEFINES += -DMOZ_VTUNE
CXXFLAGS += -IC:/Program\ Files/Intel/VTune/Analyzer/Include
OTHER_LIBS += C:/Program\ Files/Intel/VTune/Analyzer/Lib/VtuneApi.lib
endif

ifndef NO_LIBM
LDFLAGS += -lm
endif

# Prevent floating point errors caused by VC++ optimizations
ifeq ($(OS_ARCH),WINNT)
_MSC_VER = $(shell $(CXX) 2>&1 | sed -n 's/.*Compiler Version \([0-9]*\)\.\([0-9]*\).*/\1\2/p')
ifeq (,$(filter-out 1200 1300 1310,$(_MSC_VER)))
CFLAGS += -Op
else
CFLAGS += -fp:precise
endif
endif # WINNT

#
#	Server-related changes :
#
ifdef NES40
DEFINES += -DNES40
endif

#
# Line editing support.
# Define JS_READLINE or JS_EDITLINE to enable line editing in the
# js command-line interpreter.
#
ifdef JS_READLINE
# For those platforms with the readline library installed.
DEFINES += -DEDITLINE
PROG_LIBS += -lreadline -ltermcap
else
ifdef JS_EDITLINE
# Use the editline library, built locally.
PREDIRS += editline
DEFINES += -DEDITLINE
PROG_LIBS += $(OBJDIR)/editline/libedit.a
endif
endif

# For purify
PURE_CFLAGS     = -DXP_UNIX $(OPTIMIZER) $(PURE_OS_CFLAGS) $(DEFINES) \
                  $(INCLUDES) $(XCFLAGS)

#
# JS file lists
#
JS_HFILES =		\
	jsarray.h	\
	jsatom.h	\
	jsbool.h	\
	jscntxt.h	\
	jsdate.h	\
	jsemit.h	\
	jsexn.h		\
	jsfun.h		\
	jsgc.h		\
	jsinterp.h	\
	jsiter.h	\
	jslibmath.h	\
	jslock.h	\
	jsmath.h	\
	jsnum.h		\
	jsobj.h		\
	json.h		\
	jsopcode.h	\
	jsparse.h	\
	jsarena.h	\
	jsclist.h	\
	jsdhash.h	\
	jsdtoa.h	\
	jshash.h	\
	jslong.h	\
	jstypes.h	\
	jsprvtd.h	\
	jspubtd.h	\
	jsregexp.h	\
	jsscan.h	\
	jsscope.h	\
	jsscript.h	\
	jsstr.h		\
	jsversion.h	\
	jsxdrapi.h	\
	jsxml.h		\
	$(NULL)

ifdef ENABLE_JIT
JS_HFILES +=			\
	jstracer.h		\
	nanojit/Assembler.h     \
	nanojit/LIR.h		\
	nanojit/Native$(NANOJIT_ARCH).h	\
	nanojit/avmplus.h	\
	nanojit/vm_fops.h	\
	nanojit/Fragmento.h	\
	nanojit/Native.h	\
	nanojit/RegAlloc.h	\
	nanojit/nanojit.h	\
	nanojit/TraceTreeDrawer.h \
	$(NULL)
endif

ifndef BUILD_OPT
#JS_HFILES +=            \
#        vprof/vprof.h   \
#        $(NULL)
endif

API_HFILES =		\
	jsapi.h		\
	jsdbgapi.h	\
	$(NULL)

OTHER_HFILES =		\
	jsbit.h		\
	jscompat.h	\
	jscpucfg.h	\
	jsotypes.h	\
	jsstddef.h	\
	prmjtime.h	\
	resource.h	\
	jsopcode.tbl	\
	jsproto.tbl     \
	js.msg		\
	jsshell.msg	\
	jskeyword.tbl	\
	$(NULL)

ifdef ENABLE_JIT
OTHER_HFILES += builtins.tbl
endif

ifndef PREBUILT_CPUCFG
OTHER_HFILES += $(OBJDIR)/jsautocfg.h
endif
OTHER_HFILES += $(OBJDIR)/jsautokw.h $(OBJDIR)/js-config.h

HFILES = $(JS_HFILES) $(API_HFILES) $(OTHER_HFILES)

JS_CPPFILES =		\
	jsapi.cpp	\
	jsarena.cpp	\
	jsarray.cpp	\
	jsatom.cpp	\
	jsbool.cpp	\
	jscntxt.cpp	\
	jsdate.cpp	\
	jsdbgapi.cpp	\
	jsdhash.cpp	\
	jsdtoa.cpp	\
	jsemit.cpp	\
	jsexn.cpp	\
	jsfun.cpp	\
	jsgc.cpp	\
	jshash.cpp	\
	jsinterp.cpp	\
	jsinvoke.cpp    \
	jsiter.cpp	\
	jslock.cpp	\
	jslog2.cpp	\
	jslong.cpp	\
	jsmath.cpp	\
	jsnum.cpp	\
	jsobj.cpp	\
	json.cpp	\
	jsopcode.cpp	\
	jsparse.cpp	\
	jsprf.cpp	\
	jsregexp.cpp	\
	jsscan.cpp	\
	jsscope.cpp	\
	jsscript.cpp	\
	jsstr.cpp	\
	jsutil.cpp	\
	jsxdrapi.cpp	\
	jsxml.cpp	\
	prmjtime.cpp	\
	$(NULL)

ifdef ENABLE_JIT
JS_CPPFILES +=		       \
	jsbuiltins.cpp         \
	jstracer.cpp	       \
	nanojit/Assembler.cpp  \
	nanojit/Fragmento.cpp  \
	nanojit/LIR.cpp        \
	nanojit/Native$(NANOJIT_ARCH).cpp \
	nanojit/RegAlloc.cpp   \
	nanojit/avmplus.cpp    \
	$(NULL)

ifdef DEBUG
JS_CPPFILES += nanojit/TraceTreeDrawer.cpp
endif
endif

ifndef BUILD_OPT
#JS_CPPFILES +=                 \
#        vprof/vprof.cpp        \
#        $(NULL)
endif

ifdef JS_LIVECONNECT
DIRS      += liveconnect
endif

ifdef JS_HAS_FILE_OBJECT
JS_CPPFILES += jsfile.cpp
JS_HFILES += jsfile.h
endif

LIB_CPPFILES  = $(JS_CPPFILES)
LIB_ASFILES := $(wildcard *_$(OS_ARCH).s)
PROG_CPPFILES = js.cpp

ifdef USE_MSVC
LIBRARY = $(OBJDIR)/js32.lib
SHARED_LIBRARY = $(OBJDIR)/js32.dll
PROGRAM = $(OBJDIR)/js.exe
else
LIBRARY = $(OBJDIR)/libjs.a
SHARED_LIBRARY = $(OBJDIR)/libjs.$(SO_SUFFIX)
PROGRAM = $(OBJDIR)/js
endif

include rules.mk

MOZ_DEPTH = ../..
include jsconfig.mk

nsinstall-target:
	cd ../../config; $(MAKE) OBJDIR=$(OBJDIR) OBJDIR_NAME=$(OBJDIR)

#
# Automatic header generation
#

AUTO_HEADERS =					\
	$(OBJDIR)/jsautokw.h			\
	$(OBJDIR)/jsautooplen.h			\
	$(NULL)

$(OBJDIR)/jsautokw.h: jskeyword.tbl

$(OBJDIR)/jsautooplen.h: jsopcode.tbl

GARBAGE += $(AUTO_HEADERS)
GARBAGE	+= $(AUTO_HEADERS:$(OBJDIR)/jsauto%.h=$(OBJDIR)/js%gen$(HOST_BIN_SUFFIX))

ifdef USE_MSVC

GARBAGE	+= $(AUTO_HEADERS:$(OBJDIR)/jsauto%.h=$(OBJDIR)/js%gen.obj)

$(AUTO_HEADERS): $(OBJDIR)/jsauto%.h: js%gen.cpp
	@$(MAKE_OBJDIR)
	$(CXX) -Fo$(OBJDIR)/ -c $(CFLAGS) $(OPTIMIZER) $<
	link.exe -out:"$(OBJDIR)/js$*gen$(HOST_BIN_SUFFIX)" $(EXE_LINK_FLAGS) $(OBJDIR)/js$*gen.obj
	$(OBJDIR)/js$*gen$(HOST_BIN_SUFFIX) $@
else

GARBAGE	+= $(AUTO_HEADERS:$(OBJDIR)/jsauto%.h=$(OBJDIR)/js%gen.d)
$(AUTO_HEADERS): $(OBJDIR)/jsauto%.h: js%gen.cpp
	@$(MAKE_OBJDIR)
	$(CXX) -o $(OBJDIR)/js$*gen$(HOST_BIN_SUFFIX) $(CFLAGS) $(OPTIMIZER) $(LDFLAGS) $<
	$(OBJDIR)/js$*gen$(HOST_BIN_SUFFIX) $@

endif

# force creation of autoheaders before compiling any source that may use them
$(LIB_OBJS) : $(AUTO_HEADERS)

#
# An installed header file describing configuration options that affect
# the API.
#

# Avoid rebuilding unless js-config.h's contents actually change.  The
# timestamp on js-config.h.stamp corresponds to the last time we
# checked that js-config.h was up to date.  If the stamp changes but
# js-config.h does not, then make concludes that targets depending on
# js-config.h don't need to be rebuilt.  The dummy '@true' rule here
# keeps make from concluding that js-config.h never changes.
$(OBJDIR)/js-config.h: $(OBJDIR)/js-config.h.stamp
	@true

js-config-switch=$(if $(value $($1)),-e 's/\#undef $1/\#define $1/')
$(OBJDIR)/js-config.h.stamp: js-config.h.in Makefile.ref
	sed < $< > $(@:.stamp=.tmp)			\
	    $(call js-config-switch,JS_THREADSAFE)	\
	    $(call js-config-switch,JS_GC_ZEAL)		\
	    -e :dummy
	if ! [ -f $(@:.stamp=) ] || ! cmp $(@:.stamp=.tmp) $(@:.stamp=); then \
	    mv $(@:.stamp=.tmp) $(@:.stamp=);				      \
	fi
	touch $@

GARBAGE += $(OBJDIR)/js-config.h $(OBJDIR)/js-config.h.stamp

# Force creation of js-config.h before compiling any source that may use it.
$(LIB_OBJS) : $(OBJDIR)/js-config.h

#
# JS shell executable
#

ifdef USE_MSVC
$(PROGRAM): $(PROG_OBJS) $(LIBRARY)
	link.exe -out:"$@" $(EXE_LINK_FLAGS) $^
else
$(PROGRAM): $(PROG_OBJS) $(LIBRARY)
	$(CXX) -o $@ $(CFLAGS) $(PROG_OBJS) $(LIBRARY) $(LDFLAGS) $(OTHER_LIBS) \
	    $(PROG_LIBS)
endif

$(PROGRAM).pure: $(PROG_OBJS) $(LIBRARY)
	purify $(PUREFLAGS) \
	    $(CXX) -o $@ $(PURE_OS_CFLAGS) $(PROG_OBJS) $(LIBRARY) $(LDFLAGS) \
		$(OTHER_LIBS) $(PROG_LIBS)

ifndef PREBUILT_CPUCFG
$(filter-out jscpucfg.h $(OBJDIR)/jsautocfg.h, $(HFILES)) $(CPPFILES): $(OBJDIR)/jsautocfg.h

$(OBJDIR)/jsautocfg.h: $(OBJDIR)/jscpucfg
	rm -f $@
	$(OBJDIR)/jscpucfg > $@

$(OBJDIR)/jscpucfg: $(OBJDIR)/jscpucfg.o
	$(CXX) $(OS_LDFLAGS) -o $@ $(OBJDIR)/jscpucfg.o

GARBAGE += $(OBJDIR)/jsautocfg.h $(OBJDIR)/jscpucfg \
	   $(OBJDIR)/jscpucfg.o $(OBJDIR)/jscpucfg.d
endif

# Automatic make dependencies files
DEPENDENCIES    = $(CPPFILES:%.cpp=$(OBJDIR)/%.d)

#
# Hardwire dependencies for some files 
#
ifdef USE_MSVC
OBJ=obj
else
OBJ=o
endif

$(OBJDIR)/jsinvoke.$(OBJ): jsinterp.h jsinterp.cpp
$(OBJDIR)/jsinvoke.obj : jsinterp.h jsinterp.cpp

-include $(DEPENDENCIES)

TARNAME = jsref.tar
TARFILES = files `cat files`

SUFFIXES: .i
%.i: %.cpp
	$(CXX) -C -E $(CFLAGS) $< > $*.i