Questionable instructions on "A guide to Windows application development using w64devkit

Message ID
DKIM signature
Download raw message

In the example hello world Makefile, this line in shown for the extension of the executable
"EXE     = .exe"
It is in fact not actually necessary to do this on Windows, the .exe extension is added automatically
This reduces complexity in the Makefile at absolutely no cost.
I don't know of any other operating systems that put extensions on executables, so I'm not really
sure what its purpose is.

It also makes the following reduntant:
"This is very much a Windows-first style of Makefile, but still allows it to be comfortably used on other systems. On Linux this make invocation strips away the .exe extension:"
"make EXE="

Perhaps this section of the article should be removed? I think it's not necessary or helpful.

Best wishes,
Peter D.
Message ID
<CG3GAJ2EBINX.3W1K4UV49XC2O@PeterD> (view parent)
DKIM signature
Download raw message
It's true that GCC automatically adds the extension. However, if the 
Makefile target lacks the extension then make always rebuilds the target 
unnecessarily, because the target and compiler output file name disagree. 
Furthermore, the "clean" target will not work correctly unless the file 
name arguments have the correct extension.

I resolve both issues using "EXE" as a convention as described. On Windows 
I set it in my .profile so that all of my Makefiles automatically work by 
default regardless of where I'm building:


If not set, the Makefile will still mostly work thanks to GCC's behavior, 
even if less optimal, which acts as a kind of fallback.
Reply to thread Export thread (mbox)