diff options
author | Thorsten Glaser <tg@mirbsd.org> | 2009-12-20 13:40:32 +0059 |
---|---|---|
committer | Waldemar Brodkorb <wbx@openadk.org> | 2009-12-20 17:37:01 +0100 |
commit | ff88b47383f872dbc8b1cf734f5a1679cc9cbe9b (patch) | |
tree | 79f4c63263f8baa62fe3b7d932325ea41e9a5777 | |
parent | 9a29e680fc81a0185dcf6aaca2b560a69edd1f26 (diff) |
In addition to “show”, also do a “dump” target
Similar to MirBSD commitid 1004B2E19EE11E297EC – although this
is a kind of “masterpiece” of freakin’ GNU make hackery. Here,
quoting is achieved manually by the formula of “replace ‘'’ by
‘'\''’ and wrap the whole thing in ‘'…'’” instead of the easier
variable expansion suffix :Q which BSD make has. Compare:
• GNU make
ifneq (${dump},)
__shquote= '$(subst ','\'',$(1))'
__dumpvar= echo $(call __shquote,$(1)=$(call __shquote,${$(1)}))
.DEFAULT_GOAL:= show
show:
@$(foreach _s,${dump},$(call __dumpvar,${_s});)
endif
• BSD make
.ifdef dump
.MAIN: show
show:
. for _s in ${dump}
@echo ${_s:Q:Q}=${${_s}:Q:Q}
. endfor
.endif
Signed-off-by: Thorsten Glaser <tg@mirbsd.org>
-rw-r--r-- | rules.mk | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -43,8 +43,15 @@ TARGET_CFLAGS:= $(strip -fwrapv -fno-ident ${TARGET_CFLAGS}) TARGET_CC:= $(strip ${TARGET_CC}) TARGET_CXX:= $(strip ${TARGET_CXX}) +# I hate GNU make! --mirabilos ifneq (${show},) .DEFAULT_GOAL:= show show: @$(info ${${show}}) +else ifneq (${dump},) +__shquote= '$(subst ','\'',$(1))' +__dumpvar= echo $(call __shquote,$(1)=$(call __shquote,${$(1)})) +.DEFAULT_GOAL:= show +show: + @$(foreach _s,${dump},$(call __dumpvar,${_s});) endif |