Bug 387935, Always build JS as C++, r=benjamin
authoredward.lee@engineering.uiuc.edu
Mon, 16 Jul 2007 11:40:49 -0700
changeset 3624 bd9c9cbf9ec8cf83df128d219ccce0f32ec5a705
parent 3623 40af793a3dc579dd2ee5e8aa0d0f9ec02dff4225
child 3625 0f62afa8267f32bbd7ef6acf7fa739f363df78a7
child 15144 11f0d02a9652719244b9ebf50c3c596752a387c8
push idunknown
push userunknown
push dateunknown
reviewersbenjamin
bugs387935
milestone1.9a7pre
Bug 387935, Always build JS as C++, r=benjamin
config/rules.mk
js/src/Makefile.in
js/src/Makefile.ref
js/src/config/Darwin.mk
js/src/js.c
js/src/js.cpp
js/src/jsapi.c
js/src/jsapi.cpp
js/src/jsarena.c
js/src/jsarena.cpp
js/src/jsarray.c
js/src/jsarray.cpp
js/src/jsatom.c
js/src/jsatom.cpp
js/src/jsbool.c
js/src/jsbool.cpp
js/src/jscntxt.c
js/src/jscntxt.cpp
js/src/jscpucfg.c
js/src/jscpucfg.cpp
js/src/jsdate.c
js/src/jsdate.cpp
js/src/jsdbgapi.c
js/src/jsdbgapi.cpp
js/src/jsdhash.c
js/src/jsdhash.cpp
js/src/jsdtoa.c
js/src/jsdtoa.cpp
js/src/jsemit.c
js/src/jsemit.cpp
js/src/jsexn.c
js/src/jsexn.cpp
js/src/jsfile.c
js/src/jsfile.cpp
js/src/jsfun.c
js/src/jsfun.cpp
js/src/jsgc.c
js/src/jsgc.cpp
js/src/jshash.c
js/src/jshash.cpp
js/src/jsinterp.c
js/src/jsinterp.cpp
js/src/jsiter.c
js/src/jsiter.cpp
js/src/jskwgen.c
js/src/jskwgen.cpp
js/src/jslock.c
js/src/jslock.cpp
js/src/jslog2.c
js/src/jslog2.cpp
js/src/jslong.c
js/src/jslong.cpp
js/src/jsmath.c
js/src/jsmath.cpp
js/src/jsnum.c
js/src/jsnum.cpp
js/src/jsobj.c
js/src/jsobj.cpp
js/src/jsopcode.c
js/src/jsopcode.cpp
js/src/jsparse.c
js/src/jsparse.cpp
js/src/jsprf.c
js/src/jsprf.cpp
js/src/jsregexp.c
js/src/jsregexp.cpp
js/src/jsscan.c
js/src/jsscan.cpp
js/src/jsscope.c
js/src/jsscope.cpp
js/src/jsscript.c
js/src/jsscript.cpp
js/src/jsstr.c
js/src/jsstr.cpp
js/src/jsutil.c
js/src/jsutil.cpp
js/src/jsxdrapi.c
js/src/jsxdrapi.cpp
js/src/jsxml.c
js/src/jsxml.cpp
js/src/prmjtime.c
js/src/prmjtime.cpp
js/src/rules.mk
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -980,17 +980,17 @@ ifeq ($(MOZ_OS2_TOOLS),VACPP)
 	$(HOST_LD) -OUT:$@ $< $(LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS) -ST:0x100000
 else
 ifeq (WINCE,$(OS_ARCH))
 	$(HOST_LD) -NOLOGO -OUT:$@ $(WIN32_EXE_LDFLAGS) $< $(HOST_LIBS) $(HOST_EXTRA_LIBS)
 else
 ifeq (WINNT_,$(HOST_OS_ARCH)_$(GNU_CC))
 	$(HOST_LD) -NOLOGO -OUT:$@ -PDB:$(PDBFILE) $< $(WIN32_EXE_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
 else
-ifdef HOST_CPPSRCS
+ifneq (,$(HOST_CPPSRCS)$(USE_HOST_CXX))
 	$(HOST_CXX) $(HOST_OUTOPTION)$@ $(HOST_CXXFLAGS) $(INCLUDES) $< $(HOST_LIBS) $(HOST_EXTRA_LIBS)
 else
 	$(HOST_CC) $(HOST_OUTOPTION)$@ $(HOST_CFLAGS) $(INCLUDES) $< $(HOST_LIBS) $(HOST_EXTRA_LIBS)
 endif
 endif
 endif
 endif
 
--- a/js/src/Makefile.in
+++ b/js/src/Makefile.in
@@ -41,17 +41,16 @@ DEPTH		= ../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= js
 LIBRARY_NAME	= mozjs
-LIB_IS_C_ONLY	= 1
 GRE_MODULE	= 1
 
 ifeq (,$(filter-out WINNT WINCE,$(OS_ARCH)))
 LIBRARY_NAME	= js$(MOZ_BITS)$(VERSION_NUMBER)
 RESFILE		= js$(MOZ_BITS)40.res
 endif
 
 PACKAGE_FILE = js.pkg
@@ -60,52 +59,52 @@ PACKAGE_FILE = js.pkg
 # other modules which are always built shared. Failure to do so results in
 # the js code getting copied into xpinstall and jsd as well as mozilla-bin,
 # and then the static data cells used for locking no longer work.
 
 ifndef JS_STATIC_BUILD
 FORCE_SHARED_LIB = 1
 endif
 
-CSRCS		= \
-		jsapi.c \
-		jsarena.c \
-		jsarray.c \
-		jsatom.c \
-		jsbool.c \
-		jscntxt.c \
-		jsdate.c \
-		jsdbgapi.c \
-		jsdhash.c \
-		jsdtoa.c \
-		jsemit.c \
-		jsexn.c \
-		jsfun.c \
-		jsgc.c \
-		jshash.c \
-		jsinterp.c \
-		jsiter.c \
-		jslock.c \
-		jslog2.c \
-		jslong.c \
-		jsmath.c \
-		jsnum.c \
-		jsobj.c \
-		jsopcode.c \
-		jsparse.c \
-		jsprf.c \
-		jsregexp.c \
-		jsscan.c \
-		jsscope.c \
-		jsscript.c \
-		jsstr.c \
-		jsutil.c \
-		jsxdrapi.c \
-		jsxml.c \
-		prmjtime.c \
+CPPSRCS		= \
+		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 \
+		jsiter.cpp \
+		jslock.cpp \
+		jslog2.cpp \
+		jslong.cpp \
+		jsmath.cpp \
+		jsnum.cpp \
+		jsobj.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)
 
 EXPORTS		= \
 		jsautocfg.h \
 		jsautokw.h \
 		js.msg \
 		jsapi.h \
 		jsarray.h \
@@ -159,17 +158,17 @@ endif
 JS_SAFE_ARENA	= 1
 
 DASH_R		= -r
 
 include $(topsrcdir)/config/config.mk
 
 EXTRA_DSO_LDOPTS += $(NSPR_LIBS)
 
-# When using gcc the assembly is inlined in the C-file (see jslock.c)
+# When using gcc the assembly is inlined in the C-file (see jslock.cpp)
 ifeq ($(OS_ARCH),SunOS)
 ifneq ($(OS_TEST),i86pc)
 ifndef GNU_CC
 ASFILES		= lock_$(OS_ARCH).s
 endif
 endif
 endif
 
@@ -190,16 +189,17 @@ JSJAVA_CFLAGS	= \
 		-I$(topsrcdir)/sun-java/md-include \
 		-I$(topsrcdir)/sun-java/include \
 		$(JSJAVA_STUBHEADERS)
 
 # Define keyword generator before rules.mk, see bug 323979 comment 50
 
 HOST_SIMPLE_PROGRAMS += host_jskwgen$(HOST_BIN_SUFFIX)
 GARBAGE += jsautokw.h host_jskwgen$(HOST_BIN_SUFFIX)
+USE_HOST_CXX = 1
 
 include $(topsrcdir)/config/rules.mk
 
 DEFINES		+= -DEXPORT_JS_API 
 
 INCLUDES	+= -I$(srcdir)
 
 # MSVC '-Gy' cc flag and '/OPT:REF' linker flag cause JS_GetArgument and
@@ -292,37 +292,37 @@ LDFLAGS		+= -ldl -lnsl
 else
 LDFLAGS		+= -lposix4 -ldl -lnsl -lsocket
 endif
 endif
 
 ifeq ($(OS_ARCH),IRIX)
 ifndef GNU_CC
 _COMPILE_CFLAGS  = $(patsubst -O%,-O1,$(COMPILE_CFLAGS))
-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: %.c Makefile.in
+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
 	$(REPORT_BUILD)
 	@$(MAKE_DEPS_AUTO)
-	$(CC) -o $@ -c $(_COMPILE_CFLAGS) $<
+	$(CXX) -o $@ -c $(_COMPILE_CFLAGS) $<
 endif
 endif
 
 # An AIX Optimization bug causes PR_dtoa() & JS_dtoa to produce wrong result.
 # This suppresses optimization for this single compilation unit.
 ifeq ($(OS_ARCH),AIX)
-jsatom.o: jsatom.c Makefile.in
+jsatom.o: jsatom.cpp Makefile.in
 	$(REPORT_BUILD)
 	@$(MAKE_DEPS_AUTO)
-	$(CC) -o $@ -c $(filter-out $(MOZ_OPTIMIZE_FLAGS), $(COMPILE_CFLAGS)) $<
-jsdtoa.o: jsdtoa.c Makefile.in
+	$(CXX) -o $@ -c $(filter-out $(MOZ_OPTIMIZE_FLAGS), $(COMPILE_CFLAGS)) $<
+jsdtoa.o: jsdtoa.cpp Makefile.in
 	$(REPORT_BUILD)
 	@$(MAKE_DEPS_AUTO)
-	$(CC) -o $@ -c $(filter-out $(MOZ_OPTIMIZE_FLAGS), $(COMPILE_CFLAGS)) $<
+	$(CXX) -o $@ -c $(filter-out $(MOZ_OPTIMIZE_FLAGS), $(COMPILE_CFLAGS)) $<
 endif
 
-jsopcode.h jsopcode.c: jsopcode.tbl
+jsopcode.h jsopcode.cpp: jsopcode.tbl
 
 ifeq (,$(CROSS_COMPILE)$(filter-out WINNT,$(OS_ARCH)))
 jsautocfg.h:
 	touch $@
 else
 ifeq ($(OS_ARCH),WINCE)
 jsautocfg.h:
 	touch $@
@@ -333,18 +333,18 @@ jsautocfg.h: jscpucfg$(HOST_BIN_SUFFIX)
 	mv jsautocfg.tmp $@
 endif
 endif
 
 # jscpucfg is a strange target
 # Needs to be built with the host compiler but needs to include
 # the mdcpucfg for the target so it needs the appropriate target defines
 ifdef HOST_NSPR_MDCPUCFG
-HOST_CC := $(HOST_CC) -DMDCPUCFG=$(TARGET_NSPR_MDCPUCFG)
-HOST_CFLAGS := $(patsubst -DXP_%,,$(HOST_CFLAGS))
+HOST_CXX := $(HOST_CXX) -DMDCPUCFG=$(TARGET_NSPR_MDCPUCFG)
+HOST_CXXFLAGS := $(patsubst -DXP_%,,$(HOST_CXXFLAGS))
 endif
 
 ifdef CROSS_COMPILE
 # jscpucfg needs to know when it's supposed to produce a config for the target
 JSCPUCFG_DEFINES = $(ACDEFINES)
 
 # This is incredibly hacky.  Darwin NSPR uses the same MDCPUCFG for multiple
 # processors, and determines which processor to configure for based on
@@ -358,29 +358,29 @@ else
 JSCPUCFG_DEFINES += -Di386=1
 endif
 endif
 endif
 
 ifeq ($(OS_ARCH),QNX)
 ifneq ($(OS_TARGET),NTO)
 # QNX's compiler apparently can't build a binary directly from a source file.
-jscpucfg.o: jscpucfg.c Makefile.in
-	$(HOST_CC) $(HOST_CFLAGS) -c $(JSCPUCFG_DEFINES) $(DEFINES) $(NSPR_CFLAGS) -o $@ $<
+jscpucfg.o: jscpucfg.cpp Makefile.in
+	$(HOST_CXX) $(HOST_CXXFLAGS) -c $(JSCPUCFG_DEFINES) $(DEFINES) $(NSPR_CFLAGS) -o $@ $<
 
 jscpucfg: jscpucfg.o
-	$(HOST_CC) $(HOST_CFLAGS) $(JSCPUCFG_DEFINES) $(DEFINES) -o $@ $<
+	$(HOST_CXX) $(HOST_CXXFLAGS) $(JSCPUCFG_DEFINES) $(DEFINES) -o $@ $<
 endif
 else
 ifeq ($(OS_ARCH),WINCE)
 jscpucfg$(HOST_BIN_SUFFIX):
 	echo no need to build jscpucfg $<
 else
-jscpucfg$(HOST_BIN_SUFFIX): jscpucfg.c Makefile.in
-	$(HOST_CC) $(HOST_CFLAGS) $(JSCPUCFG_DEFINES) $(DEFINES) $(NSPR_CFLAGS) $(OUTOPTION)$@ $<
+jscpucfg$(HOST_BIN_SUFFIX): jscpucfg.cpp Makefile.in
+	$(HOST_CXX) $(HOST_CXXFLAGS) $(JSCPUCFG_DEFINES) $(DEFINES) $(NSPR_CFLAGS) $(OUTOPTION)$@ $<
 endif
 endif
 
 # Extra dependancies and rules for keyword switch code
 jsscan.$(OBJ_SUFFIX): jsautokw.h jskeyword.tbl
 
 host_jskwgen.$(OBJ_SUFFIX): jsconfig.h jskeyword.tbl
 
--- a/js/src/Makefile.ref
+++ b/js/src/Makefile.ref
@@ -87,17 +87,17 @@ CFLAGS          += $(OPTIMIZER) $(OS_CFL
 LDFLAGS		= $(XLDFLAGS)
 
 ifndef NO_LIBM
 LDFLAGS += -lm
 endif
 
 # Prevent floating point errors caused by VC++ optimizations
 ifeq ($(OS_ARCH),WINNT)
-_MSC_VER = $(shell $(CC) 2>&1 | sed -n 's/.*Compiler Version \([0-9]*\)\.\([0-9]*\).*/\1\2/p')
+_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
 
 #
@@ -193,66 +193,66 @@ OTHER_HFILES =		\
 
 ifndef PREBUILT_CPUCFG
 OTHER_HFILES += $(OBJDIR)/jsautocfg.h
 endif
 OTHER_HFILES += $(OBJDIR)/jsautokw.h
 
 HFILES = $(JS_HFILES) $(API_HFILES) $(OTHER_HFILES)
 
-JS_CFILES =		\
-	jsapi.c		\
-	jsarena.c	\
-	jsarray.c	\
-	jsatom.c	\
-	jsbool.c	\
-	jscntxt.c	\
-	jsdate.c	\
-	jsdbgapi.c	\
-	jsdhash.c	\
-	jsdtoa.c	\
-	jsemit.c	\
-	jsexn.c		\
-	jsfun.c		\
-	jsgc.c		\
-	jshash.c	\
-	jsinterp.c	\
-	jsiter.c	\
-	jslock.c	\
-	jslog2.c	\
-	jslong.c	\
-	jsmath.c	\
-	jsnum.c		\
-	jsobj.c		\
-	jsopcode.c      \
-	jsparse.c	\
-	jsprf.c		\
-	jsregexp.c	\
-	jsscan.c	\
-	jsscope.c	\
-	jsscript.c	\
-	jsstr.c		\
-	jsutil.c        \
-	jsxdrapi.c	\
-	jsxml.c		\
-	prmjtime.c	\
+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	\
+	jsiter.cpp	\
+	jslock.cpp	\
+	jslog2.cpp	\
+	jslong.cpp	\
+	jsmath.cpp	\
+	jsnum.cpp	\
+	jsobj.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 JS_LIVECONNECT
 DIRS      += liveconnect
 endif
 
 ifdef JS_HAS_FILE_OBJECT
-JS_CFILES += jsfile.c
+JS_CPPFILES += jsfile.cpp
 JS_HFILES += jsfile.h
 endif
 
-LIB_CFILES  = $(JS_CFILES)
+LIB_CPPFILES  = $(JS_CPPFILES)
 LIB_ASFILES := $(wildcard *_$(OS_ARCH).s)
-PROG_CFILES = js.c
+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)
@@ -271,79 +271,79 @@ nsinstall-target:
 # Rules for keyword switch generation
 #
 
 GARBAGE += $(OBJDIR)/jsautokw.h $(OBJDIR)/jskwgen$(HOST_BIN_SUFFIX)
 GARBAGE += $(OBJDIR)/jskwgen.$(OBJ_SUFFIX)
 
 $(OBJDIR)/jsscan.$(OBJ_SUFFIX): $(OBJDIR)/jsautokw.h jskeyword.tbl
 
-$(OBJDIR)/jskwgen.$(OBJ_SUFFIX): jskwgen.c jskeyword.tbl
+$(OBJDIR)/jskwgen.$(OBJ_SUFFIX): jskwgen.cpp jskeyword.tbl
 
 $(OBJDIR)/jsautokw.h: $(OBJDIR)/jskwgen$(HOST_BIN_SUFFIX) jskeyword.tbl
 	$(OBJDIR)/jskwgen$(HOST_BIN_SUFFIX) $@
 
 ifdef USE_MSVC
 
-$(OBJDIR)/jskwgen.obj: jskwgen.c jskeyword.tbl
+$(OBJDIR)/jskwgen.obj: jskwgen.cpp jskeyword.tbl
 	@$(MAKE_OBJDIR)
-	$(CC) -Fo$(OBJDIR)/ -c $(CFLAGS) $<
+	$(CXX) -Fo$(OBJDIR)/ -c $(CFLAGS) $<
 
 $(OBJDIR)/jskwgen$(HOST_BIN_SUFFIX): $(OBJDIR)/jskwgen.$(OBJ_SUFFIX)
 	link.exe -out:"$@" $(EXE_LINK_FLAGS) $^
 
 else
 
-$(OBJDIR)/jskwgen.o: jskwgen.c jskeyword.tbl
+$(OBJDIR)/jskwgen.o: jskwgen.cpp jskeyword.tbl
 	@$(MAKE_OBJDIR)
-	$(CC) -o $@ -c $(CFLAGS) $<
+	$(CXX) -o $@ -c $(CFLAGS) $<
 
 $(OBJDIR)/jskwgen$(HOST_BIN_SUFFIX): $(OBJDIR)/jskwgen.$(OBJ_SUFFIX)
-	$(CC) -o $@ $(CFLAGS) $(LDFLAGS) $^
+	$(CXX) -o $@ $(CFLAGS) $(LDFLAGS) $^
 
 endif
 
 #
 # JS shell executable
 #
 
 ifdef USE_MSVC
 $(PROGRAM): $(PROG_OBJS) $(LIBRARY)
 	link.exe -out:"$@" $(EXE_LINK_FLAGS) $^
 else
 $(PROGRAM): $(PROG_OBJS) $(LIBRARY)
-	$(CC) -o $@ $(CFLAGS) $(PROG_OBJS) $(LIBRARY) $(LDFLAGS) $(OTHER_LIBS) \
+	$(CXX) -o $@ $(CFLAGS) $(PROG_OBJS) $(LIBRARY) $(LDFLAGS) $(OTHER_LIBS) \
 	    $(PROG_LIBS)
 endif
 
 $(PROGRAM).pure: $(PROG_OBJS) $(LIBRARY)
 	purify $(PUREFLAGS) \
-	    $(CC) -o $@ $(PURE_OS_CFLAGS) $(PROG_OBJS) $(LIBRARY) $(LDFLAGS) \
+	    $(CXX) -o $@ $(PURE_OS_CFLAGS) $(PROG_OBJS) $(LIBRARY) $(LDFLAGS) \
 		$(OTHER_LIBS) $(PROG_LIBS)
 
 ifndef PREBUILT_CPUCFG
-$(HFILES) $(CFILES): $(OBJDIR)/jsautocfg.h
+$(HFILES) $(CPPFILES): $(OBJDIR)/jsautocfg.h
 
 $(OBJDIR)/jsautocfg.h: $(OBJDIR)/jscpucfg
 	rm -f $@
 	$(OBJDIR)/jscpucfg > $@
 
 $(OBJDIR)/jscpucfg: $(OBJDIR)/jscpucfg.o
-	$(CC) -o $@ $(OBJDIR)/jscpucfg.o
+	$(CXX) -o $@ $(OBJDIR)/jscpucfg.o
 
 # Add to TARGETS for clobber rule
 TARGETS += $(OBJDIR)/jsautocfg.h $(OBJDIR)/jscpucfg \
 	$(OBJDIR)/jscpucfg.o
 endif
 
 #
 # Hardwire dependencies on jsopcode.tbl
 #
-jsopcode.h jsopcode.c: jsopcode.tbl
+jsopcode.h jsopcode.cpp: jsopcode.tbl
 
 -include $(DEPENDENCIES)
 
 TARNAME = jsref.tar
 TARFILES = files `cat files`
 
 SUFFIXES: .i
-%.i: %.c
-	$(CC) -C -E $(CFLAGS) $< > $*.i
+%.i: %.cpp
+	$(CXX) -C -E $(CFLAGS) $< > $*.i
--- a/js/src/config/Darwin.mk
+++ b/js/src/config/Darwin.mk
@@ -44,17 +44,17 @@
 #
 
 CC = cc
 CCC = g++
 CFLAGS +=  -Wall -Wno-format
 OS_CFLAGS = -DXP_UNIX -DSVR4 -DSYSV -D_BSD_SOURCE -DPOSIX_SOURCE -DDARWIN
 
 RANLIB = ranlib
-MKSHLIB = $(CC) -dynamiclib $(XMKSHLIBOPTS) -framework System
+MKSHLIB = $(CCC) -dynamiclib $(XMKSHLIBOPTS) -framework System
 
 SO_SUFFIX = dylib
 
 #.c.o:
 #      $(CC) -c -MD $*.d $(CFLAGS) $<
 
 CPU_ARCH = $(shell uname -m)
 ifeq (86,$(findstring 86,$(CPU_ARCH)))
rename from js/src/js.c
rename to js/src/js.cpp
rename from js/src/jsapi.c
rename to js/src/jsapi.cpp
rename from js/src/jsarena.c
rename to js/src/jsarena.cpp
rename from js/src/jsarray.c
rename to js/src/jsarray.cpp
rename from js/src/jsatom.c
rename to js/src/jsatom.cpp
rename from js/src/jsbool.c
rename to js/src/jsbool.cpp
rename from js/src/jscntxt.c
rename to js/src/jscntxt.cpp
rename from js/src/jscpucfg.c
rename to js/src/jscpucfg.cpp
rename from js/src/jsdate.c
rename to js/src/jsdate.cpp
rename from js/src/jsdbgapi.c
rename to js/src/jsdbgapi.cpp
rename from js/src/jsdhash.c
rename to js/src/jsdhash.cpp
rename from js/src/jsdtoa.c
rename to js/src/jsdtoa.cpp
rename from js/src/jsemit.c
rename to js/src/jsemit.cpp
rename from js/src/jsexn.c
rename to js/src/jsexn.cpp
rename from js/src/jsfile.c
rename to js/src/jsfile.cpp
rename from js/src/jsfun.c
rename to js/src/jsfun.cpp
rename from js/src/jsgc.c
rename to js/src/jsgc.cpp
rename from js/src/jshash.c
rename to js/src/jshash.cpp
rename from js/src/jsinterp.c
rename to js/src/jsinterp.cpp
rename from js/src/jsiter.c
rename to js/src/jsiter.cpp
rename from js/src/jskwgen.c
rename to js/src/jskwgen.cpp
rename from js/src/jslock.c
rename to js/src/jslock.cpp
rename from js/src/jslog2.c
rename to js/src/jslog2.cpp
rename from js/src/jslong.c
rename to js/src/jslong.cpp
rename from js/src/jsmath.c
rename to js/src/jsmath.cpp
rename from js/src/jsnum.c
rename to js/src/jsnum.cpp
rename from js/src/jsobj.c
rename to js/src/jsobj.cpp
rename from js/src/jsopcode.c
rename to js/src/jsopcode.cpp
rename from js/src/jsparse.c
rename to js/src/jsparse.cpp
rename from js/src/jsprf.c
rename to js/src/jsprf.cpp
rename from js/src/jsregexp.c
rename to js/src/jsregexp.cpp
rename from js/src/jsscan.c
rename to js/src/jsscan.cpp
rename from js/src/jsscope.c
rename to js/src/jsscope.cpp
rename from js/src/jsscript.c
rename to js/src/jsscript.cpp
rename from js/src/jsstr.c
rename to js/src/jsstr.cpp
rename from js/src/jsutil.c
rename to js/src/jsutil.cpp
rename from js/src/jsxdrapi.c
rename to js/src/jsxdrapi.cpp
rename from js/src/jsxml.c
rename to js/src/jsxml.cpp
rename from js/src/prmjtime.c
rename to js/src/prmjtime.cpp
--- a/js/src/rules.mk
+++ b/js/src/rules.mk
@@ -38,71 +38,71 @@
 # 
 # ***** END LICENSE BLOCK *****
 
 #
 # JSRef GNUmake makefile rules
 #
 
 ifdef USE_MSVC
-LIB_OBJS  = $(addprefix $(OBJDIR)/, $(LIB_CFILES:.c=.obj))
-PROG_OBJS = $(addprefix $(OBJDIR)/, $(PROG_CFILES:.c=.obj))
+LIB_OBJS  = $(addprefix $(OBJDIR)/, $(LIB_CPPFILES:.cpp=.obj))
+PROG_OBJS = $(addprefix $(OBJDIR)/, $(PROG_CPPFILES:.cpp=.obj))
 else
-LIB_OBJS  = $(addprefix $(OBJDIR)/, $(LIB_CFILES:.c=.o))
+LIB_OBJS  = $(addprefix $(OBJDIR)/, $(LIB_CPPFILES:.cpp=.o))
 LIB_OBJS  += $(addprefix $(OBJDIR)/, $(LIB_ASFILES:.s=.o))
-PROG_OBJS = $(addprefix $(OBJDIR)/, $(PROG_CFILES:.c=.o))
+PROG_OBJS = $(addprefix $(OBJDIR)/, $(PROG_CPPFILES:.cpp=.o))
 endif
 
-CFILES = $(LIB_CFILES) $(PROG_CFILES)
+CPPFILES = $(LIB_CPPFILES) $(PROG_CPPFILES)
 OBJS   = $(LIB_OBJS) $(PROG_OBJS)
 
 ifdef USE_MSVC
 # TARGETS = $(LIBRARY)   # $(PROGRAM) not supported for MSVC yet
 TARGETS += $(SHARED_LIBRARY) $(PROGRAM)  # it is now
 else
 TARGETS += $(LIBRARY) $(SHARED_LIBRARY) $(PROGRAM) 
 endif
 
 all:
 	+$(LOOP_OVER_PREDIRS) 
 ifneq "$(strip $(TARGETS))" ""
 	$(MAKE) -f Makefile.ref $(TARGETS)
 endif
 	+$(LOOP_OVER_DIRS)
 
-$(OBJDIR)/%: %.c
+$(OBJDIR)/%: %.cpp
 	@$(MAKE_OBJDIR)
-	$(CC) -o $@ $(CFLAGS) $*.c $(LDFLAGS)
+	$(CXX) -o $@ $(CFLAGS) $*.cpp $(LDFLAGS)
 
 # This rule must come before the rule with no dep on header
-$(OBJDIR)/%.o: %.c %.h
+$(OBJDIR)/%.o: %.cpp %.h
 	@$(MAKE_OBJDIR)
-	$(CC) -o $@ -c $(CFLAGS) $*.c
+	$(CXX) -o $@ -c $(CFLAGS) $*.cpp
 
 
-$(OBJDIR)/%.o: %.c
+$(OBJDIR)/%.o: %.cpp
 	@$(MAKE_OBJDIR)
-	$(CC) -o $@ -c $(CFLAGS) $*.c
+	$(CXX) -o $@ -c $(CFLAGS) $*.cpp
 
 $(OBJDIR)/%.o: %.s
 	@$(MAKE_OBJDIR)
 	$(AS) -o $@ $(ASFLAGS) $*.s
 
 # This rule must come before rule with no dep on header
-$(OBJDIR)/%.obj: %.c %.h
+$(OBJDIR)/%.obj: %.cpp %.h
 	@$(MAKE_OBJDIR)
-	$(CC) -Fo$(OBJDIR)/ -c $(CFLAGS) $(JSDLL_CFLAGS) $*.c
+	$(CXX) -Fo$(OBJDIR)/ -c $(CFLAGS) $(JSDLL_CFLAGS) $*.cpp
 
-$(OBJDIR)/%.obj: %.c
+$(OBJDIR)/%.obj: %.cpp
 	@$(MAKE_OBJDIR)
-	$(CC) -Fo$(OBJDIR)/ -c $(CFLAGS) $(JSDLL_CFLAGS) $*.c
+	$(CXX) -Fo$(OBJDIR)/ -c $(CFLAGS) $(JSDLL_CFLAGS) $*.cpp
 
-$(OBJDIR)/js.obj: js.c
+$(OBJDIR)/js.obj: js.cpp
 	@$(MAKE_OBJDIR)
-	$(CC) -Fo$(OBJDIR)/ -c $(CFLAGS) $<
+	$(CXX) -Fo$(OBJDIR)/ -c $(CFLAGS) $<
 
 ifeq ($(OS_ARCH),OS2)
 $(LIBRARY): $(LIB_OBJS)
 	$(AR) $@ $? $(AR_OS2_SUFFIX)
 	$(RANLIB) $@
 else
 ifdef USE_MSVC
 $(SHARED_LIBRARY): $(LIB_OBJS)
@@ -180,14 +180,14 @@ clean:
 	rm -rf $(OBJS) $(GARBAGE)
 	@cd fdlibm; $(MAKE) -f Makefile.ref clean
 
 clobber:
 	rm -rf $(OBJS) $(TARGETS) $(DEPENDENCIES)
 	@cd fdlibm; $(MAKE) -f Makefile.ref clobber
 
 depend:
-	gcc -MM $(CFLAGS) $(LIB_CFILES)
+	gcc -MM $(CFLAGS) $(LIB_CPPFILES)
 
 tar:
 	tar cvf $(TARNAME) $(TARFILES)
 	gzip $(TARNAME)