# Forcing a compiler after cloning "something" from github.



## Alain De Vos (Nov 6, 2021)

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?


----------



## ct85711 (Nov 6, 2021)

The normal convention used between the various make files; is using the environmental variables of CC and CXX.  So I'd recommend you check the makefile first to see if they specified a particular compiler.
https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html


----------



## ralphbsz (Nov 6, 2021)

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.


----------

