2013-06-20 14:19:02 +04:00
|
|
|
# -*- makefile-gmake -*-
|
2014-07-03 07:38:13 +04:00
|
|
|
gnumake = yes
|
2017-02-13 02:37:28 +03:00
|
|
|
override gnumake_recursive := $(if $(findstring n,$(firstword $(MFLAGS))),,+)
|
2017-02-15 13:51:58 +03:00
|
|
|
override mflags := $(filter-out -j%,$(MFLAGS))
|
2017-03-26 04:21:57 +03:00
|
|
|
MSPECOPT += $(if $(filter -j%,$(MFLAGS)),-j)
|
2014-07-03 07:38:13 +04:00
|
|
|
|
2017-03-08 16:52:32 +03:00
|
|
|
CHECK_TARGETS := great exam love check test check% test% btest%
|
2017-02-13 08:11:14 +03:00
|
|
|
# expand test targets, and those dependents
|
2017-03-02 07:54:18 +03:00
|
|
|
TEST_TARGETS := $(filter $(CHECK_TARGETS),$(MAKECMDGOALS))
|
2017-03-09 04:06:09 +03:00
|
|
|
TEST_DEPENDS := $(filter-out commit $(TEST_TARGETS),$(MAKECMDGOALS))
|
2017-03-08 16:52:32 +03:00
|
|
|
TEST_TARGETS := $(patsubst great,exam,$(TEST_TARGETS))
|
|
|
|
TEST_DEPENDS := $(filter-out great $(TEST_TARGETS),$(TEST_DEPENDS))
|
2017-02-13 08:11:14 +03:00
|
|
|
TEST_TARGETS := $(patsubst exam,check test-rubyspec,$(TEST_TARGETS))
|
2017-02-23 07:10:41 +03:00
|
|
|
TEST_DEPENDS := $(filter-out exam $(TEST_TARGETS),$(TEST_DEPENDS))
|
2017-02-13 08:11:14 +03:00
|
|
|
TEST_TARGETS := $(patsubst love,check,$(TEST_TARGETS))
|
2017-02-23 07:10:41 +03:00
|
|
|
TEST_DEPENDS := $(filter-out love $(TEST_TARGETS),$(TEST_DEPENDS))
|
2017-02-13 08:11:14 +03:00
|
|
|
TEST_TARGETS := $(patsubst check,test test-testframework test-almost,$(patsubst check-%,test test-%,$(TEST_TARGETS)))
|
2017-02-23 07:10:41 +03:00
|
|
|
TEST_DEPENDS := $(filter-out check $(TEST_TARGETS),$(TEST_DEPENDS))
|
2017-02-13 08:11:14 +03:00
|
|
|
TEST_TARGETS := $(patsubst test,btest-ruby test-knownbug test-basic,$(TEST_TARGETS))
|
2017-02-23 07:10:41 +03:00
|
|
|
TEST_DEPENDS := $(filter-out test $(TEST_TARGETS),$(TEST_DEPENDS))
|
2017-02-13 08:11:14 +03:00
|
|
|
TEST_DEPENDS += $(if $(filter-out btest%,$(TEST_TARGETS)),all exts)
|
2013-03-06 15:59:23 +04:00
|
|
|
|
2014-03-25 05:30:07 +04:00
|
|
|
ifneq ($(filter -O0 -Od,$(optflags)),)
|
|
|
|
override XCFLAGS := $(filter-out -D_FORTIFY_SOURCE=%,$(XCFLAGS))
|
|
|
|
endif
|
|
|
|
|
2015-03-13 11:29:26 +03:00
|
|
|
ifeq ($(if $(filter all main exts enc trans libencs libenc libtrans \
|
2015-03-18 11:08:31 +03:00
|
|
|
prog program ruby ruby$(EXEEXT) \
|
|
|
|
wprogram rubyw rubyw$(EXEEXT) \
|
|
|
|
miniruby$(EXEEXT) mini,\
|
2015-03-12 19:15:07 +03:00
|
|
|
$(MAKECMDGOALS)),,$(MAKECMDGOALS)),)
|
2015-10-22 17:56:37 +03:00
|
|
|
-include $(SHOWFLAGS)
|
2015-03-12 19:15:07 +03:00
|
|
|
endif
|
|
|
|
|
2014-06-01 23:32:15 +04:00
|
|
|
ifneq ($(filter universal-%,$(arch)),)
|
|
|
|
define archcmd
|
2014-06-01 23:32:17 +04:00
|
|
|
%.$(1).S: %.c
|
|
|
|
@$$(ECHO) translating $$< with $(2)
|
|
|
|
$$(Q) $$(CC) $$(CFLAGS_NO_ARCH) $(2) $$(XCFLAGS) $$(CPPFLAGS) $$(COUTFLAG)$$@ -S $$<
|
|
|
|
|
|
|
|
%.S: %.$(1).S
|
|
|
|
|
2014-06-01 23:32:15 +04:00
|
|
|
%.$(1).i: %.c
|
|
|
|
@$$(ECHO) preprocessing $$< with $(2)
|
|
|
|
$$(Q) $$(CPP) $$(warnflags) $(2) $$(XCFLAGS) $$(CPPFLAGS) $$(COUTFLAG)$$@ -E $$< > $$@
|
|
|
|
|
|
|
|
%.i: %.$(1).i
|
|
|
|
endef
|
|
|
|
|
2014-06-02 01:50:32 +04:00
|
|
|
$(foreach arch,$(filter -arch=%,$(subst -arch ,-arch=,$(ARCH_FLAG))),\
|
2014-06-01 23:32:15 +04:00
|
|
|
$(eval $(call archcmd,$(patsubst -arch=%,%,$(value arch)),$(patsubst -arch=%,-arch %,$(value arch)))))
|
|
|
|
endif
|
|
|
|
|
2017-02-13 08:11:14 +03:00
|
|
|
.PHONY: $(addprefix yes-,$(TEST_TARGETS))
|
|
|
|
|
|
|
|
ifneq ($(filter-out btest%,$(TEST_TARGETS)),)
|
|
|
|
$(addprefix yes-,$(TEST_TARGETS)): $(TEST_DEPENDS)
|
2013-03-27 07:42:19 +04:00
|
|
|
endif
|
2013-03-06 15:59:23 +04:00
|
|
|
|
2017-02-13 08:11:14 +03:00
|
|
|
ORDERED_TEST_TARGETS := $(filter $(TEST_TARGETS), \
|
|
|
|
btest-ruby test-knownbug test-basic \
|
2017-02-13 18:28:25 +03:00
|
|
|
test-testframework test-ruby test-almost test-all \
|
2017-02-13 08:11:14 +03:00
|
|
|
test-rubyspec \
|
|
|
|
)
|
|
|
|
prev_test := $(if $(filter test-rubyspec,$(ORDERED_TEST_TARGETS)),test-rubyspec-precheck)
|
2017-03-02 07:54:18 +03:00
|
|
|
$(foreach test,$(ORDERED_TEST_TARGETS), \
|
|
|
|
$(eval yes-$(value test) no-$(value test): $(value prev_test)); \
|
2017-02-13 08:11:14 +03:00
|
|
|
$(eval prev_test := $(value test)))
|
2013-03-07 05:39:10 +04:00
|
|
|
|
|
|
|
ifneq ($(if $(filter install,$(MAKECMDGOALS)),$(filter uninstall,$(MAKECMDGOALS))),)
|
|
|
|
install-targets := $(filter install uninstall,$(MAKECMDGOALS))
|
|
|
|
$(word 1,$(install-targets)): $(word 0,$(install-targets))
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifneq ($(filter reinstall,$(MAKECMDGOALS)),)
|
2014-06-19 18:11:52 +04:00
|
|
|
install-prereq: uninstall
|
|
|
|
uninstall sudo-precheck: all $(if $(filter all,$(INSTALLDOC)),docs)
|
2013-03-07 05:39:10 +04:00
|
|
|
endif
|
2014-06-20 08:20:26 +04:00
|
|
|
|
|
|
|
ifneq ($(filter love,$(MAKECMDGOALS)),)
|
|
|
|
showflags: up
|
2016-07-26 19:03:51 +03:00
|
|
|
sudo-precheck: test yes-test-testframework no-test-testframework
|
2014-06-20 08:20:26 +04:00
|
|
|
install-prereq: sudo-precheck
|
|
|
|
yes-test-all no-test-all: install
|
2016-07-26 16:02:34 +03:00
|
|
|
yes-test-almost no-test-almost: install
|
2014-06-20 08:20:26 +04:00
|
|
|
endif
|
2017-03-08 16:52:32 +03:00
|
|
|
ifneq ($(filter great,$(MAKECMDGOALS)),)
|
|
|
|
love: test-rubyspec
|
|
|
|
endif
|
2016-06-04 05:40:04 +03:00
|
|
|
|
|
|
|
$(srcdir)/missing/des_tables.c: $(srcdir)/missing/crypt.c
|
2016-06-04 06:46:06 +03:00
|
|
|
ifeq ($(if $(filter yes,$(CROSS_COMPILING)),,$(CC)),)
|
2016-06-04 05:40:04 +03:00
|
|
|
touch $@
|
|
|
|
else
|
|
|
|
@$(ECHO) building make_des_table
|
2016-06-04 06:46:06 +03:00
|
|
|
$(CC) $(CPPFLAGS) -DDUMP $(LDFLAGS) $(XLDFLAGS) $(LIBS) -omake_des_table $(srcdir)/missing/crypt.c
|
|
|
|
@[ -x ./make_des_table ]
|
2016-06-04 05:40:04 +03:00
|
|
|
@$(ECHO) generating $@
|
|
|
|
$(Q) $(MAKEDIRS) $(@D)
|
2016-06-04 13:58:14 +03:00
|
|
|
$(Q) ./make_des_table > $@.new
|
|
|
|
$(Q) mv $@.new $@
|
2016-06-04 05:40:04 +03:00
|
|
|
$(Q) $(RMALL) make_des_table*
|
|
|
|
endif
|
2016-08-20 05:20:34 +03:00
|
|
|
|
|
|
|
STUBPROGRAM = rubystub$(EXEEXT)
|
|
|
|
IGNOREDPATTERNS = %~ .% %.orig %.rej \#%\#
|
|
|
|
SCRIPTBINDIR := $(if $(EXEEXT),,exec/)
|
|
|
|
SCRIPTPROGRAMS = $(addprefix $(SCRIPTBINDIR),$(addsuffix $(EXEEXT),$(filter-out $(IGNOREDPATTERNS),$(notdir $(wildcard $(srcdir)/bin/*)))))
|
|
|
|
|
|
|
|
stub: $(STUBPROGRAM)
|
|
|
|
scriptbin: $(SCRIPTPROGRAMS)
|
|
|
|
ifneq ($(STUBPROGRAM),rubystub)
|
|
|
|
rubystub: $(STUBPROGRAM)
|
|
|
|
endif
|
|
|
|
|
|
|
|
$(SCRIPTPROGRAMS): $(STUBPROGRAM)
|
|
|
|
|
|
|
|
$(STUBPROGRAM): rubystub.$(OBJEXT) $(LIBRUBY) $(MAINOBJ) $(OBJS) $(EXTOBJS) $(SETUP) $(PREP)
|
|
|
|
|
|
|
|
rubystub$(EXEEXT):
|
|
|
|
@rm -f $@
|
|
|
|
$(ECHO) linking $@
|
|
|
|
$(Q) $(PURIFY) $(CC) $(LDFLAGS) $(XLDFLAGS) rubystub.$(OBJEXT) $(EXTOBJS) $(LIBRUBYARG) $(MAINLIBS) $(LIBS) $(EXTLIBS) $(OUTFLAG)$@
|
|
|
|
$(Q) $(POSTLINK)
|
|
|
|
$(if $(STRIP),$(Q) $(STRIP) $@)
|
|
|
|
|
|
|
|
$(SCRIPTBINDIR)%$(EXEEXT): bin/% $(STUBPROGRAM) \
|
|
|
|
$(if $(SCRIPTBINDIR),$(TIMESTAMPDIR)/.exec.time)
|
|
|
|
$(ECHO) generating $@
|
|
|
|
$(Q) { cat $(STUBPROGRAM); echo; sed -e '1{' -e '/^#!.*ruby/!i\' -e '#!/bin/ruby' -e '}' $<; } > $@
|
|
|
|
$(Q) chmod +x $@
|
|
|
|
$(Q) $(POSTLINK)
|
|
|
|
|
|
|
|
$(TIMESTAMPDIR)/.exec.time:
|
|
|
|
$(Q) mkdir exec
|
|
|
|
$(Q) exit > $@
|
2017-03-09 04:06:09 +03:00
|
|
|
|
|
|
|
ifneq (,)
|
|
|
|
else ifeq ($(VCS),svn)
|
|
|
|
VCSCOMMIT = $(VCS) commit $(SVNCOMMITOPTIONS)
|
|
|
|
else ifeq ($(VCS),git svn)
|
|
|
|
VCSCOMMIT = $(VCS) dcommit $(GITSVNCOMMITOPTIONS)
|
2017-03-11 16:24:08 +03:00
|
|
|
VCSWAIT = sleep 2 # wait for svn to git sync
|
2017-03-09 04:06:09 +03:00
|
|
|
else ifeq ($(VCS),git)
|
|
|
|
VCSCOMMIT := $(VCS) push $(GITCOMMITOPTIONS)
|
|
|
|
endif
|
|
|
|
ifneq ($(VCSCOMMIT),)
|
|
|
|
.PHONY: commit
|
|
|
|
commit: $(if $(filter commit,$(MAKECMDGOALS)),$(filter-out commit,$(MAKECMDGOALS)))
|
|
|
|
@$(CHDIR) "$(srcdir)" && LC_TIME=C exec $(VCSCOMMIT)
|
2017-03-11 16:24:08 +03:00
|
|
|
$(Q)$(VCSWAIT)
|
|
|
|
$(Q)$(MAKE) $(mflags) Q=$(Q) REVISION_FORCE=PHONY update-src srcs all-incs
|
2017-03-09 04:06:09 +03:00
|
|
|
endif
|