diff options
Diffstat (limited to 'meta-oe/recipes-test/libfaketime/libfaketime/0001-Makefile-Detect-compiler-in-makefile.patch')
-rw-r--r-- | meta-oe/recipes-test/libfaketime/libfaketime/0001-Makefile-Detect-compiler-in-makefile.patch | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/meta-oe/recipes-test/libfaketime/libfaketime/0001-Makefile-Detect-compiler-in-makefile.patch b/meta-oe/recipes-test/libfaketime/libfaketime/0001-Makefile-Detect-compiler-in-makefile.patch new file mode 100644 index 0000000000..ff04837652 --- /dev/null +++ b/meta-oe/recipes-test/libfaketime/libfaketime/0001-Makefile-Detect-compiler-in-makefile.patch @@ -0,0 +1,45 @@ +From 735bb5d053efad274aa4ea5a6682e656ff792909 Mon Sep 17 00:00:00 2001 +From: Khem Raj <raj.khem@gmail.com> +Date: Thu, 24 Aug 2023 01:49:48 -0700 +Subject: [PATCH] Makefile: Detect compiler in makefile + +Add compiler specific options based on detected compiler gcc/clang + +Upstream-Status: Pending +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + src/Makefile | 18 +++++++++++++++++- + 1 file changed, 17 insertions(+), 1 deletion(-) + +diff --git a/src/Makefile b/src/Makefile +index 62e924c..c15eb33 100644 +--- a/src/Makefile ++++ b/src/Makefile +@@ -110,7 +110,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 +-- +2.42.0 + |