X-Git-Url: http://pilppa.org/gitweb/?a=blobdiff_plain;f=scripts%2FKbuild.include;h=0168d6c37075dd46b4b5bd090ac7c85fb153ce60;hb=2bf2154c6bb5599e3ec3f73c34861a0b12aa839e;hp=9087273abf91665e078ea43884cbea00d8e3ea07;hpb=1e231efe50ffe4d291be24d2fe393188de9c4b08;p=linux-2.6-omap-h63xx.git diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 9087273abf9..0168d6c3707 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -3,6 +3,7 @@ # Convinient variables comma := , +squote := ' empty := space := $(empty) $(empty) @@ -11,6 +12,10 @@ space := $(empty) $(empty) # contain a comma depfile = $(subst $(comma),_,$(@D)/.$(@F).d) +### +# Escape single quote for use in echo statements +escsq = $(subst $(squote),'\$(squote)',$1) + ### # filechk is used to check if the content of a generated file is updated. # Sample usage: @@ -47,7 +52,10 @@ build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj # If quiet is set, only print short version of command cmd = @$(if $($(quiet)cmd_$(1)),\ - echo ' $(subst ','\'',$($(quiet)cmd_$(1)))' &&) $(cmd_$(1)) + echo ' $(call escsq,$($(quiet)cmd_$(1)))' &&) $(cmd_$(1)) + +# Add $(obj)/ for paths that is not absolute +objectify = $(foreach o,$(1),$(if $(filter /%,$(o)),$(o),$(obj)/$(o))) ### # if_changed - execute command if any prerequisite is newer than @@ -65,7 +73,7 @@ endif # echo command. Short version is $(quiet) equals quiet, otherwise full command echo-cmd = $(if $($(quiet)cmd_$(1)), \ - echo ' $(subst ','\'',$($(quiet)cmd_$(1)))';) + echo ' $(call escsq,$($(quiet)cmd_$(1)))';) # function to only execute the passed command if necessary # >'< substitution is for echo to work, >$< substitution to preserve $ when reloading .cmd file @@ -75,7 +83,7 @@ if_changed = $(if $(strip $? $(call arg-check, $(cmd_$(1)), $(cmd_$@)) ), \ @set -e; \ $(echo-cmd) \ $(cmd_$(1)); \ - echo 'cmd_$@ := $(subst $$,$$$$,$(subst ','\'',$(cmd_$(1))))' > $(@D)/.$(@F).cmd) + echo 'cmd_$@ := $(subst $$,$$$$,$(call escsq,$(cmd_$(1))))' > $(@D)/.$(@F).cmd) # execute the command and also postprocess generated .d dependencies # file @@ -84,7 +92,7 @@ if_changed_dep = $(if $(strip $? $(filter-out FORCE $(wildcard $^),$^)\ @set -e; \ $(echo-cmd) \ $(cmd_$(1)); \ - scripts/basic/fixdep $(depfile) $@ '$(subst $$,$$$$,$(subst ','\'',$(cmd_$(1))))' > $(@D)/.$(@F).tmp; \ + scripts/basic/fixdep $(depfile) $@ '$(subst $$,$$$$,$(call escsq,$(cmd_$(1))))' > $(@D)/.$(@F).tmp; \ rm -f $(depfile); \ mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd)