Skip to content

Commit

Permalink
Merge pull request #435 from kraj/master
Browse files Browse the repository at this point in the history
Makefile: Detect compiler in makefile
  • Loading branch information
wolfcw authored Aug 25, 2023
2 parents 27b9c83 + 8908752 commit 0af80dd
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,23 @@ PREFIX ?= /usr/local
LIBDIRNAME ?= /lib/faketime
PLATFORM ?=$(shell uname)

CFLAGS += -std=gnu99 -Wall -Wextra -Werror -Wno-nonnull-compare -DFAKE_PTHREAD -DFAKE_STAT -DFAKE_UTIME -DFAKE_SLEEP -DFAKE_TIMERS -DFAKE_INTERNAL_CALLS -fPIC -DPREFIX='"'$(PREFIX)'"' -DLIBDIRNAME='"'$(LIBDIRNAME)'"' $(FAKETIME_COMPILE_CFLAGS)
ifeq ($(shell $(CC) -v 2>&1 | grep -c "clang version"), 1)
COMPILER := clang
else
COMPILER := gcc
endif
export COMPILER

CFLAGS += -std=gnu99 -Wall -Wextra -Werror -DFAKE_PTHREAD -DFAKE_STAT -DFAKE_UTIME -DFAKE_SLEEP -DFAKE_TIMERS -DFAKE_INTERNAL_CALLS -fPIC -DPREFIX='"'$(PREFIX)'"' -DLIBDIRNAME='"'$(LIBDIRNAME)'"' $(FAKETIME_COMPILE_CFLAGS)

ifeq ($(COMPILER),clang)
CFLAGS += -Wno-tautological-pointer-compare
endif

ifeq ($(COMPILER),gcc)
CFLAGS += -Wno-nonnull-compare
endif

ifeq ($(PLATFORM),SunOS)
CFLAGS += -D__EXTENSIONS__ -D_XOPEN_SOURCE=600
endif
Expand Down

0 comments on commit 0af80dd

Please sign in to comment.