2013-06-20 06:19:02 -04:00
|
|
|
# -*- makefile-gmake -*-
|
2014-07-02 23:38:13 -04:00
|
|
|
gnumake = yes
|
|
|
|
|
2015-04-02 22:57:11 -04:00
|
|
|
CHECK_TARGETS := exam love check%
|
2013-03-06 06:59:23 -05:00
|
|
|
TEST_TARGETS := $(filter check test check% test% btest%,$(MAKECMDGOALS))
|
|
|
|
TEST_TARGETS += $(subst check,test-all,$(patsubst check-%,test-%,$(TEST_TARGETS)))
|
|
|
|
TEST_TARGETS := $(patsubst test-%,yes-test-%,$(patsubst btest-%,yes-btest-%,$(TEST_TARGETS)))
|
|
|
|
TEST_DEPENDS := $(if $(TEST_TARGETS),$(filter all main exts,$(MAKECMDGOALS)))
|
2015-04-02 22:57:11 -04:00
|
|
|
TEST_DEPENDS += $(if $(filter $(CHECK_TARGETS),$(MAKECMDGOALS)),main)
|
2015-09-01 22:51:13 -04:00
|
|
|
TEST_DEPENDS += $(if $(filter main,$(TEST_DEPENDS)),$(if $(filter all,$(INSTALLDOC)),docs))
|
2013-03-06 06:59:23 -05:00
|
|
|
|
2014-03-24 21:30:07 -04:00
|
|
|
ifneq ($(filter -O0 -Od,$(optflags)),)
|
|
|
|
override XCFLAGS := $(filter-out -D_FORTIFY_SOURCE=%,$(XCFLAGS))
|
|
|
|
endif
|
|
|
|
|
2015-03-13 04:29:26 -04:00
|
|
|
ifeq ($(if $(filter all main exts enc trans libencs libenc libtrans \
|
2015-03-18 04:08:31 -04:00
|
|
|
prog program ruby ruby$(EXEEXT) \
|
|
|
|
wprogram rubyw rubyw$(EXEEXT) \
|
|
|
|
miniruby$(EXEEXT) mini,\
|
2015-03-12 12:15:07 -04:00
|
|
|
$(MAKECMDGOALS)),,$(MAKECMDGOALS)),)
|
2015-10-22 10:56:37 -04:00
|
|
|
-include $(SHOWFLAGS)
|
2015-03-12 12:15:07 -04:00
|
|
|
endif
|
|
|
|
|
2014-06-01 15:32:15 -04:00
|
|
|
ifneq ($(filter universal-%,$(arch)),)
|
|
|
|
define archcmd
|
2014-06-01 15: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 15: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-01 17:50:32 -04:00
|
|
|
$(foreach arch,$(filter -arch=%,$(subst -arch ,-arch=,$(ARCH_FLAG))),\
|
2014-06-01 15:32:15 -04:00
|
|
|
$(eval $(call archcmd,$(patsubst -arch=%,%,$(value arch)),$(patsubst -arch=%,-arch %,$(value arch)))))
|
|
|
|
endif
|
|
|
|
|
2015-04-01 04:14:35 -04:00
|
|
|
ifneq ($(filter $(CHECK_TARGETS) test,$(MAKECMDGOALS)),)
|
2016-01-15 20:37:47 -05:00
|
|
|
yes-test-basic: $(TEST_DEPENDS) yes-test-knownbug
|
2013-03-06 06:59:23 -05:00
|
|
|
yes-test-knownbug: $(TEST_DEPENDS) yes-btest-ruby
|
2016-01-15 20:37:47 -05:00
|
|
|
yes-btest-ruby: $(TEST_DEPENDS)
|
2013-03-06 06:59:23 -05:00
|
|
|
endif
|
2016-01-15 20:37:47 -05:00
|
|
|
ifneq ($(filter $(CHECK_TARGETS),$(MAKECMDGOALS)) $(filter yes-test-all,$(TEST_TARGETS)),)
|
|
|
|
yes-test-testframework yes-test-almost yes-test-ruby: $(filter-out %test-all %test-ruby check%,$(TEST_TARGETS)) \
|
|
|
|
yes-test-basic
|
2013-03-06 06:59:23 -05:00
|
|
|
endif
|
2015-04-01 04:14:35 -04:00
|
|
|
ifneq ($(filter $(CHECK_TARGETS),$(MAKECMDGOALS))$(if $(filter test-all,$(MAKECMDGOALS)),$(filter test-knownbug,$(MAKECMDGOALS))),)
|
2015-10-09 09:54:43 -04:00
|
|
|
yes-test-testframework yes-test-almost yes-test-ruby: yes-test-knownbug
|
|
|
|
yes-test-almost: yes-test-testframework
|
2013-03-26 23:42:19 -04:00
|
|
|
endif
|
2013-03-06 06:59:23 -05:00
|
|
|
|
|
|
|
$(TEST_TARGETS): $(TEST_DEPENDS)
|
2013-03-06 20:39:10 -05: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 10:11:52 -04:00
|
|
|
install-prereq: uninstall
|
|
|
|
uninstall sudo-precheck: all $(if $(filter all,$(INSTALLDOC)),docs)
|
2013-03-06 20:39:10 -05:00
|
|
|
endif
|
2014-06-20 00:20:26 -04:00
|
|
|
|
2015-04-02 03:06:06 -04:00
|
|
|
ifneq ($(filter exam,$(MAKECMDGOALS)),)
|
2015-04-01 10:30:53 -04:00
|
|
|
test-rubyspec: check
|
|
|
|
yes-test-all no-test-all: test
|
|
|
|
endif
|
|
|
|
|
2014-06-20 00:20:26 -04:00
|
|
|
ifneq ($(filter love,$(MAKECMDGOALS)),)
|
|
|
|
showflags: up
|
2016-07-26 12:03:51 -04:00
|
|
|
sudo-precheck: test yes-test-testframework no-test-testframework
|
2014-06-20 00:20:26 -04:00
|
|
|
install-prereq: sudo-precheck
|
|
|
|
yes-test-all no-test-all: install
|
2016-07-26 09:02:34 -04:00
|
|
|
yes-test-almost no-test-almost: install
|
2014-06-20 00:20:26 -04:00
|
|
|
endif
|
2016-06-03 22:40:04 -04:00
|
|
|
|
|
|
|
$(srcdir)/missing/des_tables.c: $(srcdir)/missing/crypt.c
|
2016-06-03 23:46:06 -04:00
|
|
|
ifeq ($(if $(filter yes,$(CROSS_COMPILING)),,$(CC)),)
|
2016-06-03 22:40:04 -04:00
|
|
|
touch $@
|
|
|
|
else
|
|
|
|
@$(ECHO) building make_des_table
|
2016-06-03 23:46:06 -04:00
|
|
|
$(CC) $(CPPFLAGS) -DDUMP $(LDFLAGS) $(XLDFLAGS) $(LIBS) -omake_des_table $(srcdir)/missing/crypt.c
|
|
|
|
@[ -x ./make_des_table ]
|
2016-06-03 22:40:04 -04:00
|
|
|
@$(ECHO) generating $@
|
|
|
|
$(Q) $(MAKEDIRS) $(@D)
|
2016-06-04 06:58:14 -04:00
|
|
|
$(Q) ./make_des_table > $@.new
|
|
|
|
$(Q) mv $@.new $@
|
2016-06-03 22:40:04 -04:00
|
|
|
$(Q) $(RMALL) make_des_table*
|
|
|
|
endif
|
2016-08-19 22:20:34 -04: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 > $@
|