bcrypt_elixir icon indicating copy to clipboard operation
bcrypt_elixir copied to clipboard

Makefile: Obey CPPFLAGS from the environment.

Open Batchyx opened this issue 2 years ago • 2 comments

Most Linux packaging systems provide generic CPPFLAGS that should be used by every package.

Batchyx avatar Mar 05 '23 18:03 Batchyx

Sorry, but I have just noticed this PR. Could you give me a little more info about adding CPPFLAGS - a link to some docs, perhaps?

riverrun avatar Aug 09 '23 01:08 riverrun

There is no definitive manual for this convention, but the GNU documentation includes some useful pointers. Given how widespread the autotools were, most packaging systems and build systems adopted its conventions.

https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html https://www.gnu.org/software/make/manual/html_node/Catalogue-of-Rules.html https://www.gnu.org/prep/standards/html_node/Command-Variables.html#Command-Variables

Chosen excerpts:

Compiling C programs

n.o is made automatically from n.c with a recipe of the form ‘$(CC) $(CPPFLAGS) $(CFLAGS) -c.

Linking a single object file

n is made automatically from n.o by running the C compiler to link the program. The precise recipe used is ‘$(CC) $(LDFLAGS) n.o $(LOADLIBES) $(LDLIBS).

CPPFLAGS

Extra flags to give to the C preprocessor and programs that use it (the C and Fortran compilers).

CFLAGS

Extra flags to give to the C compiler.

CXXFLAGS

Extra flags to give to the C++ compiler.

LDFLAGS

Extra flags to give to compilers when they are supposed to invoke the linker, ‘ld’, such as > -L. Libraries (-lfoo) should be added to the LDLIBS variable instead.

Each program-name variable should come with an options variable that is used to supply options to the program. Append ‘FLAGS’ to the program-name variable name to get the options variable name—for example, BISONFLAGS. (The names CFLAGS for the C compiler, YFLAGS for yacc, and LFLAGS for lex, are exceptions to this rule, but we keep them because they are standard.) Use CPPFLAGS in any compilation command that runs the preprocessor, and use LDFLAGS in any compilation command that does linking as well as in any direct use of ld.

If there are C compiler options that must be used for proper compilation of certain files, do not include them in CFLAGS. Users expect to be able to specify CFLAGS freely themselves. Instead, arrange to pass the necessary options to the C compiler independently of CFLAGS, by writing them explicitly in the compilation commands or by defining an implicit rule

Batchyx avatar Sep 04 '23 18:09 Batchyx

Apologies for not getting back to you about this. I am still not convinced this is needed. Closing this PR now. If you feel like reopening it,, please let me know.

riverrun avatar Oct 04 '24 12:10 riverrun