2009-10-10 14:15:09 +00:00
|
|
|
include make/$(BUILDRULES).mk
|
2008-04-29 12:55:25 +00:00
|
|
|
|
2009-10-10 16:51:20 +00:00
|
|
|
define firstelem
|
|
|
|
$(word 1,$(subst /, ,$(1)))
|
|
|
|
endef
|
|
|
|
SPC := $(subst /, ,/)
|
|
|
|
define lastelem
|
|
|
|
$(subst $(SPC),/,$(word $(words $(subst /, ,$(1))),$(subst /, ,$(1))))
|
|
|
|
endef
|
|
|
|
define objbase
|
|
|
|
$(patsubst %.$(2),%.$(3),$(firstelem)/$(OUTPUT_DIR)/$(lastelem))
|
|
|
|
endef
|
|
|
|
|
2008-04-29 12:55:25 +00:00
|
|
|
# Usage: $(call src_to_obj,srcs)
|
|
|
|
define src_to_obj
|
2009-10-10 16:51:20 +00:00
|
|
|
$(foreach F,$(1),$(call objbase,$(F),cc,$(OBJ)))
|
2008-04-29 12:55:25 +00:00
|
|
|
endef
|
|
|
|
|
2009-09-27 14:52:04 +00:00
|
|
|
# Usage: $(call c_src_to_obj,srcs)
|
|
|
|
define c_src_to_obj
|
2009-10-10 16:51:20 +00:00
|
|
|
$(foreach F,$(1),$(call objbase,$(F),c,$(OBJ)))
|
2009-09-27 14:52:04 +00:00
|
|
|
endef
|
|
|
|
|
2008-04-29 12:55:25 +00:00
|
|
|
# Usage: $(call src_to_lobj,srcs)
|
|
|
|
define src_to_lobj
|
2009-10-10 16:51:20 +00:00
|
|
|
$(foreach F,$(1),$(call objbase,$(F),cc,$(LOBJ)))
|
|
|
|
endef
|
|
|
|
|
|
|
|
# Usage: $(call c_src_to_lobj,srcs)
|
|
|
|
define c_src_to_lobj
|
|
|
|
$(foreach F,$(1),$(call objbase,$(F),c,$(LOBJ)))
|
2008-04-29 12:55:25 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
# Usage: $(call obj_to_dep,objs)
|
|
|
|
define obj_to_dep
|
2009-10-10 14:15:09 +00:00
|
|
|
$(patsubst %.$(OBJ),%.dep,$(1))
|
2008-04-29 12:55:25 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
# Usage: $(call lobj_to_dep,objs)
|
|
|
|
define lobj_to_dep
|
2009-10-10 14:15:09 +00:00
|
|
|
$(patsubst %.$(LOBJ),%.dep,$(1))
|
2008-04-29 12:55:25 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
# Usage: $(call depflags,$(basename obj))
|
|
|
|
ifeq ($(GENDEPS),1)
|
|
|
|
depflags=-MD -MF $(1).dep -MP
|
|
|
|
else
|
|
|
|
depflags=
|
|
|
|
endif
|
2017-08-14 12:02:35 +00:00
|
|
|
|
|
|
|
# Usage: $(call run_qtest,dir)
|
|
|
|
define run_qtest
|
|
|
|
@echo running qtest-driver for $(1)
|
|
|
|
@(cd $(1)/$(OUTPUT_DIR); \
|
|
|
|
if TC_SRCS="$(foreach T,$(TC_SRCS_$(1)),../../$(T))" \
|
|
|
|
$(QTEST) -bindirs .:.. -datadir ../qtest -covdir ..; then \
|
|
|
|
true; \
|
|
|
|
else \
|
|
|
|
if test "$(SHOW_FAILED_TEST_OUTPUT)" = "1"; then \
|
|
|
|
cat -v qtest.log; \
|
|
|
|
fi; \
|
|
|
|
false; \
|
|
|
|
fi)
|
|
|
|
endef
|