Ticket #66639: Makefile_outside

File Makefile_outside, 24.5 KB (added by erikbs, 22 months ago)
Line 
1RUBY_RELEASE_YEAR = 2022
2RUBY_RELEASE_MONTH = 11
3RUBY_RELEASE_DAY = 24
4# -*- mode: makefile-gmake; indent-tabs-mode: t -*-
5
6SHELL = /bin/sh
7NULLCMD = :
8silence = no # yes/no
9yes_silence = $(silence:no=)
10no_silence = $(silence:yes=)
11n=$(NULLCMD)
12ECHO1 = $(V:1=$n)
13RUNCMD = $(SHELL)
14CDPATH = .
15CHDIR = cd -P
16exec = exec
17NULL = /dev/null
18PATH_SEPARATOR = :
19
20#### Start of system configuration section. ####
21
22srcdir = .
23top_srcdir = $(srcdir)
24hdrdir = $(srcdir)/include
25tooldir = $(srcdir)/tool
26
27PLATFORM_DIR =
28
29CC_WRAPPER =
30CC = clang
31CPP = $(CC) -E
32LD = clang
33YACC = bison
34PURIFY =
35AUTOCONF = autoconf
36CONFIGURE = configure
37
38MKFILES = Makefile GNUmakefile
39BASERUBY = echo executable host ruby is required.  use --with-baseruby option.; false
40HAVE_BASERUBY = no
41TEST_RUNNABLE = yes
42CROSS_COMPILING = no
43DOXYGEN =
44
45prefix = /usr/local
46exec_prefix = ${prefix}
47bindir = ${exec_prefix}/bin
48sbindir = ${exec_prefix}/sbin
49libdir = ${exec_prefix}/lib
50libexecdir = ${exec_prefix}/libexec
51datarootdir = ${prefix}/share
52datadir = ${datarootdir}
53arch = x86_64-darwin13
54sitearch = ${arch}
55sitedir = ${rubylibprefix}/site_ruby
56archlibdir = ${libdir}/${arch}
57includedir = ${prefix}/include
58archincludedir = ${includedir}/${arch}
59rubylibprefix = ${libdir}/${RUBY_BASE_NAME}
60rubylibdir = ${rubylibprefix}/${ruby_version}
61rubyarchprefix = ${rubylibprefix}/${arch}
62rubyarchdir = ${rubylibdir}/${arch}
63rubyhdrdir = /opt/local/include/ruby-31
64rubyarchhdrdir = ${rubyhdrdir}/${arch}
65ruby_version = 3.1.0
66RUBY_VERSION_NAME = ${RUBY_BASE_NAME}-${ruby_version}
67UNIVERSAL_ARCHNAMES =
68
69TESTUI = console
70TESTS =
71INSTALLDOC = nodoc
72DOCTARGETS = nodoc nodoc
73
74EXTOUT = .ext
75TIMESTAMPDIR  = $(EXTOUT)/.timestamp
76arch_hdrdir = $(EXTOUT)/include/$(arch)
77VPATH = $(arch_hdrdir)/ruby:$(hdrdir)/ruby:$(srcdir)/missing
78
79empty =
80CC_VERSION = $(CC) --version
81OUTFLAG = -o $(empty)
82COUTFLAG = -o $(empty)
83CPPOUTFLAG = >
84ARCH_FLAG =
85CFLAGS_NO_ARCH = ${cflags}  -fno-common -pipe
86CFLAGS = $(CFLAGS_NO_ARCH) $(ARCH_FLAG)
87cflags = -fdeclspec ${optflags} ${debugflags} ${warnflags}
88optflags = -O3 -fno-fast-math
89debugflags = -ggdb3
90warnflags = -Wall -Wextra -Wdeprecated-declarations -Wdivision-by-zero -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wshorten-64-to-32 -Wwrite-strings -Wold-style-definition -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wunused-variable -Wextra-tokens -Wundef -std=gnu99
91cppflags =
92XCFLAGS = -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fno-strict-overflow -fvisibility=hidden -DRUBY_EXPORT $(INCFLAGS)
93USE_RUBYGEMS = yes
94USE_RUBYGEMS_ = $(USE_RUBYGEMS:yes=)
95CPPFLAGS = -I/opt/local/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT $(DEFS) ${cppflags} $(USE_RUBYGEMS_:no=-DDISABLE_RUBYGEMS=1)
96MJIT_SUPPORT = yes
97MJIT_HEADER_FLAGS = -P -dD
98MJIT_HEADER_SUFFIX =
99MJIT_HEADER_ARCH =
100MJIT_HEADER_INSTALL_DIR = include/${RUBY_VERSION_NAME}/${arch}
101MJIT_CC = /opt/local/bin/clang
102MJIT_CFLAGS = -w  -fdeclspec
103MJIT_OPTFLAGS = $(optflags)
104MJIT_DEBUGFLAGS = $(debugflags)
105MJIT_LDSHARED = $(MJIT_CC) -dynamic -bundle
106MJIT_DLDFLAGS = $(XDLDFLAGS)
107MJIT_HEADER   = rb_mjit_header.h
108MJIT_MIN_HEADER_NAME = rb_mjit_min_header-$(RUBY_PROGRAM_VERSION).h
109MJIT_MIN_HEADER = $(MJIT_HEADER_BUILD_DIR)/$(MJIT_MIN_HEADER_NAME)
110MJIT_HEADER_BUILD_DIR = $(EXTOUT)/include/$(arch)
111MJIT_TABS=
112LDFLAGS =  $(CFLAGS) -L. -fstack-protector-strong -L/opt/local/lib -L/usr/local/lib -L/opt/local/libexec/llvm-15/lib/clang/15.0.6/lib
113EXE_LDFLAGS = $(LDFLAGS)
114EXTLDFLAGS =
115XLDFLAGS = -fstack-protector-strong -framework Security -framework CoreFoundation $(EXTLDFLAGS)
116EXTLIBS =
117LIBS =  $(EXTLIBS)
118MISSING =  ${LIBOBJDIR}explicit_bzero.o ${LIBOBJDIR}setproctitle.o ${LIBOBJDIR}addr2line.o
119ENABLE_SHARED = yes
120LDSHARED = $(CC) -dynamiclib
121DLDSHARED = $(CC) -dynamiclib
122XDLDFLAGS = -L/opt/local/lib -Wl,-multiply_defined,suppress -Wl,-undefined,dynamic_lookup
123DLDFLAGS = -L/opt/local/lib -Wl,-multiply_defined,suppress -Wl,-undefined,dynamic_lookup -install_name $(libdir)/$(LIBRUBY_SONAME) -compatibility_version $(RUBY_API_VERSION) -current_version $(RUBY_PROGRAM_VERSION)  $(XLDFLAGS) $(XLDFLAGS) $(ARCH_FLAG)
124SOLIBS = $(MAINLIBS)
125ENABLE_DEBUG_ENV =
126MAINLIBS = -lpthread -ldl -lobjc
127ARCHMINIOBJS = dmydln.o
128DLNOBJ = dln.o
129ENCOBJS = dmyenc.$(OBJEXT)
130EXTOBJS = dmyext.$(OBJEXT)
131BUILTIN_ENCOBJS =  enc/ascii.$(OBJEXT) enc/us_ascii.$(OBJEXT) enc/unicode.$(OBJEXT) enc/utf_8.$(OBJEXT)
132BUILTIN_TRANSSRCS =  enc/trans/newline.c
133BUILTIN_TRANSOBJS =  enc/trans/newline.$(OBJEXT)
134POSTLINK = dsymutil $@; { test -z '$(RUBY_CODESIGN)' || codesign -s '$(RUBY_CODESIGN)' -f $@; }
135
136RUBY_BASE_NAME=ruby
137RUBY_API_VERSION=$(MAJOR).$(MINOR)
138RUBY_INSTALL_NAME=$(RUBY_BASE_NAME)31
139RUBY_SO_NAME=$(RUBY_BASE_NAME).$(RUBY_API_VERSION)
140EXEEXT =
141LIBEXT = a
142PROGRAM=$(RUBY_INSTALL_NAME)$(EXEEXT)
143RUBY = $(RUBY_INSTALL_NAME)
144MINIRUBY = ./miniruby$(EXEEXT) -I$(srcdir)/lib -I. -I$(EXTOUT)/common\
145        $(MINIRUBYOPT)
146# RUNRUBY_COMMAND:: runruby.rb or baseruby. do not append options directly
147RUNRUBY_COMMAND = $(MINIRUBY) $(tooldir)/runruby.rb --extout=$(EXTOUT) $(RUNRUBYOPT)
148# RUNRUBY:: run ruby with RUN_OPTS which is passed to ruby
149RUNRUBY = $(RUNRUBY_COMMAND) -- $(RUN_OPTS)
150# RUNRUBY_DEBUGGER:: debugging option for runruby.rb
151RUNRUBY_DEBUGGER = --debugger='gdb -x run.gdb --quiet --args'
152XRUBY = $(RUNRUBY)
153BTESTRUBY = $(MINIRUBY) -r./$(arch)-fake
154INSTALL = /opt/local/bin/ginstall -c
155INSTALL_DATA = ${INSTALL} -m 644
156INSTALL_SCRIPT = ${INSTALL}
157INSTALL_PROGRAM = ${INSTALL}
158XRUBY_LIBDIR =
159XRUBY_RUBYLIBDIR =
160XRUBY_RUBYHDRDIR =
161
162yes_baseruby = $(HAVE_BASERUBY:no=)
163no_baseruby = $(HAVE_BASERUBY:yes=)
164BOOTSTRAPRUBY = $(yes_baseruby:yes=$(BASERUBY)) $(no_baseruby:no=$(MINIRUBY))
165BOOTSTRAPRUBY_OPT = $(yes_baseruby:yes=-r./$(arch)-fake)
166BOOTSTRAPRUBY_FAKE = $(yes_baseruby:yes=$(arch)-fake.rb)
167
168COROUTINE_H = coroutine/amd64/Context.h
169COROUTINE_OBJ = $(COROUTINE_H:.h=.o)
170COROUTINE_SRC = coroutine/amd64/Context.$(ASMEXT)
171
172#### End of system configuration section. ####
173
174MAJOR=  3
175MINOR=  1
176TEENY=  3
177
178# here for MJIT_MIN_HEADER_NAME, not in common.mk
179RUBY_PROGRAM_VERSION = $(MAJOR).$(MINOR).$(TEENY)
180
181LIBRUBY_A     = lib$(RUBY_SO_NAME)-static.a
182LIBRUBY_SO    = lib$(RUBY_SO_NAME).$(SOEXT)
183LIBRUBY_SONAME= $(LIBRUBY_SO)
184LIBRUBY_ALIASES= lib$(RUBY_INSTALL_NAME).$(SOEXT)
185LIBRUBY       = $(LIBRUBY_SO)
186LIBRUBYARG    = $(LIBRUBYARG_SHARED)
187LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static -framework Security -framework CoreFoundation $(MAINLIBS)
188LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME)
189LIBRUBY_RELATIVE = no
190LIBRUBY_A_OBJS = $(OBJS)
191
192DTRACE_REBUILD_OBJS = $(DTRACE_REBUILD:yes=$(DTRACE_DEPENDENT_OBJS))
193
194DTRACE_DEPENDENT_OBJS = array.$(OBJEXT) \
195                        eval.$(OBJEXT) \
196                        gc.$(OBJEXT) \
197                        hash.$(OBJEXT) \
198                        load.$(OBJEXT) \
199                        object.$(OBJEXT) \
200                        parse.$(OBJEXT) \
201                        string.$(OBJEXT) \
202                        symbol.$(OBJEXT) \
203                        vm.$(OBJEXT)
204
205THREAD_MODEL  = pthread
206
207PREP          = miniruby$(EXEEXT)
208ARCHFILE      =
209SETUP         =
210EXTSTATIC     =
211ENCSTATIC     =
212SET_LC_MESSAGES = env LC_MESSAGES=C
213
214MAKEDIRS      = /opt/local/bin/gmkdir -p
215CP            = cp
216MV            = mv
217RM            = rm -f
218RM1           = $(RM)
219RMDIR         = rmdir
220RMDIRS        = rmdir -p
221RMALL         = rm -fr
222LN_S          = ln -s
223NM            = llvm-nm
224AR            = llvm-ar
225ARFLAGS       = rcD $(empty)
226RANLIB        = llvm-ranlib
227AS            = as
228ASFLAGS       =  $(ARCH_FLAG) $(INCFLAGS)
229IFCHANGE      = $(SHELL) $(tooldir)/ifchange
230OBJDUMP       = llvm-objdump
231OBJCOPY       = :
232HAVE_GIT      = yes
233GIT           = git
234VCS           = echo cannot
235VCSUP         = $(VCS)
236DTRACE        = dtrace -xnolibs
237DTRACE_EXT    = d
238DTRACE_OBJ    =
239DTRACE_REBUILD=
240DTRACE_GLOMMED_OBJ = $(DTRACE_REBUILD:yes=ruby-glommed.$(OBJEXT))
241
242OBJEXT        = o
243ASMEXT        = S
244SOEXT         = dylib
245DLEXT         = bundle
246MANTYPE       = doc
247SYMBOL_PREFIX = _
248
249INSTALLED_LIST= .installed.list
250
251NEWLINE_C     = enc/trans/newline.c
252MINIPRELUDE_C = miniprelude.c
253GOLF_PRELUDE_C= golf_prelude.c
254RBCONFIG      = .rbconfig.time
255
256MAINSRC = $(MAINOBJ:.o=.c)
257
258SRC_FILE      = $<
259OS_SRC_FILE   = $<
260DEST_FILE     = $@
261OS_DEST_FILE  = $@
262
263MESSAGE_BEGIN = @for line in
264MESSAGE_END = ; do echo "$$line"; done
265ECHO_BEGIN = @sep=''; for word in
266ECHO_END = ; do echo  "$$sep'$$word'\c"; sep=' '; done; echo
267
268ACTIONS_GROUP = @$(NULLCMD) $(empty)
269ACTIONS_ENDGROUP = @$(NULLCMD)
270
271DESTDIR       =
272
273configure_args =  '--enable-shared' '--enable-install-static-library' '--disable-install-doc' '--mandir=/opt/local/share/man' '--enable-pthread' '--without-gmp' '--with-opt-dir=/opt/local' '--program-suffix=31' '--with-rubyhdrdir=/opt/local/include/ruby-31' '--with-ruby-libprefix=/opt/local/lib/ruby31' '--with-openssl-dir=/opt/local' '--without-baseruby' 'CC=clang'
274#### End of variables
275
276.SUFFIXES: .inc .h .c .y .i .$(ASMEXT) .$(DTRACE_EXT)
277
278all:
279
280# Prevent GNU make v3 from overflowing arg limit on SysV.
281.NOEXPORT:
282
283miniruby$(EXEEXT):
284                @-if test -f $@; then $(MV) -f $@ $@.old; $(RM) $@.old; fi
285                $(ECHO) linking $@
286                $(Q) $(PURIFY) $(CC) $(EXE_LDFLAGS) $(XLDFLAGS) $(NORMALMAINOBJ) $(MINIOBJS) $(COMMONOBJS) $(MAINLIBS) $(LIBS) $(OUTFLAG)$@
287                $(Q) $(POSTLINK)
288
289$(PROGRAM):
290                @$(RM) $@
291                $(ECHO) linking $@
292                $(Q) $(PURIFY) $(CC) $(EXE_LDFLAGS) $(XLDFLAGS) $(MAINOBJ) $(EXTOBJS) $(LIBRUBYARG) $(MAINLIBS) $(LIBS) $(EXTLIBS) $(OUTFLAG)$@
293                $(Q) $(POSTLINK)
294
295$(PROGRAM):
296
297PRE_LIBRUBY_UPDATE = [ -n "$(LIBRUBY_SO_UPDATE)" ] || $(gnumake:yes=exec) $(RM) $(LIBRUBY_EXTS)
298
299# We must `rm' the library each time this rule is invoked because "updating" a
300# MAB library on Apple/NeXT (see --enable-fat-binary in configure) is not
301# supported.
302$(LIBRUBY_A):
303                @$(RM) $@
304                @-[ -z "$(EXTSTATIC)" ] || $(PRE_LIBRUBY_UPDATE)
305                $(ECHO) linking static-library $@
306                $(Q) $(AR) $(ARFLAGS) $@ $(LIBRUBY_A_OBJS) $(INITOBJS)
307                @-$(RANLIB) $@ 2> /dev/null || true
308
309verify-static-library: $(LIBRUBY_A)
310                $(ECHO) verifying static-library $@
311                @$(PURIFY) $(CC) $(EXE_LDFLAGS) $(XLDFLAGS) $(MAINOBJ) $(LIBRUBY_A) $(MAINLIBS) $(EXTLIBS) $(LIBS) $(OUTFLAG)conftest$(EXEEXT)
312                @$(RMALL) conftest$(EXEEXT) conftest.c conftest.dSYM
313
314$(LIBRUBY_SO):
315                @-[ -n "$(EXTSTATIC)" ] || $(PRE_LIBRUBY_UPDATE)
316                $(ECHO) linking shared-library $@
317                $(Q) $(LDSHARED) $(DLDFLAGS) $(OBJS) $(DLDOBJS) $(SOLIBS) $(EXTSOLIBS) $(OUTFLAG)$@
318                -$(Q) $(OBJCOPY) -w -L '$(SYMBOL_PREFIX)Init_*' -L '$(SYMBOL_PREFIX)ruby_static_id_*' \
319                        -L '$(SYMBOL_PREFIX)*_threadptr_*' -L '$(SYMBOL_PREFIX)*_ec_*' $@
320                $(Q) $(POSTLINK)
321                @-$(MINIRUBY) -e 'so, *aliases = ARGV; aliases.uniq!; aliases.delete(File.basename(so)); \
322                                  aliases.each { |link| File.delete link rescue nil; File.symlink so, link }' \
323                                $(LIBRUBY_SO) $(LIBRUBY_ALIASES) || true
324
325LIBRUBY_WITH_EXT = @LIBRUBY_WITH_EXT@
326$(LIBRUBY_$(LIBRUBY_WITH_EXT)): $(LIBRUBY_SO_UPDATE)
327
328PKG_CONFIG = pkg-config
329ruby_pc = ruby-3.1.pc
330$(ruby_pc): config.status Makefile
331        $(Q)./config.status --file=-:$(srcdir)/template/ruby.pc.in | \
332        sed -e 's/\$$(\([A-Za-z_][A-Za-z0-9_]*\))/$${\1}/g' \
333            -e 's|^prefix=.*|prefix=$(prefix)|' \
334            > ruby.tmp.pc
335        $(Q)pkg_config=${PKG_CONFIG} && PKG_CONFIG_PATH=. $${pkg_config:-:} --print-errors ruby.tmp
336        $(Q)$(MV) -f ruby.tmp.pc $(ruby_pc)
337
338pre-install-local:: pkgconfig-data
339
340ruby-runner.h: template/ruby-runner.h.in config.status
341                @./config.status --file=$@:$(srcdir)/template/$(@F).in
342
343install-cross: $(arch)-fake.rb $(RBCONFIG) rbconfig.rb $(arch_hdrdir)/ruby/config.h \
344        $(LIBRUBY_A) $(LIBRUBY_SO) $(ARCHFILE) pkgconfig-data
345        $(ECHO) installing cross-compiling stuff
346        $(Q) $(MAKEDIRS) $(XRUBY_RUBYLIBDIR)/$(arch) $(XRUBY_RUBYHDRDIR)/$(arch)/ruby
347        $(Q) sed '/^\$$:\.unshift/q' $(arch)-fake.rb > fake.rb
348        $(Q) $(BASERUBY) -p \
349        -e '~/^\s*CONFIG\["LDFLAGS"\]/ and' \
350        -e '$$_[/(?=\s*"$$)/] = %q[ #{(CONFIG["LIBPATHFLAG"]%File.dirname(__FILE__)).strip}]' \
351        rbconfig.rb > fake-rbconfig.rb
352        $(INSTALL_SCRIPT) fake.rb $(XRUBY_RUBYLIBDIR)/$(arch)/fake.rb
353        $(INSTALL_SCRIPT) fake-rbconfig.rb $(XRUBY_RUBYLIBDIR)/$(arch)/rbconfig.rb
354        @$(RM) fake.rb fake-rbconfig.rb
355        $(INSTALL_DATA) $(arch_hdrdir)/ruby/config.h $(XRUBY_RUBYHDRDIR)/$(arch)/ruby
356        $(INSTALL_DATA) $(top_srcdir)/include/ruby/win32.h $(XRUBY_RUBYHDRDIR)/ruby
357        $(INSTALL_DATA) $(LIBRUBY) $(LIBRUBY_A) $(XRUBY_RUBYLIBDIR)/$(arch)
358        $(INSTALL_PROGRAM) $(LIBRUBY_SO) $(XRUBY_RUBYLIBDIR)/$(arch)
359
360Makefile:       $(srcdir)/template/Makefile.in $(srcdir)/enc/Makefile.in
361
362$(MKFILES): config.status $(srcdir)/version.h
363                @[ -f $@ ] && mv $@ $@.old
364                MAKE=$(MAKE) $(SHELL) ./config.status $@
365                @cmp $@ $@.old > /dev/null 2>&1 && echo $@ unchanged && exit 0; \
366                { \
367                    echo "all:; -@rm -f conftest.mk"; \
368                    echo "conftest.mk: .force; @echo AUTO_REMAKE"; \
369                    echo ".force:"; \
370                } > conftest.mk || exit 1; \
371                $(MAKE) -f conftest.mk | grep '^AUTO_REMAKE$$' >/dev/null 2>&1 || \
372                { echo "$@ updated, restart."; exit 1; }
373
374uncommon.mk: $(srcdir)/common.mk
375                sed 's/{\$$([^(){}]*)[^{}]*}//g' $< > $@
376
377.PHONY: reconfig
378reconfig-args = $(srcdir)/$(CONFIGURE) $(yes_silence:yes=--silent) $(configure_args)
379config.status-args = ./config.status $(yes_silence:yes=--silent) --recheck
380reconfig-exec-0 = test -t 1 && { : $${CONFIGURE_TTY=yes}; export CONFIGURE_TTY; }; exec 3>&1; exit `exec 4>&1; { "$$@" 3>&- 4>&-; echo $$? 1>&4; } | fgrep -v '(cached)' 1>&3 3>&- 4>&-`
381reconfig-exec-1 = set -x; "$$@"
382
383reconfig config.status: $(srcdir)/$(CONFIGURE) $(srcdir)/enc/Makefile.in \
384                        $(srcdir)/include/ruby/version.h
385        @PWD= MINIRUBY="$(MINIRUBY)"; export MINIRUBY; \
386        set $(SHELL) $($@-args); $(reconfig-exec-$(V))
387
388$(srcdir)/$(CONFIGURE): $(srcdir)/configure.ac
389        $(CHDIR) $(srcdir) && exec $(AUTOCONF) -o $(@F)
390
391prereq: $(srcdir)/$(CONFIGURE)
392
393incs: id.h
394all-incs: probes.h
395
396# Things which should be considered:
397# * with gperf v.s. without gperf
398# * committers may have various versions of gperf
399# * ./configure v.s. ../ruby/configure
400# * GNU make v.s. HP-UX make    # HP-UX make invokes the action if lex.c and keywords has same mtime.
401# * svn checkout generate a file with mtime as current time
402# * ext4 and XFS has a mtime with fractional part
403lex.c: defs/keywords
404        @\
405        if cmp -s $(srcdir)/defs/lex.c.src $?; then \
406          [ $(Q) ] && echo copying $@ || set -x; \
407          $(CP) $(srcdir)/lex.c.blt $@; \
408        else \
409          [ $(Q) ] && echo generating $@ || set -x; \
410          gperf -C -P -p -j1 -i 1 -g -o -t -N rb_reserved_word -k1,3,$$ $? \
411          | sed -f $(tooldir)/gperf.sed \
412          > $@.tmp && \
413          $(MV) $@.tmp $@ && \
414          $(CP) $? $(srcdir)/defs/lex.c.src && \
415          $(CP) $@ $(srcdir)/lex.c.blt; \
416        fi
417
418JIS_PROPS_OPTIONS = -k1,3 -7 -c -j1 -i1 -t -C -P -t --ignore-case -H onig_jis_property_hash -Q onig_jis_property_pool -N onig_jis_property
419
420$(srcdir)/enc/jis/props.h: enc/jis/props.kwd
421        $(MAKEDIRS) $(@D)
422        @set +e; \
423        if cmp -s $(?:.kwd=.src) $?; then \
424          set -x; \
425          $(CP) $(?:.kwd=.h.blt) $@; \
426        else \
427          set -x; \
428          gperf $(JIS_PROPS_OPTIONS) $? | \
429          sed -f $(tooldir)/gperf.sed > $@ && \
430          $(CP) $? $(?:.kwd=.src) && \
431          $(CP) $@ $(?:.kwd=.h.blt); \
432        fi
433
434.c.o:
435        @$(ECHO) compiling $<
436        $(Q) $(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(COUTFLAG)$@ -c $<
437
438.$(ASMEXT).o:
439        @$(ECHO) assembling $<
440        $(Q) $(CC) $(ASFLAGS) -DSYMBOL_PREFIX=$(SYMBOL_PREFIX) -o $@ -c $<
441
442.c.$(ASMEXT):
443        @$(ECHO) translating $<
444        $(Q) $(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(COUTFLAG)$@ -S $<
445
446.c.i:
447        @$(ECHO) preprocessing $<
448        $(Q) $(CPP) $(warnflags) $(XCFLAGS) $(CPPFLAGS) $(COUTFLAG)$@ -E $< > $@
449
450.d.h:
451        @$(ECHO) translating probes $<
452        $(Q) $(DTRACE) -o $@.tmp -h -C $(INCFLAGS) -s $<
453        $(Q) sed -e 's/RUBY_/RUBY_DTRACE_/g' -e 's/PROBES_H_TMP/RUBY_PROBES_H/' -e 's/(char \*/(const char */g' -e 's/, char \*/, const char */g' $@.tmp > $@
454        $(Q) $(RM) $@.tmp
455
456.dmyh.h:
457        @$(ECHO) making dummy $(DEST_FILE)
458        $(Q)echo '#include "$(*F).dmyh"' > $@
459
460probes.stamp: $(DTRACE_REBUILD_OBJS)
461        $(Q) if test -f $@ -o -f probes.$(OBJEXT); then \
462          $(RM) $(DTRACE_REBUILD_OBJS) $@; \
463          $(ECHO0) "rebuilding objects which were modified by \"dtrace -G\""; \
464          $(MAKE) $(DTRACE_REBUILD_OBJS); \
465        fi
466        $(Q) touch $@
467
468probes.$(OBJEXT): $(srcdir)/probes.d $(DTRACE_REBUILD:yes=probes.stamp)
469        @$(ECHO) processing probes in object files
470        $(Q) $(RM) $@
471        $(Q) $(DTRACE) -G -C $(INCFLAGS) -s $(srcdir)/probes.d -o $@ $(DTRACE_REBUILD_OBJS)
472
473main: mjit-headers
474yes-mjit-headers: $(MJIT_MIN_HEADER)
475clean-local::
476        $(Q)$(RM) \
477          $(MJIT_HEADER) $(MJIT_HEADER:.h=)$(MJIT_HEADER_SUFFIX:%=*).h \
478          $(MJIT_MIN_HEADER) $(MJIT_MIN_HEADER:.h=)$(MJIT_HEADER_SUFFIX:%=*).h \
479          $(MJIT_HEADER_INSTALL_DIR)/rb_mjit_min_header-*.h \
480          $(TIMESTAMPDIR)/$(MJIT_HEADER:.h=)$(MJIT_HEADER_SUFFIX).time mjit_config.h \
481        || $(NULLCMD)
482        $(Q)$(RM) -r mjit_build_dir.*
483        -$(Q) $(RMDIRS) $(MJIT_HEADER_INSTALL_DIR) $(MJIT_HEADER_BUILD_DIR) $(TIMESTAMPDIR) 2> $(NULL) || $(NULLCMD)
484
485# DTrace static library hacks described here:
486# https://marc.info/?l=opensolaris-dtrace-discuss&m=114761203110734&w=4
487ruby-glommed.$(OBJEXT):
488        @$(ECHO) generating a glommed object with DTrace probes for static library
489        $(Q) $(LD) -r -o $@ $(OBJS)
490
491clean-local::
492        $(Q)$(RM) \
493          ext/extinit.c ext/extinit.$(OBJEXT) ext/ripper/y.output \
494          enc/encinit.c enc/encinit.$(OBJEXT) $(pkgconfig_DATA) \
495          ruby-runner.$(OBJEXT) ruby-runner.h \
496        || $(NULLCMD)
497        $(Q)find . -name '*.bc' -o -name '*.[is]' -delete
498        -$(Q)$(RMALL) exe/ *.dSYM
499
500distclean-local::
501        $(Q)$(RM) \
502          ext/config.cache $(RBCONFIG) Doxyfile run.gdb \
503          $(INSTALLED_LIST) $(arch_hdrdir)/ruby/config.h verconf.h \
504        || $(NULLCMD)
505        -$(Q)$(RMDIRS) $(arch_hdrdir)/ruby 2> /dev/null || true
506
507ext/clean.sub:: ext/clean.mk
508ext/distclean.sub:: ext/distclean.mk
509ext/realclean.sub:: ext/realclean.mk
510
511ext/clean.mk ext/distclean.mk ext/realclean.mk::
512        -$(Q) if [ -f $(EXTS_MK) ]; then exec $(MAKE) -f $(EXTS_MK) $(@F:.mk=); fi
513
514ext/clean:: ext/clean.sub
515ext/distclean:: ext/distclean.sub
516ext/realclean:: ext/realclean.sub
517.bundle/clean:: .bundle/clean.sub
518.bundle/distclean:: .bundle/distclean.sub
519.bundle/realclean:: .bundle/realclean.sub
520
521ext/clean.sub .bundle/clean.sub:: ext/clean.mk
522ext/distclean.sub .bundle/distclean.sub:: ext/distclean.mk
523ext/realclean.sub .bundle/realclean.sub:: ext/realclean.mk
524
525ext/clean.sub ext/distclean.sub ext/realclean.sub \
526.bundle/clean.sub .bundle/distclean.sub .bundle/realclean.sub::
527        $(Q) set dummy `echo "${EXTS}" | tr , ' '`; shift; \
528        test "$$#" = 0 && set .; \
529        set dummy `\
530            cd $(@D) 2>/dev/null && \
531            find "$$@" \( -name Makefile -o -name exts.mk \) -print | \
532            sed -n 's:^\./::;s:^:$(@D)/:;s:/[^/][^/]*$$::p' | sort -u; \
533        `; shift; \
534        for dir do \
535            $(RM) "$$dir/exts.mk"; \
536            if [ -f "$$dir/Makefile" ]; then \
537                echo $(@F:.sub=)ing "$$dir"; \
538                (cd "$$dir" && exec $(MAKE) $(mflags) $(@F:.sub=)); \
539            fi; \
540        done || true
541
542ext/distclean ext/realclean .bundle/distclean .bundle/realclean::
543        $(Q) set dummy `echo "${EXTS}" | tr , ' '`; shift; \
544        test "$$#" = 0 && set .; \
545        cd $(@D) 2>/dev/null && \
546        find "$$@" -type d -empty -exec $(RMDIRS) {} + 2> /dev/null || true
547        $(Q) $(RMDIRS) $(@D) 2> /dev/null || true
548
549clean-enc distclean-enc realclean-enc:
550        @test -f "$(ENC_MK)" || exit 0; \
551        echo $(@:-enc=ing) encodings; \
552        exec $(MAKE) $(MAKE_ENC) $(@:-enc=)
553
554ext/extinit.$(OBJEXT): ext/extinit.c $(SETUP)
555        $(ECHO) compiling $@
556        $(Q) $(CC) $(CFLAGS) $(XCFLAGS) $(CPPFLAGS) $(COUTFLAG)$@ -c ext/extinit.c
557
558enc/encinit.$(OBJEXT): enc/encinit.c $(SETUP)
559
560cont.$(OBJEXT): $(COROUTINE_H)
561
562update-src::
563        @$(CHDIR) "$(srcdir)" && LC_TIME=C exec $(VCSUP)
564
565update-download:: update-config_files
566
567after-update:: prereq
568
569gcov:
570        $(Q) $(BASERUBY) $(tooldir)/run-gcov.rb
571
572lcov:
573        $(Q) $(BASERUBY) $(tooldir)/run-lcov.rb
574
575update-benchmark-driver:
576        $(Q) $(tooldir)/git-refresh -C $(srcdir)/benchmark $(Q1:0=-q) \
577                --branch $(BENCHMARK_DRIVER_GIT_REF) \
578                $(BENCHMARK_DRIVER_GIT_URL) benchmark-driver $(GIT_OPTS)
579
580update-doclie:
581        $(Q) $(tooldir)/git-refresh -C $(srcdir)/coverage $(Q1:0=-q) \
582                --branch $(DOCLIE_GIT_REF) \
583                $(DOCLIE_GIT_URL) doclie $(GIT_OPTS)
584
585update-simplecov-html:
586        $(Q) $(tooldir)/git-refresh -C $(srcdir)/coverage $(Q1:0=-q) \
587                --branch $(SIMPLECOV_HTML_GIT_REF) \
588                $(SIMPLECOV_HTML_GIT_URL) simplecov-html $(GIT_OPTS)
589
590update-simplecov:
591        $(Q) $(tooldir)/git-refresh -C $(srcdir)/coverage $(Q1:0=-q) \
592                --branch $(SIMPLECOV_GIT_REF)  \
593                $(SIMPLECOV_GIT_URL) simplecov $(GIT_OPTS)
594
595update-coverage: update-simplecov update-simplecov-html update-doclie
596
597update-known-errors:
598        errno --list | cut -d' ' -f1 | sort -u - $(srcdir)/defs/known_errors.def | \
599        $(IFCHANGE) $(srcdir)/defs/known_errors.def -
600
601INSNS   = opt_sc.inc optinsn.inc optunifs.inc insns.inc insns_info.inc \
602          vmtc.inc vm.inc mjit_compile.inc
603
604$(INSNS): $(srcdir)/insns.def vm_opts.h \
605          $(srcdir)/defs/opt_operand.def $(srcdir)/defs/opt_insn_unif.def \
606          $(tooldir)/insns2vm.rb \
607          $(tooldir)/ruby_vm/controllers/application_controller.rb \
608          $(tooldir)/ruby_vm/helpers/c_escape.rb \
609          $(tooldir)/ruby_vm/helpers/dumper.rb \
610          $(tooldir)/ruby_vm/helpers/scanner.rb \
611          $(tooldir)/ruby_vm/loaders/insns_def.rb \
612          $(tooldir)/ruby_vm/loaders/opt_insn_unif_def.rb \
613          $(tooldir)/ruby_vm/loaders/opt_operand_def.rb \
614          $(tooldir)/ruby_vm/loaders/vm_opts_h.rb \
615          $(tooldir)/ruby_vm/models/attribute.rb \
616          $(tooldir)/ruby_vm/models/bare_instructions.rb \
617          $(tooldir)/ruby_vm/models/c_expr.rb \
618          $(tooldir)/ruby_vm/models/instructions.rb \
619          $(tooldir)/ruby_vm/models/instructions_unifications.rb \
620          $(tooldir)/ruby_vm/models/operands_unifications.rb \
621          $(tooldir)/ruby_vm/models/trace_instructions.rb \
622          $(tooldir)/ruby_vm/models/typemap.rb \
623          $(tooldir)/ruby_vm/scripts/converter.rb \
624          $(tooldir)/ruby_vm/scripts/insns2vm.rb \
625          $(tooldir)/ruby_vm/views/_attributes.erb \
626          $(tooldir)/ruby_vm/views/_c_expr.erb \
627          $(tooldir)/ruby_vm/views/_comptime_insn_stack_increase.erb \
628          $(tooldir)/ruby_vm/views/_copyright.erb \
629          $(tooldir)/ruby_vm/views/_insn_entry.erb \
630          $(tooldir)/ruby_vm/views/_insn_len_info.erb \
631          $(tooldir)/ruby_vm/views/_insn_name_info.erb \
632          $(tooldir)/ruby_vm/views/_insn_operand_info.erb \
633          $(tooldir)/ruby_vm/views/_insn_sp_pc_dependency.erb \
634          $(tooldir)/ruby_vm/views/_insn_type_chars.erb \
635          $(tooldir)/ruby_vm/views/_leaf_helpers.erb \
636          $(tooldir)/ruby_vm/views/_mjit_compile_insn.erb \
637          $(tooldir)/ruby_vm/views/_mjit_compile_insn_body.erb \
638          $(tooldir)/ruby_vm/views/_mjit_compile_ivar.erb \
639          $(tooldir)/ruby_vm/views/_mjit_compile_pc_and_sp.erb \
640          $(tooldir)/ruby_vm/views/_mjit_compile_send.erb \
641          $(tooldir)/ruby_vm/views/_notice.erb \
642          $(tooldir)/ruby_vm/views/_sp_inc_helpers.erb \
643          $(tooldir)/ruby_vm/views/_trace_instruction.erb \
644          $(tooldir)/ruby_vm/views/insns.inc.erb \
645          $(tooldir)/ruby_vm/views/insns_info.inc.erb \
646          $(tooldir)/ruby_vm/views/mjit_compile.inc.erb \
647          $(tooldir)/ruby_vm/views/opt_sc.inc.erb \
648          $(tooldir)/ruby_vm/views/optinsn.inc.erb \
649          $(tooldir)/ruby_vm/views/optunifs.inc.erb \
650          $(tooldir)/ruby_vm/views/vm.inc.erb \
651          $(tooldir)/ruby_vm/views/vmtc.inc.erb
652        $(ECHO) generating $@
653        $(Q) $(BASERUBY) -Ku $(tooldir)/insns2vm.rb $(INSNS2VMOPT) $@
654
655
656loadpath: verconf.h
657        @$(CPP) $(XCFLAGS) $(CPPFLAGS) $(srcdir)/loadpath.c | \
658        sed -e '1,/^const char ruby_initial_load_paths/d;/;/,$$d' \
659            -e '/^ /!d;s/ *"\\0"$$//;s/" *"//g'
660
661un-runnable:
662        $(ECHO) cannot make runnable, configure with --enable-load-relative.
663        $(Q) exit 1
664
665mjit_config.h:
666        $(ECHO) making $@
667        @{ \
668        . $(tooldir)/mjit_archflag.sh; \
669        parse_arch_flags "$(UNIVERSAL_ARCHNAMES)" $(ARCH_FLAG); \
670        test "$(Q)" = @ || set -x; \
671        echo '#ifndef RUBY_MJIT_CONFIG_H'; \
672        echo '#define RUBY_MJIT_CONFIG_H 1'; \
673        echo; \
674        sep=; \
675        echo '#ifdef LOAD_RELATIVE'; \
676        quote MJIT_HEADER_INSTALL_DIR "/$(MJIT_HEADER_INSTALL_DIR)"; \
677        echo '#else'; \
678        quote MJIT_HEADER_INSTALL_DIR "$(rubyarchhdrdir)"; \
679        echo '#endif'; \
680        quote MJIT_MIN_HEADER_NAME "$(MJIT_MIN_HEADER_NAME)"; \
681        sep=,; \
682        quote "MJIT_CC_COMMON  " $(MJIT_CC); \
683        quote "MJIT_CFLAGS      MJIT_ARCHFLAG" $(MJIT_CFLAGS); \
684        quote "MJIT_OPTFLAGS   " $(MJIT_OPTFLAGS); \
685        quote "MJIT_DEBUGFLAGS " $(MJIT_DEBUGFLAGS); \
686        quote "MJIT_LDSHARED   " $(MJIT_LDSHARED); \
687        quote "MJIT_DLDFLAGS    MJIT_ARCHFLAG" $(MJIT_DLDFLAGS); \
688        quote "MJIT_LIBS       " $(LIBRUBYARG_SHARED); \
689        quote 'PRELOADENV       "DYLD_INSERT_LIBRARIES"'; \
690        indent=$${archs:+'  '}; \
691        define_arch_flags; \
692        echo; \
693        echo '#endif /* RUBY_MJIT_CONFIG_H */'; \
694        } > $@
695
696yes-test-almost yes-test-all programs: mjit_build_dir.$(SOEXT)
697mjit_build_dir.$(SOEXT): $(MJIT_MIN_HEADER) $(srcdir)/ruby-runner.c ruby-runner.h
698        $(ECHO) making $@
699        $(Q) $(DLDSHARED) $(MJIT_DLDFLAGS) $(ARCH_FLAG) $(CFLAGS) $(INCFLAGS) $(CPPFLAGS) \
700                -DMAKE_MJIT_BUILD_DIR=1 -DMJIT_MIN_HEADER='"$(MJIT_MIN_HEADER)"' \
701                $(OUTFLAG)$@ $(srcdir)/ruby-runner.c
702
703# yes-test-basic: leaked-globals
704leaked-globals: $(COMMONOBJS) prog $(tooldir)/leaked-globals PHONY
705        $(Q) $(XRUBY) $(tooldir)/leaked-globals NM=$(NM) SYMBOL_PREFIX=$(SYMBOL_PREFIX) PLATFORM=$(hdrdir)/ruby/$(PLATFORM_DIR).h $(srcdir)/configure.ac $(COMMONOBJS)
706
707distclean-local::; @$(RM) GNUmakefile uncommon.mk
708ruby: $(PROGRAM);