Skip to content

Commit fc62b4a

Browse files
committed
makevars
1 parent dac4e73 commit fc62b4a

File tree

1 file changed

+54
-53
lines changed

1 file changed

+54
-53
lines changed

src/Makevars

+54-53
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
PKG_LIBS =
22
CXX_STD = CXX11
3-
PKG_CPPFLAGS = -pthread -DSTRICT_R_HEADERS -I./dr_libs -I./whisper_cpp
4-
PKG_CFLAGS += -D_XOPEN_SOURCE=600
5-
PKG_CPPFLAGS += -D_XOPEN_SOURCE=600
63

74
#CFLAGS = -I. -O3 -DNDEBUG -std=c11 -fPIC
85
#CXXFLAGS = -I. -I./examples -O3 -DNDEBUG -std=c++11 -fPIC
@@ -26,56 +23,6 @@ ifndef NVCC_VERSION
2623
endif
2724
endif
2825

29-
# Somehow in OpenBSD whenever POSIX conformance is specified
30-
# some string functions rely on locale_t availability,
31-
# which was introduced in POSIX.1-2008, forcing us to go higher
32-
ifeq ($(UNAME_S),OpenBSD)
33-
PKG_CFLAGS += -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700
34-
PKG_CPPFLAGS += -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700
35-
endif
36-
37-
# Data types, macros and functions related to controlling CPU affinity
38-
# are available on Linux through GNU extensions in libc
39-
ifeq ($(UNAME_S),Linux)
40-
PKG_CFLAGS += -D_GNU_SOURCE
41-
PKG_CPPFLAGS += -D_GNU_SOURCE
42-
endif
43-
44-
# RLIMIT_MEMLOCK came in BSD, is not specified in POSIX.1,
45-
# and on macOS its availability depends on enabling Darwin extensions
46-
# similarly on DragonFly, enabling BSD extensions is necessary
47-
ifeq ($(UNAME_S),Darwin)
48-
PKG_CFLAGS += -D_DARWIN_C_SOURCE
49-
PKG_CPPFLAGS += -D_DARWIN_C_SOURCE
50-
endif
51-
ifeq ($(UNAME_S),DragonFly)
52-
PKG_CFLAGS += -D__BSD_VISIBLE
53-
PKG_CPPFLAGS += -D__BSD_VISIBLE
54-
endif
55-
56-
# alloca is a non-standard interface that is not visible on BSDs when
57-
# POSIX conformance is specified, but not all of them provide a clean way
58-
# to enable it in such cases
59-
ifeq ($(UNAME_S),FreeBSD)
60-
PKG_CFLAGS += -D__BSD_VISIBLE
61-
PKG_CPPFLAGS += -D__BSD_VISIBLE
62-
endif
63-
ifeq ($(UNAME_S),NetBSD)
64-
PKG_CFLAGS += -D_NETBSD_SOURCE
65-
PKG_CPPFLAGS += -D_NETBSD_SOURCE
66-
endif
67-
ifeq ($(UNAME_S),OpenBSD)
68-
PKG_CFLAGS += -D_BSD_SOURCE
69-
PKG_CPPFLAGS += -D_BSD_SOURCE
70-
endif
71-
72-
# OS specific
73-
# TODO: support Windows
74-
ifeq ($(filter $(UNAME_S),Linux Darwin DragonFly FreeBSD NetBSD OpenBSD Haiku),$(UNAME_S))
75-
PKG_CFLAGS += -pthread
76-
PKG_CPPFLAGS += -pthread
77-
endif
78-
7926
# Architecture specific
8027
# TODO: probably these flags need to be tweaked on some architectures
8128
# feel free to update the Makefile for your architecture and send a pull request or issue
@@ -231,6 +178,60 @@ ifdef WHISPER_LIBS
231178
PKG_LIBS = $(WHISPER_LIBS)
232179
endif
233180

181+
PKG_CPPFLAGS += -DSTRICT_R_HEADERS -I./dr_libs -I./whisper_cpp
182+
PKG_CFLAGS += -D_XOPEN_SOURCE=600
183+
PKG_CPPFLAGS += -D_XOPEN_SOURCE=600
184+
185+
# Somehow in OpenBSD whenever POSIX conformance is specified
186+
# some string functions rely on locale_t availability,
187+
# which was introduced in POSIX.1-2008, forcing us to go higher
188+
ifeq ($(UNAME_S),OpenBSD)
189+
PKG_CFLAGS += -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700
190+
PKG_CPPFLAGS += -U_XOPEN_SOURCE -D_XOPEN_SOURCE=700
191+
endif
192+
193+
# Data types, macros and functions related to controlling CPU affinity
194+
# are available on Linux through GNU extensions in libc
195+
ifeq ($(UNAME_S),Linux)
196+
PKG_CFLAGS += -D_GNU_SOURCE
197+
PKG_CPPFLAGS += -D_GNU_SOURCE
198+
endif
199+
200+
# RLIMIT_MEMLOCK came in BSD, is not specified in POSIX.1,
201+
# and on macOS its availability depends on enabling Darwin extensions
202+
# similarly on DragonFly, enabling BSD extensions is necessary
203+
ifeq ($(UNAME_S),Darwin)
204+
PKG_CFLAGS += -D_DARWIN_C_SOURCE
205+
PKG_CPPFLAGS += -D_DARWIN_C_SOURCE
206+
endif
207+
ifeq ($(UNAME_S),DragonFly)
208+
PKG_CFLAGS += -D__BSD_VISIBLE
209+
PKG_CPPFLAGS += -D__BSD_VISIBLE
210+
endif
211+
212+
# alloca is a non-standard interface that is not visible on BSDs when
213+
# POSIX conformance is specified, but not all of them provide a clean way
214+
# to enable it in such cases
215+
ifeq ($(UNAME_S),FreeBSD)
216+
PKG_CFLAGS += -D__BSD_VISIBLE
217+
PKG_CPPFLAGS += -D__BSD_VISIBLE
218+
endif
219+
ifeq ($(UNAME_S),NetBSD)
220+
PKG_CFLAGS += -D_NETBSD_SOURCE
221+
PKG_CPPFLAGS += -D_NETBSD_SOURCE
222+
endif
223+
ifeq ($(UNAME_S),OpenBSD)
224+
PKG_CFLAGS += -D_BSD_SOURCE
225+
PKG_CPPFLAGS += -D_BSD_SOURCE
226+
endif
227+
228+
# OS specific
229+
# TODO: support Windows
230+
ifeq ($(filter $(UNAME_S),Linux Darwin DragonFly FreeBSD NetBSD OpenBSD Haiku),$(UNAME_S))
231+
PKG_CFLAGS += -pthread
232+
PKG_CPPFLAGS += -pthread
233+
endif
234+
234235
#PKG_CFLAGS = -mavx -mavx2 -mfma -mf16c
235236
#PKG_CFLAGS = -msse3
236237
#PKG_CLFAGS = -mcpu=native

0 commit comments

Comments
 (0)