Menu

#8 Fixup build flags

2.0
closed
nobody
None
2020-07-27
2018-12-31
No

Hi,
Please separate between required flags and optional/debug/target flags.
These flags should be left for downstream to apply.
CCFLAGS: -ggdb -O0 -Werror
LNFLAGS: -ggdb

You can keep these as default in a different variable, for example:

CCFLAGS=-ggdb -O0 -Werror
BUILD_CCFLAGS=$(CCFLAGS) <the rest="">
LNFLAGS=-ggdb
BUILD_LNFLAGS=$(SITE_LNFLAGS) <the rest=""></the></the>

This way downstream can override only CCFLAGS/LNFLAGS which should probably be called CFLAGS and LDFLAGS... without breaking the mandatory build specific flags.

Thanks!

Related

Tickets: #8

Discussion

  • Ken Goldman

    Ken Goldman - 2019-01-07

    You obviously know more about makefile coding than I do, but I want to
    make sure what you suggested will work in general.

    Here are some questions to start. Once the code gets complex. comments
    will help a lot. Remember that most users are not experts. I had to
    actually document (for Linux users) that they should run make by typing
    'make' on the command line.

    1 - It seems that your structure is now makefile.mak -> makefile ->
    makefile-common. Is that right?

    2 - If so, e.g., ARCH_CFLAGS is set in makefile.mak. When that calls
    makefile, there's a ARCH_CFLAGS that seems to override the top level one.

    https://www.gnu.org/software/make/manual/html_node/Variables_002fRecursion.html#Variables_002fRecursion
    says that -e is needed, but I don't see it.

    Is it documented that the top level settings have precedence?

    3 - -lrt I believe is needed for the threads library. The TPM has a
    second port that it uses for out of band commands like power up/down.

    4 - I had "c:/program files/MinGW/lib/libws2_32.a". I now
    see -lws2_32. Does that work if the path changes.

    5 - You changed CCFLAGS to CFLAGS. I sense that there is something
    special about CFLAGS, right? Are BUILD_CFLAGS, ARCH_CFLAGS, etc.
    also special key words, or are they just a convention.

    --
    Ken Goldman kgoldman@us.ibm.com
    914-945-2415 (862-2415)

    From: "Alon Bar-Lev" alonbl@users.sourceforge.net
    To: "Ticket #8: Fixup build flags"
    8@tickets.ibmswtpm2.p.re.sourceforge.net
    Date: 12/31/2018 05:25 PM
    Subject: [ibmswtpm2:tickets] #8 Fixup build flags


    [tickets:#8] Fixup build flags

    Status: open
    Milestone: 2.0
    Created: Mon Dec 31, 2018 10:24 PM UTC by Alon Bar-Lev
    Last Updated: Mon Dec 31, 2018 10:24 PM UTC
    Owner: nobody

    Hi,
    Please separate between required flags and optional/debug/target flags.
    These flags should be left for downstream to apply.
    CCFLAGS: -ggdb -O0 -Werror
    LNFLAGS: -ggdb

    You can keep these as default in a different variable, for example:

    CCFLAGS=-ggdb -O0 -Werror
    BUILD_CCFLAGS=$(CCFLAGS) <the rest="">
    LNFLAGS=-ggdb
    BUILD_LNFLAGS=$(SITE_LNFLAGS) <the rest=""></the></the>

    This way downstream can override only CCFLAGS/LNFLAGS which should
    probably be called CFLAGS and LDFLAGS... without breaking the mandatory
    build specific flags.

    Thanks!


    Sent from sourceforge.net because you indicated interest in <
    https://sourceforge.net/p/ibmswtpm2/tickets/8/

    To unsubscribe from further messages, please visit <
    https://sourceforge.net/auth/subscriptions/

     

    Related

    Tickets: #8

    • Alon Bar-Lev

      Alon Bar-Lev - 2019-01-07

      On Mon, Jan 7, 2019 at 5:55 PM Ken Goldman
      kagoldman@users.sourceforge.net wrote:

      You obviously know more about makefile coding than I do, but I want to
      make sure what you suggested will work in general.

      Here are some questions to start. Once the code gets complex. comments
      will help a lot. Remember that most users are not experts. I had to
      actually document (for Linux users) that they should run make by typing
      'make' on the command line.

      Yes, this is the reason we do not use make directly but
      autoconf/automake, which helps a lot in simplifying the build system
      and detecting dependencies. After we finish this phase we can migrate
      to these tools if you like, much easier to maintain and use.

      1 - It seems that your structure is now makefile.mak -> makefile ->
      makefile-common. Is that right?

      I left makefile-common because I did not want to make too many changes.
      The makefile is the one that is reused by all component, by default it
      is suitable for linux.,

      2 - If so, e.g., ARCH_CFLAGS is set in makefile.mak. When that calls
      makefile, there's a ARCH_CFLAGS that seems to override the top level one.

      Correct.

      https://www.gnu.org/software/make/manual/html_node/Variables_002fRecursion.html#Variables_002fRecursion
      says that -e is needed, but I don't see it.

      Is it documented that the top level settings have precedence?

      This is how it worked for decades[1] :)

      [1] https://www.gnu.org/software/make/manual/html_node/Overriding.html

      3 - -lrt I believe is needed for the threads library. The TPM has a
      second port that it uses for out of band commands like power up/down.

      This dependency is added automatically, I do not experience any issue
      when removing it explicitly.

      4 - I had "c:/program files/MinGW/lib/libws2_32.a". I now
      see -lws2_32. Does that work if the path changes.

      The ws2_32 is default mingw library, it is in the default search path.
      Please make sure this is the case for you or your mingw installation
      is not correct.
      In any case you should use -L to add library search path and not use
      fully qualified library.

      5 - You changed CCFLAGS to CFLAGS. I sense that there is something
      special about CFLAGS, right? Are BUILD_CFLAGS, ARCH_CFLAGS, etc.
      also special key words, or are they just a convention.

      CFLAGS/LDFLAGS are the best practice for people to specify additional
      flags to a build.
      The BUILD_ flags I used within the makefile for these flags that are
      provided by the build system and should not be overridden by the
      users.
      The ARCH_
      flags I used to allow override by the different makefiles
      that you have per architecture, as you do not use autoconf/automake so
      you require static flags.

      --
      Ken Goldman kgoldman@us.ibm.com
      914-945-2415 (862-2415)

      From: "Alon Bar-Lev" alonbl@users.sourceforge.net
      To: "Ticket #8: Fixup build flags"
      8@tickets.ibmswtpm2.p.re.sourceforge.net
      Date: 12/31/2018 05:25 PM
      Subject: [ibmswtpm2:tickets] #8 Fixup build flags


      [tickets:#8] Fixup build flags

      Status: open
      Milestone: 2.0
      Created: Mon Dec 31, 2018 10:24 PM UTC by Alon Bar-Lev
      Last Updated: Mon Dec 31, 2018 10:24 PM UTC
      Owner: nobody

      Hi,
      Please separate between required flags and optional/debug/target flags.
      These flags should be left for downstream to apply.
      CCFLAGS: -ggdb -O0 -Werror
      LNFLAGS: -ggdb

      You can keep these as default in a different variable, for example:

      CCFLAGS=-ggdb -O0 -Werror
      BUILD_CCFLAGS=$(CCFLAGS) <the rest="">
      LNFLAGS=-ggdb
      BUILD_LNFLAGS=$(SITE_LNFLAGS) <the rest=""></the></the>

      This way downstream can override only CCFLAGS/LNFLAGS which should
      probably be called CFLAGS and LDFLAGS... without breaking the mandatory
      build specific flags.

      Thanks!


      Sent from sourceforge.net because you indicated interest in <
      https://sourceforge.net/p/ibmswtpm2/tickets/8/

      To unsubscribe from further messages, please visit <
      https://sourceforge.net/auth/subscriptions/


      [tickets:#8] Fixup build flags

      Status: open
      Milestone: 2.0
      Created: Mon Dec 31, 2018 10:24 PM UTC by Alon Bar-Lev
      Last Updated: Tue Jan 01, 2019 09:15 PM UTC
      Owner: nobody

      Hi,
      Please separate between required flags and optional/debug/target flags.
      These flags should be left for downstream to apply.
      CCFLAGS: -ggdb -O0 -Werror
      LNFLAGS: -ggdb

      You can keep these as default in a different variable, for example:

      CCFLAGS=-ggdb -O0 -Werror
      BUILD_CCFLAGS=$(CCFLAGS) <the rest="">
      LNFLAGS=-ggdb
      BUILD_LNFLAGS=$(SITE_LNFLAGS) <the rest=""></the></the>

      This way downstream can override only CCFLAGS/LNFLAGS which should probably be called CFLAGS and LDFLAGS... without breaking the mandatory build specific flags.

      Thanks!


      Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/ibmswtpm2/tickets/8/

      To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

       

      Related

      Tickets: #8

  • Ken Goldman

    Ken Goldman - 2020-07-27
    • status: open --> closed
     

Log in to post a comment.