How can I say to create a makefile that uses clang?

I would like to create my application using clang when creating a Makefile (gmake toolchain). Is there any way to do this?

+5
source share
4 answers

Here is what I use, it works for me:

--  ugly hack to use clang
premake.gcc.cc  = 'clang'
premake.gcc.cxx = 'clang++'

Nothing else seemed to work at all.

+6
source

I ended up working on what @Burton Samograd did: assign a CC environment variable. However, buried deep in the bulletin board4, they have a way to identify a new platform .

When using premake4, just call:

premake4 --platform=clang gmake

, , - , . , , .

+2

, CC varaible:

CC ?= /usr/bin/clang

in your file. Parameter? = Installs it only if you did not install it in your environment.

+1
source

In premake5 use

#!/bin/bash
premake-5.0.0-alpha11-linux --file=PA7.lua --cc=clang --verbose gmake

--cc=clang is analogous to the --platform option in premake4.

0
source

All Articles