diff --git a/Makefile.in b/Makefile.in index 2b308f49ee..24ae13bac6 100644 --- a/Makefile.in +++ b/Makefile.in @@ -69,7 +69,7 @@ optflags = @optflags@ debugflags = @debugflags@ warnflags = @warnflags@ @strict_warnflags@ cppflags = @cppflags@ -XCFLAGS = @XCFLAGS@ $(MJIT_CPPFLAGS) +XCFLAGS = @XCFLAGS@ CPPFLAGS = @CPPFLAGS@ $(INCFLAGS) MJIT_HEADER_FLAGS = @MJIT_HEADER_FLAGS@ MJIT_HEADER_SUFFIX = @@ -553,6 +553,8 @@ mjit_config.h: echo '#ifndef RUBY_MJIT_CONFIG_H'; \ echo '#define RUBY_MJIT_CONFIG_H 1'; \ echo; \ + sep=; \ + quote MJIT_HEADER_INSTALL_DIR "$(MJIT_HEADER_INSTALL_DIR)"; \ sep=,; \ quote "MJIT_CC_COMMON " $(CC); \ quote "MJIT_CFLAGS " -w $(ARCH_FLAG); \ @@ -560,6 +562,7 @@ mjit_config.h: quote "MJIT_DEBUGFLAGS " $(debugflags); \ quote "MJIT_LDSHARED " @LDSHARED@; \ quote "MJIT_DLDFLAGS " @DLDFLAGS@; \ + quote "MJIT_LIBS " $(LIBRUBYARG_SHARED); \ echo; \ echo '#endif /* RUBY_MJIT_CONFIG_H */'; \ } > $@ diff --git a/common.mk b/common.mk index 9deb8cb3dd..69ab1a0733 100644 --- a/common.mk +++ b/common.mk @@ -61,8 +61,6 @@ HTMLOUT = $(EXTOUT)/html CAPIOUT = doc/capi MJIT_HEADER = rb_mjit_header.h MJIT_MIN_HEADER = $(MJIT_HEADER_BUILD_DIR)/rb_mjit_min_header-$(RUBY_PROGRAM_VERSION).h -MJIT_CPPFLAGS = -DMJIT_HEADER_INSTALL_DIR=\""$(MJIT_HEADER_INSTALL_DIR)"\" \ - -DLIBRUBYARG_SHARED=\""$(LIBRUBYARG_SHARED)"\" MJIT_HEADER_BUILD_DIR = $(EXTOUT)/include/$(arch) INITOBJS = dmyext.$(OBJEXT) dmyenc.$(OBJEXT) diff --git a/mjit.c b/mjit.c index 117e72f750..acd4ea3d27 100644 --- a/mjit.c +++ b/mjit.c @@ -647,7 +647,7 @@ compile_c_to_so(const char *c_file, const char *so_file) const char *libs[] = { #ifdef _WIN32 # ifdef _MSC_VER - LIBRUBYARG_SHARED, + MJIT_LIBS "-link", libruby_installed, libruby_build, @@ -655,8 +655,7 @@ compile_c_to_so(const char *c_file, const char *so_file) /* Look for ruby.dll.a in build and install directories. */ libruby_installed, libruby_build, - /* Link to ruby.dll.a, because Windows DLLs don't allow unresolved symbols. */ - LIBRUBYARG_SHARED, + MJIT_LIBS "-lmsvcrt", "-lgcc", # endif diff --git a/win32/Makefile.sub b/win32/Makefile.sub index 6cfb917acb..0cb1b6ba21 100644 --- a/win32/Makefile.sub +++ b/win32/Makefile.sub @@ -1010,7 +1010,6 @@ s,@top_srcdir@,$(srcdir),;t t s,@try_header@,try_compile,;t t s,@ruby_pc@,$(ruby_pc),;t t <> $@ @echo /* MJIT_DLDFLAGS */>> $@ @ + @(set sep=#define MJIT_LIBS ) & \ + for %I in ($(LIBRUBYARG_SHARED)) do @(call echo.%%sep%%"%%~I", \& set sep= ) >> $@ + @echo /* MJIT_LIBS */>> $@ + @ + @echo.>> $@ @echo #endif /* RUBY_MJIT_CONFIG_H */>> $@ @$(Q:@=: :) type $@