From ac6924e10eed6a0747ed61f53d793b2611a5f72f Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sat, 3 Jul 2021 22:39:14 +0900 Subject: [PATCH] goruby.c: include golf_prelude.c to get rid of overwriting EXTOBJS --- common.mk | 211 +++++++----------------------------------------------- goruby.c | 6 +- 2 files changed, 31 insertions(+), 186 deletions(-) diff --git a/common.mk b/common.mk index e1457d7593..4eaae1e9c3 100644 --- a/common.mk +++ b/common.mk @@ -164,7 +164,7 @@ EXPORTOBJS = $(DLNOBJ) \ OBJS = $(EXPORTOBJS) builtin.$(OBJEXT) ALLOBJS = $(NORMALMAINOBJ) $(MINIOBJS) $(COMMONOBJS) $(INITOBJS) -GOLFOBJS = goruby.$(OBJEXT) golf_prelude.$(OBJEXT) +GOLFOBJS = goruby.$(OBJEXT) DEFAULT_PRELUDES = $(GEM_PRELUDE) PRELUDE_SCRIPTS = $(DEFAULT_PRELUDES) @@ -326,7 +326,6 @@ $(GOLF): $(LIBRUBY) $(GOLFOBJS) PHONY $(Q) $(MAKE) $(mflags) \ GOLF=_dummy_golf_target_to_avoid_conflict_just_in_case_ \ MAINOBJ=goruby.$(OBJEXT) \ - EXTOBJS="golf_prelude.$(OBJEXT) $(EXTOBJS)" \ PROGRAM=$(GORUBY)$(EXEEXT) \ V=$(V) \ program @@ -5844,192 +5843,22 @@ gc.$(OBJEXT): {$(VPATH)}vm_core.h gc.$(OBJEXT): {$(VPATH)}vm_debug.h gc.$(OBJEXT): {$(VPATH)}vm_opts.h gc.$(OBJEXT): {$(VPATH)}vm_sync.h -golf_prelude.$(OBJEXT): $(CCAN_DIR)/check_type/check_type.h -golf_prelude.$(OBJEXT): $(CCAN_DIR)/container_of/container_of.h -golf_prelude.$(OBJEXT): $(CCAN_DIR)/list/list.h -golf_prelude.$(OBJEXT): $(CCAN_DIR)/str/str.h -golf_prelude.$(OBJEXT): $(hdrdir)/ruby.h -golf_prelude.$(OBJEXT): $(hdrdir)/ruby/ruby.h -golf_prelude.$(OBJEXT): $(top_srcdir)/internal/array.h -golf_prelude.$(OBJEXT): $(top_srcdir)/internal/compilers.h -golf_prelude.$(OBJEXT): $(top_srcdir)/internal/gc.h -golf_prelude.$(OBJEXT): $(top_srcdir)/internal/imemo.h -golf_prelude.$(OBJEXT): $(top_srcdir)/internal/serial.h -golf_prelude.$(OBJEXT): $(top_srcdir)/internal/static_assert.h -golf_prelude.$(OBJEXT): $(top_srcdir)/internal/vm.h -golf_prelude.$(OBJEXT): $(top_srcdir)/internal/warnings.h -golf_prelude.$(OBJEXT): {$(VPATH)}assert.h -golf_prelude.$(OBJEXT): {$(VPATH)}atomic.h -golf_prelude.$(OBJEXT): {$(VPATH)}backward/2/assume.h -golf_prelude.$(OBJEXT): {$(VPATH)}backward/2/attributes.h -golf_prelude.$(OBJEXT): {$(VPATH)}backward/2/bool.h -golf_prelude.$(OBJEXT): {$(VPATH)}backward/2/gcc_version_since.h -golf_prelude.$(OBJEXT): {$(VPATH)}backward/2/inttypes.h -golf_prelude.$(OBJEXT): {$(VPATH)}backward/2/limits.h -golf_prelude.$(OBJEXT): {$(VPATH)}backward/2/long_long.h -golf_prelude.$(OBJEXT): {$(VPATH)}backward/2/stdalign.h -golf_prelude.$(OBJEXT): {$(VPATH)}backward/2/stdarg.h -golf_prelude.$(OBJEXT): {$(VPATH)}config.h -golf_prelude.$(OBJEXT): {$(VPATH)}defines.h -golf_prelude.$(OBJEXT): {$(VPATH)}golf_prelude.c -golf_prelude.$(OBJEXT): {$(VPATH)}golf_prelude.rb -golf_prelude.$(OBJEXT): {$(VPATH)}id.h -golf_prelude.$(OBJEXT): {$(VPATH)}intern.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/anyargs.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/arithmetic.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/arithmetic/char.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/arithmetic/double.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/arithmetic/fixnum.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/arithmetic/gid_t.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/arithmetic/int.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/arithmetic/intptr_t.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/arithmetic/long.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/arithmetic/long_long.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/arithmetic/mode_t.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/arithmetic/off_t.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/arithmetic/pid_t.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/arithmetic/short.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/arithmetic/size_t.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/arithmetic/st_data_t.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/arithmetic/uid_t.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/assume.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/attr/alloc_size.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/attr/artificial.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/attr/cold.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/attr/const.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/attr/constexpr.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/attr/deprecated.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/attr/diagnose_if.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/attr/enum_extensibility.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/attr/error.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/attr/flag_enum.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/attr/forceinline.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/attr/format.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/attr/maybe_unused.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/attr/noalias.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/attr/nodiscard.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/attr/noexcept.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/attr/noinline.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/attr/nonnull.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/attr/noreturn.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/attr/pure.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/attr/restrict.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/attr/returns_nonnull.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/attr/warning.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/attr/weakref.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/cast.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/compiler_is.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/compiler_is/apple.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/compiler_is/clang.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/compiler_is/gcc.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/compiler_is/intel.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/compiler_is/msvc.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/compiler_is/sunpro.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/compiler_since.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/config.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/constant_p.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/core.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/core/rarray.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/core/rbasic.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/core/rbignum.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/core/rclass.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/core/rdata.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/core/rfile.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/core/rhash.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/core/robject.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/core/rregexp.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/core/rstring.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/core/rstruct.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/core/rtypeddata.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/ctype.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/dllexport.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/dosish.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/error.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/eval.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/event.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/fl_type.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/gc.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/glob.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/globals.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/has/attribute.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/has/builtin.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/has/c_attribute.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/has/cpp_attribute.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/has/declspec_attribute.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/has/extension.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/has/feature.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/has/warning.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/array.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/bignum.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/class.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/compar.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/complex.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/cont.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/dir.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/enum.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/enumerator.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/error.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/eval.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/file.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/gc.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/hash.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/io.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/load.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/marshal.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/numeric.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/object.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/parse.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/proc.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/process.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/random.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/range.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/rational.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/re.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/ruby.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/select.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/select/largesize.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/signal.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/sprintf.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/string.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/struct.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/thread.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/time.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/variable.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/intern/vm.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/interpreter.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/iterator.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/memory.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/method.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/module.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/newobj.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/rgengc.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/scan_args.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/special_consts.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/static_assert.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/stdalign.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/stdbool.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/symbol.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/value.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/value_type.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/variable.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/warning_push.h -golf_prelude.$(OBJEXT): {$(VPATH)}internal/xmalloc.h -golf_prelude.$(OBJEXT): {$(VPATH)}iseq.h -golf_prelude.$(OBJEXT): {$(VPATH)}method.h -golf_prelude.$(OBJEXT): {$(VPATH)}missing.h -golf_prelude.$(OBJEXT): {$(VPATH)}node.h -golf_prelude.$(OBJEXT): {$(VPATH)}ruby_assert.h -golf_prelude.$(OBJEXT): {$(VPATH)}ruby_atomic.h -golf_prelude.$(OBJEXT): {$(VPATH)}st.h -golf_prelude.$(OBJEXT): {$(VPATH)}subst.h -golf_prelude.$(OBJEXT): {$(VPATH)}thread_$(THREAD_MODEL).h -golf_prelude.$(OBJEXT): {$(VPATH)}thread_native.h -golf_prelude.$(OBJEXT): {$(VPATH)}vm_core.h -golf_prelude.$(OBJEXT): {$(VPATH)}vm_opts.h +goruby.$(OBJEXT): $(CCAN_DIR)/check_type/check_type.h +goruby.$(OBJEXT): $(CCAN_DIR)/container_of/container_of.h +goruby.$(OBJEXT): $(CCAN_DIR)/list/list.h +goruby.$(OBJEXT): $(CCAN_DIR)/str/str.h goruby.$(OBJEXT): $(hdrdir)/ruby.h goruby.$(OBJEXT): $(hdrdir)/ruby/ruby.h +goruby.$(OBJEXT): $(top_srcdir)/internal/array.h +goruby.$(OBJEXT): $(top_srcdir)/internal/compilers.h +goruby.$(OBJEXT): $(top_srcdir)/internal/gc.h +goruby.$(OBJEXT): $(top_srcdir)/internal/imemo.h +goruby.$(OBJEXT): $(top_srcdir)/internal/serial.h +goruby.$(OBJEXT): $(top_srcdir)/internal/static_assert.h +goruby.$(OBJEXT): $(top_srcdir)/internal/vm.h +goruby.$(OBJEXT): $(top_srcdir)/internal/warnings.h goruby.$(OBJEXT): {$(VPATH)}assert.h +goruby.$(OBJEXT): {$(VPATH)}atomic.h goruby.$(OBJEXT): {$(VPATH)}backward.h goruby.$(OBJEXT): {$(VPATH)}backward/2/assume.h goruby.$(OBJEXT): {$(VPATH)}backward/2/attributes.h @@ -6042,8 +5871,12 @@ goruby.$(OBJEXT): {$(VPATH)}backward/2/stdalign.h goruby.$(OBJEXT): {$(VPATH)}backward/2/stdarg.h goruby.$(OBJEXT): {$(VPATH)}config.h goruby.$(OBJEXT): {$(VPATH)}defines.h +goruby.$(OBJEXT): {$(VPATH)}golf_prelude.c +goruby.$(OBJEXT): {$(VPATH)}golf_prelude.rb goruby.$(OBJEXT): {$(VPATH)}goruby.c +goruby.$(OBJEXT): {$(VPATH)}id.h goruby.$(OBJEXT): {$(VPATH)}intern.h +goruby.$(OBJEXT): {$(VPATH)}internal.h goruby.$(OBJEXT): {$(VPATH)}internal/anyargs.h goruby.$(OBJEXT): {$(VPATH)}internal/arithmetic.h goruby.$(OBJEXT): {$(VPATH)}internal/arithmetic/char.h @@ -6183,12 +6016,20 @@ goruby.$(OBJEXT): {$(VPATH)}internal/value_type.h goruby.$(OBJEXT): {$(VPATH)}internal/variable.h goruby.$(OBJEXT): {$(VPATH)}internal/warning_push.h goruby.$(OBJEXT): {$(VPATH)}internal/xmalloc.h +goruby.$(OBJEXT): {$(VPATH)}iseq.h goruby.$(OBJEXT): {$(VPATH)}main.c +goruby.$(OBJEXT): {$(VPATH)}method.h goruby.$(OBJEXT): {$(VPATH)}missing.h goruby.$(OBJEXT): {$(VPATH)}node.h +goruby.$(OBJEXT): {$(VPATH)}ruby_assert.h +goruby.$(OBJEXT): {$(VPATH)}ruby_atomic.h goruby.$(OBJEXT): {$(VPATH)}st.h goruby.$(OBJEXT): {$(VPATH)}subst.h +goruby.$(OBJEXT): {$(VPATH)}thread_$(THREAD_MODEL).h +goruby.$(OBJEXT): {$(VPATH)}thread_native.h +goruby.$(OBJEXT): {$(VPATH)}vm_core.h goruby.$(OBJEXT): {$(VPATH)}vm_debug.h +goruby.$(OBJEXT): {$(VPATH)}vm_opts.h hash.$(OBJEXT): $(hdrdir)/ruby.h hash.$(OBJEXT): $(hdrdir)/ruby/ruby.h hash.$(OBJEXT): $(top_srcdir)/internal/array.h diff --git a/goruby.c b/goruby.c index e4119c56f7..c90fc97b0a 100644 --- a/goruby.c +++ b/goruby.c @@ -1,4 +1,6 @@ -void Init_golf(void); +static void Init_golf(void); +static void *goruby_options(int argc, char **argv); +static int goruby_run_node(void *arg); #define ruby_options goruby_options #define ruby_run_node goruby_run_node #include "main.c" @@ -17,6 +19,8 @@ RUBY_EXTERN void *ruby_options(int argc, char **argv); RUBY_EXTERN int ruby_run_node(void*); RUBY_EXTERN void ruby_init_ext(const char *name, void (*init)(void)); +#include "golf_prelude.c" + static VALUE init_golf(VALUE arg) {