Intel® C++ Compiler 16.0 User and Reference Guide
If you use makefiles to build your Clang application, you need to change the value for the Clang compiler variable to use the Intel® C++ compiler. You may also want to review the options specified by CFLAGS. A simple example follows:
Clang makefile
# Use Clang compiler CC = clang # Compile-time flags CFLAGS = -O2 -std=c99 all: area_app area_app: area_main.o area_functions.o $(CC) area_main.o area_functions.o -o area area_main.o: area_main.c $(CC) -c $(CFLAGS) area_main.c area_functions.o: area_functions.c $(CC) -c -fno-asm $(CFLAGS) area_functions.c clean: rm -rf *o area
Modified makefile for Intel® C++ Compiler
# Use Intel C compiler CC = icl # Compile-time flags CFLAGS = -std=c99 all: area-app area-app: area_main.o area_functions.o $(CC) area_main.o area_functions.o -o area area_main.o: area_main.c $(CC) -c $(CFLAGS) area_main.c area_functions.o: area_functions.c clang -c -O2 -fno-asm $(CFLAGS) area_functions.c clean: rm -rf *o area
If your Clang code includes features that are not supported with the Intel® C++ compiler, such as compiler options, language extensions, macros, pragmas, and so on, you can compile those sources separately with Clang if necessary.
In the above makefile, area_functions.c is an example of a source file that includes features unique to Clang. Since the Intel C++ Compiler uses the O2 option by default and Clang uses option O0 as the default, you instruct Clang to compile with O2. You also include the -fno-asm switch from the original makefile since this switch is not supported with the Intel C++ Compiler. With the modified makefile, the output of make is:
icc -c -std=c99 area_main.c clang -c -O2 -fno-asm -std=c99 area_functions.c icc area_main.o area_functions.o -o area