X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=scripts%2FKbuild.include;h=ac5f275b0283f1f9807fcc281c3a443e30955eda;hb=5d22a312b7afddaed3cbb2fffb3cceb0c22a6cf5;hp=59620b1554e022a316daa7185a0cf17a02fe6e3d;hpb=95d465fd750897ab32462a6702fbfe1b122cbbc0;p=linux-2.6 diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index 59620b1554..ac5f275b02 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -12,6 +12,11 @@ space := $(empty) $(empty) # contain a comma depfile = $(subst $(comma),_,$(@D)/.$(@F).d) +### +# basetarget equals the filename of the target with no extension. +# So 'foo/bar.o' becomes 'bar' +basetarget = $(basename $(notdir $@)) + ### # Escape single quote for use in echo statements escsq = $(subst $(squote),'\$(squote)',$1) @@ -87,6 +92,11 @@ cc-ifversion = $(shell if [ $(call cc-version, $(CC)) $(1) $(2) ]; then \ # $(Q)$(MAKE) $(build)=dir build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj +# Prefix -I with $(srctree) if it is not an absolute path +addtree = $(if $(filter-out -I/%,$(1)),$(patsubst -I%,-I$(srctree)/%,$(1))) $(1) +# Find all -I options and call addtree +flags = $(foreach o,$($(1)),$(if $(filter -I%,$(o)),$(call addtree,$(o)),$(o))) + # If quiet is set, only print short version of command cmd = @$(echo-cmd) $(cmd_$(1))