Menu

#23 Do not set CC in makefile if already defined

1.0
pending
nobody
None
2018-05-14
2018-04-25
fredtrot
No

I suggest the following change to be able to build for different platforms without patching the makefile:

diff --git a/utils/makefile b/utils/makefile
index 70ec27b..ab2268d 100644
--- a/utils/makefile
+++ b/utils/makefile
@@ -40,7 +40,7 @@

 # C compiler

-CC = /usr/bin/gcc
+CC ?= /usr/bin/gcc

 # compile - common flags for TSS library and applications

Discussion

  • Ken Goldman

    Ken Goldman - 2018-04-25
    • status: open --> accepted
     
  • Ken Goldman

    Ken Goldman - 2018-05-14
    • status: accepted --> pending
     
  • Ken Goldman

    Ken Goldman - 2018-05-14

    While this construct seems to be supported by gnu make on Linux, it does not seem to be universally supported. It fails with mingw's make. Thus, my instinct is to leave it as is for portability. I looked at a few other open source projects, and never saw ?=.

    Question: Are you using a Linux platform that doesn't install gcc in /usr/bin, or that doesn't use gcc? Did you actually encounter a problem?

     
    • fredtrot

      fredtrot - 2018-05-15

      I think ?= is quite common. I am building for ARM using OpenEmbedded so this is actually a problem, but it's a minor change so I could handle it by local patch of course.

       

Log in to post a comment.