Hi,

I am interested in learning more about the default implicit rules. It seems
that make has explicitly supported C projects for many years, providing
default rule behaviors for common C files, including implementation files,
header files, objects, and executables.

Given the popularity of the higher level C++ language, I think it would be
useful to declare similar implicit default rules for C++ project files.

As of POSIX 2024, make defaults the C standard version to C17. Simply for
parity, propose declaring the default C++ standard version as C++17.

The default C++ compiler program name would be "c++".

In addition to C's CFLAGS, we have:

* CPPFLAGS (apply to both C and C++ implementation and header files)
* CXXFLAGS (apply solely to C++ implementation and header files)

We have an opportunity to improve the out of the box compilation behavior
for C++ projects with make. Unlike C, many C++ compilers fall on their face
if the C++ standard library version is not set. Conventionally -std=c++17.
We could feature -std=$(C++17) as one of the default CXXFLAGS entries, so
that more C++ programs build correctly by default. Anyone who wishes to
override this behavior may customize CXXFLAGS. So embedded developers,
C++23 developers, and legacy C++11 or older developers can continue with
minimal impact.

autotools, cmake, ninja, and a dozen other build systems also support C++
projects. But ideally we tap into the elegance of pure make.

Same question for linkers (ld program, .ld files), and for assemblers as
well (cc program, .asm files).

I think it's an interesting historical quirk that make has built-in rules
for lex and yacc but not C++.

-- 
Cheers,
Andrew
  • Proposal: Declare... Andrew Pennebaker via austin-group-l at The Open Group
    • Re: Proposal... Lawrence Velázquez via austin-group-l at The Open Group
    • Re: Proposal... Oğuz via austin-group-l at The Open Group
    • Re: Proposal... Paul Smith via austin-group-l at The Open Group
      • Re: Prop... Paul Smith via austin-group-l at The Open Group
        • Re: ... Andrew Pennebaker via austin-group-l at The Open Group
          • ... Lawrence Velázquez via austin-group-l at The Open Group
            • ... Steffen Nurpmeso via austin-group-l at The Open Group
    • Re: Proposal... Jonathan Wakely via austin-group-l at The Open Group
      • Re: Prop... Jonathan Wakely via austin-group-l at The Open Group

Reply via email to