From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de ([195.135.220.15]:60242 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932116AbcAHLbq (ORCPT ); Fri, 8 Jan 2016 06:31:46 -0500 Subject: Re: Thoughts about introducing OPTIMIZATION_CFLAG References: <20160104113318.700a9ed0@lxorguk.ukuu.org.uk> <568AF421.7050305@suse.cz> From: Michal Marek Message-ID: <568F9E1E.7030406@suse.cz> Date: Fri, 8 Jan 2016 12:31:42 +0100 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kbuild-owner@vger.kernel.org List-ID: To: sedat.dilek@gmail.com Cc: One Thousand Gnomes , Linus Torvalds , Andrew Morton , Sam Ravnborg , "Rafael J. Wysocki" , Arnd Bergmann , Ingo Molnar , linux-kbuild@vger.kernel.org, Linux ACPI , LKML , the arch/x86 maintainers On 2016-01-08 11:03, Sedat Dilek wrote: > On Mon, Jan 4, 2016 at 11:37 PM, Michal Marek wrote: >> Dne 4.1.2016 v 12:47 Sedat Dilek napsal(a): >>> But I think you did not get my problem - to have two different >>> optimization-levels for a compiler in *one* make-line makes no sense >>> to me. >> >> That we sometimes have -O2 ... -Os on the command line is not a problem, >> since any same unix tool parses its options so that the last one of >> mutually exclusive options wins. > > That is new to me and I haven't tested this by dropping arguments in > my make-line(s). > > From where do have this information - sort of "business-life-experience" :-)? > Is that documented somewhere in the Linux-sources? You override a previously set option by appending one with different value: $ yes | head -n 10 -n 999 -n 2 y y $ This pattern is used all over in Makefiles. > Do you agree that it is confusing to have two optlevel arguments in > one make-line? It probably is, but fixing this problem would make the Makefiles unreadable. > Linus suggested me to use a wrapper-script in case of using two > different compiler and passing arguments... > > [ /usr/bin/mycompiler ] > #!/bin/bash > > gcc-4.9 "$@" > - EOF - > > According to your statement passing an optlevel here in this script > will never-ever be recognized - as it is at the begin-of-(make)-line. Pass it as the last argument. > So how should someone change the Linux-sources to test a different > optlevel than -O2? make KCFLAGS=-O3 However, per-directory and per-file cflags set in Makefiles will take precedence. If you want to override these as well, use the wrapper. Michal