diff --git a/Makefile.in b/Makefile.in index bfb3ae32d3..f17579f6e4 100644 --- a/Makefile.in +++ b/Makefile.in @@ -78,6 +78,7 @@ MISSING = @LIBOBJS@ @ALLOCA@ LDSHARED = @LIBRUBY_LDSHARED@ DLDFLAGS = @LIBRUBY_DLDFLAGS@ $(XLDFLAGS) $(ARCH_FLAG) SOLIBS = @SOLIBS@ +ENABLE_DEBUG_ENV = @ENABLE_DEBUG_ENV@ MAINLIBS = @MAINLIBS@ ARCHMINIOBJS = @MINIOBJS@ DLNOBJ = @DLNOBJ@ @@ -195,6 +196,8 @@ MINIPRELUDE_C = miniprelude.c PRELUDE_C = prelude.c RBCONFIG = .rbconfig.time +MAINSRC = $(MAINOBJ:@OBJEXT@=c) + SRC_FILE = $< OS_SRC_FILE = $< DEST_FILE = $@ diff --git a/common.mk b/common.mk index b2c1eb0633..9e554753c6 100644 --- a/common.mk +++ b/common.mk @@ -938,6 +938,12 @@ $(PRELUDE_C): $(COMPILE_PRELUDE) \ $(Q) $(BASERUBY) $(srcdir)/tool/generic_erb.rb -I$(srcdir) -c -o $@ \ $(srcdir)/template/prelude.c.tmpl golf_prelude.rb +MAINCPPFLAGS = $(ENABLE_DEBUG_ENV:yes=-DRUBY_DEBUG_ENV=1) + +$(MAINOBJ): $(srcdir)/$(MAINSRC) + $(ECHO) compiling $(srcdir)/$(MAINSRC) + $(Q) $(CC) $(MAINCPPFLAGS) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(COUTFLAG)$@ -c $(CSRCFLAG)$(srcdir)/$(MAINSRC) + {$(VPATH)}probes.dmyh: {$(srcdir)}probes.d $(srcdir)/tool/gen_dummy_probes.rb probes.dmyh: diff --git a/configure.in b/configure.in index a2ab09bb76..3933db8a7b 100644 --- a/configure.in +++ b/configure.in @@ -4209,7 +4209,7 @@ AS_CASE(["$THREAD_MODEL"], AC_ARG_ENABLE(debug-env, AS_HELP_STRING([--enable-debug-env], [enable RUBY_DEBUG environment variable]), - [AC_DEFINE(RUBY_DEBUG_ENV)]) + [AC_SUBST(ENABLE_DEBUG_ENV, yes)]) AS_CASE(["$FIRSTMAKEFILE"], [*GNUmakefile:*], [gnumake=yes], [ AC_MSG_CHECKING([if ${MAKE-make} is GNU make]) diff --git a/main.c b/main.c index 16da117732..764d947af3 100644 --- a/main.c +++ b/main.c @@ -15,6 +15,9 @@ #ifdef HAVE_LOCALE_H #include #endif +#if defined RUBY_DEBUG_ENV && !RUBY_DEBUG_ENV +# undef RUBY_DEBUG_ENV +#endif #ifdef RUBY_DEBUG_ENV #include #endif diff --git a/win32/Makefile.sub b/win32/Makefile.sub index e1a283e73f..2f59d83b0b 100644 --- a/win32/Makefile.sub +++ b/win32/Makefile.sub @@ -364,6 +364,7 @@ OS_DEST_FILE = $(@:/=\) !if !defined(WINMAINOBJ) WINMAINOBJ = winmain.$(OBJEXT) !endif +MAINSRC = $(MAINOBJ:.obj=.c) ARCHMINIOBJS = dmydln.$(OBJEXT) miniruby.res LIBOBJS = $(MISSING) $(LIBOBJS) @@ -772,9 +773,6 @@ $(CONFIG_H): $(MKFILES) $(srcdir)/win32/Makefile.sub $(win_srcdir)/Makefile.sub !endif #define CANONICALIZATION_FOR_MATHN 1 #define DEFAULT_KCODE KCODE_NONE -!if "$(ENABLE_DEBUG_ENV)" == "yes" -#define RUBY_DEBUG_ENV 1 -!endif #define LOAD_RELATIVE 1 #define DLEXT ".so" !if "$(EXTSTATIC)" == "static"