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
16
# The Original Code is Mozilla Communicator client code, released
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.
25
# Michael Ang <mang@subcarrier.org>
26
# Kevin Buhr <buhr@stat.wisc.edu>
28
# Alternatively, the contents of this file may be used under the terms of
29
# either of the GNU General Public License Version 2 or later (the "GPL"),
30
# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
31
# in which case the provisions of the GPL or the LGPL are applicable instead
32
# of those above. If you wish to allow use of your version of this file only
33
# under the terms of either the GPL or the LGPL, and not to allow others to
34
# use your version of this file under the terms of the MPL, indicate your
35
# decision by deleting the provisions above and replace them with the notice
36
# and other provisions required by the GPL or the LGPL. If you do not delete
37
# the provisions above, a recipient may use your version of this file under
38
# the terms of any one of the MPL, the GPL or the LGPL.
40
# ***** END LICENSE BLOCK *****
43
# JSRef GNUmake makefile.
45
# Note: dependency rules are missing for some files (some
46
# .h, all .msg, etc.) Re-make clean if in doubt.
57
OTHER_LIBS += fdlibm/$(OBJDIR)/fdlibm.lib
59
OTHER_LIBS += -Lfdlibm/$(OBJDIR) -lfdm
63
DEFINES += -DJS_THREADSAFE
64
INCLUDES += -I../../dist/$(OBJDIR)/include
66
OTHER_LIBS += ../../dist/$(OBJDIR)/lib/libnspr${NSPR_LIBSUFFIX}.lib
68
OTHER_LIBS += -L../../dist/$(OBJDIR)/lib -lnspr${NSPR_LIBSUFFIX}
72
ifdef JS_NO_THIN_LOCKS
73
DEFINES += -DJS_USE_ONLY_NSPR_LOCKS
76
ifdef JS_HAS_FILE_OBJECT
77
DEFINES += -DJS_HAS_FILE_OBJECT
81
# XCFLAGS may be set in the environment or on the gmake command line
83
CFLAGS += $(OPTIMIZER) $(OS_CFLAGS) $(DEFINES) $(INCLUDES) $(XCFLAGS)
91
# Prevent floating point errors caused by VC++ optimizations
92
ifeq ($(OS_ARCH),WINNT)
93
_MSC_VER = $(shell $(CC) 2>&1 | sed -n 's/.*Compiler Version \([0-9]*\)\.\([0-9]*\).*/\1\2/p')
94
ifeq (,$(filter-out 1200 1300 1310,$(_MSC_VER)))
102
# Ask perl what flags it was built with, so we can build js with similar flags
103
# and link properly. Viva gmake.
106
DEFINES += -DPERLCONNECT -D_GNU_SOURCE
108
PERLCFLAGS := $(shell perl -MExtUtils::Embed -e ccopts)
109
PERLLDFLAGS := $(shell perl -MExtUtils::Embed -e ldopts)
111
# perl erroneously reports compiler flag -rdynamic (interpreted by ld
112
# as -r) when it really meant -export-dynamic.
113
PERLLDFLAGS := $(subst -rdynamic,-export-dynamic,$(PERLLDFLAGS))
115
CFLAGS += $(PERLCFLAGS)
116
#LDFLAGS += $(PERLLDFLAGS) #PH removed this assgnment
117
INCLUDES += -I. #needed for perlconnect/jsperl.c
121
# Server-related changes :
128
# Line editing support.
129
# Define JS_READLINE or JS_EDITLINE to enable line editing in the
130
# js command-line interpreter.
133
# For those platforms with the readline library installed.
134
DEFINES += -DEDITLINE
135
PROG_LIBS += -lreadline -ltermcap
138
# Use the editline library, built locally.
140
DEFINES += -DEDITLINE
141
PROG_LIBS += editline/$(OBJDIR)/libedit.a
146
PURE_CFLAGS = -DXP_UNIX $(OPTIMIZER) $(PURE_OS_CFLAGS) $(DEFINES) \
147
$(INCLUDES) $(XCFLAGS)
208
ifndef PREBUILT_CPUCFG
209
OTHER_HFILES += $(OBJDIR)/jsautocfg.h
212
HFILES = $(JS_HFILES) $(API_HFILES) $(OTHER_HFILES)
254
FDLIBM_LIBRARY = fdlibm/$(OBJDIR)/fdlibm.lib
256
FDLIBM_LIBRARY = fdlibm/$(OBJDIR)/libfdm.a
258
JSMATH_PRELINK = $(OBJDIR)/jsmathtemp.o
259
# Flag for incremental linking
262
ifeq ($(OS_ARCH),QNX)
263
ifneq ($(OS_TARGET),NTO)
264
# Don't use wildcard here, because we only want this resolved at link time.
274
JS_CFILES += perlconnect/jsperl.c
277
ifdef JS_HAS_FILE_OBJECT
278
JS_CFILES += jsfile.c
279
JS_HFILES += jsfile.h
282
LIB_CFILES = $(JS_CFILES)
283
LIB_ASFILES := $(wildcard *_$(OS_ARCH).s)
287
LIBRARY = $(OBJDIR)/js32.lib
288
SHARED_LIBRARY = $(OBJDIR)/js32.dll
289
PROGRAM = $(OBJDIR)/js.exe
291
LIBRARY = $(OBJDIR)/libjs.a
292
SHARED_LIBRARY = $(OBJDIR)/libjs.$(SO_SUFFIX)
293
PROGRAM = $(OBJDIR)/js
295
PROG_LIBS += $(PERLLDFLAGS)
305
cd ../../config; $(MAKE) OBJDIR=$(OBJDIR) OBJDIR_NAME=$(OBJDIR)
307
$(PROGRAM): $(PROG_OBJS) $(LIBRARY) $(FDLIBM_LIBRARY)
308
link.exe -out:"$@" $(EXE_LINK_FLAGS) $^
310
$(PROGRAM): $(PROG_OBJS) $(LIBRARY) $(FDLIBM_LIBRARY)
311
$(CC) -o $@ $(CFLAGS) $(PROG_OBJS) $(LIBRARY) $(LDFLAGS) $(OTHER_LIBS) \
315
$(PROGRAM).pure: $(PROG_OBJS) $(LIBRARY)
316
purify $(PUREFLAGS) \
317
$(CC) -o $@ $(PURE_OS_CFLAGS) $(PROG_OBJS) $(LIBRARY) $(LDFLAGS) \
318
$(OTHER_LIBS) $(PROG_LIBS)
320
ifndef PREBUILT_CPUCFG
321
$(HFILES) $(CFILES): $(OBJDIR)/jsautocfg.h
323
$(OBJDIR)/jsautocfg.h: $(OBJDIR)/jscpucfg
325
$(OBJDIR)/jscpucfg > $@
327
$(OBJDIR)/jscpucfg: $(OBJDIR)/jscpucfg.o
328
$(CC) -o $@ $(OBJDIR)/jscpucfg.o
330
# Look in OBJDIR to find jsautocfg.h
331
INCLUDES += -I$(OBJDIR)
333
# Add to TARGETS for clobber rule
334
TARGETS += $(OBJDIR)/jsautocfg.h $(OBJDIR)/jscpucfg \
335
$(OBJDIR)/jscpucfg.o $(OBJDIR)/jsmathtemp.o
339
# special rule for jsmath.o since we want to incrementally link
340
# against fdlibm to pull in only what is needed
341
$(OBJDIR)/jsmath.o: jsmath.c jsmath.h jslibmath.h $(FDLIBM_LIBRARY)
342
ifneq (,$(filter OS2 WINNT,$(OS_ARCH)))
343
$(CC) -Fo$(JSMATH_PRELINK) -c $(CFLAGS) $<
345
$(CC) -o $(JSMATH_PRELINK) -c $(CFLAGS) $<
348
ifeq ($(OS_ARCH),QNX)
349
ifneq ($(OS_TARGET),NTO)
350
@cp $(JSMATH_PRELINK) $@
352
$(LD) $(DASH_R) -o $@ $(JSMATH_PRELINK) $(FDLIBM_LIBRARY)
356
@echo Warning: to use $(LIBRARY) must also link against $(FDLIBM_LIBRARY)
357
@cp $(JSMATH_PRELINK) $@
359
$(LD) $(DASH_R) -o $@ $(JSMATH_PRELINK) $(FDLIBM_LIBRARY)
362
# Note: generated headers must be built before descending
363
# into fdlibm directory
365
$(MAKE) -C fdlibm -f Makefile.ref $(@F)
368
# Hardwire dependencies on jsopcode.tbl
370
jsopcode.h jsopcode.c: jsopcode.tbl
372
-include $(DEPENDENCIES)
375
TARFILES = files `cat files`
379
$(CC) -C -E $(CFLAGS) $< > $*.i