Skip to content

Commit

Permalink
#96: some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
abusalimov committed Sep 11, 2010
1 parent fc94b76 commit fdca53f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
7 changes: 6 additions & 1 deletion mk/util.mk
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ define \n
endef
\n := $(\n)

\space :=
\space +=

$(\space):=

escape = $(call assert_called,escape,$0)$(call dollar_encode,$1)

dollar_encode = $(call assert_called,dollar_encode,$0)$(subst $$,$$$$,$1)
Expand Down Expand Up @@ -46,7 +51,7 @@ already_included = \
$(or $(call get,included,$(self_makefile)), \
$(call set,included,$(self_makefile),true))

called = $()$(call seq,$1,$2)
called = $(call seq,$1,$2)

##
# Can be used to check whether the variable is expanded using call or not.
Expand Down
10 changes: 6 additions & 4 deletions mk/util/make_version.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,19 @@

### Version utils.

make_version_major = $(call __make_version_part,make_version_major,$0,$1)
make_version_minor = $(call __make_version_part,make_version_minor,$0,$1)
make_version_major = \
$(call __make_version_part,make_version_major,$(value 0),$(value 1))
make_version_minor = \
$(call __make_version_part,make_version_minor,$(value 0),$(value 1))

__make_version_part = $(strip \
$(if $(call called,$1,$2), \
$(or $(call __$1,$3),$(call assert,$(false),Invalid argument [$3]), \
$(or $(call __$1,$3),$(call assert,$(false),Invalid argument [$3])), \
$(call __$1,$(MAKE_VERSION)) \
) \
)

__make_version = $(subst ,.,$(\space),$1)
__make_version = $(subst .,$(\space),$1)
__make_version_major = $(word 1,$(__make_version))
__make_version_minor = $(word 2,$(__make_version))

Expand Down

0 comments on commit fdca53f

Please sign in to comment.