Ticket #41064

Don't assume gcc in makedeps.yash

Open Date: 2020-12-21 03:05 Last Update: 2020-12-27 23:12

Reporter:
Owner:
Type:
Status:
Closed
Component:
MileStone:
(None)
Priority:
5 - Medium
Severity:
5 - Medium
Resolution:
Fixed
File:
None
Vote
Score: 0
No votes
0.0% (0/0)
0.0% (0/0)

Details

Don't assume that the compiler is called gcc in makedeps.yash:

diff --git a/makedeps.yash b/makedeps.yash
index 907e692b..315db54e 100644
--- a/makedeps.yash
+++ b/makedeps.yash
@@ -56,8 +56,8 @@ for file do
        file=${file%.c}
        if ! check "$file"
        then
-           printf 'gcc -std=c99 -MM "%s.c" >|"%s.d"\n' "$file" "$file"
-           if ! gcc -std=c99 -MM "${file}.c" >|"${file}.d"
+           printf '%s -std=c99 -MM "%s.c" >|"%s.d"\n' "${CC:-cc}" "$file" "$file"
+           if ! "${CC:-cc}" -std=c99 -MM "${file}.c" >|"${file}.d"
            then
                exitstatus=$?
                printf '%s: cannot update "%s".\n' "$0" "${file}.d" >&2

Ticket History (3/4 Histories)

2020-12-21 03:05 Updated by: kusalananda
  • New Ticket "Don't assume gcc in makedeps.yash" created
2020-12-21 23:06 Updated by: magicant
Comment

"${CC:-cc}"

The CC environment variable is not exported from the Makefile by default, so this would usually expand to cc. If you don't want to assume gcc, you should not want to assume cc either.

2020-12-22 02:44 Updated by: kusalananda
Comment

It would be easy to make CC available in the makedeps.yash script:

diff --git a/Makefile.in b/Makefile.in
index 4d3bae39..1d332916 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -240,7 +240,7 @@ copy-distfiles: distfiles
        mkdir -p $(topdir)/$(DISTTARGETDIR)
        cp $(DISTFILES) $(topdir)/$(DISTTARGETDIR)
 makedeps: _PHONY $(TARGET)
-       $(topdir)/$(TARGET) $(topdir)/makedeps.yash $(SOURCES)
+       CC=$(CC) $(topdir)/$(TARGET) $(topdir)/makedeps.yash $(SOURCES)

 # ctags conforms to POSIX, but etags and cscope do not.
 CTAGS = @CTAGS@
2020-12-27 23:12 Updated by: magicant
  • Resolution Update from None to Fixed
  • Status Update from Open to Closed
Comment

Fixed in r4160

Thanks

Attachment File List

No attachments

Edit

You are not logged in. I you are not logged in, your comment will be treated as an anonymous post. » Login