summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
authork0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-08-04 23:53:41 (GMT)
committerk0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-08-04 23:53:41 (GMT)
commitcdf72ddc3b1e55d721545867f0fe2381c4bff120 (patch)
tree3038d7ce900605ebda11fbcdd1da424e9fec5fe7 /win32
parentff1e665729d7bf6e3f3d17b0f5eb614b78bef341 (diff)
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
Diffstat (limited to 'win32')
-rw-r--r--win32/Makefile.sub33
1 files changed, 33 insertions, 0 deletions
diff --git a/win32/Makefile.sub b/win32/Makefile.sub
index fff0e55..ceb8cce 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"
<<KEEP
+main: $(MJIT_PRECOMPILED_HEADER)
+mjit-headers: $(MJIT_PRECOMPILED_HEADER)
+clean-local::
+ $(Q)$(RM) $(MJIT_PRECOMPILED_HEADER_NAME) $(MJIT_PRECOMPILED_HEADER_NAME:.pch=.)$(OBJEXT)
+ $(Q)$(RM) $(TIMESTAMPDIR)/$(MJIT_PRECOMPILED_HEADER_NAME:.pch=.time) mjit_config.h
+ $(Q)$(RM) $(MJIT_HEADER_INSTALL_DIR)/rb_mjit_header-*.pch
+ $(Q)$(RM) $(MJIT_HEADER_INSTALL_DIR)/rb_mjit_header-*.$(OBJEXT)
+ -$(Q) $(RMDIRS) $(MJIT_HEADER_INSTALL_DIR) 2> $(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