diff options
author | Marc Kleine-Budde <mkl@pengutronix.de> | 2009-06-14 22:23:58 +0000 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2009-06-14 22:23:58 +0000 |
commit | 57d06cf06ebcb42385262a944eef2cccd555f12e (patch) | |
tree | 2b6d9b74ee007e990d4ffd761c7516d09069a062 /rules/other | |
parent | b2cce8c619a43896e73e944848227f775389fa4c (diff) | |
download | ptxdist-57d06cf06ebcb42385262a944eef2cccd555f12e.tar.gz ptxdist-57d06cf06ebcb42385262a944eef2cccd555f12e.tar.xz |
[Definitions] provide ptx/escape
add a function to escape strings for shell usage
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
git-svn-id: https://svn.pengutronix.de/svn/ptxdist/trunks/ptxdist-trunk@10774 33e552b5-05e3-0310-8538-816dae2090ed
Diffstat (limited to 'rules/other')
-rw-r--r-- | rules/other/Definitions.make | 47 |
1 files changed, 40 insertions, 7 deletions
diff --git a/rules/other/Definitions.make b/rules/other/Definitions.make index 3f658f01e..a76956dae 100644 --- a/rules/other/Definitions.make +++ b/rules/other/Definitions.make @@ -1,4 +1,13 @@ # -*-makefile-*- +# +# Copyright (C) 2004, 2005, 2006, 2007, 2008 by the PTXdist project +# 2009 by Marc Kleine-Budde <mkl@pengutronix.de> +# +# See CREDITS for details about who has contributed to this project. +# +# For further information about the PTXdist project and license conditions +# see the README file. +# PTXCONFIG := $(PTXDIST_PTXCONFIG) PLATFORMCONFIG := $(PTXDIST_PLATFORMCONFIG) @@ -7,21 +16,45 @@ PARALLELMFLAGS := $(PTXDIST_PARALLELMFLAGS_INTERN) PARALLELMFLAGS_BROKEN := -j1 # -# Some definitions for stuff which even kicks vim's syntax highlighting -# off the corner... +# provide defines for some unusual chars # +ptx/def/comma :=, +ptx/def/nullstring := +ptx/def/space :=$(ptx/def/nullstring) $(ptx/def/nullstring) +ptx/def/dquote :="#" +ptx/def/squote :='#' +ptx/def/dollar :=$$ + +define ptx/escape/1 +$(subst $(1),\$(1),$(2)) +endef + +define ptx/escape/2 +$(subst $(1),\\$(1),$(2)) +endef + +define ptx/escape +$(strip $(call ptx/escape/2,$(ptx/def/dollar),$(call ptx/escape/1,$(ptx/def/dquote),$(1)))) +endef + + +# backwards compat comma :=, -dollar := $$ nullstring := space :=$(nullstring) $(nullstring) quote :="#" +define remove_quotes +$(strip $(subst $(quote),,$(1))) +endef -remove_quotes = $(strip $(subst $(quote),,$(1))) -add_quote = $(strip $(subst $(dollar),\\$(dollar),$(subst $(quote),\$(quote),$(1)))) - +define add_quote +$(subst $(quote),\$(quote),$(1)) +endef -tr_sh = $(strip $(shell echo $(1) | sed 'y%*+%pp%;s%[^_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]%_%g')) +define tr_sh +$(strip $(shell echo $(1) | sed 'y%*+%pp%;s%[^_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]%_%g')) +endef # vim600:set foldmethod=marker: # vim600:set syntax=make: |