diff --git a/config/rules.mk b/config/rules.mk index bc10c19d659f..f701ed3f0d27 100644 --- a/config/rules.mk +++ b/config/rules.mk @@ -968,7 +968,7 @@ 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) diff --git a/js/src/Makefile.in b/js/src/Makefile.in index 9a6b546f5594..07504764ebb2 100644 --- a/js/src/Makefile.in +++ b/js/src/Makefile.in @@ -46,7 +46,6 @@ include $(DEPTH)/config/autoconf.mk MODULE = js LIBRARY_NAME = mozjs -LIB_IS_C_ONLY = 1 GRE_MODULE = 1 ifdef GNU_CC @@ -88,43 +87,43 @@ 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 \ - jsinvoke.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 \ + jsinvoke.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 HAVE_DTRACE @@ -206,7 +205,7 @@ 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 (86,$(findstring 86,$(OS_TEST))) ifndef GNU_CC @@ -237,6 +236,7 @@ JSJAVA_CFLAGS = \ HOST_SIMPLE_PROGRAMS += host_jskwgen$(HOST_BIN_SUFFIX) GARBAGE += jsautokw.h host_jskwgen$(HOST_BIN_SUFFIX) +USE_HOST_CXX = 1 ifdef HAVE_DTRACE ifneq ($(OS_ARCH),Darwin) @@ -357,27 +357,27 @@ 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) - $(CC) -o $@ -c $(_COMPILE_CFLAGS) $< + @$(MAKE_DEPS_AUTO_CXX) + $(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) - $(CC) -o $@ -c $(filter-out $(MOZ_OPTIMIZE_FLAGS), $(COMPILE_CFLAGS)) $< -jsdtoa.o: jsdtoa.c Makefile.in + @$(MAKE_DEPS_AUTO_CXX) + $(CXX) -o $@ -c $(filter-out $(MOZ_OPTIMIZE_FLAGS), $(COMPILE_CFLAGS)) $< +jsdtoa.o: jsdtoa.cpp Makefile.in $(REPORT_BUILD) - @$(MAKE_DEPS_AUTO_CC) - $(CC) -o $@ -c $(filter-out $(MOZ_OPTIMIZE_FLAGS), $(COMPILE_CFLAGS)) $< + @$(MAKE_DEPS_AUTO_CXX) + $(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: @@ -398,8 +398,8 @@ endif # 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 @@ -423,19 +423,19 @@ 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 diff --git a/js/src/Makefile.ref b/js/src/Makefile.ref index cbc0a4284540..483896266647 100644 --- a/js/src/Makefile.ref +++ b/js/src/Makefile.ref @@ -100,7 +100,7 @@ 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 @@ -205,43 +205,43 @@ 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 \ - jsinvoke.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 \ + jsinvoke.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 @@ -249,13 +249,13 @@ 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 @@ -284,28 +284,28 @@ 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 @@ -318,24 +318,24 @@ $(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 \ @@ -349,9 +349,9 @@ DEPENDENCIES = $(CFILES:%.c=$(OBJDIR)/%.d) # Hardwire dependencies for jsinvoke.c # ifdef USE_MSVC -$(OBJDIR)/jsinvoke.obj : jsinterp.h jsinterp.c +$(OBJDIR)/jsinvoke.obj : jsinterp.h jsinterp.cpp else -$(OBJDIR)/jsinvoke.o : jsinterp.h jsinterp.c +$(OBJDIR)/jsinvoke.o : jsinterp.h jsinterp.cpp endif -include $(DEPENDENCIES) @@ -360,5 +360,5 @@ TARNAME = jsref.tar TARFILES = files `cat files` SUFFIXES: .i -%.i: %.c - $(CC) -C -E $(CFLAGS) $< > $*.i +%.i: %.cpp + $(CXX) -C -E $(CFLAGS) $< > $*.i diff --git a/js/src/config/Darwin.mk b/js/src/config/Darwin.mk index 9f01b9f49b5f..39f84c475c2e 100644 --- a/js/src/config/Darwin.mk +++ b/js/src/config/Darwin.mk @@ -49,7 +49,7 @@ CFLAGS += -Wall -Wno-format -MMD 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 diff --git a/js/src/js.c b/js/src/js.cpp similarity index 100% rename from js/src/js.c rename to js/src/js.cpp diff --git a/js/src/jsapi.c b/js/src/jsapi.cpp similarity index 100% rename from js/src/jsapi.c rename to js/src/jsapi.cpp diff --git a/js/src/jsarena.c b/js/src/jsarena.cpp similarity index 100% rename from js/src/jsarena.c rename to js/src/jsarena.cpp diff --git a/js/src/jsarray.c b/js/src/jsarray.cpp similarity index 100% rename from js/src/jsarray.c rename to js/src/jsarray.cpp diff --git a/js/src/jsatom.c b/js/src/jsatom.cpp similarity index 100% rename from js/src/jsatom.c rename to js/src/jsatom.cpp diff --git a/js/src/jsbool.c b/js/src/jsbool.cpp similarity index 100% rename from js/src/jsbool.c rename to js/src/jsbool.cpp diff --git a/js/src/jscntxt.c b/js/src/jscntxt.cpp similarity index 100% rename from js/src/jscntxt.c rename to js/src/jscntxt.cpp diff --git a/js/src/jscpucfg.c b/js/src/jscpucfg.cpp similarity index 100% rename from js/src/jscpucfg.c rename to js/src/jscpucfg.cpp diff --git a/js/src/jsdate.c b/js/src/jsdate.cpp similarity index 100% rename from js/src/jsdate.c rename to js/src/jsdate.cpp diff --git a/js/src/jsdbgapi.c b/js/src/jsdbgapi.cpp similarity index 100% rename from js/src/jsdbgapi.c rename to js/src/jsdbgapi.cpp diff --git a/js/src/jsdhash.c b/js/src/jsdhash.cpp similarity index 100% rename from js/src/jsdhash.c rename to js/src/jsdhash.cpp diff --git a/js/src/jsdtoa.c b/js/src/jsdtoa.cpp similarity index 100% rename from js/src/jsdtoa.c rename to js/src/jsdtoa.cpp diff --git a/js/src/jsemit.c b/js/src/jsemit.cpp similarity index 100% rename from js/src/jsemit.c rename to js/src/jsemit.cpp diff --git a/js/src/jsexn.c b/js/src/jsexn.cpp similarity index 100% rename from js/src/jsexn.c rename to js/src/jsexn.cpp diff --git a/js/src/jsfile.c b/js/src/jsfile.cpp similarity index 100% rename from js/src/jsfile.c rename to js/src/jsfile.cpp diff --git a/js/src/jsfun.c b/js/src/jsfun.cpp similarity index 100% rename from js/src/jsfun.c rename to js/src/jsfun.cpp diff --git a/js/src/jsgc.c b/js/src/jsgc.cpp similarity index 100% rename from js/src/jsgc.c rename to js/src/jsgc.cpp diff --git a/js/src/jshash.c b/js/src/jshash.cpp similarity index 100% rename from js/src/jshash.c rename to js/src/jshash.cpp diff --git a/js/src/jsinterp.c b/js/src/jsinterp.cpp similarity index 100% rename from js/src/jsinterp.c rename to js/src/jsinterp.cpp diff --git a/js/src/jsinvoke.c b/js/src/jsinvoke.cpp similarity index 98% rename from js/src/jsinvoke.c rename to js/src/jsinvoke.cpp index 8a4a7beb208b..d6cedb39f097 100644 --- a/js/src/jsinvoke.c +++ b/js/src/jsinvoke.cpp @@ -40,4 +40,4 @@ #define js_invoke_c__ -#include "jsinterp.c" +#include "jsinterp.cpp" diff --git a/js/src/jsiter.c b/js/src/jsiter.cpp similarity index 100% rename from js/src/jsiter.c rename to js/src/jsiter.cpp diff --git a/js/src/jskwgen.c b/js/src/jskwgen.cpp similarity index 100% rename from js/src/jskwgen.c rename to js/src/jskwgen.cpp diff --git a/js/src/jslock.c b/js/src/jslock.cpp similarity index 100% rename from js/src/jslock.c rename to js/src/jslock.cpp diff --git a/js/src/jslog2.c b/js/src/jslog2.cpp similarity index 100% rename from js/src/jslog2.c rename to js/src/jslog2.cpp diff --git a/js/src/jslong.c b/js/src/jslong.cpp similarity index 100% rename from js/src/jslong.c rename to js/src/jslong.cpp diff --git a/js/src/jsmath.c b/js/src/jsmath.cpp similarity index 100% rename from js/src/jsmath.c rename to js/src/jsmath.cpp diff --git a/js/src/jsnum.c b/js/src/jsnum.cpp similarity index 100% rename from js/src/jsnum.c rename to js/src/jsnum.cpp diff --git a/js/src/jsobj.c b/js/src/jsobj.cpp similarity index 100% rename from js/src/jsobj.c rename to js/src/jsobj.cpp diff --git a/js/src/jsopcode.c b/js/src/jsopcode.cpp similarity index 100% rename from js/src/jsopcode.c rename to js/src/jsopcode.cpp diff --git a/js/src/jsparse.c b/js/src/jsparse.cpp similarity index 100% rename from js/src/jsparse.c rename to js/src/jsparse.cpp diff --git a/js/src/jsprf.c b/js/src/jsprf.cpp similarity index 100% rename from js/src/jsprf.c rename to js/src/jsprf.cpp diff --git a/js/src/jsregexp.c b/js/src/jsregexp.cpp similarity index 100% rename from js/src/jsregexp.c rename to js/src/jsregexp.cpp diff --git a/js/src/jsscan.c b/js/src/jsscan.cpp similarity index 100% rename from js/src/jsscan.c rename to js/src/jsscan.cpp diff --git a/js/src/jsscope.c b/js/src/jsscope.cpp similarity index 100% rename from js/src/jsscope.c rename to js/src/jsscope.cpp diff --git a/js/src/jsscript.c b/js/src/jsscript.cpp similarity index 100% rename from js/src/jsscript.c rename to js/src/jsscript.cpp diff --git a/js/src/jsstr.c b/js/src/jsstr.cpp similarity index 100% rename from js/src/jsstr.c rename to js/src/jsstr.cpp diff --git a/js/src/jsutil.c b/js/src/jsutil.cpp similarity index 100% rename from js/src/jsutil.c rename to js/src/jsutil.cpp diff --git a/js/src/jsxdrapi.c b/js/src/jsxdrapi.cpp similarity index 100% rename from js/src/jsxdrapi.c rename to js/src/jsxdrapi.cpp diff --git a/js/src/jsxml.c b/js/src/jsxml.cpp similarity index 100% rename from js/src/jsxml.c rename to js/src/jsxml.cpp diff --git a/js/src/prmjtime.c b/js/src/prmjtime.cpp similarity index 100% rename from js/src/prmjtime.c rename to js/src/prmjtime.cpp diff --git a/js/src/rules.mk b/js/src/rules.mk index 91b4c3f516e8..4ab596f23a69 100644 --- a/js/src/rules.mk +++ b/js/src/rules.mk @@ -43,15 +43,15 @@ # 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 @@ -68,43 +68,43 @@ ifneq "$(strip $(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)/jsinterp.o: jsinterp.c jsinterp.h +$(OBJDIR)/jsinterp.o: jsinterp.cpp jsinterp.h @$(MAKE_OBJDIR) - $(CC) -o $@ -c $(INTERP_CFLAGS) jsinterp.c + $(CXX) -o $@ -c $(INTERP_CFLAGS) jsinterp.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)/jsinterp.obj: jsinterp.c jsinterp.h +$(OBJDIR)/jsinterp.obj: jsinterp.cpp jsinterp.h @$(MAKE_OBJDIR) - $(CC) -Fo$(OBJDIR)/ -c $(INTERP_CFLAGS) $(JSDLL_CFLAGS) jsinterp.c + $(CXX) -Fo$(OBJDIR)/ -c $(INTERP_CFLAGS) $(JSDLL_CFLAGS) jsinterp.c -$(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)