Skip to content

Commit 735b177

Browse files
committed
makevars
1 parent 003aa8f commit 735b177

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

src/Makevars

+57
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,63 @@ PKG_CPPFLAGS += -D_XOPEN_SOURCE=600
88
#PKG_CLFAGS = -mcpu=native
99
#PKG_CFLAGS = -O3
1010
#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+
1168
ifdef WHISPER_CFLAGS
1269
PKG_CFLAGS = $(WHISPER_CFLAGS)
1370
endif

0 commit comments

Comments
 (0)