summaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-test/libfaketime/libfaketime/0001-Makefile-Detect-compiler-in-makefile.patch
diff options
context:
space:
mode:
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.patch45
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 000000000..ff0483765
--- /dev/null
+++ b/meta-oe/recipes-test/libfaketime/libfaketime/0001-Makefile-Detect-compiler-in-makefile.patch
@@ -0,0 +1,45 @@
1From 735bb5d053efad274aa4ea5a6682e656ff792909 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 24 Aug 2023 01:49:48 -0700
4Subject: [PATCH] Makefile: Detect compiler in makefile
5
6Add compiler specific options based on detected compiler gcc/clang
7
8Upstream-Status: Pending
9Signed-off-by: Khem Raj <raj.khem@gmail.com>
10---
11 src/Makefile | 18 +++++++++++++++++-
12 1 file changed, 17 insertions(+), 1 deletion(-)
13
14diff --git a/src/Makefile b/src/Makefile
15index 62e924c..c15eb33 100644
16--- a/src/Makefile
17+++ b/src/Makefile
18@@ -110,7 +110,23 @@ PREFIX ?= /usr/local
19 LIBDIRNAME ?= /lib/faketime
20 PLATFORM ?=$(shell uname)
21
22-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)
23+ifeq ($(shell $(CC) -v 2>&1 | grep -c "clang version"), 1)
24+COMPILER := clang
25+else
26+COMPILER := gcc
27+endif
28+export COMPILER
29+
30+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)
31+
32+ifeq ($(COMPILER),clang)
33+CFLAGS += -Wno-tautological-pointer-compare
34+endif
35+
36+ifeq ($(COMPILER),gcc)
37+CFLAGS += -Wno-nonnull-compare
38+endif
39+
40 ifeq ($(PLATFORM),SunOS)
41 CFLAGS += -D__EXTENSIONS__ -D_XOPEN_SOURCE=600
42 endif
43--
442.42.0
45