From 689b5ae75277ddfc01e1e7b5a3c5ce393b2d1d19 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Fri, 27 May 2022 11:27:15 +0900 Subject: Split YJIT rules for CODEOWNERS --- defs/gmake.mk | 55 +------------------------------------------------------ yjit/yjit.mk | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 54 deletions(-) create mode 100644 yjit/yjit.mk diff --git a/defs/gmake.mk b/defs/gmake.mk index 91e5b273f1..929238af7b 100644 --- a/defs/gmake.mk +++ b/defs/gmake.mk @@ -357,60 +357,7 @@ ifneq ($(REVISION_IN_HEADER),$(REVISION_LATEST)) $(srcdir)/revision.h: $(REVISION_H) endif -# Show Cargo progress when doing `make V=1` -CARGO_VERBOSE_0 = -q -CARGO_VERBOSE_1 = -CARGO_VERBOSE = $(CARGO_VERBOSE_$(V)) - -# Select between different build profiles with macro substitution -.PHONY: yjit-static-lib -yjit-static-lib: yjit-static-lib-$(YJIT_SUPPORT) - -# YJIT_SUPPORT=yes when `configure` gets `--enable-yjit` -yjit-static-lib-yes: - $(ECHO) 'building Rust YJIT (release mode)' - $(Q) $(RUSTC) \ - --crate-name=yjit \ - --crate-type=staticlib \ - --edition=2021 \ - -C opt-level=3 \ - -C overflow-checks=on \ - '--out-dir=$(CARGO_TARGET_DIR)/release/' \ - $(top_srcdir)/yjit/src/lib.rs - -yjit-static-lib-no: - $(ECHO) 'Error: Tried to build YJIT without configuring it first. Check `make showconfig`?' - @false - -yjit-static-lib-dev: - $(ECHO) 'building Rust YJIT (dev mode)' - $(Q)$(CHDIR) $(top_srcdir)/yjit && \ - CARGO_TARGET_DIR='$(CARGO_TARGET_DIR)' \ - CARGO_TERM_PROGRESS_WHEN='never' \ - $(CARGO) $(CARGO_VERBOSE) build $(CARGO_BUILD_ARGS) - -# This PHONY prerequisite makes it so that we always run cargo. When there are -# no Rust changes on rebuild, Cargo does not touch the mtime of the static -# library and GNU make avoids relinking. $(empty) seems to be important to -# trigger rebuild each time in release mode. -$(YJIT_LIBS): yjit-static-lib - $(empty) - -# Put this here instead of in common.mk to avoid breaking nmake builds -# TODO: might need to move for BSD Make support -miniruby$(EXEEXT): $(YJIT_LIBS) - -# Generate Rust bindings. See source for details. -# Needs `./configure --enable-yjit=dev` and Clang. -ifneq ($(strip $(CARGO)),) # if configure found Cargo -.PHONY: yjit-bindgen -yjit-bindgen: yjit.$(OBJEXT) - YJIT_SRC_ROOT_PATH='$(top_srcdir)' $(CARGO) run --manifest-path '$(top_srcdir)/yjit/bindgen/Cargo.toml' -- $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) - -# For CI, check whether YJIT's FFI bindings are up-to-date. -check-yjit-bindings: yjit-bindgen - git -C "$(top_srcdir)" diff --exit-code yjit/src/cruby_bindings.inc.rs -endif +include $(top_srcdir)/yjit/yjit.mk # Query on the generated rdoc # diff --git a/yjit/yjit.mk b/yjit/yjit.mk new file mode 100644 index 0000000000..2c3a6b3af8 --- /dev/null +++ b/yjit/yjit.mk @@ -0,0 +1,56 @@ +# -*- mode: makefile-gmake; indent-tabs-mode: t -*- + +# Show Cargo progress when doing `make V=1` +CARGO_VERBOSE_0 = -q +CARGO_VERBOSE_1 = +CARGO_VERBOSE = $(CARGO_VERBOSE_$(V)) + +# Select between different build profiles with macro substitution +.PHONY: yjit-static-lib +yjit-static-lib: yjit-static-lib-$(YJIT_SUPPORT) + +# YJIT_SUPPORT=yes when `configure` gets `--enable-yjit` +yjit-static-lib-yes: + $(ECHO) 'building Rust YJIT (release mode)' + $(Q) $(RUSTC) \ + --crate-name=yjit \ + --crate-type=staticlib \ + --edition=2021 \ + -C opt-level=3 \ + -C overflow-checks=on \ + '--out-dir=$(CARGO_TARGET_DIR)/release/' \ + $(top_srcdir)/yjit/src/lib.rs + +yjit-static-lib-no: + $(ECHO) 'Error: Tried to build YJIT without configuring it first. Check `make showconfig`?' + @false + +yjit-static-lib-dev: + $(ECHO) 'building Rust YJIT (dev mode)' + $(Q)$(CHDIR) $(top_srcdir)/yjit && \ + CARGO_TARGET_DIR='$(CARGO_TARGET_DIR)' \ + CARGO_TERM_PROGRESS_WHEN='never' \ + $(CARGO) $(CARGO_VERBOSE) build $(CARGO_BUILD_ARGS) + +# This PHONY prerequisite makes it so that we always run cargo. When there are +# no Rust changes on rebuild, Cargo does not touch the mtime of the static +# library and GNU make avoids relinking. $(empty) seems to be important to +# trigger rebuild each time in release mode. +$(YJIT_LIBS): yjit-static-lib + $(empty) + +# Put this here instead of in common.mk to avoid breaking nmake builds +# TODO: might need to move for BSD Make support +miniruby$(EXEEXT): $(YJIT_LIBS) + +# Generate Rust bindings. See source for details. +# Needs `./configure --enable-yjit=dev` and Clang. +ifneq ($(strip $(CARGO)),) # if configure found Cargo +.PHONY: yjit-bindgen +yjit-bindgen: yjit.$(OBJEXT) + YJIT_SRC_ROOT_PATH='$(top_srcdir)' $(CARGO) run --manifest-path '$(top_srcdir)/yjit/bindgen/Cargo.toml' -- $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) + +# For CI, check whether YJIT's FFI bindings are up-to-date. +check-yjit-bindings: yjit-bindgen + git -C "$(top_srcdir)" diff --exit-code yjit/src/cruby_bindings.inc.rs +endif -- cgit v1.2.3