[前][次][番号順一覧][スレッド一覧]

ruby-changes:51973

From: k0kubun <ko1@a...>
Date: Sun, 5 Aug 2018 08:53:47 +0900 (JST)
Subject: [ruby-changes:51973] k0kubun:r64188 (trunk): win32/Makefile.sub: build precompiled header

k0kubun	2018-08-05 08:53:41 +0900 (Sun, 05 Aug 2018)

  New Revision: 64188

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=64188

  Log:
    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.

  Modified files:
    trunk/.gitignore
    trunk/win32/Makefile.sub
Index: win32/Makefile.sub
===================================================================
--- win32/Makefile.sub	(revision 64187)
+++ win32/Makefile.sub	(revision 64188)
@@ -310,6 +310,8 @@ MJIT_HEADER_FLAGS = -P https://github.com/ruby/ruby/blob/trunk/win32/Makefile.sub#L310
 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 https://github.com/ruby/ruby/blob/trunk/win32/Makefile.sub#L1266
 #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
 
Index: .gitignore
===================================================================
--- .gitignore	(revision 64187)
+++ .gitignore	(revision 64188)
@@ -15,6 +15,7 @@ https://github.com/ruby/ruby/blob/trunk/.gitignore#L15
 *.obj
 *.old
 *.orig
+*.pch
 *.pdb
 *.rej
 *.s

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]