Subject: | gmake defaults to g++ for .c because of known bug documented at gnu.org |
Recently resolved bug at gnu.org
https://savannah.gnu.org/bugs/index.php?46304
The problem wasn't interfering with installation of cpan modules but was interfering with building of Perl6 MoarVM - see https://github.com/MoarVM/MoarVM/issues/292.
Given the Makefile below
# start of Makefile
CC=gcc
hello.exe : hello.o
gcc -o hello.exe hello.o
#end of Makefile
Strawberry Perl gmake will compile hello.c with g++ instead of gcc because gmake was, apparently inapropriately, built with a default rule that said ".c" files should be treated like ".C" files (upper case C being treated as C++).
%.o: %.c
# recipe to execute (built-in):
$(COMPILE.C) $(OUTPUT_OPTION) $<
The COMPILE.C should be COMPILE.c as detailed in the gnu bug report.
The hello.c file is standard but included below for completeness.
/*************** hello.c ****************/
#include <stdio.h>
int main(int argc, char **argv) {
printf("hello world\n");
}