From ca0b1af967cf2dec670d3baa0d176090aa0eb7ae Mon Sep 17 00:00:00 2001 From: k0kubun Date: Sat, 4 Aug 2018 23:53:41 +0000 Subject: win32/Makefile.sub: build precompiled header See the comment in win32/Makefile.sub. Not only .pch, but also .obj needs to be installed and used on runtime. .gitignore: ignore .pch that will be built by this. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64188 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- win32/Makefile.sub | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'win32/Makefile.sub') diff --git a/win32/Makefile.sub b/win32/Makefile.sub index fff0e55d75..ceb8ccedad 100644 --- a/win32/Makefile.sub +++ b/win32/Makefile.sub @@ -310,6 +310,8 @@ MJIT_HEADER_FLAGS = -P MJIT_HEADER_SUFFIX = MJIT_HEADER_ARCH = MJIT_HEADER_INSTALL_DIR = include/$(RUBY_VERSION_NAME)/$(arch) +MJIT_PRECOMPILED_HEADER_NAME = rb_mjit_header-$(RUBY_PROGRAM_VERSION).pch +MJIT_PRECOMPILED_HEADER = $(MJIT_HEADER_INSTALL_DIR)/$(MJIT_PRECOMPILED_HEADER_NAME) !ifndef MJIT_CC MJIT_CC = $(CC) !endif @@ -1264,6 +1266,37 @@ probes.h: {$(VPATH)}probes.dmyh #include "$(*F).dmyh" < $(NULL) || exit 0 + +# Non-mswin environment is not using prebuilt precompiled header because upgrading compiler +# or changing compiler options may break MJIT so build (currently only by --jit-debug though). +# +# But mswin is building precompiled header because cl.exe cannot leave macro after preprocess. +# As a workaround to use macro without installing many source files, it uses precompiled header +# without sufficient guard for a broken build. +# +# TODO: Fix the above issue by including VC version in header name, and create another header +# for --jit-debug as well. +$(TIMESTAMPDIR)/$(MJIT_PRECOMPILED_HEADER_NAME:.pch=).time: probes.h vm.$(OBJEXT) + $(ECHO) building $(@F:.time=.pch) + $(Q) $(CC) -DMJIT_HEADER $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(srcdir)/vm.c -c -Yc \ + $(COUTFLAG)$(@F:.time=.)$(OBJEXT) -Fp$(@F:.time=.pch).new + $(Q) $(IFCHANGE) "--timestamp=$@" $(@F:.time=.pch) $(@F:.time=.pch).new + +$(MJIT_PRECOMPILED_HEADER_NAME): $(TIMESTAMPDIR)/$(MJIT_PRECOMPILED_HEADER_NAME:.pch=).time + +$(MJIT_PRECOMPILED_HEADER): $(MJIT_PRECOMPILED_HEADER_NAME) + $(Q) $(MAKEDIRS) $(MJIT_HEADER_INSTALL_DIR) + $(Q) $(MAKE_LINK) $(MJIT_PRECOMPILED_HEADER_NAME) $@ + $(Q) $(MAKE_LINK) $(MJIT_PRECOMPILED_HEADER_NAME:.pch=.)$(OBJEXT) $(MJIT_HEADER_INSTALL_DIR)/$(MJIT_PRECOMPILED_HEADER_NAME:.pch=.)$(OBJEXT) + INSNS = opt_sc.inc optinsn.inc optunifs.inc insns.inc insns_info.inc \ vmtc.inc vm.inc mjit_compile.inc -- cgit v1.2.3