Merge pull request #1499 from tonytheodore/target-checks

Makefile: fix target validation checks
This commit is contained in:
Tony Theodore 2017-01-19 20:44:23 +11:00 committed by GitHub
commit 43a40a4092
1 changed files with 23 additions and 17 deletions

View File

@ -10,8 +10,8 @@ include $(EXT_DIR)/gmsl
MXE_TRIPLETS := i686-w64-mingw32 x86_64-w64-mingw32 MXE_TRIPLETS := i686-w64-mingw32 x86_64-w64-mingw32
MXE_LIB_TYPES := static shared MXE_LIB_TYPES := static shared
MXE_TARGET_LIST := $(foreach TRIPLET,$(MXE_TRIPLETS),\ MXE_TARGET_LIST := $(strip $(foreach TRIPLET,$(MXE_TRIPLETS),\
$(addprefix $(TRIPLET).,$(MXE_LIB_TYPES))) $(addprefix $(TRIPLET).,$(MXE_LIB_TYPES))))
MXE_TARGETS := i686-w64-mingw32.static MXE_TARGETS := i686-w64-mingw32.static
DEFAULT_MAX_JOBS := 6 DEFAULT_MAX_JOBS := 6
@ -69,8 +69,10 @@ define newline
endef endef
\n := $(newline)
null := null :=
space := $(null) $(null) space := $(null) $(null)
repeat = $(subst x,$(1),$(subst $(space),,$(call int_encode,$(2))))
MXE_DISABLE_DOC_OPTS = \ MXE_DISABLE_DOC_OPTS = \
ac_cv_prog_HAVE_DOXYGEN="false" \ ac_cv_prog_HAVE_DOXYGEN="false" \
@ -421,27 +423,31 @@ MAX_TARGET_WIDTH := $(call LIST_NMAX, $(sort $(call map, strlen, $(MXE_TARGETS))
TARGET_COL_WIDTH := $(call subtract,100,$(call plus,$(PKG_COL_WIDTH),$(MAX_TARGET_WIDTH))) TARGET_COL_WIDTH := $(call subtract,100,$(call plus,$(PKG_COL_WIDTH),$(MAX_TARGET_WIDTH)))
PRINTF_FMT := printf '%-11s %-$(PKG_COL_WIDTH)s %-$(TARGET_COL_WIDTH)s %-15s %s\n' PRINTF_FMT := printf '%-11s %-$(PKG_COL_WIDTH)s %-$(TARGET_COL_WIDTH)s %-15s %s\n'
RTRIM := $(SED) 's, \+$$$$,,' RTRIM := $(SED) 's, \+$$$$,,'
WRAP_MESSAGE = $(\n)$(\n)$(call repeat,-,60)$(\n)$(1)$(and $(2),$(\n)$(\n)$(2))$(\n)$(call repeat,-,60)$(\n)
.PHONY: download .PHONY: download
download: $(addprefix download-,$(PKGS)) download: $(addprefix download-,$(PKGS))
define TARGET_RULE define TARGET_RULE
$(if $(findstring i686-pc-mingw32,$(1)), $(if $(findstring i686-pc-mingw32,$(1)),\
$(error Deprecated target specified: "$(1)". Please use \ $(error $(call WRAP_MESSAGE,\
i686-w64-mingw32.[$(subst $(space),|,$(MXE_LIB_TYPES))] instead)) Obsolete target specified: "$(1)",\
$(if $(filter $(addsuffix %,$(MXE_TARGET_LIST) $(BUILD) $(MXE_TRIPLETS)),$(1)),, Please use i686-w64-mingw32.[$(subst $(space),|,$(MXE_LIB_TYPES))]$(\n)\
$(error Invalid target specified: "$(1)")) i686-pc-mingw32 removed 2014-10-14 (https://github.com/mxe/mxe/pull/529)\
$(if $(findstring 1,$(words $(subst ., ,$(filter-out $(BUILD),$(1))))), )))\
@echo $(if $(filter $(addsuffix %,$(MXE_TARGET_LIST) $(BUILD) $(MXE_TRIPLETS)),$(1)),,\
@echo '------------------------------------------------------------' $(error $(call WRAP_MESSAGE,\
@echo 'Warning: Deprecated target name $(1) specified' Invalid target specified: "$(1)",\
@echo Please use:$(\n)\
@echo 'Please use $(1).[$(subst $(space),|,$(MXE_LIB_TYPES))] instead' $(subst $(space),$(\n) ,$(MXE_TARGET_LIST))\
@echo 'See docs/index.html for further information' )))\
@echo '------------------------------------------------------------' $(if $(findstring 1,$(words $(subst ., ,$(filter-out $(BUILD),$(1))))),\
@echo) $(warning $(call WRAP_MESSAGE,\
Warning: Deprecated target specified "$(1)",\
Please use $(1).[$(subst $(space),|,$(MXE_LIB_TYPES))]$(\n) \
)))
endef endef
$(foreach TARGET,$(MXE_TARGETS),$(eval $(call TARGET_RULE,$(TARGET)))) $(foreach TARGET,$(MXE_TARGETS),$(call TARGET_RULE,$(TARGET)))
define PKG_RULE define PKG_RULE
.PHONY: download-$(1) .PHONY: download-$(1)