[kbuild-devel] [request for testing] kbuild: improving option checking
kbuild: improving option checking GNU binutils, root users, tmpfiles, external modules ro builds must be fixed to do the right thing now. In "safe" environment new /dev/null replacement may be use as simply as `echo > null', `gcc -o null'. In aggressive starting with $(null) is recommended. Feature: file $(objtree)/null isn't in any "clear" target (yet). Cc: Roman Zippel <[EMAIL PROTECTED]> Cc: Sam Ravnborg <[EMAIL PROTECTED]> Signed-off-by: Oleg Verych <[EMAIL PROTECTED]> --- -o--=O`C #oo'L O <___=E M --- linux~2.6.20-rc5/scripts/Kbuild.include~blackhole-4-tmpfiles 2007-01-12 19:54:26.0 +0100 +++ linux~2.6.20-rc5/scripts/Kbuild.include 2007-01-24 09:19:01.386426000 +0100 @@ -2,5 +2,5 @@ # kbuild: Generic definitions -# Convinient variables +# Convinient constants comma := , squote := ' @@ -8,4 +8,7 @@ space := $(empty) $(empty) +# Immortal black-hole for mortals and roots +null = $(shell test -L null || (rm -f null; ln -s /dev/null null); echo null) + ### # Name of target with a '.' as filename prefix. foo/bar.o => foo/.bar.o @@ -57,33 +60,43 @@ # See documentation in Documentation/kbuild/makefiles.txt -# output directory for tests below -TMPOUT := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/) - # as-option # Usage: cflags-y += $(call as-option, -Wa$(comma)-isa=foo,) - -as-option = $(shell if $(CC) $(CFLAGS) $(1) -Wa,-Z -c -o /dev/null \ --xassembler /dev/null > /dev/null 2>&1; then echo "$(1)"; \ -else echo "$(2)"; fi ;) +define as-option + $(shell +if $(CC) $(CFLAGS) $(1) -c -o $(null) -xassembler null >null 2>&1; \ + then echo $(1); \ + else echo $(2); \ +fi) +endef # as-instr # Usage: cflags-y += $(call as-instr, instr, option1, option2) - -as-instr = $(shell if echo -e "$(1)" | \ - $(CC) $(AFLAGS) -c -xassembler - \ - -o $(TMPOUT)astest.out > /dev/null 2>&1; \ - then rm $(TMPOUT)astest.out; echo "$(2)"; \ - else echo "$(3)"; fi) +define as-instr + $(shell \ +if printf "$(1)" | $(AS) >$(null) 2>&1 -W -o null; \ + then echo "$(2)"; \ + else echo "$(3)"; \ +fi) +endef # cc-option # Usage: cflags-y += $(call cc-option, -march=winchip-c6, -march=i586) - -cc-option = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \ - > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;) +define cc-option + $(shell \ +if $(CC) $(CFLAGS) $(1) -S -o $(null) -xc null >null 2>&1; \ + then echo "$(1)"; \ + else echo "$(2)"; \ +fi) +endef # cc-option-yn # Usage: flag := $(call cc-option-yn, -march=winchip-c6) -cc-option-yn = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \ -> /dev/null 2>&1; then echo "y"; else echo "n"; fi;) +define cc-option-yn + $(shell \ +if $(CC) $(CFLAGS) $(1) -S -o $(null) -xc null >null 2>&1; \ + then echo "y"; \ + else echo "n"; \ +fi) +endef # cc-option-align @@ -103,8 +116,11 @@ # ld-option # Usage: ldflags += $(call ld-option, -Wl$(comma)--hash-style=both) -ld-option = $(shell if $(CC) $(1) -nostdlib -xc /dev/null \ --o $(TMPOUT)ldtest.out > /dev/null 2>&1; \ - then rm $(TMPOUT)ldtest.out; echo "$(1)"; \ - else echo "$(2)"; fi) +define ld-option + $(shell \ +if $(CC) $(1) -nostdlib -o $(null) -xc null >null 2>&1; \ + then echo "$(1)"; \ + else echo "$(2)"; \ +fi) +endef ### @@ -116,4 +132,5 @@ # 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))) @@ -126,5 +143,5 @@ ### -# if_changed - execute command if any prerequisite is newer than +# if_changed - execute command if any prerequisite is newer than # target, or command line has changed # if_changed_dep - as if_changed, but uses fixdep to reveal dependencies - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ kbuild-devel mailing list kbuild-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kbuild-devel
Re: [kbuild-devel] [request for testing] kbuild: improving option checking
On Wed, 24 Jan 2007, Oleg Verych wrote: > kbuild: improving option checking ... > --- linux~2.6.20-rc5/scripts/Kbuild.include~blackhole-4-tmpfiles > 2007-01-12 19:54:26.0 +0100 > +++ linux~2.6.20-rc5/scripts/Kbuild.include 2007-01-24 09:19:01.386426000 > +0100 > @@ -2,5 +2,5 @@ > # kbuild: Generic definitions > > -# Convinient variables > +# Convinient constants ^^ "Convenient" rday - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ kbuild-devel mailing list kbuild-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kbuild-devel
[kbuild-devel] spelling of Kbuild.include (Re: [request for testing] kbuild: improving option checking)
On Wed, Jan 24, 2007 at 05:37:00AM -0500, Robert P. J. Day wrote: > On Wed, 24 Jan 2007, Oleg Verych wrote: > > > kbuild: improving option checking > ... > > --- linux~2.6.20-rc5/scripts/Kbuild.include~blackhole-4-tmpfiles > > 2007-01-12 19:54:26.0 +0100 > > +++ linux~2.6.20-rc5/scripts/Kbuild.include 2007-01-24 09:19:01.386426000 > > +0100 > > @@ -2,5 +2,5 @@ > > # kbuild: Generic definitions > > > > -# Convinient variables > > +# Convinient constants > ^^ > "Convenient" Kind of testing i never expected. Are you serious? If yes, here more spell things from there, take care of the patch ;D -- # Execute command if command has changed or prerequisitei(s) are updated -- # Usage: $(call if_changed_rule,foo) # will check if $(cmd_foo) changed, or any of the prequisites changed, # and if so will execute $(rule_foo) -- Anyway, i know for sure -- that "things" aren't variables ;D. Variable $(space) == "hyper-space". You know, what i mean. - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ kbuild-devel mailing list kbuild-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kbuild-devel
Re: [kbuild-devel] spelling of Kbuild.include (Re: [request for testing] kbuild: improving option checking)
On Wed, 24 Jan 2007, Oleg Verych wrote: > On Wed, Jan 24, 2007 at 05:37:00AM -0500, Robert P. J. Day wrote: > > On Wed, 24 Jan 2007, Oleg Verych wrote: > > > > > kbuild: improving option checking > > ... > > > --- linux~2.6.20-rc5/scripts/Kbuild.include~blackhole-4-tmpfiles > > > 2007-01-12 19:54:26.0 +0100 > > > +++ linux~2.6.20-rc5/scripts/Kbuild.include 2007-01-24 > > > 09:19:01.386426000 +0100 > > > @@ -2,5 +2,5 @@ > > > # kbuild: Generic definitions > > > > > > -# Convinient variables > > > +# Convinient constants > > ^^ > > "Convenient" > > Kind of testing i never expected. um ... it wasn't "testing," just a trivial observation. happens on the LKML all the time. > Are you serious? If yes, here more spell things from there, take > care of the patch ;D kay, i won't be doing any more of *that* in the future. rday -- == Robert P. J. Day Linux Consulting, Training and Annoying Kernel Pedantry Waterloo, Ontario, CANADA == - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ kbuild-devel mailing list kbuild-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kbuild-devel
Re: [kbuild-devel] spelling of Kbuild.include (Re: [request for testing] kbuild: improving option checking)
24-01-2007, Robert P. J. Day: > On Wed, 24 Jan 2007, Oleg Verych wrote: [] >> > > -# Convinient variables >> > > +# Convinient constants >> > ^^ >> > "Convenient" >> >> Kind of testing i never expected. > > um ... it wasn't "testing," just a trivial observation. happens > on the LKML all the time. And it usually ends with ENOPATCH, IMO. - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ kbuild-devel mailing list kbuild-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kbuild-devel