Forcing a compiler after cloning "something" from github.

I know how to force a compiler when building a freebsd port.

But when i clone some random stuff i found on github i also want to force a certain compiler when isuing gmake. How do i do ?
Set a simple environment flag?
Edit a makefile?
Edit a config file?
It depends on the build tools used?
 
Depends on the make file. Theoretically, it should be sufficient to say "CC=xxx gmake", since a very simple make file will just use the CC variable for running the C compiler. Obviously, for other languages you have to use different flags, like CXX for C++, FC for Fortran, and so on.

In practice, you probably need to edit and understand the make file. Most have considerable amount of logic to select the correct compiler. They might use automake, imake, or a variety of other meta-make tools. In most cases, different compilers use different flags, so you at least need to also set CFLAGS (or CXXFLAGS...), but in practice edit the makefile.
 
Back
Top