2013-06-20 14:19:02 +04:00
|
|
|
# -*- makefile-gmake -*-
|
2013-03-06 15:59:23 +04: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)))
|
|
|
|
TEST_DEPENDS += $(TEST_DEPENDS) $(if $(filter check%,$(MAKECMDGOALS)),main)
|
|
|
|
|
2014-03-25 05:30:07 +04:00
|
|
|
ifneq ($(filter -O0 -Od,$(optflags)),)
|
|
|
|
override XCFLAGS := $(filter-out -D_FORTIFY_SOURCE=%,$(XCFLAGS))
|
|
|
|
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
|
|
|
|
|
2013-03-06 15:59:23 +04:00
|
|
|
ifneq ($(filter check% test,$(MAKECMDGOALS)),)
|
|
|
|
yes-test-knownbug: $(TEST_DEPENDS) yes-btest-ruby
|
|
|
|
yes-btest-ruby: $(TEST_DEPENDS) yes-test-sample
|
|
|
|
yes-test-sample: $(TEST_DEPENDS)
|
|
|
|
endif
|
|
|
|
ifneq ($(filter check%,$(MAKECMDGOALS)) $(filter test-all,$(TEST_TARGETS)),)
|
2013-03-27 01:39:47 +04:00
|
|
|
yes-test-all yes-test-ruby: $(filter-out %test-all %test-ruby check%,$(TEST_TARGETS))
|
2013-03-06 15:59:23 +04:00
|
|
|
endif
|
2013-03-27 07:42:19 +04:00
|
|
|
ifneq ($(filter check%,$(MAKECMDGOALS))$(if $(filter test-all,$(MAKECMDGOALS)),$(filter test-knownbug,$(MAKECMDGOALS))),)
|
|
|
|
yes-test-all yes-test-ruby: yes-test-knownbug
|
|
|
|
endif
|
2013-03-06 15:59:23 +04:00
|
|
|
|
|
|
|
$(TEST_TARGETS): $(TEST_DEPENDS)
|
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)),)
|
|
|
|
install: uninstall
|
|
|
|
endif
|