Commit 1b343c86 authored by Jan Kiene's avatar Jan Kiene
Browse files

default to cc in Makefile in case there is no clang

parent b75d9070
Loading
Loading
Loading
Loading
Loading
+10 −7
Original line number Diff line number Diff line
@@ -31,12 +31,8 @@ LIB_LIBISAR ?= libisar.a
LIB_LC3PLUS  	?= liblc3plus.a
LIB_LIBUTIL  	?= libivasutil.a


CCCLANG = clang
CCGCC = gcc

# Default tool settings
CC        ?= $(CCCLANG)
CC        ?= cc
RM        ?= rm -f
AR        ?= ar

@@ -73,6 +69,13 @@ CFLAGS += -std=c99 -pedantic -Wcast-qual -Wall -W -Wextra -Wno-long-long \
# libs to link
LDLIBS   += -lm

# check if clang is available on system and use it if it is there
CLANG_EXISTS := $(shell which clang)

ifneq "$(CLANG_EXISTS)" ""
CC = clang
endif

# Clang sanitizer compiler options
ifeq "$(CLANG)" "1"
CC       = $(CCCLANG)
@@ -96,7 +99,7 @@ endif

# check if explicitly gcc is mandated
ifneq "$(GCC)" ""
CC = $(CCGCC)
CC = gcc
endif

ifeq "$(RELEASE)" "1"
@@ -110,7 +113,7 @@ LDFLAGS += -g3
endif

ifeq "$(GCOV)" "1"
CC       = "$(CCGCC)"
CC       = gcc
CFLAGS  += -fprofile-arcs -ftest-coverage -fprofile-update=atomic
LDFLAGS += -fprofile-arcs -ftest-coverage -fprofile-update=atomic
endif