1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Get rid of FreeBSD make incompatibility [Bug #16331]

FreeBSD make works differently with `-j` option.

> -j	max_jobs
> 	Specify the maximum number of jobs that `make` may have running
>	at any one time.  The value is saved in `.MAKE.JOBS.` Turns
>	compatibility mode off, unless the `B` flag is also specified.
>	When compatibility mode is off, all commands associated with a
>	target are executed in a single shell invocation as opposed to
>	the traditional one shell invocation per line.  This can break
>	traditional scripts which change directories on each command
>	invocation and then expect to start with a fresh environment on
>	the next line.  It is more efficient to correct the scripts
>	rather than turn backwards compatibility on.

Stop using exit, cd, exec in middle of commands.
This commit is contained in:
Nobuyoshi Nakada 2019-11-10 09:15:12 +09:00
parent ff767dd914
commit faa4f4f23f
No known key found for this signature in database
GPG key ID: 4BC7D6DF58D8DF60
2 changed files with 45 additions and 36 deletions

View file

@ -345,7 +345,7 @@ $(LIBRUBY_A): $(LIBRUBY_A_OBJS) $(MAINOBJ) $(INITOBJS) $(ARCHFILE)
$(LIBRUBY_SO): $(OBJS) $(DLDOBJS) $(LIBRUBY_A) $(PREP) $(BUILTIN_ENCOBJS)
$(LIBRUBY_EXTS):
@exit > $@
@$(NULLCMD) > $@
$(STATIC_RUBY)$(EXEEXT): $(MAINOBJ) $(DLDOBJS) $(EXTOBJS) $(LIBRUBY_A)
$(Q)$(RM) $@
@ -594,11 +594,14 @@ clean-local:: clean-runnable
$(Q)$(RM) y.tab.c y.output encdb.h transdb.h config.log rbconfig.rb $(ruby_pc) $(COROUTINE_H:/Context.h=/.time)
$(Q)$(RM) probes.h probes.$(OBJEXT) probes.stamp ruby-glommed.$(OBJEXT) ruby.imp
$(Q)$(RM) GNUmakefile.old Makefile.old $(arch)-fake.rb bisect.sh $(ENC_TRANS_D)
-$(Q) $(RMDIR) enc/jis enc/trans enc $(COROUTINE_H:/Context.h=) coroutine 2> $(NULL) || exit 0
clean-runnable:: PHONY
$(Q)$(CHDIR) bin 2>$(NULL) && $(RM) $(PROGRAM) $(WPROGRAM) $(GORUBY)$(EXEEXT) bin/*.$(DLEXT) 2>$(NULL) || exit 0
$(Q)$(CHDIR) lib 2>$(NULL) && $(RM) $(LIBRUBY_A) $(LIBRUBY) $(LIBRUBY_ALIASES) $(RUBY_BASE_NAME)/$(RUBY_PROGRAM_VERSION) $(RUBY_BASE_NAME)/vendor_ruby 2>$(NULL) || exit 0
$(Q)$(RMDIR) lib/$(RUBY_BASE_NAME) lib bin 2>$(NULL) || exit 0
-$(Q) $(RMDIR) enc/jis enc/trans enc $(COROUTINE_H:/Context.h=) coroutine 2> $(NULL) || $(NULLCMD)
bin/clean-runnable:: PHONY
$(Q)$(CHDIR) bin 2>$(NULL) && $(RM) $(PROGRAM) $(WPROGRAM) $(GORUBY)$(EXEEXT) bin/*.$(DLEXT) 2>$(NULL) || $(NULLCMD)
lib/clean-runnable:: PHONY
$(Q)$(CHDIR) lib 2>$(NULL) && $(RM) $(LIBRUBY_A) $(LIBRUBY) $(LIBRUBY_ALIASES) $(RUBY_BASE_NAME)/$(RUBY_PROGRAM_VERSION) $(RUBY_BASE_NAME)/vendor_ruby 2>$(NULL) || $(NULLCMD)
clean-runnable:: bin/clean-runnable lib/clean-runnable PHONY
$(Q)$(RMDIR) lib/$(RUBY_BASE_NAME) lib bin 2>$(NULL) || $(NULLCMD)
clean-ext:: PHONY
clean-golf: PHONY
$(Q)$(RM) $(GORUBY)$(EXEEXT) $(GOLFOBJS)
@ -607,7 +610,7 @@ clean-html: PHONY
clean-capi: PHONY
clean-platform: PHONY
clean-extout: PHONY
-$(Q)$(RMDIR) $(EXTOUT)/$(arch) $(EXTOUT) 2> $(NULL) || exit 0
-$(Q)$(RMDIR) $(EXTOUT)/$(arch) $(EXTOUT) 2> $(NULL) || $(NULLCMD)
clean-docs: clean-rdoc clean-html clean-capi
clean-spec: PHONY
clean-rubyspec: clean-spec
@ -643,9 +646,10 @@ clean-srcs-local::
$(Q)$(RM) $(MJIT_MIN_HEADER) $(MJIT_MIN_HEADER:.h=)$(MJIT_HEADER_SUFFIX:%=*).h
realclean-srcs-local:: clean-srcs-local
$(Q)$(CHDIR) $(srcdir) && $(exec) $(RM) parse.c parse.h lex.c enc/trans/newline.c $(PRELUDES) revision.h
$(Q)$(CHDIR) $(srcdir) && $(exec) $(RM) id.c id.h probes.dmyh
$(Q)$(CHDIR) $(srcdir) && $(exec) $(RM) configure aclocal.m4 tool/config.guess tool/config.sub gems/*.gem
$(Q)$(CHDIR) $(srcdir) && $(RM) \
parse.c parse.h lex.c enc/trans/newline.c $(PRELUDES) revision.h \
id.c id.h probes.dmyh configure aclocal.m4 tool/config.guess tool/config.sub gems/*.gem \
|| $(NULLCMD)
clean-srcs-ext::
realclean-srcs-ext:: clean-srcs-ext
@ -677,14 +681,14 @@ timestamp/realclean:: ext/realclean gems/realclean
timestamp/clean timestamp/distclean timestamp/realclean::
$(Q)$(RM) $(TIMESTAMPDIR)/.*.time $(TIMESTAMPDIR)/$(arch)/.time
$(Q)$(RMDIRS) $(TIMESTAMPDIR)/$(arch) $(TIMESTAMPDIR) 2> $(NULL) || exit 0
$(Q)$(RMDIRS) $(TIMESTAMPDIR)/$(arch) $(TIMESTAMPDIR) 2> $(NULL) || $(NULLCMD)
clean-ext::
-$(Q)$(RM) ext/extinit.$(OBJEXT)
distclean-ext realclean-ext::
-$(Q)$(RM) $(EXTS_MK) ext/extinit.* ext/configure-ext.mk
-$(Q)$(RMDIR) ext 2> $(NULL) || exit 0
-$(Q)$(RMDIR) ext 2> $(NULL) || $(NULLCMD)
clean-enc distclean-enc realclean-enc: PHONY
@ -692,7 +696,7 @@ clean-enc: clean-enc.d
clean-enc.d: PHONY
$(Q)$(RM) $(ENC_TRANS_D)
-$(Q) $(RMDIR) enc/jis enc/trans enc 2> $(NULL) || exit 0
-$(Q) $(RMDIR) enc/jis enc/trans enc 2> $(NULL) || $(NULLCMD)
clean-rdoc distclean-rdoc realclean-rdoc:
@echo $(@:-rdoc=ing) rdoc
@ -708,12 +712,12 @@ clean-capi distclean-capi realclean-capi:
clean-platform:
$(Q) $(RM) $(PLATFORM_D)
-$(Q) $(RMDIR) $(PLATFORM_DIR) 2> $(NULL) || exit 0
-$(Q) $(RMDIR) $(PLATFORM_DIR) 2> $(NULL) || $(NULLCMD)
RUBYSPEC_CAPIEXT = spec/ruby/optional/capi/ext
clean-spec: PHONY
-$(Q) $(RM) $(RUBYSPEC_CAPIEXT)/*.$(OBJEXT) $(RUBYSPEC_CAPIEXT)/*.$(DLEXT)
-$(Q) $(RMDIRS) $(RUBYSPEC_CAPIEXT) 2> $(NULL) || exit 0
-$(Q) $(RMDIRS) $(RUBYSPEC_CAPIEXT) 2> $(NULL) || $(NULLCMD)
check: main test test-tool test-all test-spec
$(ECHO) check succeeded
@ -867,7 +871,7 @@ PHONY:
$(PLATFORM_D):
$(Q) $(MAKEDIRS) $(PLATFORM_DIR) $(@D)
@exit > $@
@$(NULLCMD) > $@
exe/$(PROGRAM): ruby-runner.c ruby-runner.h exe/.time miniruby$(EXEEXT) {$(VPATH)}config.h
$(Q) $(CC) $(CFLAGS) $(INCFLAGS) $(CPPFLAGS) -DRUBY_INSTALL_NAME=$(@F) $(COUTFLAG)ruby-runner.$(OBJEXT) -c $(CSRCFLAG)$(srcdir)/ruby-runner.c
@ -884,17 +888,17 @@ exe/$(PROGRAM): ruby-runner.c ruby-runner.h exe/.time miniruby$(EXEEXT) {$(VPATH
exe/.time:
$(Q) $(MAKEDIRS) $(@D)
@exit > $@
@$(NULLCMD) > $@
$(BUILTIN_ENCOBJS) $(BUILTIN_TRANSOBJS): $(ENC_TRANS_D)
$(ENC_TRANS_D):
$(Q) $(MAKEDIRS) enc/trans $(@D)
@exit > $@
@$(NULLCMD) > $@
$(TIMESTAMPDIR)/$(arch)/.time:
$(Q)$(MAKEDIRS) $(@D) $(EXTOUT)/$(arch)
@exit > $@
@$(NULLCMD) > $@
###
CCAN_DIR = {$(VPATH)}ccan
@ -930,7 +934,7 @@ nt.$(OBJEXT): {$(VPATH)}nt.c
$(COROUTINE_H:/Context.h=/.time)
$(COROUTINE_H:/Context.h=/.time):
$(Q) $(MAKEDIRS) $(@D)
@exit > $@
@$(NULLCMD) > $@
###
@ -1115,10 +1119,10 @@ $(BUILTIN_RB_INCS): $(top_srcdir)/tool/mk_builtin_loader.rb
$(srcdir)/revision.h:
$(Q)$(gnumake:yes=#) $(RM) $(@F)
$(Q)$(gnumake:yes=#) exit > $@ || exit > $(@F)
$(Q)$(gnumake:yes=#) $(NULLCMD) > $@ || $(NULLCMD) > $(@F)
revision.tmp::
$(Q)exit > $@
$(Q) $(NULLCMD) > $@
revision.$(HAVE_BASERUBY:yes=tmp):: $(srcdir)/version.h $(srcdir)/tool/file2lastrev.rb $(REVISION_FORCE)
$(Q) $(BASERUBY) $(srcdir)/tool/file2lastrev.rb -q --revision.h --srcdir="$(srcdir)" > $@
@ -1440,7 +1444,7 @@ $(UNICODE_SRC_DATA_DIR)/.unicode-tables.time: $(srcdir)/tool/generic_erb.rb \
$(UNICODE_DATA_DIR) lib/unicode_normalize
$(UNICODE_SRC_DATA_DIR):
$(Q) $(exec) $(MAKEDIRS) $@ || exit && echo $(MAKE)
$(gnumake_recursive)$(Q) $(MAKEDIRS) $@
$(UNICODE_HDR_DIR)/$(ALWAYS_UPDATE_UNICODE:yes=name2ctype.h): \
$(srcdir)/tool/enc-unicode.rb \

View file

@ -275,7 +275,7 @@ $(PROGRAM):
$(Q) $(PURIFY) $(CC) $(LDFLAGS) $(XLDFLAGS) $(MAINOBJ) $(EXTOBJS) $(LIBRUBYARG) $(MAINLIBS) $(LIBS) $(EXTLIBS) $(OUTFLAG)$@
$(Q) $(POSTLINK)
PRE_LIBRUBY_UPDATE = [ -n "$(LIBRUBY_SO_UPDATE)" ] || $(exec) $(RM) $(LIBRUBY_EXTS)
PRE_LIBRUBY_UPDATE = [ -n "$(LIBRUBY_SO_UPDATE)" ] || $(gnumake:yes=exec) $(RM) $(LIBRUBY_EXTS)
# We must `rm' the library each time this rule is invoked because "updating" a
# MAB library on Apple/NeXT (see --enable-fat-binary in configure) is not
@ -456,12 +456,14 @@ probes.$(OBJEXT): $(srcdir)/probes.d $(DTRACE_REBUILD:yes=probes.stamp)
main: mjit-headers
yes-mjit-headers: $(MJIT_MIN_HEADER)
clean-local::
$(Q)$(RM) $(MJIT_HEADER) $(MJIT_HEADER:.h=)$(MJIT_HEADER_SUFFIX:%=*).h
$(Q)$(RM) $(MJIT_MIN_HEADER) $(MJIT_MIN_HEADER:.h=)$(MJIT_HEADER_SUFFIX:%=*).h
$(Q)$(RM) $(MJIT_HEADER_INSTALL_DIR)/rb_mjit_min_header-*.h
$(Q)$(RM) $(TIMESTAMPDIR)/$(MJIT_HEADER:.h=)$(MJIT_HEADER_SUFFIX).time mjit_config.h
$(Q)$(RM) \
$(MJIT_HEADER) $(MJIT_HEADER:.h=)$(MJIT_HEADER_SUFFIX:%=*).h \
$(MJIT_MIN_HEADER) $(MJIT_MIN_HEADER:.h=)$(MJIT_HEADER_SUFFIX:%=*).h \
$(MJIT_HEADER_INSTALL_DIR)/rb_mjit_min_header-*.h \
$(TIMESTAMPDIR)/$(MJIT_HEADER:.h=)$(MJIT_HEADER_SUFFIX).time mjit_config.h \
|| $(NULLCMD)
$(Q)$(RM) -r mjit_build_dir.*
-$(Q) $(RMDIRS) $(MJIT_HEADER_INSTALL_DIR) $(MJIT_HEADER_BUILD_DIR) $(TIMESTAMPDIR) 2> $(NULL) || exit 0
-$(Q) $(RMDIRS) $(MJIT_HEADER_INSTALL_DIR) $(MJIT_HEADER_BUILD_DIR) $(TIMESTAMPDIR) 2> $(NULL) || $(NULLCMD)
# DTrace static library hacks described here:
# http://mail.opensolaris.org/pipermail/dtrace-discuss/2005-August/000207.html
@ -470,15 +472,18 @@ ruby-glommed.$(OBJEXT):
$(Q) $(LD) -r -o $@ $(OBJS)
clean-local::
$(Q)$(RM) ext/extinit.c ext/extinit.$(OBJEXT) ext/ripper/y.output \
enc/encinit.c enc/encinit.$(OBJEXT)
-$(Q)$(RM) $(pkgconfig_DATA)
-$(Q)$(RMALL) exe/ ruby-runner.$(OBJEXT) ruby-runner.h *.dSYM
$(Q)$(RM) \
ext/extinit.c ext/extinit.$(OBJEXT) ext/ripper/y.output \
enc/encinit.c enc/encinit.$(OBJEXT) $(pkgconfig_DATA) \
ruby-runner.$(OBJEXT) ruby-runner.h *.dSYM \
|| $(NULLCMD)
-$(Q)$(RMALL) exe/
distclean-local::
$(Q)$(RM) ext/config.cache $(RBCONFIG) Doxyfile
-$(Q)$(RM) run.gdb
-$(Q)$(RM) $(INSTALLED_LIST) $(arch_hdrdir)/ruby/config.h verconf.h
$(Q)$(RM) \
ext/config.cache $(RBCONFIG) Doxyfile run.gdb \
$(INSTALLED_LIST) $(arch_hdrdir)/ruby/config.h verconf.h \
|| $(NULLCMD)
-$(Q)$(RMDIRS) $(arch_hdrdir)/ruby 2> /dev/null || true
ext/clean.sub:: ext/clean.mk