YJIT: Support MAKE=bmake for release build

This add support for bmake, which should allow building with
`configure --enable-yjit` for the BSDs. Tested on FreeBSD 13 and
on macOS with `configure MAKE=bmake` on a case-sensitive file system.

It works by including a fragment into the Makefile through the configure
script, similar to common.mk. It uses the always rebuild approach to
keep build system changes minimal.
This commit is contained in:
Alan Wu 2022-09-20 08:36:06 -04:00
Родитель b3d8dddee7
Коммит a8dc49b4d5
4 изменённых файлов: 28 добавлений и 10 удалений

Просмотреть файл

@ -219,6 +219,14 @@ MAKE_LINK = $(MINIRUBY) -rfileutils -e "include FileUtils::Verbose" \
-e "noraise {ln(src, dest)} or" \ -e "noraise {ln(src, dest)} or" \
-e "cp(src, dest)" -e "cp(src, dest)"
# For release builds
YJIT_RUSTC_ARGS = --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
all: $(SHOWFLAGS) main docs all: $(SHOWFLAGS) main docs

Просмотреть файл

@ -4370,6 +4370,10 @@ AC_CONFIG_FILES(Makefile:template/Makefile.in, [
AS_IF([test "$gnumake" != yes], [ AS_IF([test "$gnumake" != yes], [
echo ['$(MKFILES): $(srcdir)/common.mk'] echo ['$(MKFILES): $(srcdir)/common.mk']
sed ['s/{\$([^(){}]*)[^{}]*}//g'] ${srcdir}/common.mk sed ['s/{\$([^(){}]*)[^{}]*}//g'] ${srcdir}/common.mk
AS_IF([test "$YJIT_SUPPORT" = yes], [
cat ${srcdir}/yjit/not_gmake.mk
echo ['$(MKFILES): ${srcdir}/yjit/not_gmake.mk']
])
], [ ], [
echo 'distclean-local::; @$(RM) GNUmakefile uncommon.mk' echo 'distclean-local::; @$(RM) GNUmakefile uncommon.mk'
]) ])
@ -4387,7 +4391,7 @@ AC_CONFIG_FILES(Makefile:template/Makefile.in, [
echo 'ruby: $(PROGRAM);' >> $tmpmk echo 'ruby: $(PROGRAM);' >> $tmpmk
test "$tmpmk" = "$tmpgmk" || rm -f "$tmpgmk" test "$tmpmk" = "$tmpgmk" || rm -f "$tmpgmk"
]) && mv -f $tmpmk Makefile], ]) && mv -f $tmpmk Makefile],
[EXEEXT='$EXEEXT' MAKE='${MAKE-make}' gnumake='$gnumake' GIT='$GIT']) [EXEEXT='$EXEEXT' MAKE='${MAKE-make}' gnumake='$gnumake' GIT='$GIT' YJIT_SUPPORT='$YJIT_SUPPORT'])
AC_ARG_WITH([ruby-pc], AC_ARG_WITH([ruby-pc],
AS_HELP_STRING([--with-ruby-pc=FILENAME], [pc file basename]), AS_HELP_STRING([--with-ruby-pc=FILENAME], [pc file basename]),

14
yjit/not_gmake.mk Normal file
Просмотреть файл

@ -0,0 +1,14 @@
# This file is included into the Makefile when
# we're *not* using GNU make. Stick to basic features.
# Rebuild every time since we don't want to list Rust source
# file dependencies.
.PHONY: yjit-static-lib
$(YJIT_LIBS): yjit-static-lib
$(empty)
yjit-static-lib:
$(ECHO) 'building Rust YJIT (release mode)'
$(Q) $(RUSTC) $(YJIT_RUSTC_ARGS)
miniruby$(EXEEXT): $(YJIT_LIBS)

Просмотреть файл

@ -23,14 +23,7 @@ YJIT_LIB_TOUCH = touch $@
ifeq ($(YJIT_SUPPORT),yes) ifeq ($(YJIT_SUPPORT),yes)
$(YJIT_LIBS): $(YJIT_SRC_FILES) $(YJIT_LIBS): $(YJIT_SRC_FILES)
$(ECHO) 'building Rust YJIT (release mode)' $(ECHO) 'building Rust YJIT (release mode)'
$(Q) $(RUSTC) \ $(Q) $(RUSTC) $(YJIT_RUSTC_ARGS)
--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_LIB_TOUCH) $(YJIT_LIB_TOUCH)
else ifeq ($(YJIT_SUPPORT),no) else ifeq ($(YJIT_SUPPORT),no)
$(YJIT_LIBS): $(YJIT_LIBS):
@ -48,7 +41,6 @@ else
endif endif
# Put this here instead of in common.mk to avoid breaking nmake builds # 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) miniruby$(EXEEXT): $(YJIT_LIBS)
# By using YJIT_BENCH_OPTS instead of RUN_OPTS, you can skip passing the options to `make install` # By using YJIT_BENCH_OPTS instead of RUN_OPTS, you can skip passing the options to `make install`