summaryrefslogtreecommitdiffstats
path: root/rules/post/check-version.make
blob: f1146a39b37bbe993ca4c9491a46e17166f5b77a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#-*-makefile-*-

#
# some black-make-magick:
#
# var					example		meaning
# ----------------------------------------------------------------------------------------------------
# $(1)					"PTX_CV_GTK"	the input
# $($(1))				"2.10.14"	the "should" be version number
# $(subst PTX_CV_,,$(1))_VERSION	"GTK_VERSION"	the variable that holds the is version number
# $($(subst PTX_CV_,,$(1))_VERSION)	"2.10.14"	the "is" version number
#
# we try substitute the "is" version number
# with "" (nothing) in the "should" version number string.
# if this equals "" (nothing) we have the right version,
# if not we bail out with an error
#
# BTW: if someone has a different, better or more elegant solution,
#      I'm courious to see :)
#
define ptx/cv/check
$(if $(subst $($(subst PTX_CV_,,$(1))_VERSION),,$($(1))), \
	$(error Wrong $(subst PTX_CV_,,$(1)) version, you should have "$($(1))", but "$($(subst PTX_CV_,,$(1))_VERSION)" is selected), )
endef

ptx/cv/programs := $(filter PTX_CV_%,$(.VARIABLES))
$(foreach program,$(ptx/cv/programs),$(call ptx/cv/check,$(program)))

# vim: syntax=make