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
DEFINES += -DNARCISSUS
61
# Look in OBJDIR to find jsautocfg.h and jsautokw.h
62
INCLUDES += -I$(OBJDIR)
65
DEFINES += -DJS_THREADSAFE
66
INCLUDES += -I$(DIST)/include/nspr
68
OTHER_LIBS += $(DIST)/lib/libnspr$(NSPR_LIBSUFFIX).lib
70
OTHER_LIBS += -L$(DIST)/lib -lnspr$(NSPR_LIBSUFFIX)
74
ifdef JS_NO_THIN_LOCKS
75
DEFINES += -DJS_USE_ONLY_NSPR_LOCKS
78
ifdef JS_HAS_FILE_OBJECT
79
DEFINES += -DJS_HAS_FILE_OBJECT
83
# XCFLAGS may be set in the environment or on the gmake command line
85
CFLAGS += $(OPTIMIZER) $(OS_CFLAGS) $(DEFINES) $(INCLUDES) $(XCFLAGS)
93
# Prevent floating point errors caused by VC++ optimizations
94
ifeq ($(OS_ARCH),WINNT)
95
_MSC_VER = $(shell $(CC) 2>&1 | sed -n 's/.*Compiler Version \([0-9]*\)\.\([0-9]*\).*/\1\2/p')
96
ifeq (,$(filter-out 1200 1300 1310,$(_MSC_VER)))
104
# Server-related changes :
111
# Line editing support.
112
# Define JS_READLINE or JS_EDITLINE to enable line editing in the
113
# js command-line interpreter.
116
# For those platforms with the readline library installed.
117
DEFINES += -DEDITLINE
118
PROG_LIBS += -lreadline -ltermcap
121
# Use the editline library, built locally.
123
DEFINES += -DEDITLINE
124
PROG_LIBS += editline/$(OBJDIR)/libedit.a
129
PURE_CFLAGS = -DXP_UNIX $(OPTIMIZER) $(PURE_OS_CFLAGS) $(DEFINES) \
130
$(INCLUDES) $(XCFLAGS)
194
ifndef PREBUILT_CPUCFG
195
OTHER_HFILES += $(OBJDIR)/jsautocfg.h
197
OTHER_HFILES += $(OBJDIR)/jsautokw.h
199
HFILES = $(JS_HFILES) $(API_HFILES) $(OTHER_HFILES)
243
ifdef JS_HAS_FILE_OBJECT
244
JS_CFILES += jsfile.c
245
JS_HFILES += jsfile.h
248
LIB_CFILES = $(JS_CFILES)
249
LIB_ASFILES := $(wildcard *_$(OS_ARCH).s)
253
LIBRARY = $(OBJDIR)/js32.lib
254
SHARED_LIBRARY = $(OBJDIR)/js32.dll
255
PROGRAM = $(OBJDIR)/js.exe
257
LIBRARY = $(OBJDIR)/libjs.a
258
SHARED_LIBRARY = $(OBJDIR)/libjs.$(SO_SUFFIX)
259
PROGRAM = $(OBJDIR)/js
268
cd ../../config; $(MAKE) OBJDIR=$(OBJDIR) OBJDIR_NAME=$(OBJDIR)
271
# Rules for keyword switch generation
274
GARBAGE += $(OBJDIR)/jsautokw.h $(OBJDIR)/jskwgen$(HOST_BIN_SUFFIX)
275
GARBAGE += $(OBJDIR)/jskwgen.$(OBJ_SUFFIX)
277
$(OBJDIR)/jsscan.$(OBJ_SUFFIX): $(OBJDIR)/jsautokw.h jskeyword.tbl
279
$(OBJDIR)/jskwgen.$(OBJ_SUFFIX): jskwgen.c jskeyword.tbl
281
$(OBJDIR)/jsautokw.h: $(OBJDIR)/jskwgen$(HOST_BIN_SUFFIX) jskeyword.tbl
282
$(OBJDIR)/jskwgen$(HOST_BIN_SUFFIX) $@
286
$(OBJDIR)/jskwgen.obj: jskwgen.c jskeyword.tbl
288
$(CC) -Fo$(OBJDIR)/ -c $(CFLAGS) $<
290
$(OBJDIR)/jskwgen$(HOST_BIN_SUFFIX): $(OBJDIR)/jskwgen.$(OBJ_SUFFIX)
291
link.exe -out:"$@" $(EXE_LINK_FLAGS) $^
295
$(OBJDIR)/jskwgen.o: jskwgen.c jskeyword.tbl
297
$(CC) -o $@ -c $(CFLAGS) $<
299
$(OBJDIR)/jskwgen$(HOST_BIN_SUFFIX): $(OBJDIR)/jskwgen.$(OBJ_SUFFIX)
300
$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $^
305
# JS shell executable
309
$(PROGRAM): $(PROG_OBJS) $(LIBRARY)
310
link.exe -out:"$@" $(EXE_LINK_FLAGS) $^
312
$(PROGRAM): $(PROG_OBJS) $(LIBRARY)
313
$(CC) -o $@ $(CFLAGS) $(PROG_OBJS) $(LIBRARY) $(LDFLAGS) $(OTHER_LIBS) \
317
$(PROGRAM).pure: $(PROG_OBJS) $(LIBRARY)
318
purify $(PUREFLAGS) \
319
$(CC) -o $@ $(PURE_OS_CFLAGS) $(PROG_OBJS) $(LIBRARY) $(LDFLAGS) \
320
$(OTHER_LIBS) $(PROG_LIBS)
322
ifndef PREBUILT_CPUCFG
323
$(HFILES) $(CFILES): $(OBJDIR)/jsautocfg.h
325
$(OBJDIR)/jsautocfg.h: $(OBJDIR)/jscpucfg
327
$(OBJDIR)/jscpucfg > $@
329
$(OBJDIR)/jscpucfg: $(OBJDIR)/jscpucfg.o
330
$(CC) -o $@ $(OBJDIR)/jscpucfg.o
332
# Add to TARGETS for clobber rule
333
TARGETS += $(OBJDIR)/jsautocfg.h $(OBJDIR)/jscpucfg \
338
# Hardwire dependencies on jsopcode.tbl
340
jsopcode.h jsopcode.c: jsopcode.tbl
342
-include $(DEPENDENCIES)
345
TARFILES = files `cat files`
349
$(CC) -C -E $(CFLAGS) $< > $*.i