@@ -8,6 +8,63 @@ PKG_CPPFLAGS += -D_XOPEN_SOURCE=600
8
8
#PKG_CLFAGS = -mcpu=native
9
9
#PKG_CFLAGS = -O3
10
10
#PKG_CPPFLAGS += -mcpu=native
11
+
12
+ ifndef UNAME_S
13
+ UNAME_S := $(shell uname -s)
14
+ endif
15
+
16
+ ifndef UNAME_P
17
+ UNAME_P := $(shell uname -p)
18
+ endif
19
+
20
+ ifndef UNAME_M
21
+ UNAME_M := $(shell uname -m)
22
+ endif
23
+
24
+ # Somehow in OpenBSD whenever POSIX conformance is specified
25
+ # some string functions rely on locale_t availability,
26
+ # which was introduced in POSIX.1-2008, forcing us to go higher
27
+ ifeq ($(UNAME_S),OpenBSD)
28
+ PKG_CFLAGS += -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700
29
+ PKG_CPPFLAGS += -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700
30
+ endif
31
+
32
+ # Data types, macros and functions related to controlling CPU affinity
33
+ # are available on Linux through GNU extensions in libc
34
+ ifeq ($(UNAME_S),Linux)
35
+ PKG_CFLAGS += -D_GNU_SOURCE
36
+ PKG_CPPFLAGS += -D_GNU_SOURCE
37
+ endif
38
+
39
+ # RLIMIT_MEMLOCK came in BSD, is not specified in POSIX.1,
40
+ # and on macOS its availability depends on enabling Darwin extensions
41
+ # similarly on DragonFly, enabling BSD extensions is necessary
42
+ ifeq ($(UNAME_S),Darwin)
43
+ PKG_CFLAGS += -D_DARWIN_C_SOURCE
44
+ PKG_CPPFLAGS += -D_DARWIN_C_SOURCE
45
+ endif
46
+ ifeq ($(UNAME_S),DragonFly)
47
+ PKG_CFLAGS += -D__BSD_VISIBLE
48
+ PKG_CPPFLAGS += -D__BSD_VISIBLE
49
+ endif
50
+
51
+ # alloca is a non-standard interface that is not visible on BSDs when
52
+ # POSIX conformance is specified, but not all of them provide a clean way
53
+ # to enable it in such cases
54
+ ifeq ($(UNAME_S),FreeBSD)
55
+ PKG_CFLAGS += -D__BSD_VISIBLE
56
+ PKG_CPPFLAGS += -D__BSD_VISIBLE
57
+ endif
58
+ ifeq ($(UNAME_S),NetBSD)
59
+ PKG_CFLAGS += -D_NETBSD_SOURCE
60
+ PKG_CPPFLAGS += -D_NETBSD_SOURCE
61
+ endif
62
+ ifeq ($(UNAME_S),OpenBSD)
63
+ PKG_CFLAGS += -D_BSD_SOURCE
64
+ PKG_CPPFLAGS += -D_BSD_SOURCE
65
+ endif
66
+
67
+
11
68
ifdef WHISPER_CFLAGS
12
69
PKG_CFLAGS = $(WHISPER_CFLAGS)
13
70
endif
0 commit comments