diff options
author | k0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-08-04 23:53:41 +0000 |
---|---|---|
committer | k0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-08-04 23:53:41 +0000 |
commit | cdf72ddc3b1e55d721545867f0fe2381c4bff120 (patch) | |
tree | 3038d7ce900605ebda11fbcdd1da424e9fec5fe7 | |
parent | ff1e665729d7bf6e3f3d17b0f5eb614b78bef341 (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
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | win32/Makefile.sub | 33 |
2 files changed, 34 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore index 5adf6ccf52..9849721d2a 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,7 @@ *.obj *.old *.orig +*.pch *.pdb *.rej *.s 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" <<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 |